Skip to content

Commit

Permalink
Merge pull request #26 from GetStream/upsert_users
Browse files Browse the repository at this point in the history
Nicer upsert method and tests for teams
  • Loading branch information
tbarbugli authored Apr 26, 2024
2 parents f3714d0 + 064c317 commit 76fb113
Show file tree
Hide file tree
Showing 9 changed files with 207 additions and 210 deletions.
1 change: 1 addition & 0 deletions .github/workflows/initiate_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ jobs:
run: |
gh pr create \
-t "Release ${{ github.event.inputs.version }}" \
-l "ignore-for-release" \
-b "# :rocket: ${{ github.event.inputs.version }}
Make sure to use squash & merge when merging!
Once this is merged, another job will kick off automatically and publish the package."
22 changes: 6 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,24 +32,14 @@ client = Stream(api_key="your_api_key", api_secret="your_api_secret")
from getstream.models import UserRequest

# sync two users using the update_users method, both users will get insert or updated
client.update_users(users={
"tommaso-id": UserRequest(
id="tommaso-id",
name="tommaso",
role="admin",
custom={
"country": "NL"
}
client.upsert_users(
UserRequest(
id="tommaso-id", name="tommaso", role="admin", custom={"country": "NL"}
),
"thierry-id": UserRequest(
id="thierry-id",
name="thierry",
role="admin",
custom={
"country": "US"
}
UserRequest(
id="thierry-id", name="thierry", role="admin", custom={"country": "US"}
),
})
)

# Create a JWT token for the user to connect client-side (e.g. browser/mobile app)
token = client.create_token("tommaso-id")
Expand Down
31 changes: 31 additions & 0 deletions getstream/chat/rest_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -923,6 +923,37 @@ def get_reactions(
path_params=path_params,
)

def query_reactions(
self,
id: str,
limit: Optional[int] = None,
next: Optional[str] = None,
prev: Optional[str] = None,
user_id: Optional[str] = None,
sort: Optional[List[Optional[SortParam]]] = None,
filter: Optional[Dict[str, object]] = None,
user: Optional[UserRequest] = None,
) -> StreamResponse[QueryReactionsResponse]:
path_params = {
"id": id,
}
json = build_body_dict(
limit=limit,
next=next,
prev=prev,
user_id=user_id,
sort=sort,
filter=filter,
user=user,
)

return self.post(
"/api/v2/chat/messages/{id}/reactions",
QueryReactionsResponse,
path_params=path_params,
json=json,
)

def translate_message(
self, id: str, language: str
) -> StreamResponse[MessageResponse]:
Expand Down
Loading

0 comments on commit 76fb113

Please sign in to comment.