Skip to content
This repository was archived by the owner on Feb 18, 2026. It is now read-only.

Commit e724c4d

Browse files
committed
Add list of participants API
1 parent d302d69 commit e724c4d

2 files changed

Lines changed: 53 additions & 1 deletion

File tree

client/src/dolbyio_rest_apis/communications/conference.py

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from dolbyio_rest_apis.communications.internal.http_context import CommunicationsHttpContext
1010
from dolbyio_rest_apis.core.helpers import get_value, add_if_not_none
1111
from dolbyio_rest_apis.core.urls import get_comms_url_v2
12-
from .models import UserToken, Conference, SpatialAudioEnvironment, SpatialAudioListener, SpatialAudioUser, RTCPMode, Participant, VideoCodec
12+
from .models import UserToken, Conference, SpatialAudioEnvironment, SpatialAudioListener, SpatialAudioUser, RTCPMode, Participant, VideoCodec, GetParticipantsResponse
1313
from typing import List
1414

1515
async def create_conference(
@@ -336,6 +336,32 @@ async def update_permissions(
336336

337337
return user_tokens
338338

339+
async def list_participants(
340+
access_token: str,
341+
conference_id: str,
342+
) -> GetParticipantsResponse:
343+
r"""
344+
Returns the current participant list.
345+
346+
See: https://docs.dolby.io/communications-apis/reference/return-participant-list
347+
348+
Args:
349+
access_token: Access token to use for authentication.
350+
conference_id: Identifier of the conference.
351+
352+
Raises:
353+
HttpRequestError: If a client error one occurred.
354+
HTTPError: If one occurred.
355+
"""
356+
357+
async with CommunicationsHttpContext() as http_context:
358+
json_response = await http_context.requests_get(
359+
access_token=access_token,
360+
url=f'{get_comms_url_v2()}/conferences/{conference_id}/participants',
361+
)
362+
363+
return GetParticipantsResponse(json_response)
364+
339365
async def terminate(
340366
access_token: str,
341367
conference_id: str,

client/src/dolbyio_rest_apis/communications/models.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,32 @@ def __init__(self, dictionary: dict):
9999
user_token = UserToken(key, self['usersTokens'][key])
100100
self.user_tokens.append(user_token)
101101

102+
class ConferenceParticipant(dict):
103+
"""Representation of a participant."""
104+
105+
def __init__(self, dictionary: dict):
106+
dict.__init__(self, dictionary)
107+
108+
self.user_id = get_value_or_default(self, 'userId', None)
109+
self.external_id = get_value_or_default(self, 'externalId', None)
110+
self.name = get_value_or_default(self, 'name', None)
111+
self.avatar_url = get_value_or_default(self, 'avatarUrl', None)
112+
self.ip_address = get_value_or_default(self, 'ipAddress', None)
113+
self.user_agent = get_value_or_default(self, 'userAgent', None)
114+
self.last_join_timestamp = get_value_or_default(self, 'lastJoinTimestamp', 0)
115+
self.nb_session = get_value_or_default(self, 'nbSession', 0)
116+
117+
class GetParticipantsResponse(dict):
118+
"""Representation of a Participants response."""
119+
120+
def __init__(self, dictionary: dict):
121+
dict.__init__(self, dictionary)
122+
123+
self.participants: List[ConferenceParticipant] = []
124+
if in_and_not_none(self, 'participants'):
125+
for participant in self['participants']:
126+
self.participants.append(ConferenceParticipant(participant))
127+
102128
class RemixStatus(dict):
103129
"""Representation of a Remix Status."""
104130

0 commit comments

Comments
 (0)