azure.communication.rooms.aio package
- class azure.communication.rooms.aio.RoomsClient(endpoint: str, credential: AsyncTokenCredential | AzureKeyCredential, **kwargs)[source]
A client to interact with the AzureCommunicationService Rooms gateway.
This client provides operations to manage rooms.
- Parameters:
endpoint (str) – The endpoint url for Azure Communication Service resource.
credential (Union[AsyncTokenCredential, AzureKeyCredential]) – The access key we use to authenticate against the service.
- Keyword Arguments:
api_version (str) – Azure Communication Rooms API version. Default value is “2023-06-14”. Note that overriding this default value may result in unsupported behavior.
- classmethod from_connection_string(conn_str: str, **kwargs) RoomsClient[source]
Create RoomsClient from a Connection String.
- Parameters:
conn_str (str) – A connection string to an Azure Communication Service resource.
- Returns:
Instance of RoomsClient.
- Return type:
RoomsClient
Example:
Creating the RoomsClient from a connection string.self.connection_string = os.getenv("COMMUNICATION_CONNECTION_STRING_ROOMS") self.rooms_client = RoomsClient.from_connection_string(self.connection_string)
- async add_or_update_participants(*, room_id: str, participants: List[RoomParticipant], **kwargs) None[source]
Update participants to a room. It looks for the room participants based on their communication identifier and replace those participants with the value passed in this API.
- Keyword Arguments:
room_id (str) – Required. Id of room to be updated
participants (List[RoomParticipant]) – Required. Collection of identities invited to be updated
- Returns:
None.
- Return type:
None
- Raises:
~azure.core.exceptions.HttpResponseError, ValueError
- async create_room(*, valid_from: datetime | None = None, valid_until: datetime | None = None, pstn_dial_out_enabled: bool = False, participants: List[RoomParticipant] | None = None, **kwargs) CommunicationRoom[source]
Create a new room.
- Keyword Arguments:
valid_from (datetime) – The timestamp from when the room is open for joining. Optional.
valid_until (datetime) – The timestamp from when the room can no longer be joined. Optional.
pstn_dial_out_enabled (bool) – Set this flag to true if, at the time of the call, dial out to a PSTN number is enabled in a particular room. Optional.
participants (List[RoomParticipant]) – Collection of identities invited to the room. Optional.
- Returns:
Created room.
- Return type:
- Raises:
~azure.core.exceptions.HttpResponseError
- async delete_room(room_id: str, **kwargs) None[source]
Delete room.
- Parameters:
room_id (str) – Required. Id of room to be deleted
- Returns:
None.
- Return type:
None
- Raises:
~azure.core.exceptions.HttpResponseError
- async get_room(room_id: str, **kwargs) CommunicationRoom[source]
Get a valid room
- Parameters:
room_id (str) – Required. Id of room to be fetched
- Returns:
Room with current attributes.
- Return type:
- Raises:
~azure.core.exceptions.HttpResponseError
- list_participants(room_id: str, **kwargs) AsyncItemPaged[RoomParticipant][source]
Get participants of a room
- Parameters:
room_id (str) – Required. Id of room whose participants to be fetched.
- Returns:
An iterator like instance of RoomParticipant.
- Return type:
- Raises:
~azure.core.exceptions.HttpResponseError
- list_rooms(**kwargs) AsyncItemPaged[CommunicationRoom][source]
List all rooms
- Returns:
An iterator like instance of CommunicationRoom.
- Return type:
- Raises:
~azure.core.exceptions.HttpResponseError
- async remove_participants(*, room_id: str, participants: List[RoomParticipant | CommunicationIdentifier], **kwargs) None[source]
Remove participants from a room
- Keyword Arguments:
room_id (str) – Required. Id of room to be updated
participants (List[Union[RoomParticipant, CommunicationIdentifier]]) – Required. Collection of identities to be removed from the room.
- Returns:
None.
- Return type:
None
- Raises:
~azure.core.exceptions.HttpResponseError, ValueError
- async update_room(*, room_id: str, valid_from: datetime | None = None, valid_until: datetime | None = None, pstn_dial_out_enabled: bool | None = None, **kwargs: Any) CommunicationRoom[source]
Update a valid room’s attributes. For any argument that is passed in, the corresponding room property will be replaced with the new value.
- Keyword Arguments:
room_id (str) – Required. Id of room to be updated
valid_from (datetime) – The timestamp from when the room is open for joining. Optional.
valid_until (datetime) – The timestamp from when the room can no longer be joined. Optional.
pstn_dial_out_enabled (bool) – Optional. Set this flag to true if, at the time of the call, dial out to a PSTN number is enabled in a particular room. By default, this flag is set to false.
- Returns:
Updated room.
- Return type:
- Raises:
~azure.core.exceptions.HttpResponseError, ValueError