Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions getstream/chat/rest_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -963,7 +963,7 @@ def send_reaction(

def delete_reaction(
self, id: str, type: str, user_id: Optional[str] = None
) -> StreamResponse[ReactionRemovalResponse]:
) -> StreamResponse[DeleteReactionResponse]:
query_params = build_query_param(user_id=user_id)
path_params = {
"id": id,
Expand All @@ -972,7 +972,7 @@ def delete_reaction(

return self.delete(
"/api/v2/chat/messages/{id}/reaction/{type}",
ReactionRemovalResponse,
DeleteReactionResponse,
query_params=query_params,
path_params=path_params,
)
Expand Down Expand Up @@ -1418,6 +1418,15 @@ def query_poll_votes(
json=json,
)

def update_push_notification_preferences(
self, preferences: List[PushPreferenceInput]
) -> StreamResponse[UpsertPushPreferencesResponse]:
json = build_body_dict(preferences=preferences)

return self.post(
"/api/v2/chat/push_preferences", UpsertPushPreferencesResponse, json=json
)

def query_banned_users(
self, payload: Optional[QueryBannedUsersPayload] = None
) -> StreamResponse[QueryBannedUsersResponse]:
Expand Down
53 changes: 39 additions & 14 deletions getstream/common/rest_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,44 +116,69 @@ def update_app(

return self.patch("/api/v2/app", Response, json=json)

def list_block_lists(self) -> StreamResponse[ListBlockListResponse]:
return self.get("/api/v2/blocklists", ListBlockListResponse)
def list_block_lists(
self, team: Optional[str] = None
) -> StreamResponse[ListBlockListResponse]:
query_params = build_query_param(team=team)

return self.get(
"/api/v2/blocklists", ListBlockListResponse, query_params=query_params
)

def create_block_list(
self, name: str, words: List[str], type: Optional[str] = None
) -> StreamResponse[Response]:
json = build_body_dict(name=name, words=words, type=type)
self,
name: str,
words: List[str],
team: Optional[str] = None,
type: Optional[str] = None,
) -> StreamResponse[CreateBlockListResponse]:
json = build_body_dict(name=name, words=words, team=team, type=type)

return self.post("/api/v2/blocklists", Response, json=json)
return self.post("/api/v2/blocklists", CreateBlockListResponse, json=json)

def delete_block_list(self, name: str) -> StreamResponse[Response]:
def delete_block_list(
self, name: str, team: Optional[str] = None
) -> StreamResponse[Response]:
query_params = build_query_param(team=team)
path_params = {
"name": name,
}

return self.delete(
"/api/v2/blocklists/{name}", Response, path_params=path_params
"/api/v2/blocklists/{name}",
Response,
query_params=query_params,
path_params=path_params,
)

def get_block_list(self, name: str) -> StreamResponse[GetBlockListResponse]:
def get_block_list(
self, name: str, team: Optional[str] = None
) -> StreamResponse[GetBlockListResponse]:
query_params = build_query_param(team=team)
path_params = {
"name": name,
}

return self.get(
"/api/v2/blocklists/{name}", GetBlockListResponse, path_params=path_params
"/api/v2/blocklists/{name}",
GetBlockListResponse,
query_params=query_params,
path_params=path_params,
)

def update_block_list(
self, name: str, words: Optional[List[str]] = None
) -> StreamResponse[Response]:
self, name: str, team: Optional[str] = None, words: Optional[List[str]] = None
) -> StreamResponse[UpdateBlockListResponse]:
path_params = {
"name": name,
}
json = build_body_dict(words=words)
json = build_body_dict(team=team, words=words)

return self.put(
"/api/v2/blocklists/{name}", Response, path_params=path_params, json=json
"/api/v2/blocklists/{name}",
UpdateBlockListResponse,
path_params=path_params,
json=json,
)

def check_push(
Expand Down
Loading
Loading