async def test_unfollow_user(user_api, user_service): user_api.v1_user_uid_unfollow_post = AsyncMock() await user_service.unfollow_user([1234, 2345], 12345) user_api.v1_user_uid_unfollow_post.assert_called_with( uid=12345, uid_list=FollowersList(followers=UserIdList(value=[1234, 2345])), session_token="session_token")
async def test_create_im_admin(mocked_api_client, stream_service, streams_api): mocked_api_client.call_api.return_value = get_deserialized_object_from_resource( Stream, "stream/create_im_or_mim.json") user_ids = [12334] stream = await stream_service.create_im_admin(user_ids) streams_api.v1_admin_im_create_post.assert_called_once_with( uid_list=UserIdList(value=user_ids), session_token=SESSION_TOKEN) assert stream.id == "-M8s5WG7K8lAP7cpIiuyTH___oh4zK8EdA"
async def unfollow_user(self, follower_ids: [int], user_id: int) -> None: """Make a list of users to stop following a specific user. See: `Unfollow User <https://developers.symphony.com/restapi/v20.9/reference#unfollow-user>`_ :param follower_ids: List of the ids of the followers. :param user_id: The id of the user to be unfollowed. """ params = { 'uid': user_id, 'uid_list': FollowersList(followers=UserIdList(value=follower_ids)), 'session_token': await self._auth_session.session_token } await self._user_api.v1_user_uid_unfollow_post(**params)
async def create_im_or_mim(self, user_ids: [int]) -> Stream: """Create a new single or multi party instant message conversation between the caller and specified users. The caller is implicitly included in the members of the created chat. Duplicate users will be included in the membership of the chat but the duplication will be silently ignored. If there is an existing IM conversation with the same set of participants then the id of that existing stream will be returned. If the given list of user ids contains only one id, an IM will be created, otherwise, a MIM will be created. Wraps the `Create IM or MIM <https://developers.symphony.com/restapi/reference#create-im-or-mim>`_ endpoint. :param user_ids: the list of user ids ti be put as room participants. :return: the created stream. """ return await self._streams_api.v1_im_create_post( uid_list=UserIdList(value=user_ids), session_token=await self._auth_session.session_token)
async def create_im_admin(self, user_ids: [int]) -> Stream: """Create a new single or multi party instant message conversation. At least two user IDs must be provided or an error response will be sent. The caller is not included in the members of the created chat. Duplicate users will be included in the membership of the chat but the duplication will be silently ignored. If there is an existing IM conversation with the same set of participants then the id of that existing stream will be returned. Wraps the `Create IM or MIM Non-inclusive <https://developers.symphony.com/restapi/reference#create-im-or-mim-admin>`_ endpoint. :param user_ids: the list of user IDs to be put as participants. At least two user IDs must be provided. :return: the created IM or MIM. """ return await self._streams_api.v1_admin_im_create_post( uid_list=UserIdList(value=user_ids), session_token=await self._auth_session.session_token)