Skip to content

Commit b050a0c

Browse files
PLAT-11215: Release Python legacy BDK 1.3.6 (#216)
* PLAT-11208 Legacy Python BDK: Params missing in list attachments endpoint Stream attachments list method in Python Legacy BDK was missing parameters for pagination. They have been added in this PR * added comments and type hints for parameters * Made since and to optional with a default value of None * Bumped version to 1.3.6 Co-authored-by: symphony-soufiane <soufiane.aourinmouche@symphony.com>
1 parent 5392b8f commit b050a0c

File tree

2 files changed

+25
-3
lines changed

2 files changed

+25
-3
lines changed

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ def readme():
99
setuptools.setup(
1010
name="sym_api_client_python",
1111

12-
version="1.3.5",
12+
version="1.3.6",
1313
author="Symphony Platform Solutions",
1414
author_email="platformsolutions@symphony.com",
1515
description="Symphony REST API - Python Client",

sym_api_client_python/clients/message_client.py

+24-2
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,29 @@ def list_msg_receipts(self, msg_id):
154154
url = '/pod/v1/admin/messages/{0}/receipts'.format(msg_id)
155155
return self.bot_client.example('GET', url)
156156

157-
def list_stream_attachments(self, stream_id):
157+
def list_stream_attachments(self, stream_id: str, since: int = None, to: int = None, limit: int = 50,
158+
sort_dir: str = "ASC"):
159+
"""List attachments in a particular stream.
160+
See: `List Attachments <https://developers.symphony.com/restapi/reference#list-attachments>`_
161+
:param stream_id: The stream ID where to look for the attachments
162+
:param since: Unix epoch timestamp of the first required attachment in milliseconds.
163+
:param to: Unix epoch timestamp of the last required attachment in milliseconds.
164+
:param limit: Maximum number of attachments to return.
165+
This optional value defaults to 50 and should be between 0 and 100.
166+
:param sort_dir: Attachment date sort direction : ASC or DESC. Default: ASC.
167+
:return: the list of attachments in the stream.
168+
"""
158169
logging.debug('MessageClient/list_msg_attachments()')
159170
url = '/pod/v1/streams/{0}/attachments'.format(stream_id)
160-
return self.bot_client.execute_rest_call('GET', url)
171+
172+
params = {
173+
'limit': limit,
174+
'sortDir': sort_dir
175+
}
176+
177+
if since is not None:
178+
params["since"] = since
179+
if to is not None:
180+
params["to"] = to
181+
182+
return self.bot_client.execute_rest_call('GET', url, params=params)

0 commit comments

Comments
 (0)