From 3ddd1edfc75e109de9a6e34a83062e82b896be58 Mon Sep 17 00:00:00 2001 From: Ella Katz Date: Mon, 9 Jul 2018 17:21:39 +0300 Subject: [PATCH 1/5] tag: add delete --- intercom/service/tag.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/intercom/service/tag.py b/intercom/service/tag.py index 1bf1a5ea..d5aea216 100644 --- a/intercom/service/tag.py +++ b/intercom/service/tag.py @@ -5,10 +5,11 @@ from intercom.api_operations.find import Find from intercom.api_operations.find_all import FindAll from intercom.api_operations.save import Save +from intercom.api_operations.delete import Delete from intercom.service.base_service import BaseService -class Tag(BaseService, All, Find, FindAll, Save): +class Tag(BaseService, All, Find, FindAll, Save, Delete): @property def collection_class(self): From 82b0c4a63911cf4c3edbc5ca8d1384c03dc74dbb Mon Sep 17 00:00:00 2001 From: Ella Katz Date: Mon, 6 Aug 2018 16:51:51 +0300 Subject: [PATCH 2/5] fix mark as read --- intercom/service/conversation.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/intercom/service/conversation.py b/intercom/service/conversation.py index 61f143a7..ddfe176f 100644 --- a/intercom/service/conversation.py +++ b/intercom/service/conversation.py @@ -25,7 +25,7 @@ def collection_class(self): def resource_url(self, _id): """Return the URL for the specified resource in this collection.""" - return "/%s/%s/reply" % (self.collection, _id) + return "/%s/%s" % (self.collection, _id) def reply(self, **reply_data): """Reply to a message.""" @@ -59,5 +59,5 @@ def __reply(self, reply_data): """Send requests to the resource handler.""" _id = reply_data.pop('id') reply_data['conversation_id'] = _id - response = self.client.post(self.resource_url(_id), reply_data) + response = self.client.post(self.resource_url(_id) + "/reply", reply_data) return self.collection_class().from_response(response) From c0038d1c46f6802f392e1cd90cdb5f2ec32bd1ef Mon Sep 17 00:00:00 2001 From: Ella Katz Date: Sun, 19 Aug 2018 14:06:41 +0300 Subject: [PATCH 3/5] conversation: support adding/removing a user from a conversation (https://developers.intercom.com/intercom-api-reference/reference#adding-to-group-conversations-as-customer) --- intercom/service/conversation.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/intercom/service/conversation.py b/intercom/service/conversation.py index ddfe176f..6cb06595 100644 --- a/intercom/service/conversation.py +++ b/intercom/service/conversation.py @@ -55,6 +55,18 @@ def mark_read(self, _id): response = self.client.put(self.resource_url(_id), data) return self.collection_class().from_response(response) + def add_user(self, _id, user_id, admin_id): + """Add user to conversation""" + data = {"admin_id": admin_id, "customer": {"intercom_user_id": user_id}} + response = self.client.post(self.resource_url(_id) + "/customers", data) + self.collection_class().from_response(response) + + def remove_user(self, _id, user_id, admin_id): + """Remove user from a conversation""" + data = {"admin_id": admin_id} + response = self.client.delete(self.resource_url(_id) + "/customers/%s" % user_id, data) + self.collection_class().from_response(response) + def __reply(self, reply_data): """Send requests to the resource handler.""" _id = reply_data.pop('id') From 4337dfdfc92845a2f691a32927f78611354e6bce Mon Sep 17 00:00:00 2001 From: Ella Katz Date: Mon, 20 Aug 2018 13:29:29 +0300 Subject: [PATCH 4/5] intercom: update version --- intercom/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/intercom/__init__.py b/intercom/__init__.py index 23824dc6..bbf6ce62 100644 --- a/intercom/__init__.py +++ b/intercom/__init__.py @@ -6,7 +6,7 @@ MultipleMatchingUsersError, RateLimitExceeded, ResourceNotFound, ServerError, ServiceUnavailableError, UnexpectedError, TokenUnauthorizedError) -__version__ = '3.1.0' +__version__ = '3.1.1' RELATED_DOCS_TEXT = "See https://github.com/jkeyes/python-intercom \ From 6abb763f3dc0527a9d01f9e32e25e6de49d427fa Mon Sep 17 00:00:00 2001 From: Nimrod Gutman Date: Wed, 18 Jan 2023 15:51:17 +0200 Subject: [PATCH 5/5] rename package --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 3b5bcde8..94b495c6 100644 --- a/setup.py +++ b/setup.py @@ -19,7 +19,7 @@ long_description = readme.read() setup( - name="python-intercom", + name="singular-python-intercom", version=__version__, description="Intercom API wrapper", long_description=long_description,