Skip to content

Commit

Permalink
share data between get stared and calls page
Browse files Browse the repository at this point in the history
  • Loading branch information
szuperaz committed Nov 7, 2023
1 parent c3f9e05 commit 15ec0a4
Show file tree
Hide file tree
Showing 5 changed files with 219 additions and 381 deletions.
81 changes: 81 additions & 0 deletions docusaurus/video/docusaurus/docs/api/_common_/create-call.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

You can create a call by providing the call type and an ID:

- The [call type](/api/call_types/builtin) controls which features are enabled and sets up permissions. Call type settings and permissions can be set from API, or using the [Stream Dashboard](https://dashboard.getstream.io/).
- Calls IDs can be reused, which means they can be joined multiple times, so it's possible to set up recurring calls.

You can optionally restrict call access by providing a list of existing users.

It's also possible to store any custom data with the call object.

<Tabs groupId="examples">
<TabItem value="js" label="JavaScript">

```js
const callType = 'default';
const callId = 'my-first-call';
const call = client.video.call(callType, callId);

call.create({ data: { created_by_id: 'john' } });

// optionally provide additional data
call.create({
data: {
created_by_id: 'john',
// Call members need to be existing users
members: [{ user_id: 'john', role: 'admin' }, { user_id: 'jack' }],
custom: {
color: 'blue',
},
},
});
```

</TabItem>
<TabItem value="py" label="Python">

```py
from getstream.models.call_request import CallRequest

call = client.video.call("default", "id")
response = call.create(
data=CallRequest(
created_by_id="sacha",
),
)

//optionally provide additional data
response = call.create(
data=CallRequest(
created_by_id="sacha",
// Call members need to be existing users
members=[
MemberRequest(user_id: "john", role: "admin"),
MemberRequest(user_id: "jack"),
],
custom={"color": "blue"},
),
)
```

</TabItem>

<TabItem value="curl" label="cURL">

```bash
curl -X POST "https://video.stream-io-api.com/video/call/default/${CALL_ID}?api_key=${API_KEY}" \
-H "Content-Type: application/json" \
-H "Authorization: ${JWT_TOKEN}" \
-d '{
"data": {
"created_by_id": "[email protected]",
"settings_override": { "audio": { "access_request_enabled": false } }
},
"members": [ { "role": "speaker", "user_id": "[email protected]" } ]
}'
```

</TabItem>
</Tabs>
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

You can restrict call access by defining a list of members who are allowed to join the call. Call members need to be existing users. Every call member has a call-level role, [you can configure roles](/api/call_types/permissions/) on the call type.

Call members can receive [push notifications](/api/call_types/settings/#push-notifications-settings).

<Tabs groupId="examples">
<TabItem value="js" label="JavaScript">

```js
// Call members need to be existing users
call.updateCallMembers({
// You can add new members
// You can also update the role of existing members
update_members: [{ user_id: 'sara' }, { user_id: 'emily', role: 'admin' }],
});
```

</TabItem>
<TabItem value="py" label="Python">

```py
call.update_members(update_members=[
MemberRequest(user_id: "sara"),
MemberRequest(user_id: "emily", role: "admin")])
```

</TabItem>
<TabItem value="curl" label="cURL">

```bash
curl -X PUT "https://video.stream-io-api.com/video/call/default/${CALL_ID}/members?api_key=${API_KEY}" \
-H "Content-Type: application/json" \
-H "Authorization: ${JWT_TOKEN}" \
-d '{
"update_members": [
{ "user_id": "sara" },
{ "user_id": "emily", "role": "admin" }
]
}'
```

</TabItem>
</Tabs>

You can also remove call members:

<Tabs groupId="examples">
<TabItem value="js" label="JavaScript">

```js
call.updateCallMembers({
remove_members: ['sara'],
});
```

</TabItem>
<TabItem value="py" label="Python">

```py
call.update_members(
remove_members=[
MemberRequest(user_id: 'jack', role: 'admin')
]
)
```

</TabItem>
</Tabs>
55 changes: 55 additions & 0 deletions docusaurus/video/docusaurus/docs/api/_common_/update-call.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

Default call settings are inherited from the [call type](/api/call_types/settings/). These settings can be overridden if necessary.

<Tabs groupId="examples">
<TabItem value="js" label="JavaScript">

```js
call.update({
settings_override: {
audio: { mic_default_on: true, default_device: 'speaker' },
},
});

// or to update custom data
call.update({ custom: { color: 'red' } });
```

</TabItem>
<TabItem value="py" label="Python">

```py
call.update(
settings_override=CallSettingsRequest(
audio=AudioSettingsRequest(
mic_default_on=True,
default_device="speaker",
),
)
)

// or to update custom data
call.update(custom: { 'color': 'red' });
```

</TabItem>
<TabItem value="curl" label="cURL">

```bash
curl -X PUT "https://video.stream-io-api.com/video/call/default/${CALL_ID}?api_key=${API_KEY}" \
-H "Content-Type: application/json" \
-H "Authorization: ${JWT_TOKEN}" \
-d '{
"settings_override": {
"audio": {
"mic_default_on": true
}
}
}'

```

</TabItem>
</Tabs>
Loading

0 comments on commit 15ec0a4

Please sign in to comment.