Skip to content

Commit c5a5301

Browse files
committed
Merge branch 'main' into doc/fix-broken-links
2 parents 436cfdc + 2727e68 commit c5a5301

360 files changed

Lines changed: 3261 additions & 1059 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

api_client_generation/generate.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ code_gen_dir=`pwd`
44
project_root=$code_gen_dir/..
55
echo $code_gen_dir
66

7-
commit_hash=ab10aa5263cfed89ddae0720cea31eca0c06a003
7+
commit_hash=b63d67cc0ed7c5a3962e72f21001df4d2ed482f2
88
api_spec_base_url=https://raw.githubusercontent.com/symphonyoss/symphony-api-spec/${commit_hash}
99
echo $api_spec_base_url
1010

poetry.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

symphony/bdk/core/config/model/bdk_config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ def __init__(self, **config):
3030
self.datafeed = BdkDatafeedConfig(config.get("datafeed"))
3131
self.datahose = BdkDatahoseConfig(config.get("datahose"))
3232
self.retry = BdkRetryConfig(config.get("retry"))
33+
self.manifest = config.get("manifest")
3334

3435
def is_bot_configured(self) -> bool:
3536
"""

symphony/bdk/core/service/stream/stream_service.py

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,31 +136,35 @@ async def list_streams_one_page(skip, limit):
136136

137137
@retry
138138
async def search_rooms(self, query: V2RoomSearchCriteria, skip: int = 0,
139-
limit: int = 50) -> V3RoomSearchResults:
139+
limit: int = 50, include_non_discoverable=False) -> V3RoomSearchResults:
140140
"""Search for rooms according to the specified criteria.
141141
Wraps the `Search Rooms V3 <https://developers.symphony.com/restapi/reference/search-rooms-v3>`_ endpoint.
142142
143143
:param query: the search criteria.
144144
:param skip: number of rooms to skip, defaults to 0.
145145
:param limit: number of maximum rooms to return. Must be a positive integer that does not exceed 100.
146+
:param include_non_discoverable: set to `True` to include rooms not publicly searchable, false by default.
146147
:return: the rooms matching search criteria.
147148
"""
148149
return await self._streams_api.v3_room_search_post(query=query, skip=skip, limit=limit,
150+
include_non_discoverable=include_non_discoverable,
149151
session_token=await self._auth_session.session_token)
150152

151153
async def search_all_rooms(self, query: V2RoomSearchCriteria, chunk_size: int = 50,
152-
max_number: int = None) -> AsyncGenerator[V3RoomDetail, None]:
154+
max_number: int = None, include_non_discoverable : bool = False)\
155+
-> AsyncGenerator[V3RoomDetail, None]:
153156
"""Search for rooms according to the specified criteria.
154157
Wraps the `Search Rooms V3 <https://developers.symphony.com/restapi/reference/search-rooms-v3>`_ endpoint.
155158
156159
:param query: the search criteria.
157160
:param chunk_size: the maximum number of elements to retrieve in one underlying HTTP call.
158161
:param max_number: the total maximum number of elements to retrieve.
162+
:param include_non_discoverable: set to `True` to include rooms not publicly searchable, false by default.
159163
:return: an asynchronous generator of the rooms matching the search criteria.
160164
"""
161165

162166
async def search_rooms_one_page(skip, limit):
163-
result = await self.search_rooms(query, skip, limit)
167+
result = await self.search_rooms(query, skip, limit, include_non_discoverable)
164168
return result.rooms if result.rooms else None
165169

166170
return offset_based_pagination(search_rooms_one_page, chunk_size, max_number)
@@ -346,6 +350,39 @@ async def list_streams_admin_one_page(skip, limit):
346350

347351
return offset_based_pagination(list_streams_admin_one_page, chunk_size, max_number)
348352

353+
@retry
354+
async def list_user_streams_admin(self, uid: int, stream_filter: StreamFilter = None, skip: int = 0,
355+
limit: int = 50) -> StreamList:
356+
"""Retrieve a list of all streams of which a user is a member.
357+
Wraps the `User Streams <https://developers.symphony.com/restapi/v20.16/reference#user-streams>`_ endpoint.
358+
359+
:param uid: the ID of the user.
360+
:param stream_filter: the filtering criteria for the streams.
361+
:param skip: the number of streams to skip.
362+
:param limit: the maximum number of streams to retrieve. Must be less or equal than 1000.
363+
:return: the list of streams for the specified user.
364+
"""
365+
return await self._streams_api.v1_admin_user_uid_streams_list_post(
366+
uid=uid, filter=stream_filter, skip=skip, limit=limit, session_token=await self._auth_session.session_token
367+
)
368+
369+
async def list_all_user_streams_admin(self, uid: int, stream_filter: StreamFilter = None, chunk_size: int = 50,
370+
max_number: int = None) -> AsyncGenerator[StreamAttributes, None]:
371+
"""Retrieves all streams of which a user is a member, handling pagination automatically.
372+
Wraps the `User Streams <https://developers.symphony.com/restapi/v20.16/reference#user-streams>`_ endpoint.
373+
374+
:param uid: the ID of the user.
375+
:param stream_filter: the filtering criteria for the streams.
376+
:param chunk_size: the maximum number of streams to retrieve in one underlying HTTP call.
377+
:param max_number: the total maximum number of streams to retrieve.
378+
:return: an asynchronous generator of the streams.
379+
"""
380+
async def list_streams_one_page(skip, limit):
381+
result = await self.list_user_streams_admin(uid, stream_filter, skip, limit)
382+
return result.value if result else None
383+
384+
return offset_based_pagination(list_streams_one_page, chunk_size, max_number)
385+
349386
@retry
350387
async def list_stream_members(self, stream_id: str, skip: int = 0, limit: int = 100) -> V2MembershipList:
351388
"""List the current members of an existing stream. The stream can be of type IM, MIM, or ROOM.

symphony/bdk/core/service/user/user_service.py

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import base64
2+
import json
3+
from pathlib import Path
24
from typing import Union, AsyncGenerator
35

46
from symphony.bdk.core.auth.auth_session import AuthSession
@@ -21,6 +23,7 @@
2123
from symphony.bdk.gen.pod_model.followers_list_response import FollowersListResponse
2224
from symphony.bdk.gen.pod_model.following_list_response import FollowingListResponse
2325
from symphony.bdk.gen.pod_model.role_detail import RoleDetail
26+
from symphony.bdk.gen.pod_model.service_account_manifest import ServiceAccountManifest
2427
from symphony.bdk.gen.pod_model.string_id import StringId
2528
from symphony.bdk.gen.pod_model.user_filter import UserFilter
2629
from symphony.bdk.gen.pod_model.user_id_list import UserIdList
@@ -260,10 +263,12 @@ def __init__(self, user_api: UserApi,
260263
audit_trail_api: AuditTrailApi,
261264
system_api: SystemApi,
262265
auth_session: AuthSession,
263-
retry_config: BdkRetryConfig):
266+
retry_config: BdkRetryConfig,
267+
manifest: str):
264268
super().__init__(user_api, users_api, auth_session, retry_config)
265269
self._audit_trail_api = audit_trail_api
266270
self._system_api = system_api
271+
self._manifest = manifest
267272

268273
@retry
269274
async def get_user_detail(
@@ -898,3 +903,40 @@ async def unsuspend(
898903
}
899904

900905
await self._user_api.v1_admin_user_user_id_suspension_update_put(**params)
906+
907+
@retry
908+
async def update_manifest_from_json(self, manifest_data: str) -> None:
909+
"""
910+
Updates the user manifest from a JSON string.
911+
912+
:param manifest_data: A JSON string.
913+
:raises json.JSONDecodeError: If the string is not valid JSON.
914+
"""
915+
await self._user_api.v1_user_manifest_own_post(
916+
session_token=await self._auth_session.session_token,
917+
manifest=ServiceAccountManifest(manifest_data)
918+
)
919+
920+
async def update_manifest_from_file(self) -> None:
921+
"""
922+
Updates the user manifest using the file mentioned in config.yaml under 'manifest'.
923+
924+
:raises FileNotFoundError: If the file does not exist.
925+
:raises json.JSONDecodeError: If the file content is not valid JSON.
926+
:raises IOError: If the file can't be read.
927+
"""
928+
file_path = Path(self._manifest)
929+
930+
with file_path.open('r', encoding='utf-8') as f:
931+
content = json.load(f)
932+
manifest_text = json.dumps(content)
933+
934+
await self._user_api.v1_user_manifest_own_post(
935+
session_token=await self._auth_session.session_token,
936+
manifest=ServiceAccountManifest(manifest_text)
937+
)
938+
939+
@retry
940+
async def get_manifest(self) -> ServiceAccountManifest:
941+
"""Retrieves own user manifest"""
942+
return await self._user_api.v1_user_manifest_own_get(session_token=await self._auth_session.session_token)

symphony/bdk/core/service_factory.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ def get_user_service(self) -> UserService:
7474
AuditTrailApi(self._agent_client),
7575
PodSystemApi(self._pod_client),
7676
self._auth_session,
77-
self._config.retry
77+
self._config.retry,
78+
self._config.manifest
7879
)
7980

8081
def get_message_service(self) -> MessageService:

symphony/bdk/gen/agent_api/attachments_api.py

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
44
This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501
55
6-
The version of the OpenAPI document: 22.9.1
6+
The version of the OpenAPI document: 24.12.1
77
Generated by: https://openapi-generator.tech
88
"""
99

@@ -49,13 +49,12 @@ def __init__(self, api_client=None):
4949
'all': [
5050
'sid',
5151
'session_token',
52-
'key_manager_token',
5352
'file',
53+
'key_manager_token',
5454
],
5555
'required': [
5656
'sid',
5757
'session_token',
58-
'key_manager_token',
5958
'file',
6059
],
6160
'nullable': [
@@ -75,22 +74,22 @@ def __init__(self, api_client=None):
7574
(str,),
7675
'session_token':
7776
(str,),
78-
'key_manager_token':
79-
(str,),
8077
'file':
8178
(file_type,),
79+
'key_manager_token':
80+
(str,),
8281
},
8382
'attribute_map': {
8483
'sid': 'sid',
8584
'session_token': 'sessionToken',
86-
'key_manager_token': 'keyManagerToken',
8785
'file': 'file',
86+
'key_manager_token': 'keyManagerToken',
8887
},
8988
'location_map': {
9089
'sid': 'path',
9190
'session_token': 'header',
92-
'key_manager_token': 'header',
9391
'file': 'form',
92+
'key_manager_token': 'header',
9493
},
9594
'collection_format_map': {
9695
}
@@ -127,7 +126,6 @@ def __init__(self, api_client=None):
127126
'file_id',
128127
'message_id',
129128
'session_token',
130-
'key_manager_token',
131129
],
132130
'nullable': [
133131
],
@@ -251,7 +249,6 @@ def v1_stream_sid_attachment_create_post(
251249
self,
252250
sid,
253251
session_token,
254-
key_manager_token,
255252
file,
256253
**kwargs
257254
):
@@ -261,16 +258,16 @@ def v1_stream_sid_attachment_create_post(
261258
This method makes a synchronous HTTP request by default. To make an
262259
asynchronous HTTP request, please pass async_req=True
263260
264-
>>> thread = agent_api.v1_stream_sid_attachment_create_post(sid, session_token, key_manager_token, file, async_req=True)
261+
>>> thread = agent_api.v1_stream_sid_attachment_create_post(sid, session_token, file, async_req=True)
265262
>>> result = thread.get()
266263
267264
Args:
268265
sid (str): Stream ID
269266
session_token (str): Session authentication token.
270-
key_manager_token (str): Key Manager authentication token.
271267
file (file_type): The attachment body.
272268
273269
Keyword Args:
270+
key_manager_token (str): Key Manager authentication token.. [optional]
274271
_return_http_data_only (bool): response data without head status
275272
code and headers. Default is True.
276273
_preload_content (bool): if False, the urllib3.HTTPResponse object
@@ -331,8 +328,6 @@ def v1_stream_sid_attachment_create_post(
331328
sid
332329
kwargs['session_token'] = \
333330
session_token
334-
kwargs['key_manager_token'] = \
335-
key_manager_token
336331
kwargs['file'] = \
337332
file
338333
return self.v1_stream_sid_attachment_create_post_endpoint.call_with_http_info(**kwargs)
@@ -343,7 +338,6 @@ def v1_stream_sid_attachment_get(
343338
file_id,
344339
message_id,
345340
session_token,
346-
key_manager_token,
347341
**kwargs
348342
):
349343
"""Download an attachment. # noqa: E501
@@ -352,17 +346,17 @@ def v1_stream_sid_attachment_get(
352346
This method makes a synchronous HTTP request by default. To make an
353347
asynchronous HTTP request, please pass async_req=True
354348
355-
>>> thread = agent_api.v1_stream_sid_attachment_get(sid, file_id, message_id, session_token, key_manager_token, async_req=True)
349+
>>> thread = agent_api.v1_stream_sid_attachment_get(sid, file_id, message_id, session_token, async_req=True)
356350
>>> result = thread.get()
357351
358352
Args:
359353
sid (str): Stream ID
360354
file_id (str): The attachment ID (Base64-encoded)
361355
message_id (str): The ID of the message containing the attachment
362356
session_token (str): Session authentication token.
363-
key_manager_token (str): Key Manager authentication token.
364357
365358
Keyword Args:
359+
key_manager_token (str): Key Manager authentication token.. [optional]
366360
_return_http_data_only (bool): response data without head status
367361
code and headers. Default is True.
368362
_preload_content (bool): if False, the urllib3.HTTPResponse object
@@ -427,8 +421,6 @@ def v1_stream_sid_attachment_get(
427421
message_id
428422
kwargs['session_token'] = \
429423
session_token
430-
kwargs['key_manager_token'] = \
431-
key_manager_token
432424
return self.v1_stream_sid_attachment_get_endpoint.call_with_http_info(**kwargs)
433425

434426
def v3_stream_sid_attachment_create_post(

0 commit comments

Comments
 (0)