From 40754ad2cf8971111692d7d8d3d71a784314772d Mon Sep 17 00:00:00 2001 From: Amrith Kumar Date: Sat, 11 Dec 2021 17:10:51 -0500 Subject: [PATCH 1/3] Added add_thread_members_by_access_level() --- python/quip.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/python/quip.py b/python/quip.py index b39eafe..558797b 100644 --- a/python/quip.py +++ b/python/quip.py @@ -272,6 +272,22 @@ def add_thread_members(self, thread_id, member_ids): "member_ids": ",".join(member_ids), }) + def add_thread_members_by_access_level(self, thread_id, full=None, + edit=None, comment=None, + view=None): + """Adds the given folder or userIDs to the given thread.""" + return self._fetch_json("threads/add-members", post_data={ + "thread_id": thread_id, + "member_ids_by_access_level": json.dumps([ + {"access_level": 0, + "member_ids": [",".join(full)] if full else []}, + {"access_level": 1, + "member_ids": [",".join(edit)] if edit else []}, + {"access_level": 2, + "member_ids": [",".join(comment)] if comment else []}, + {"access_level": 3, + "member_ids": [",".join(view)] if view else []}])}) + def delete_thread(self, thread_id): """Deletes the thread with the given thread id or secret""" return self._fetch_json("threads/delete", post_data={ From 0039705f80222a7ce6387374e322f0c404dbdeef Mon Sep 17 00:00:00 2001 From: Amrith Kumar Date: Mon, 13 Dec 2021 16:52:02 -0500 Subject: [PATCH 2/3] simplified handling of access lists --- python/quip.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/python/quip.py b/python/quip.py index 558797b..5ab7509 100644 --- a/python/quip.py +++ b/python/quip.py @@ -280,13 +280,13 @@ def add_thread_members_by_access_level(self, thread_id, full=None, "thread_id": thread_id, "member_ids_by_access_level": json.dumps([ {"access_level": 0, - "member_ids": [",".join(full)] if full else []}, + "member_ids": full or []}, {"access_level": 1, - "member_ids": [",".join(edit)] if edit else []}, + "member_ids": edit or []}, {"access_level": 2, - "member_ids": [",".join(comment)] if comment else []}, + "member_ids": comment or []}, {"access_level": 3, - "member_ids": [",".join(view)] if view else []}])}) + "member_ids": view or []}])}) def delete_thread(self, thread_id): """Deletes the thread with the given thread id or secret""" From d1bab5e1ec8479132dda32331e4cbb6024045cb6 Mon Sep 17 00:00:00 2001 From: Amrith Kumar Date: Sat, 11 Dec 2021 17:10:51 -0500 Subject: [PATCH 3/3] Added add_thread_members_by_access_level() --- python/quip.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/python/quip.py b/python/quip.py index b39eafe..5ab7509 100644 --- a/python/quip.py +++ b/python/quip.py @@ -272,6 +272,22 @@ def add_thread_members(self, thread_id, member_ids): "member_ids": ",".join(member_ids), }) + def add_thread_members_by_access_level(self, thread_id, full=None, + edit=None, comment=None, + view=None): + """Adds the given folder or userIDs to the given thread.""" + return self._fetch_json("threads/add-members", post_data={ + "thread_id": thread_id, + "member_ids_by_access_level": json.dumps([ + {"access_level": 0, + "member_ids": full or []}, + {"access_level": 1, + "member_ids": edit or []}, + {"access_level": 2, + "member_ids": comment or []}, + {"access_level": 3, + "member_ids": view or []}])}) + def delete_thread(self, thread_id): """Deletes the thread with the given thread id or secret""" return self._fetch_json("threads/delete", post_data={