From 6cd1549481ab015d2e3181928707eb55e6cadbf8 Mon Sep 17 00:00:00 2001 From: Zita Szupera Date: Tue, 24 Oct 2023 09:44:22 +0200 Subject: [PATCH 1/3] basics JS code examples updated --- .../docs/api/basics/authentication.mdx | 57 ++++++++++++++++++- .../docusaurus/docs/api/basics/calls.mdx | 12 ++-- .../docs/api/basics/get_started.mdx | 23 ++++---- 3 files changed, 71 insertions(+), 21 deletions(-) diff --git a/docusaurus/video/docusaurus/docs/api/basics/authentication.mdx b/docusaurus/video/docusaurus/docs/api/basics/authentication.mdx index 641c37d8..c1d9f0de 100644 --- a/docusaurus/video/docusaurus/docs/api/basics/authentication.mdx +++ b/docusaurus/video/docusaurus/docs/api/basics/authentication.mdx @@ -10,11 +10,64 @@ import TabItem from '@theme/TabItem'; ## Creating users -// TODO API endpoint + + + +```js +const newUser: UserObjectRequest = { + id: 'userid', + role: "user", + custom: { + color: 'red' + }, + name: 'This is a test user', + image: 'link/to/profile/image' +}; +await client.upsertUsers({ + users: { + [newUser.id]: newUser, + }, +}); +``` + + + ## Updating users -// TODO API endpoint + + + +```js +const user: UserObjectRequest = { + id: 'userid', + role: "user", + custom: { + color: 'red' + }, + name: 'This is a test user', + image: 'link/to/profile/image' +}; +client.upsertUsers({ + users: { + [user.id]: user, + }, +}); + +// or +client.updateUsersPartial({users: [ + { + id: user.id, + set: { + color: 'blue' + }, + unset: ['name'], + } +]}); +``` + + + ## User tokens diff --git a/docusaurus/video/docusaurus/docs/api/basics/calls.mdx b/docusaurus/video/docusaurus/docs/api/basics/calls.mdx index ad950144..308d1573 100644 --- a/docusaurus/video/docusaurus/docs/api/basics/calls.mdx +++ b/docusaurus/video/docusaurus/docs/api/basics/calls.mdx @@ -16,7 +16,7 @@ import TabItem from '@theme/TabItem'; ```js const callType = 'default'; const callId = 'my-first-call'; -const call = client.call(callType, callId); +const call = client.video.call(callType, callId); call.create({ data: { created_by_id: 'john' } }); // or @@ -98,7 +98,7 @@ curl -X POST "https://video.stream-io-api.com/video/call/default/${CALL_ID}?api_ ```js -call.update({ settings_override: { audio: { mic_default_on: true } } }); +call.update({ settings_override: { audio: { mic_default_on: true, default_device: "speaker" } } }); // or to update custom data call.update({ custom: { color: 'red' } }); @@ -273,23 +273,23 @@ curl -X PUT "https://video.stream-io-api.com/video/call/default/${CALL_ID}/membe ```js // default sorting -client.queryCalls(); +client.video.queryCalls(); // sorting and pagination const queryCallsReq = { sort: [{ field: 'starts_at', direction: -1 }], limit: 2, }; -response = await client.queryCalls(queryCallsReq); +response = await client.video.queryCalls(queryCallsReq); // loading next page -client.queryCalls({ +client.video.queryCalls({ ...queryCallsReq, next: response.next, }); // filtering -client.queryCalls({ +client.video.queryCalls({ filter_conditions: { backstage: { $eq: false } }, }); ``` diff --git a/docusaurus/video/docusaurus/docs/api/basics/get_started.mdx b/docusaurus/video/docusaurus/docs/api/basics/get_started.mdx index bffe72d2..2f47bdf5 100644 --- a/docusaurus/video/docusaurus/docs/api/basics/get_started.mdx +++ b/docusaurus/video/docusaurus/docs/api/basics/get_started.mdx @@ -14,9 +14,9 @@ import TabItem from '@theme/TabItem'; ```bash -npm install @stream-io/video-client +npm install @stream-io/node-sdk // or using yarn -yarn add @stream-io/video-client +yarn add @stream-io/node-sdk ``` @@ -42,9 +42,9 @@ go get github.com/GetStream/video-go-sdk ```js -const client = new StreamVideoServerClient('', { - secret: '', -}); +const apiKey = ''; +const secret = ''; +client = new StreamClient(apiKey, secret); ``` @@ -135,7 +135,7 @@ func main() { ```js const callType = 'default'; const callId = 'my-first-call'; -const call = client.call(callType, callId); +const call = client.video.call(callType, callId); call.create({ data: { created_by_id: 'john' } }); @@ -295,7 +295,7 @@ curl -X PUT "https://video.stream-io-api.com/video/call/default/${CALL_ID}/membe ```js -call.update({ settings_override: { audio: { mic_default_on: true } } }); +call.update({ settings_override: { audio: { mic_default_on: true, default_device: "speaker" } } }); // or to update custom data call.update({ custom: { color: 'red' } }); @@ -383,10 +383,10 @@ curl -X PUT "https://video.stream-io-api.com/video/call/default/${CALL_ID}?api_k ```js -call.startBroadcasting(); +call.startHLSBroadcasting(); // to end broadcasting -call.stopBroadcasting(); +call.stopHLSBroadcasting(); ``` @@ -570,10 +570,7 @@ curl -X POST "https://video.stream-io-api.com/video/call/default/${CALL_ID}/star ```js -call.queryRecordings(); - -// optionally query recordings for a specific session -call.queryRecordings(''); +call.listRecordings(); ``` From bfc864f76f7e95edce3afa42ff9333d2ee6ab422 Mon Sep 17 00:00:00 2001 From: Zita Szupera Date: Tue, 24 Oct 2023 10:02:38 +0200 Subject: [PATCH 2/3] call types code snippets --- .../docs/api/call_types/geofencing.mdx | 32 ++++++++ .../docs/api/call_types/manage-types.mdx | 77 +++++++++++++++++++ .../docs/api/call_types/permissions.mdx | 25 +++++- .../docs/api/call_types/settings.mdx | 63 ++++++++++++++- 4 files changed, 195 insertions(+), 2 deletions(-) create mode 100644 docusaurus/video/docusaurus/docs/api/call_types/manage-types.mdx diff --git a/docusaurus/video/docusaurus/docs/api/call_types/geofencing.mdx b/docusaurus/video/docusaurus/docs/api/call_types/geofencing.mdx index 54baa5ba..60137d47 100644 --- a/docusaurus/video/docusaurus/docs/api/call_types/geofencing.mdx +++ b/docusaurus/video/docusaurus/docs/api/call_types/geofencing.mdx @@ -4,3 +4,35 @@ sidebar_position: 3 slug: /call_types/geofencing title: Geofencing --- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + + + + +```js +client.video.createCallType({ + name: '', + settings: { + geofencing: { + names: ['european_union'], + }, + }, +}); + +//override settings on call level +call.create({ + data: { + created_by_id: 'john', + settings_override: { + geofencing: { + names: ['european_union'], + }, + }, + }, +}); +``` + + + \ No newline at end of file diff --git a/docusaurus/video/docusaurus/docs/api/call_types/manage-types.mdx b/docusaurus/video/docusaurus/docs/api/call_types/manage-types.mdx new file mode 100644 index 00000000..01d3bad3 --- /dev/null +++ b/docusaurus/video/docusaurus/docs/api/call_types/manage-types.mdx @@ -0,0 +1,77 @@ +--- +id: manage_types +sidebar_position: 2 +slug: /call_types/manage +title: Manage Types +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +## Read call types + + + + +```js +client.video.listCallTypes(); + +//or +client.getCallType({name: 'livestream'}); +``` + + + + +## Create call type + + + + +```js +client.video.createCallType({ + name: 'allhands', + settings: { + audio: { mic_default_on: true, default_device: 'speaker' }, + }, + grants: { + admin: [ + VideoOwnCapability.SEND_AUDIO, + VideoOwnCapability.SEND_VIDEO, + VideoOwnCapability.MUTE_USERS, + ], + user: [VideoOwnCapability.SEND_AUDIO, VideoOwnCapability.SEND_VIDEO], + }, +}); +``` + + + + +## Update call type + + + + +```js +client.video.updateCallType('allhands', { + settings: { + audio: { mic_default_on: false, default_device: 'earpiece' }, + }, +}); +``` + + + + +## Delete call type + + + + +```js +client.video.deleteCallType({name: 'allhands'}); +``` + + + \ No newline at end of file diff --git a/docusaurus/video/docusaurus/docs/api/call_types/permissions.mdx b/docusaurus/video/docusaurus/docs/api/call_types/permissions.mdx index 27cb3f06..4bc83f67 100644 --- a/docusaurus/video/docusaurus/docs/api/call_types/permissions.mdx +++ b/docusaurus/video/docusaurus/docs/api/call_types/permissions.mdx @@ -1,6 +1,29 @@ --- id: call_types_permissions -sidebar_position: 2 +sidebar_position: 3 slug: /call_types/permissions title: Permissions --- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + + + + +```js +client.video.createCallType({ + name: '', + grants: { + admin: [ + VideoOwnCapability.SEND_AUDIO, + VideoOwnCapability.SEND_VIDEO, + VideoOwnCapability.MUTE_USERS, + ], + user: [VideoOwnCapability.SEND_AUDIO, VideoOwnCapability.SEND_VIDEO], + }, +}); +``` + + + \ No newline at end of file diff --git a/docusaurus/video/docusaurus/docs/api/call_types/settings.mdx b/docusaurus/video/docusaurus/docs/api/call_types/settings.mdx index e00dca33..28b976e3 100644 --- a/docusaurus/video/docusaurus/docs/api/call_types/settings.mdx +++ b/docusaurus/video/docusaurus/docs/api/call_types/settings.mdx @@ -1,6 +1,67 @@ --- id: call_types_settings -sidebar_position: 4 +sidebar_position: 5 slug: /call_types/settings title: Settings --- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +## Settings + + + + +```js +client.video.createCallType({ + name: '', + settings: { + screensharing: { + access_request_enabled: false, + enabled: true, + }, + }, +}); + +// override settings on call level +call.create({ + data: { + created_by_id: 'john', + settings_override: { + screensharing: { + enabled: false, + }, + }, + }, +}); +``` + + + + +## Notification settings + + + + +```js +client.video.createCallType({ + name: '', + notification_settings: { + enabled: true, + call_notification: { + apns: { + title: '{{ user.display_name }} invites you to a call', + }, + enabled: true, + }, + session_started: { + enabled: false, + }, + }, +}); +``` + + + \ No newline at end of file From fdadaa04ad91ccce13584e204407f9b3be053f38 Mon Sep 17 00:00:00 2001 From: Zita Szupera Date: Tue, 24 Oct 2023 10:08:14 +0200 Subject: [PATCH 3/3] update remaining code snippets --- .../docs/api/recording/recording_calls.mdx | 15 ++++++--------- .../docusaurus/docs/api/streaming/backstage.mdx | 6 +++--- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/docusaurus/video/docusaurus/docs/api/recording/recording_calls.mdx b/docusaurus/video/docusaurus/docs/api/recording/recording_calls.mdx index ba0b718c..378f7050 100644 --- a/docusaurus/video/docusaurus/docs/api/recording/recording_calls.mdx +++ b/docusaurus/video/docusaurus/docs/api/recording/recording_calls.mdx @@ -18,16 +18,16 @@ import TabItem from '@theme/TabItem'; call.update({ settings_override: { recording: { - mode: RecordSettingsRequestModeEnum.DISABLED, + mode: VideoRecordSettingsRequestModeEnum.DISABLED, }, }, }); // Disable on call type level -client.updateCallType('', { +client.video.updateCallType('', { settings: { recording: { - mode: RecordSettingsModeEnum.DISABLED, + mode: VideoRecordSettingsModeEnum.DISABLED, }, }, }); @@ -36,7 +36,7 @@ client.updateCallType('', { call.update({ settings_override: { recording: { - mode: RecordSettingsRequestModeEnum.AVAILABLE, + mode: VideoRecordSettingsRequestModeEnum.AVAILABLE, }, }, }); @@ -46,7 +46,7 @@ call.update({ settings_override: { recording: { audio_only: false, - quality: RecordSettingsRequestQualityEnum._1080P, + quality: VideoRecordSettingsRequestQualityEnum._1080P, }, }, }); @@ -201,10 +201,7 @@ curl -X POST "https://video.stream-io-api.com/video/call/default/${CALL_ID}/star ```js -call.queryRecordings(); - -// optionally query recordings for a specific session -call.queryRecordings(''); +call.listRecordings(); ``` diff --git a/docusaurus/video/docusaurus/docs/api/streaming/backstage.mdx b/docusaurus/video/docusaurus/docs/api/streaming/backstage.mdx index 25d092df..67fe5124 100644 --- a/docusaurus/video/docusaurus/docs/api/streaming/backstage.mdx +++ b/docusaurus/video/docusaurus/docs/api/streaming/backstage.mdx @@ -26,7 +26,7 @@ call.update({ }); // or call type level -client.updateCallType('', { +client.video.updateCallType('', { settings: { backstage: { enabled: true, @@ -44,9 +44,9 @@ client.updateCallType('', { ```js -client.updateCallType('', { +client.video.updateCallType('', { grants: { - host: [OwnCapability.JOIN_BACKSTAGE], + host: [VideoOwnCapability.JOIN_BACKSTAGE], }, }); ```