symphony.bdk.core.service.stream.stream_service.StreamService#

class symphony.bdk.core.service.stream.stream_service.StreamService(streams_api: symphony.bdk.gen.pod_api.streams_api.StreamsApi, room_membership_api: symphony.bdk.gen.pod_api.room_membership_api.RoomMembershipApi, share_api: symphony.bdk.gen.agent_api.share_api.ShareApi, auth_session: symphony.bdk.core.auth.auth_session.AuthSession, retry_config: symphony.bdk.core.config.model.bdk_retry_config.BdkRetryConfig)#

Bases: symphony.bdk.core.service.stream.stream_service.OboStreamService

Service class to manage streams.

__init__(streams_api: symphony.bdk.gen.pod_api.streams_api.StreamsApi, room_membership_api: symphony.bdk.gen.pod_api.room_membership_api.RoomMembershipApi, share_api: symphony.bdk.gen.agent_api.share_api.ShareApi, auth_session: symphony.bdk.core.auth.auth_session.AuthSession, retry_config: symphony.bdk.core.config.model.bdk_retry_config.BdkRetryConfig)#
Parameters
  • streams_api – a generated StreamsApi instance.

  • room_membership_api – a generated RoomMembershipApi instance.

  • share_api – a generated ShareApi instance.

  • auth_session – the bot session.

Methods

__init__(streams_api, room_membership_api, ...)

param streams_api

a generated StreamsApi instance.

add_member_to_room(user_id, room_id)

Adds a member to an existing room.

create_im_admin(user_ids)

Create a new single or multi party instant message conversation.

create_im_or_mim(user_ids)

Create a new single or multi party instant message conversation between the caller and specified users.

create_room(room_attributes)

Creates a new chatroom.

demote_owner_to_room_participant(user_id, ...)

Demotes room owner to a participant in the chat room.

get_im_info(im_id)

Get information about a particular IM.

get_room_info(room_id)

Get information about a particular room.

get_stream(stream_id)

Returns information about a particular stream.

list_all_stream_members(stream_id[, ...])

List the current members of an existing stream.

list_all_streams(stream_filter[, ...])

Returns an asynchronous of all the streams of which the requesting user is a member, sorted by creation date (ascending - oldest to newest).

list_all_streams_admin(stream_filter[, ...])

Retrieves all the streams across the enterprise.

list_room_members(room_id)

Lists the current members of an existing room.

list_stream_members(stream_id[, skip, limit])

List the current members of an existing stream.

list_streams(stream_filter[, skip, limit])

Returns a list of all the streams of which the requesting user is a member, sorted by creation date (ascending - oldest to newest).

list_streams_admin(stream_filter[, skip, limit])

Retrieves all the streams across the enterprise.

promote_user_to_room_owner(user_id, room_id)

Promotes user to owner of the chat room.

remove_member_from_room(user_id, room_id)

Removes a member from an existing room.

search_all_rooms(query[, chunk_size, max_number])

Search for rooms according to the specified criteria.

search_rooms(query[, skip, limit])

Search for rooms according to the specified criteria.

set_room_active(room_id, active)

Deactivates or reactivates a chatroom.

set_room_active_admin(room_id, active)

Deactivates or reactivates a chatroom via AC Portal.

share(stream_id, content)

Share third-party content, such as a news article, into the specified stream.

update_im(im_id, im_attributes)

Updates the attributes of an existing im.

update_room(room_id, room_attributes)

Updates the attributes of an existing chatroom.

add_member_to_room(user_id: int, room_id: str)#

Adds a member to an existing room. Wraps the Add Member endpoint.

Parameters
  • user_id – the id of the user to be added to the room.

  • room_id – the id of the room in which to add the user.

Returns

None

create_im_admin(user_ids: [<class 'int'>]) symphony.bdk.gen.pod_model.stream.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 endpoint.

Parameters

user_ids – the list of user IDs to be put as participants. At least two user IDs must be provided.

Returns

the created IM or MIM.

create_im_or_mim(user_ids: [<class 'int'>]) symphony.bdk.gen.pod_model.stream.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 endpoint.

Parameters

user_ids – the list of user ids ti be put as room participants.

Returns

the created stream.

create_room(room_attributes: symphony.bdk.gen.pod_model.v3_room_attributes.V3RoomAttributes) symphony.bdk.gen.pod_model.v3_room_detail.V3RoomDetail#

Creates a new chatroom. If no attributes are specified, the room is created as a private chatroom. Wraps the Create Room V3 endpoint.

Parameters

room_attributes – attributes of the room to be created.

Returns

details of created room.

demote_owner_to_room_participant(user_id: int, room_id: str)#

Demotes room owner to a participant in the chat room. Wraps the Demote Owner endpoint.

Parameters
  • user_id – the id of the room owner to be demoted.

  • room_id – the room id.

Returns

None

get_im_info(im_id: str) symphony.bdk.gen.pod_model.v1_im_detail.V1IMDetail#

Get information about a particular IM. Wraps the IM info <https://developers.symphony.com/restapi/reference/im-info> endpoint

Parameters

im_id – the id of the IM.

Returns

the im details.

get_room_info(room_id: str) symphony.bdk.gen.pod_model.v3_room_detail.V3RoomDetail#

Get information about a particular room. Wraps the Room Info V3 endpoint.

Parameters

room_id – the id of the room.

Returns

the room details.

get_stream(stream_id: str) symphony.bdk.gen.pod_model.v2_stream_attributes.V2StreamAttributes#

Returns information about a particular stream. Wraps the Stream Info V2 endpoint.

Parameters

stream_id – the ID of the stream to be retrieved.

Returns

the information about the given stream.

async list_all_stream_members(stream_id: str, chunk_size: int = 50, max_number=None) AsyncGenerator[symphony.bdk.gen.pod_model.v2_member_info.V2MemberInfo, None]#

List the current members of an existing stream. The stream can be of type IM, MIM, or ROOM. Wraps the Stream Members endpoint.

Parameters
  • stream_id – the ID of the stream.

  • chunk_size – the maximum number of elements to retrieve in one underlying HTTP call.

  • max_number – the total maximum number of elements to retrieve.

Returns

an asynchronous generator of the stream members.

list_all_streams(stream_filter: symphony.bdk.gen.pod_model.stream_filter.StreamFilter, chunk_size: int = 50, max_number: int = None) AsyncGenerator[symphony.bdk.gen.pod_model.stream_attributes.StreamAttributes, None]#

Returns an asynchronous of all the streams of which the requesting user is a member, sorted by creation date (ascending - oldest to newest). Wraps the List User Streams endpoint.

Parameters
  • stream_filter – the stream searching criteria.

  • chunk_size – the maximum number of elements to retrieve in one underlying HTTP call

  • max_number – the total maximum number of elements to retrieve

Returns

an asynchronous generator of the streams matching the search filter.

async list_all_streams_admin(stream_filter: symphony.bdk.gen.pod_model.v2_admin_stream_filter.V2AdminStreamFilter, chunk_size=50, max_number=None) AsyncGenerator[symphony.bdk.gen.pod_model.v2_admin_stream_info.V2AdminStreamInfo, None]#

Retrieves all the streams across the enterprise. Wraps the List Streams for Enterprise V2 endpoint.

Parameters
  • stream_filter – the stream searching filter.

  • chunk_size – the maximum number of elements to retrieve in one underlying HTTP call.

  • max_number – the total maximum number of elements to retrieve.

Returns

an asynchronous generator of streams matching the search criteria.

list_room_members(room_id: str) symphony.bdk.gen.pod_model.membership_list.MembershipList#

Lists the current members of an existing room. Wraps the Room Members endpoint.

Parameters

room_id – the ID of the room.

Returns

the list of room members.

list_stream_members(stream_id: str, skip: int = 0, limit: int = 100) symphony.bdk.gen.pod_model.v2_membership_list.V2MembershipList#

List the current members of an existing stream. The stream can be of type IM, MIM, or ROOM. Wraps the Stream Members endpoint.

Parameters
  • stream_id – the ID of the stream.

  • skip – the number of members to skip.

  • limit – the maximum number of members to retrieve. Must be less or equal than 1000.

Returns

the list of stream members.

list_streams(stream_filter: symphony.bdk.gen.pod_model.stream_filter.StreamFilter, skip: int = 0, limit: int = 50) symphony.bdk.gen.pod_model.stream_list.StreamList#

Returns a list of all the streams of which the requesting user is a member, sorted by creation date (ascending - oldest to newest). Wraps the List User Streams endpoint.

Parameters
  • stream_filter – the stream searching criteria.

  • skip – number of stream results to skip.

  • limit – maximum number of streams to return.

Returns

the list of stream retrieved matching the search filter.

list_streams_admin(stream_filter: symphony.bdk.gen.pod_model.v2_admin_stream_filter.V2AdminStreamFilter, skip: int = 0, limit: int = 50) symphony.bdk.gen.pod_model.v2_admin_stream_list.V2AdminStreamList#

Retrieves all the streams across the enterprise. Wraps the List Streams for Enterprise V2 endpoint.

Parameters
  • stream_filter – the stream searching filter.

  • skip – the number of streams to skip.

  • limit – the maximum number of streams to retrieve. Must be a positive integer less or equal than 100.

Returns

the list of streams matching the search criteria.

promote_user_to_room_owner(user_id: int, room_id: str)#

Promotes user to owner of the chat room. Wraps the Promote Owner endpoint.

Parameters
  • user_id – the id of the user to be promoted as owner.

  • room_id – the room id.

Returns

None

remove_member_from_room(user_id: int, room_id: str)#

Removes a member from an existing room. Wraps the Remove Member endpoint.

Parameters
  • user_id – the id of the user to be removed from the room.

  • room_id – the id of the room from which to remove the user.

Returns

None

async search_all_rooms(query: symphony.bdk.gen.pod_model.v2_room_search_criteria.V2RoomSearchCriteria, chunk_size: int = 50, max_number: Optional[int] = None) AsyncGenerator[symphony.bdk.gen.pod_model.v3_room_detail.V3RoomDetail, None]#

Search for rooms according to the specified criteria. Wraps the Search Rooms V3 endpoint.

Parameters
  • query – the search criteria.

  • chunk_size – the maximum number of elements to retrieve in one underlying HTTP call.

  • max_number – the total maximum number of elements to retrieve.

Returns

an asynchronous generator of the rooms matching the search criteria.

search_rooms(query: symphony.bdk.gen.pod_model.v2_room_search_criteria.V2RoomSearchCriteria, skip: int = 0, limit: int = 50) symphony.bdk.gen.pod_model.v3_room_search_results.V3RoomSearchResults#

Search for rooms according to the specified criteria. Wraps the Search Rooms V3 endpoint.

Parameters
  • query – the search criteria.

  • skip – number of rooms to skip, defaults to 0.

  • limit – number of maximum rooms to return. Must be a positive integer that does not exceed 100.

Returns

the rooms matching search criteria.

set_room_active(room_id: str, active: bool) symphony.bdk.gen.pod_model.room_detail.RoomDetail#

Deactivates or reactivates a chatroom. At creation time, the chatroom is activated by default. Wraps the De/Reactivate Room endpoint.

Parameters
  • room_id – the id of the room to be deactivated or reactivated.

  • active – the new active status (True to reactivate, false to deactivate).

Returns

the details of the updated room.

set_room_active_admin(room_id: str, active: bool) symphony.bdk.gen.pod_model.room_detail.RoomDetail#

Deactivates or reactivates a chatroom via AC Portal.

Parameters
  • room_id – the id of the room to be deactivated or reactivated.

  • active – the new active status (True to reactivate, false to deactivate).

Returns

the details of the updated room.

share(stream_id: str, content: symphony.bdk.gen.agent_model.share_content.ShareContent) symphony.bdk.gen.agent_model.v2_message.V2Message#

Share third-party content, such as a news article, into the specified stream. The stream can be a chat room, an IM, or an MIM. Wraps the Share endpoint.

Parameters
  • stream_id – the id of the stream in which to share the given content.

  • content – the third-party content to be shared.

Returns

the created message.

update_im(im_id: str, im_attributes: symphony.bdk.gen.pod_model.v1_im_attributes.V1IMAttributes) symphony.bdk.gen.pod_model.v1_im_detail.V1IMDetail#

Updates the attributes of an existing im. Wraps the Update IM endpoint.

Parameters
  • im_id – the id of the im to be updated.

  • im_attributes – the attributes of the im to be updated.

Returns

the details of the updated im.

update_room(room_id: str, room_attributes: symphony.bdk.gen.pod_model.v3_room_attributes.V3RoomAttributes) symphony.bdk.gen.pod_model.v3_room_detail.V3RoomDetail#

Updates the attributes of an existing chatroom. Wraps the Update Room V3 endpoint.

Parameters
  • room_id – the id of the room to be updated.

  • room_attributes – the attributes of the room to be updated.

Returns

the details of the updated room.