Skip to content

Commit

Permalink
Update upsert user API for Python
Browse files Browse the repository at this point in the history
  • Loading branch information
szuperaz committed Apr 26, 2024
1 parent c9db2ce commit 94dbb30
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 20 deletions.
4 changes: 1 addition & 3 deletions docusaurus/video/docusaurus/docs/api/_common_/rtmp.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ resp = call.get()
# user ID of an existing user
user_id = 'jane'
client.upsert_users(
users={
user_id: {'id': user_id}
}
UserRequest(id=user_id)
)

# the token will be valid for 1 hour
Expand Down
17 changes: 5 additions & 12 deletions docusaurus/video/docusaurus/docs/api/basics/authentication.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,9 @@ await client.upsertUsers({
<TabItem value="py" label="Python">

```py
users = {}
user = UserRequest(
id='user_id', role="user", custom={"color": "red"}, name="This is a test user",image= "link/to/profile/image",
client.upsert_users(UserRequest(
id='user_id', role="user", custom={"color": "red"}, name="This is a test user",image= "link/to/profile/image",)
)
users[user.id] = user
client.upsert_users(users=users)
```

</TabItem>
Expand Down Expand Up @@ -95,25 +92,21 @@ client.updateUsersPartial({
<TabItem value="py" label="Python">

```py
users = {}
user = UserRequest(
client.upsert_users(UserRequest(
id= 'userid',
role= 'user',
custom= {
"color": 'red',
},
name= 'This is a test user',
image= 'link/to/profile/image',
)

users[user.id] = user
client.upsert_users(users=users)
))

# or
client.update_users_partial(
users= [
{
id: user.id,
id: 'userid',
set: {
color: 'blue',
},
Expand Down
7 changes: 2 additions & 5 deletions docusaurus/video/docusaurus/docs/api/basics/get_started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,9 @@ client.createToken(userId, exp);
<TabItem value="py" label="Python">

```py
users = {}
user = UserRequest(
id="john", role="user", custom={"color": "red"}, name="John",image= "link/to/profile/image",
client.upsert_users(UserRequest(
id="john", role="user", custom={"color": "red"}, name="John",image= "link/to/profile/image",)
)
users[user.id] = user
client.upsert_users(users=users)

# the token will be valid for 1 hour
exp = int(time.time()) + 60 * 60
Expand Down

0 comments on commit 94dbb30

Please sign in to comment.