Skip to content

Commit 80a084e

Browse files
Removed ability to create MIM
1 parent 172b9fe commit 80a084e

5 files changed

Lines changed: 14 additions & 18 deletions

File tree

docsrc/markdown/stream_service.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ More precisely:
88
* [Share third-party content](https://rest-api.symphony.com/main/streams-conversations/all-streams-endpoints/share-v3)
99
* [Promote user to room owner](https://rest-api.symphony.com/main/streams-conversations/room-endpoints/promote-owner)
1010
* [Demote owner to room participant](https://rest-api.symphony.com/main/streams-conversations/room-endpoints/demote-owner)
11-
* [Create IM or MIM](https://rest-api.symphony.com/main/streams-conversations/im-mim-endpoints/create-im-or-mim)
12-
* [Create IM or MIM non-inclusive](https://rest-api.symphony.com/main/streams-conversations/im-mim-endpoints/create-im-or-mim-admin)
13-
* [Update IM or MIM](https://rest-api.symphony.com/main/streams-conversations/im-mim-endpoints/update-im)
11+
* [Create IM](https://rest-api.symphony.com/main/streams-conversations/im-mim-endpoints/create-im-or-mim)
12+
* [Create IM non-inclusive](https://rest-api.symphony.com/main/streams-conversations/im-mim-endpoints/create-im-or-mim-admin)
13+
* [Update IM](https://rest-api.symphony.com/main/streams-conversations/im-mim-endpoints/update-im)
1414
* [Get IM information](https://rest-api.symphony.com/main/streams-conversations/im-mim-endpoints/im-info)
1515
* [Create room](https://rest-api.symphony.com/main/streams-conversations/room-endpoints/create-room-v3)
1616
* [Search for rooms](https://rest-api.symphony.com/main/streams-conversations/room-endpoints/search-rooms-v3)

examples/services/streams.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ async def run():
1919
async with SymphonyBdk(config) as bdk:
2020
streams = bdk.streams()
2121

22-
await streams.create_im_or_mim([13056700579872, 13056700579891, 13056700579850])
22+
await streams.create_im(13056700579872)
2323
await streams.create_room(V3RoomAttributes(name="New fancy room", description="test room"))
2424

2525
logging.debug(await streams.get_stream(stream_id))

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

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,20 +50,16 @@ def __init__(self, streams_api: StreamsApi, room_membership_api: RoomMembershipA
5050
self._retry_config = retry_config
5151

5252
@retry
53-
async def create_im_or_mim(self, user_ids: [int]) -> Stream:
54-
"""Create a new single or multi party instant message conversation between the caller and specified users.
53+
async def create_im(self, user_id: int) -> Stream:
54+
"""Create a new single party instant message conversation between the caller and specified user.
5555
The caller is implicitly included in the members of the created chat.
56-
Duplicate users will be included in the membership of the chat but the duplication will be silently ignored.
57-
If there is an existing IM conversation with the same set of participants then the id of that existing stream
58-
will be returned.
59-
If the given list of user ids contains only one id, an IM will be created, otherwise, a MIM will be created.
6056
61-
Wraps the `Create IM or MIM <https://developers.symphony.com/restapi/reference/create-im-or-mim>`_ endpoint.
57+
Wraps the `Create IM <https://rest-api.symphony.com/main/streams-conversations/im-mim-endpoints/create-im-or-mim>`_ endpoint.
6258
63-
:param user_ids: the list of user ids ti be put as room participants.
59+
:param user_id: the user id to be put as room participant.
6460
:return: the created stream.
6561
"""
66-
return await self._streams_api.v1_im_create_post(uid_list=UserIdList(value=user_ids),
62+
return await self._streams_api.v1_im_create_post(uid_list=UserIdList(value=[user_id]),
6763
session_token=await self._auth_session.session_token)
6864

6965
@retry

tests/core/service/stream/stream_service_test.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -182,12 +182,12 @@ async def test_demote_owner(stream_service, room_membership_api):
182182
@pytest.mark.asyncio
183183
async def test_create_im(mocked_api_client, stream_service, streams_api):
184184
mocked_api_client.call_api.return_value = get_deserialized_object_from_resource(Stream,
185-
"stream/create_im_or_mim.json")
185+
"stream/create_im.json")
186186

187-
user_ids = [12334]
188-
stream = await stream_service.create_im_or_mim(user_ids)
187+
user_id = 12334
188+
stream = await stream_service.create_im(user_id)
189189

190-
streams_api.v1_im_create_post.assert_called_once_with(uid_list=UserIdList(value=user_ids),
190+
streams_api.v1_im_create_post.assert_called_once_with(uid_list=UserIdList(value=[user_id]),
191191
session_token=SESSION_TOKEN)
192192
assert stream.id == "-M8s5WG7K8lAP7cpIiuyTH___oh4zK8EdA"
193193

@@ -314,7 +314,7 @@ async def test_update_im(mocked_api_client, stream_service, streams_api):
314314
@pytest.mark.asyncio
315315
async def test_create_im_admin(mocked_api_client, stream_service, streams_api):
316316
mocked_api_client.call_api.return_value = get_deserialized_object_from_resource(Stream,
317-
"stream/create_im_or_mim.json")
317+
"stream/create_im.json")
318318

319319
user_ids = [12334]
320320
stream = await stream_service.create_im_admin(user_ids)
File renamed without changes.

0 commit comments

Comments
 (0)