Skip to content

Commit

Permalink
Merge branch 'main' into call-tokens-docs
Browse files Browse the repository at this point in the history
  • Loading branch information
sachaarbonel authored May 16, 2024
2 parents b93bc1b + 0feb77e commit e3e55d5
Show file tree
Hide file tree
Showing 24 changed files with 560 additions and 248 deletions.
26 changes: 15 additions & 11 deletions docusaurus/video/docusaurus/docs/api/_common_/CallEventModels.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,23 @@ const CallEventModels = () => {
<React.Fragment>
<table>
<thead>
<th>Name</th>
<th>Description</th>
</thead>
{events.map((event) => (
<tr>
<td>
<a href={'#' + event.key}>
<code>{event.type}</code>
</a>
</td>
<td>{event.description}</td>
<th>Name</th>
<th>Description</th>
</tr>
))}
</thead>
<tbody>
{events.map((event) => (
<tr key={event.type}>
<td>
<a href={'#' + event.key}>
<code>{event.type}</code>
</a>
</td>
<td>{event.description}</td>
</tr>
))}
</tbody>
</table>
<OpenApiModels
modelFilter={filter}
Expand Down
41 changes: 28 additions & 13 deletions docusaurus/video/docusaurus/docs/api/_common_/OpenApiModels.jsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import React from 'react';
import { parseModel } from './open-api-model-parser';

const OpenApiModels = ({ modelName, modelFilter, recursive = true, apiJson }) => {

const models = React.useMemo(() => {
if (!modelName && !modelFilter) {
return [];
}
return parseModel({modelName, modelFilter, recursive, apiJson});
}, [modelName, modelFilter]);

const OpenApiModels = ({
modelName,
modelFilter,
recursive = true,
apiJson,
}) => {
const models = parseModel({ modelName, modelFilter, recursive, apiJson });
return (
<div>
{models.map((model) => (
Expand All @@ -25,17 +23,34 @@ const OpenApiModels = ({ modelName, modelFilter, recursive = true, apiJson }) =>
</tr>
</thead>
<tbody>
{model.properties.map(p => {
{model.properties.map((p) => {
return (
<tr key={model.name + p.name}>
<td data-testid={model.name + '-' + p.name + '-name'}>
<code>{p.name}</code>
</td>
<td data-testid={model.name + '-' + p.name + '-type'}>
{p.type.definitionLink ? <a data-testid={model.name + '-' + p.name + '-typelink'} href={p.type.definitionLink}><code>{p.type.formattedName}</code></a> : <code>{p.type.formattedName}</code>}
{p.type.definitionLink ? (
<a
data-testid={model.name + '-' + p.name + '-typelink'}
href={p.type.definitionLink}
>
<code>{p.type.formattedName}</code>
</a>
) : (
<code>{p.type.formattedName}</code>
)}
</td>
<td
data-testid={model.name + '-' + p.name + '-description'}
>
{p.description || '-'}
</td>
<td
data-testid={model.name + '-' + p.name + '-constraints'}
>
{p.constraints.join(', ') || '-'}
</td>
<td data-testid={model.name + '-' + p.name + '-description'}>{p.description || '-'}</td>
<td data-testid={model.name + '-' + p.name + '-constraints'}>{p.constraints.join(', ') || '-'}</td>
</tr>
);
})}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Call types provide sensible default settings for different use-cases. We provide the following types out of the box:

- **Default** (`default`) for 1:1 or group calls that use both video and audio
- **Livestreaming** (`livestream`) to build ultra low latency livestreaming for your app on our global edge network. Broadcast from your phone or RTMP and scale to millions of participants.
- **Audio room** (`audio_room`) to build audio experiences for your app. You can build basic calling or feature rich experience like Twitter spaces. Audio quality, reliability and scalability is far ahead of competing solutions.

Each of our [SDKs have tutorials specific for each call type](https://getstream.io/video/sdk/). If you want to know the default settings for each of the call types check out the [Built-in call types page](/api/call_types/builtin).

It's possible to tweak the built-in call types or create new ones.
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

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

```js
client.deactivateUser({
user_id: '<id>',
});

//reactivate
client.reactivateUsers({
user_ids: ['<id>'],
});

// deactivativating users in bulk can take some time
const deactivateResponse = client.deactivateUsers({
user_ids: ['<id1>', '<id2>'...],
});

// you need to poll this endpoint
const taskResponse = await client.getTaskStatus({id: deactivateResponse.task_id})

console.log(taskResponse.status === 'completed');
```

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

```py
# deactivate one user
client.deactivate_user(user_id=alice.id)

# reactivates the user
client.reactivate_user(user_id=alice.id)

# deactivates users in bulk, this is an async operation
response = client.deactivate_users(user_ids=[alice.id, bob.id])
task_id = response.data.task_id

# get information about the task
task_status = client.get_task(task_id)

# just an example, in reality it can take a few seconds for a task to be processed
if task_status.data.status == "completed":
print(task_status.data.result)
```

</TabItem>

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

```bash
# Deactivate users
curl -X POST https://video.stream-io-api.com/api/v2/users/deactivate?api_key=${API_KEY} \
-H "Authorization: ${TOKEN}" \
-H "stream-auth-type: jwt" \
-H "Content-Type: application/json" \
-d '{
"user_ids": ["sara"]
}'

# Reactivate users
curl -X POST https://video.stream-io-api.com/api/v2/users/deactivate?api_key=${API_KEY} \
-H "Authorization: ${TOKEN}" \
-H "stream-auth-type: jwt" \
-H "Content-Type: application/json" \
-d '{
"user_ids": ["sara"]
}'

# Reactivate users in bulk can take some time, you can poll task status using the task id from the response
# When finished, task status will be completed
curl -X GET https://video.stream-io-api.com/api/v2/tasks/${TASK_ID}?api_key=${API_KEY} \
-H "Authorization: ${TOKEN}" \
-H "stream-auth-type: jwt"
```

</TabItem>
</Tabs>
39 changes: 3 additions & 36 deletions docusaurus/video/docusaurus/docs/api/basics/authentication.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ title: Users & Tokens

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import DeactivateReactivate from '../_common_/deactivate-reactivate.mdx';

## Creating users

Expand Down Expand Up @@ -227,15 +228,6 @@ Delete has the following opitions:
<TabItem value="js" label="JavaScript">

```js
client.deactivateUser({
user_id: '<id>',
});

//reactivate
client.reactivateUsers({
user_ids: ['<id>'],
});

client.deleteUsers({ user_ids: ['<id>'] });

//restore
Expand All @@ -247,15 +239,6 @@ client.restoreUsers({ user_ids: ['<id>'] });
<TabItem value="py" label="Python">

```py
client.deactivate_user(
user_id="<id>",
)

# reactivate
client.reactivate_users(
user_ids=["<id>"],
)

client.delete_users(user_ids=["<id>"])

# restore
Expand All @@ -266,24 +249,6 @@ client.restore_users(user_ids=["<id>"])
<TabItem value="curl" label="cURL">

```bash
# Deactivate users
curl -X POST https://video.stream-io-api.com/api/v2/users/deactivate?api_key=${API_KEY} \
-H "Authorization: ${TOKEN}" \
-H "stream-auth-type: jwt" \
-H "Content-Type: application/json" \
-d '{
"user_ids": ["sara"]
}'

# Reactivate users
curl -X POST https://video.stream-io-api.com/api/v2/users/deactivate?api_key=${API_KEY} \
-H "Authorization: ${TOKEN}" \
-H "stream-auth-type: jwt" \
-H "Content-Type: application/json" \
-d '{
"user_ids": ["sara"]
}'

# Delete users
curl -X POST https://video.stream-io-api.com/api/v2/users/delete?api_key=${API_KEY} \
-H "Authorization: ${TOKEN}" \
Expand All @@ -306,6 +271,8 @@ curl -X POST https://video.stream-io-api.com/api/v2/users/restore?api_key=${API_
</TabItem>
</Tabs>

<DeactivateReactivate/>

## User tokens

Stream uses JWT (JSON Web Tokens) to authenticate chat users, enabling them to log in. Knowing whether a user is authorized to perform certain actions is managed separately via a role-based permissions system. Tokens need to be generated server-side.
Expand Down
5 changes: 5 additions & 0 deletions docusaurus/video/docusaurus/docs/api/basics/calls.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import CallMemberFilters from '../../../shared/video/_call-member-filters.mdx';
import CallSort from '../../../shared/video/_call-sort-fields.mdx';
import CallMemberSort from '../../../shared/video/_call-member-sort-fields.mdx';
import OpenApiModels from '../_common_/OpenApiModels';
import CallTypesSum from '../_common_/call-types-overview.mdx';

## Creating calls

Expand Down Expand Up @@ -108,6 +109,10 @@ curl -X POST "https://video.stream-io-api.com/api/v2/video/call/${CALL_TYPE}/${C

<OpenApiModels modelName={'GetOrCreateCallRequest'}></OpenApiModels>

## Call types

<CallTypesSum />

## Updating calls

<UpdateCall />
Expand Down
5 changes: 5 additions & 0 deletions docusaurus/video/docusaurus/docs/api/basics/get_started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import TabItem from '@theme/TabItem';
import CreateCall from '../_common_/create-call.mdx';
import CallMembers from '../_common_/manage-call-members.mdx';
import UpdateCall from '../_common_/update-call.mdx';
import CallTypesSum from '../_common_/call-types-overview.mdx';

Stream powers [Chat Messaging](https://getstream.io/chat/), [Video & Audio](https://getstream.io/video/), and [Activity Feeds](https://getstream.io/activity-feeds/) for billions of global end-users across thousands of different apps.

Expand Down Expand Up @@ -184,6 +185,10 @@ curl -X POST https://video.stream-io-api.com/api/v2/users?api_key=${API_KEY} \

<CreateCall />

## Call types

<CallTypesSum />

## Call members

<CallMembers />
Expand Down
Loading

0 comments on commit e3e55d5

Please sign in to comment.