-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
113 additions
and
92 deletions.
There are no files selected for viewing
81 changes: 81 additions & 0 deletions
81
docusaurus/video/docusaurus/docs/api/_common_/deactivate-reactivate.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters