Skip to content

Commit

Permalink
improve go docs
Browse files Browse the repository at this point in the history
  • Loading branch information
tbarbugli committed Oct 7, 2024
1 parent 77c5f5c commit 57563dd
Show file tree
Hide file tree
Showing 8 changed files with 203 additions and 268 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Call types provide sensible default settings for different use-cases. We provide
- **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.
- **Development** (`development`) This call type comes with almost all permission settings disabled so that it is simpler to get your initial implementation up and running. You should only use this call type early-on during development.

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).

Expand Down
40 changes: 25 additions & 15 deletions docusaurus/video/docusaurus/docs/api/_common_/create-call.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ 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.
- Calls can be used once or multiple times depending on your app. Unless you want to re-use the same call multiple times, the recommended way to pick a call ID is to use a uuid v4 so that each call gets a unique random ID.

You can specify call members who can receive push notification about the call.

Expand Down Expand Up @@ -69,20 +69,30 @@ call.create(
<TabItem value="go" label="Golang">

```go
members := []MemberRequest{
{UserID: "john", Role: PtrTo("admin")},
{UserID: "jack"},
}
callRequest := GetOrCreateCallRequest{
Data: &CallRequest{
CreatedByID: PtrTo("sacha"),
Members: &members,
Custom: &map[string]any{
"color": "blue",
},
},
}
_, err := call.GetOrCreate(ctx, &callRequest)

import (
"github.com/GetStream/getstream-go"
"github.com/google/uuid"
)

call := client.Video().Call("default", uuid.NewString())

members := []getstream.MemberRequest{
{UserID: "john", Role: getstream.PtrTo("admin")},
{UserID: "jack"},
}

callRequest := getstream.GetOrCreateCallRequest{
Data: &getstream.CallRequest{
CreatedByID: getstream.PtrTo("sacha"),
Members: members,
Custom: map[string]any{
"color": "blue",
},
},
}

response, err := call.GetOrCreate(ctx, &callRequest)
```

</TabItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ client.deactivateUser({
user_id: '<id>',
});

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

// deactivativating users in bulk can take some time
// deactivating users in bulk is performed asynchronously
const deactivateResponse = client.deactivateUsers({
user_ids: ['<id1>', '<id2>'...],
});
Expand All @@ -31,7 +31,7 @@ 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
# deactivating users in bulk is performed asynchronously
response = client.deactivate_users(user_ids=[alice.id, bob.id])
```

Expand All @@ -41,13 +41,15 @@ response = client.deactivate_users(user_ids=[alice.id, bob.id])

```go
// deactivate one user
client.DeactivateUser(ctx, alice.ID, &DeactivateUserRequest{})
response, err := client.DeactivateUser(ctx, "alice", &getstream.DeactivateUserRequest{})

// reactivates the user
client.ReactivateUser(ctx, alice.ID, &ReactivateUserRequest{})
_, err = client.ReactivateUser(ctx, "alice", &getstream.ReactivateUserRequest{})

// deactivates users in bulk, this is an async operation
response = client.DeactivateUsers(ctx, &DeactivateUsersRequest{UserIDs: []string{alice.ID, bob.ID}})
_, err = client.DeactivateUsers(ctx, &getstream.DeactivateUsersRequest{
UserIds: []string{"alice", "bob"},
})
```

</TabItem>
Expand Down Expand Up @@ -81,4 +83,4 @@ Deactivating users in bulk can take some time, this is how you can check the pro

<AsyncTasks />

For more informiation, please refer to the [async operations guide](/api/misc/async)
For more information, please refer to the [async operations guide](/api/misc/async)
32 changes: 14 additions & 18 deletions docusaurus/video/docusaurus/docs/api/_common_/delete-users.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,6 @@ import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import AsyncTasks from '../_common_/async-tasks.mdx';

Deleting a user means:

- the user can't connect to Stream API
- their data won't appear in user queries

Delete has the following opitions:

| Name | Type | Description | Optional |
| ---------------------- | -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- |
| `user` | Enum (soft, pruning, hard) | - Soft: marks user as deleted and retains all user data. <br /> - Pruning: marks user as deleted and nullifies user information. <br /> - Hard: deletes user completely - this requires hard option for messages and conversation as well. | Yes |
| `conversations` | Enum (soft, hard) | - Soft: marks all conversation channels as deleted (same effect as Delete Channels with 'hard' option disabled). <br /> - Hard: deletes channel and all its data completely including messages (same effect as Delete Channels with 'hard' option enabled). | Yes |
| `messages` | Enum (soft, pruning, hard) | - Soft: marks all user messages as deleted without removing any related message data. <br /> - Pruning: marks all user messages as deleted, nullifies message information and removes some message data such as reactions and flags. <br /> - Hard: deletes messages completely with all related information. | Yes |
| `new_channel_owner_id` | string | Channels owned by hard-deleted users will be transferred to this userID. If you doesn't provide a value, the channel owner will have a system generated ID like `delete-user-8219f6578a7395g` | Yes |
| `calls` | Enum (soft, hard) | - Soft: marks calls and related data as deleted. <br /> - Hard: deletes calls and related data completely <br /> Note that this applies only to 1:1 calls, not group calls | Yes |

<Tabs groupId="examples">
<TabItem value="js" label="JavaScript">
Expand Down Expand Up @@ -43,10 +29,10 @@ client.restore_users(user_ids=["<id>"])
<TabItem value="go" label="Golang">

```go
client.DeleteUsers(ctx, &DeleteUsersRequest{UserIDs: []string{"<id>"}})
response, err := client.DeleteUsers(ctx, &getstream.DeleteUsersRequest{UserIds: []string{"<id>"}})

# restore
client.RestoreUsers(ctx, &RestoreUsersRequest{UserIDs: []string{"<id>"}})
// restore a soft-deleted user
_, err = client.RestoreUsers(ctx, &getstream.RestoreUsersRequest{UserIds: []string{"<id>"}})
```

</TabItem>
Expand Down Expand Up @@ -75,8 +61,18 @@ curl -X POST https://video.stream-io-api.com/api/v2/users/restore?api_key=${API_
</TabItem>
</Tabs>

The delete users endpoints supports the following parameters to control which data needs to be deleted and how. By default users and their data are soft-deleted.

| Name | Type | Description | Optional |
| ---------------------- | -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- |
| `user` | Enum (soft, pruning, hard) | - Soft: marks user as deleted and retains all user data. <br /> - Pruning: marks user as deleted and nullifies user information. <br /> - Hard: deletes user completely - this requires hard option for messages and conversation as well. | Yes |
| `conversations` | Enum (soft, hard) | - Soft: marks all conversation channels as deleted (same effect as Delete Channels with 'hard' option disabled). <br /> - Hard: deletes channel and all its data completely including messages (same effect as Delete Channels with 'hard' option enabled). | Yes |
| `messages` | Enum (soft, pruning, hard) | - Soft: marks all user messages as deleted without removing any related message data. <br /> - Pruning: marks all user messages as deleted, nullifies message information and removes some message data such as reactions and flags. <br /> - Hard: deletes messages completely with all related information. | Yes |
| `new_channel_owner_id` | string | Channels owned by hard-deleted users will be transferred to this userID. If you doesn't provide a value, the channel owner will have a system generated ID like `delete-user-8219f6578a7395g` | Yes |
| `calls` | Enum (soft, hard) | - Soft: marks calls and related data as deleted. <br /> - Hard: deletes calls and related data completely <br /> Note that this applies only to 1:1 calls, not group calls | Yes |

Deleting and restoring users in bulk can take some time, this is how you can check the progress:

<AsyncTasks />

For more informiation, please refer to the [async operations guide](/api/misc/async)
For more information, please refer to the [async operations guide](/api/misc/async)
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

You can provide a list of call members. 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.
You can provide a list of call members, this can be done when you create a call or later on when the call already exists. Please note that call members need to be existing users.

Call members can receive [push notifications](/api/call_types/settings/#push-notifications-settings).
There are two reasons to use call members:

- Call membership allows you to have more flexibility when it comes to permissions. The permission system allows you to grant different permissions to users and members, this way one user can be a member on one call or a member on another.
Membership also allows you to specify a role for user in a call. You can more information about the roles and permissions [here](/api/call_types/permissions/).
- Call members will receive [push notifications](/api/call_types/settings/#push-notifications-settings).

<Tabs groupId="examples">
<TabItem value="js" label="JavaScript">
Expand Down Expand Up @@ -35,13 +39,13 @@ call.update_call_members(
<TabItem value="go" label="Golang">

```go
// Call members need to be existing users
// Call members need to be existing users (use `client.UpdateUsers` for that)
// You can also update the role of existing members
call.UpdateCallMembers(ctx, &UpdateCallMembersRequest{
UpdateMembers: &[]MemberRequest{
{UserID: "sara"},
{UserID: "emily", Role: PtrTo("admin")},
},
response, err := call.UpdateCallMembers(ctx, &getstream.UpdateCallMembersRequest{
UpdateMembers: []getstream.MemberRequest{
{UserID: "sara"},
{UserID: "emily", Role: getstream.PtrTo("admin")},
},
})
```

Expand Down Expand Up @@ -80,7 +84,18 @@ call.updateCallMembers({
<TabItem value="py" label="Python">

```py
call.update_call_members(remove_members=["jack", "sara"])
call.update_call_members(remove_members=["sara"])
```

</TabItem>
<TabItem value="go" label="Golang">

```go
response, err := call.UpdateCallMembers(ctx, &getstream.UpdateCallMembersRequest{
RemoveMembers: []string{
"sara",
},
})
```

</TabItem>
Expand Down
16 changes: 8 additions & 8 deletions docusaurus/video/docusaurus/docs/api/_common_/update-call.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,18 @@ call.update(

```go
// update some custom data for this call
call.Update(ctx, &UpdateCallRequest{
Custom: &map[string]interface{}{"color": "red"},
response, err := call.Update(ctx, &getstream.UpdateCallRequest{
Custom: map[string]any{"color": "red"},
})

// update settings for this call
call.Update(ctx, &UpdateCallRequest{
SettingsOverride: &CallSettingsRequest{
Screensharing: &ScreensharingSettingsRequest{
Enabled: PtrTo(true),
AccessRequestEnabled: PtrTo(true),
response, err = call.Update(ctx, &getstream.UpdateCallRequest{
SettingsOverride: &getstream.CallSettingsRequest{
Screensharing: &getstream.ScreensharingSettingsRequest{
Enabled: getstream.PtrTo(true),
AccessRequestEnabled: getstream.PtrTo(true),
},
},
},
})
```

Expand Down
Loading

0 comments on commit 57563dd

Please sign in to comment.