Skip to content

Commit 7b5dea7

Browse files
Merge pull request #29 from DolbyIO/recordings-v2
Version 4.0.0
2 parents b148ad4 + 071f1d7 commit 7b5dea7

File tree

11 files changed

+286
-231
lines changed

11 files changed

+286
-231
lines changed

client/requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,3 @@ aiohttp>=3.7.4
22
aiofiles>=0.7.0
33
aiohttp-retry>=2.4.6
44
certifi>=2022.12.7
5-
Deprecated>=1.2.14

client/src/dolbyio_rest_apis/communications/authentication.py

Lines changed: 3 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -5,57 +5,12 @@
55
This module contains the functions to work with the authentication API.
66
"""
77

8-
from deprecated import deprecated
98
from dolbyio_rest_apis.communications.internal.http_context import CommunicationsHttpContext
109
from dolbyio_rest_apis.core.helpers import add_if_not_none
11-
from dolbyio_rest_apis.core.urls import get_comms_session_url, get_comms_url_v2
10+
from dolbyio_rest_apis.core.urls import get_comms_url_v2
1211
from dolbyio_rest_apis.models import AccessToken
1312
from typing import List
1413

15-
@deprecated(reason='''
16-
This function is now deprecated and will be removed in the next release of this SDK.
17-
Please start using :meth:`get_client_access_token_v2` instead.
18-
''')
19-
async def get_client_access_token(
20-
app_key: str,
21-
app_secret: str,
22-
expires_in: int=None,
23-
) -> AccessToken:
24-
r"""
25-
This API returns an access token that your backend can request on behalf of a client to initialize
26-
the Dolby.io SDK in a secure way.
27-
28-
See: https://docs.dolby.io/communications-apis/reference/get-client-access-token-v1
29-
30-
Args:
31-
app_key: Your Dolby.io App Key.
32-
app_secret: Your Dolby.io App Secret.
33-
expires_in: (Optional) Access token expiration time in seconds.
34-
The maximum value is 86,400, indicating 24 hours.
35-
If no value is specified, the default is 3,600, indicating one hour.
36-
37-
Returns:
38-
An :class:`AccessToken` object.
39-
40-
Raises:
41-
HttpRequestError: If a client error one occurred.
42-
HTTPError: If one occurred.
43-
"""
44-
data = {
45-
'grant_type': 'client_credentials',
46-
}
47-
add_if_not_none(data, 'expires_in', expires_in)
48-
49-
async with CommunicationsHttpContext() as http_context:
50-
json_response = await http_context.requests_post_basic_auth(
51-
app_key=app_key,
52-
app_secret=app_secret,
53-
url=f'{get_comms_session_url()}/oauth2/token',
54-
data=data
55-
)
56-
57-
return AccessToken(json_response)
58-
5914
async def get_client_access_token_v2(
6015
access_token: str,
6116
session_scope: List[str],
@@ -71,7 +26,8 @@ async def get_client_access_token_v2(
7126
Args:
7227
access_token: Access token to use for authentication.
7328
session_scope: A list of case-sensitive strings allowing you to control
74-
what scope of access the client access token should have.
29+
what scope of access the client access token should have. If not specified,
30+
the token will possess unrestricted access to all resources and actions.
7531
The API supports the following scopes:
7632
- conf:create: Allows creating a new conference.
7733
- notifications:set: Allows the client to subscribe to events.

client/src/dolbyio_rest_apis/communications/models.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,17 @@ def __init__(self, dictionary: dict):
135135
self.region = get_value_or_default(self, 'region', None)
136136
self.alias = get_value_or_default(self, 'alias', None)
137137

138+
class RtsStream(dict):
139+
"""Representation of an RTS Stream start response."""
140+
141+
def __init__(self, dictionary: dict):
142+
dict.__init__(self, dictionary)
143+
144+
self.stream_name = get_value_or_default(self, 'streamName', None)
145+
self.subscribe_token = get_value_or_default(self, 'subscribeToken', None)
146+
self.stream_account_id = get_value_or_default(self, 'streamAccountID', None)
147+
self.viewer_url = get_value_or_default(self, 'viewerURL', None)
148+
138149
@dataclass
139150
class Coordinates:
140151
"""Representation of a Coordinate object."""

client/src/dolbyio_rest_apis/communications/monitor/conferences.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
from dolbyio_rest_apis.communications.internal.http_context import CommunicationsHttpContext
99
from dolbyio_rest_apis.communications.monitor.models import GetConferencesResponse, ConferenceSummary, ConferenceStatistics, ConferenceParticipants, ConferenceParticipant
10-
from dolbyio_rest_apis.core.urls import get_comms_monitor_url
10+
from dolbyio_rest_apis.core.urls import get_comms_monitor_url_v1
1111
from typing import Any, Dict, List
1212

1313
async def get_conferences(
@@ -59,7 +59,7 @@ async def get_conferences(
5959
HttpRequestError: If a client error one occurred.
6060
HTTPError: If one occurred.
6161
"""
62-
url = f'{get_comms_monitor_url()}/conferences'
62+
url = f'{get_comms_monitor_url_v1()}/conferences'
6363

6464
params = {
6565
'from': tr_from,
@@ -129,7 +129,7 @@ async def get_all_conferences(
129129
HttpRequestError: If a client error one occurred.
130130
HTTPError: If one occurred.
131131
"""
132-
url = f'{get_comms_monitor_url()}/conferences'
132+
url = f'{get_comms_monitor_url_v1()}/conferences'
133133

134134
params = {
135135
'from': tr_from,
@@ -187,7 +187,7 @@ async def get_conference(
187187
HTTPError: If one occurred.
188188
"""
189189

190-
url = f'{get_comms_monitor_url()}/conferences/{conference_id}'
190+
url = f'{get_comms_monitor_url_v1()}/conferences/{conference_id}'
191191

192192
params = {
193193
'livestats': str(live_stats),
@@ -230,7 +230,7 @@ async def get_conference_statistics(
230230
HTTPError: If one occurred.
231231
"""
232232

233-
url = f'{get_comms_monitor_url()}/conferences/{conference_id}/statistics'
233+
url = f'{get_comms_monitor_url_v1()}/conferences/{conference_id}/statistics'
234234

235235
async with CommunicationsHttpContext() as http_context:
236236
json_response = await http_context.requests_get(
@@ -280,7 +280,7 @@ async def get_conference_participants(
280280
HttpRequestError: If a client error one occurred.
281281
HTTPError: If one occurred.
282282
"""
283-
url = f'{get_comms_monitor_url()}/conferences/{conference_id}/participants'
283+
url = f'{get_comms_monitor_url_v1()}/conferences/{conference_id}/participants'
284284

285285
params = {
286286
'from': tr_from,
@@ -336,7 +336,7 @@ async def get_all_conference_participants(
336336
HttpRequestError: If a client error one occurred.
337337
HTTPError: If one occurred.
338338
"""
339-
url = f'{get_comms_monitor_url()}/conferences/{conference_id}/participants'
339+
url = f'{get_comms_monitor_url_v1()}/conferences/{conference_id}/participants'
340340

341341
params = {
342342
'from': tr_from,
@@ -415,7 +415,7 @@ async def get_conference_participant(
415415
HttpRequestError: If a client error one occurred.
416416
HTTPError: If one occurred.
417417
"""
418-
url = f'{get_comms_monitor_url()}/conferences/{conference_id}/participants/{participant_id}'
418+
url = f'{get_comms_monitor_url_v1()}/conferences/{conference_id}/participants/{participant_id}'
419419

420420
params = {
421421
'from': tr_from,

client/src/dolbyio_rest_apis/communications/monitor/models.py

Lines changed: 36 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class ConferenceOwner(dict):
2323
def __init__(self, dictionary: dict):
2424
dict.__init__(self, dictionary)
2525

26-
self.user_id = get_value_or_default(self, 'userID', None)
26+
self.user_id = get_value_or_default(self, 'userId', None)
2727

2828
if in_and_not_none(self, 'metadata'):
2929
self.metadata = UserMetadata(self['metadata'])
@@ -194,71 +194,48 @@ def __init__(self, dictionary: dict):
194194
self.external_photo_url = get_value_or_default(self, 'externalPhotoUrl', None)
195195
self.ip_address = get_value_or_default(self, 'ipAddress', None)
196196

197-
class RecordingSplit(dict):
198-
"""Representation of a Recording Split."""
197+
class ConferenceRecordingMix(dict):
198+
"""Representation of a Conference Recording Mix."""
199199

200200
def __init__(self, dictionary: dict):
201201
dict.__init__(self, dictionary)
202202

203-
self.start_time = get_value_or_default(self, 'startTime', 0)
204-
self.duration = get_value_or_default(self, 'duration', 0)
205-
self.size = get_value_or_default(self, 'size', 0)
206-
self.file_name = get_value_or_default(self, 'fileName', None)
207-
self.url = get_value_or_default(self, 'url', None)
203+
self.mix_id = get_value_or_default(self, 'mixId', None)
204+
self.width = get_value_or_default(self, 'width', -1)
205+
self.height = get_value_or_default(self, 'height', -1)
206+
self.layout_url = get_value_or_default(self, 'layoutUrl', None)
208207

209-
if in_and_not_none(self, 'metadata'):
210-
self.metadata = UserMetadata(self['metadata'])
211-
212-
class RecordingRecord(dict):
213-
"""Representation of a Recording Record."""
208+
class Conference(dict):
209+
"""Representation of a Conference."""
214210

215211
def __init__(self, dictionary: dict):
216212
dict.__init__(self, dictionary)
217213

218-
self.start_time = get_value_or_default(self, 'startTime', 0)
219-
self.duration = get_value_or_default(self, 'duration', 0)
220-
self.size = get_value_or_default(self, 'size', 0)
221-
self.file_name = get_value_or_default(self, 'fileName', None)
222-
self.url = get_value_or_default(self, 'url', None)
223-
224-
self.splits = []
225-
if in_and_not_none(self, 'splits'):
226-
for split in self['splits']:
227-
self.splits.append(RecordingSplit(split))
214+
self.conf_id = get_value_or_default(self, 'confId', None)
215+
self.conf_alias = get_value_or_default(self, 'confAlias', None)
228216

229-
class RecordingAudio(dict):
230-
"""Representation of a Recording Audio."""
217+
class ConferenceRecording(dict):
218+
"""Representation of a Conference Recording."""
231219

232220
def __init__(self, dictionary: dict):
233221
dict.__init__(self, dictionary)
234222

235-
self.region = get_value_or_default(self, 'region', None)
236-
237-
if in_and_not_none(self, 'mix'):
238-
self.mix = RecordingMix(self['mix'])
239-
240-
self.records = []
241-
if in_and_not_none(self, 'records'):
242-
for record in self['records']:
243-
self.records.append(RecordingRecord(record))
244-
245-
class Recording(dict):
246-
"""Representation of a Recording."""
247-
248-
def __init__(self, dictionary: dict):
249-
dict.__init__(self, dictionary)
223+
if in_and_not_none(self, 'conference'):
224+
self.conference = Conference(self['conference'])
250225

251-
self.conf_id = get_value_or_default(self, 'confId', None)
252-
self.alias = get_value_or_default(self, 'alias', None)
253-
self.duration = get_value_or_default(self, 'duration', 0)
254-
self.ts = get_value_or_default(self, 'ts', 0)
226+
self.region = get_value_or_default(self, 'region', None)
227+
self.url = get_value_or_default(self, 'url', None)
228+
self.created_at = get_value_or_default(self, 'createdAt', None)
229+
self.recording_type = get_value_or_default(self, 'recordingType', None)
230+
self.duration = get_value_or_default(self, 'duration', -1)
231+
self.filename = get_value_or_default(self, 'filename', None)
232+
self.size = get_value_or_default(self, 'size', -1)
233+
self.start_time = get_value_or_default(self, 'startTime', 0)
234+
self.media_type = get_value_or_default(self, 'mediaType', None)
255235
self.region = get_value_or_default(self, 'region', None)
256236

257237
if in_and_not_none(self, 'mix'):
258-
self.mix = RecordingMix(self['mix'])
259-
260-
if in_and_not_none(self, 'audio'):
261-
self.audio = RecordingAudio(self['audio'])
238+
self.mix = ConferenceRecordingMix(self['mix'])
262239

263240
class GetRecordingsResponse(PagedResponse):
264241
"""Representation of a Recordings response."""
@@ -269,25 +246,23 @@ def __init__(self, dictionary: dict):
269246
self.recordings = []
270247
if in_and_not_none(self, 'recordings'):
271248
for recording in self['recordings']:
272-
self.recordings.append(Recording(recording))
249+
self.recordings.append(ConferenceRecording(recording))
273250

274-
class DolbyVoiceRecording(dict):
275-
"""Representation of a Dolby Voice Recording."""
251+
class GetConferenceRecordingsResponse(GetRecordingsResponse):
252+
"""Representation of a Conference Recordings response."""
276253

277254
def __init__(self, dictionary: dict):
278-
dict.__init__(self, dictionary)
255+
GetRecordingsResponse.__init__(self, dictionary)
279256

280-
self.region = get_value_or_default(self, 'region', None)
281-
self.conf_id = None
282-
self.conf_alias = None
283257
if in_and_not_none(self, 'conference'):
284-
self.conf_id = get_value_or_default(self, 'confId', None)
285-
self.conf_alias = get_value_or_default(self, 'confAlias', None)
258+
self.conference = Conference(self['conference'])
286259

287-
self.records = []
288-
if in_and_not_none(self, 'records'):
289-
for record in self['records']:
290-
self.records.append(RecordingRecord(record))
260+
self.live_conference = get_value_or_default(self, 'liveConference', False)
261+
262+
self.recordings = []
263+
if in_and_not_none(self, 'recordings'):
264+
for recording in self['recordings']:
265+
self.recordings.append(ConferenceRecording(recording))
291266

292267
class WebHookResponse(dict):
293268
"""Representation of a WebHook event response."""

0 commit comments

Comments
 (0)