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

class symphony.bdk.core.service.stream.stream_service.OboStreamService(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: object

Class exposing OBO-enabled endpoints for stream management.

__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_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_room_info(room_id)

Get information about a particular room.

get_stream(stream_id)

Returns information about a particular 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_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).

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.

share(stream_id, content)

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

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_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_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.

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.

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.

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.

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_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.