Skip to content
Open
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
4 changes: 3 additions & 1 deletion getstream/chat/async_channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ async def update(
invites: Optional[List[ChannelMemberRequest]] = None,
remove_filter_tags: Optional[List[str]] = None,
remove_members: Optional[List[str]] = None,
data: Optional[ChannelInput] = None,
data: Optional[ChannelInputRequest] = None,
message: Optional[MessageRequest] = None,
user: Optional[UserRequest] = None,
) -> StreamResponse[UpdateChannelResponse]:
Expand Down Expand Up @@ -330,6 +330,7 @@ async def truncate(
async def mark_unread(
self,
message_id: Optional[str] = None,
message_timestamp: Optional[datetime] = None,
thread_id: Optional[str] = None,
user_id: Optional[str] = None,
user: Optional[UserRequest] = None,
Expand All @@ -338,6 +339,7 @@ async def mark_unread(
type=self.channel_type,
id=self.channel_id,
message_id=message_id,
message_timestamp=message_timestamp,
thread_id=thread_id,
user_id=user_id,
user=user,
Expand Down
36 changes: 28 additions & 8 deletions getstream/chat/async_rest_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,21 @@ async def delete_channels(
"/api/v2/chat/channels/delete", DeleteChannelsResponse, json=json
)

@telemetry.operation_name("getstream.api.chat.mark_delivered")
async def mark_delivered(
self,
user_id: Optional[str] = None,
latest_delivered_messages: Optional[List[DeliveredMessagePayload]] = None,
) -> StreamResponse[MarkDeliveredResponse]:
query_params = build_query_param(user_id=user_id)
json = build_body_dict(latest_delivered_messages=latest_delivered_messages)
return await self.post(
"/api/v2/chat/channels/delivered",
MarkDeliveredResponse,
query_params=query_params,
json=json,
)

@telemetry.operation_name("getstream.api.chat.mark_channels_read")
async def mark_channels_read(
self,
Expand Down Expand Up @@ -246,7 +261,7 @@ async def update_channel(
invites: Optional[List[ChannelMemberRequest]] = None,
remove_filter_tags: Optional[List[str]] = None,
remove_members: Optional[List[str]] = None,
data: Optional[ChannelInput] = None,
data: Optional[ChannelInputRequest] = None,
message: Optional[MessageRequest] = None,
user: Optional[UserRequest] = None,
) -> StreamResponse[UpdateChannelResponse]:
Expand Down Expand Up @@ -619,6 +634,7 @@ async def mark_unread(
type: str,
id: str,
message_id: Optional[str] = None,
message_timestamp: Optional[datetime] = None,
thread_id: Optional[str] = None,
user_id: Optional[str] = None,
user: Optional[UserRequest] = None,
Expand All @@ -628,7 +644,11 @@ async def mark_unread(
"id": id,
}
json = build_body_dict(
message_id=message_id, thread_id=thread_id, user_id=user_id, user=user
message_id=message_id,
message_timestamp=message_timestamp,
thread_id=thread_id,
user_id=user_id,
user=user,
)
return await self.post(
"/api/v2/chat/channels/{type}/{id}/unread",
Expand Down Expand Up @@ -1036,14 +1056,14 @@ async def run_message_action(
form_data: Dict[str, str],
user_id: Optional[str] = None,
user: Optional[UserRequest] = None,
) -> StreamResponse[MessageResponse]:
) -> StreamResponse[MessageActionResponse]:
path_params = {
"id": id,
}
json = build_body_dict(form_data=form_data, user_id=user_id, user=user)
return await self.post(
"/api/v2/chat/messages/{id}/action",
MessageResponse,
MessageActionResponse,
path_params=path_params,
json=json,
)
Expand All @@ -1052,14 +1072,14 @@ async def run_message_action(
async def commit_message(
self,
id: str,
) -> StreamResponse[MessageResponse]:
) -> StreamResponse[MessageActionResponse]:
path_params = {
"id": id,
}
json = build_body_dict()
return await self.post(
"/api/v2/chat/messages/{id}/commit",
MessageResponse,
MessageActionResponse,
path_params=path_params,
json=json,
)
Expand Down Expand Up @@ -1177,14 +1197,14 @@ async def query_reactions(
@telemetry.operation_name("getstream.api.chat.translate_message")
async def translate_message(
self, id: str, language: str
) -> StreamResponse[MessageResponse]:
) -> StreamResponse[MessageActionResponse]:
path_params = {
"id": id,
}
json = build_body_dict(language=language)
return await self.post(
"/api/v2/chat/messages/{id}/translate",
MessageResponse,
MessageActionResponse,
path_params=path_params,
json=json,
)
Expand Down
4 changes: 3 additions & 1 deletion getstream/chat/channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def update(
invites: Optional[List[ChannelMemberRequest]] = None,
remove_filter_tags: Optional[List[str]] = None,
remove_members: Optional[List[str]] = None,
data: Optional[ChannelInput] = None,
data: Optional[ChannelInputRequest] = None,
message: Optional[MessageRequest] = None,
user: Optional[UserRequest] = None,
) -> StreamResponse[UpdateChannelResponse]:
Expand Down Expand Up @@ -330,6 +330,7 @@ def truncate(
def mark_unread(
self,
message_id: Optional[str] = None,
message_timestamp: Optional[datetime] = None,
thread_id: Optional[str] = None,
user_id: Optional[str] = None,
user: Optional[UserRequest] = None,
Expand All @@ -338,6 +339,7 @@ def mark_unread(
type=self.channel_type,
id=self.channel_id,
message_id=message_id,
message_timestamp=message_timestamp,
thread_id=thread_id,
user_id=user_id,
user=user,
Expand Down
36 changes: 28 additions & 8 deletions getstream/chat/rest_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,21 @@ def delete_channels(
"/api/v2/chat/channels/delete", DeleteChannelsResponse, json=json
)

@telemetry.operation_name("getstream.api.chat.mark_delivered")
def mark_delivered(
self,
user_id: Optional[str] = None,
latest_delivered_messages: Optional[List[DeliveredMessagePayload]] = None,
) -> StreamResponse[MarkDeliveredResponse]:
query_params = build_query_param(user_id=user_id)
json = build_body_dict(latest_delivered_messages=latest_delivered_messages)
return self.post(
"/api/v2/chat/channels/delivered",
MarkDeliveredResponse,
query_params=query_params,
json=json,
)

@telemetry.operation_name("getstream.api.chat.mark_channels_read")
def mark_channels_read(
self,
Expand Down Expand Up @@ -242,7 +257,7 @@ def update_channel(
invites: Optional[List[ChannelMemberRequest]] = None,
remove_filter_tags: Optional[List[str]] = None,
remove_members: Optional[List[str]] = None,
data: Optional[ChannelInput] = None,
data: Optional[ChannelInputRequest] = None,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Search for all usages of ChannelInput and ChannelInputRequest in chat client files
echo "=== ChannelInput usages ==="
rg -n "ChannelInput[^R]" getstream/chat/rest_client.py getstream/chat/async_rest_client.py

echo ""
echo "=== ChannelInputRequest usages ==="
rg -n "ChannelInputRequest" getstream/chat/rest_client.py getstream/chat/async_rest_client.py

Repository: GetStream/stream-py

Length of output: 632


🏁 Script executed:

#!/bin/bash
# Get context around the lines where ChannelInput and ChannelInputRequest are used
echo "=== Context around line 178 (ChannelInput) ==="
sed -n '170,185p' getstream/chat/rest_client.py

echo ""
echo "=== Context around line 260 (ChannelInputRequest) ==="
sed -n '252,270p' getstream/chat/rest_client.py

echo ""
echo "=== Context around line 525 (ChannelInput) ==="
sed -n '517,535p' getstream/chat/rest_client.py

# Also check the imports and type definitions
echo ""
echo "=== Type definitions and imports ==="
rg -n "class ChannelInput|class ChannelInputRequest" getstream/

Repository: GetStream/stream-py

Length of output: 2575


🏁 Script executed:

#!/bin/bash
# Examine the type definitions to understand the difference
echo "=== ChannelInput definition ==="
sed -n '/^class ChannelInput/,/^class [A-Z]/p' getstream/models/__init__.py | head -50

echo ""
echo "=== ChannelInputRequest definition ==="
sed -n '/^class ChannelInputRequest/,/^class [A-Z]/p' getstream/models/__init__.py | head -50

# Identify method at line 260
echo ""
echo "=== Full method context at line 260 ==="
sed -n '240,280p' getstream/chat/rest_client.py | head -40

Repository: GetStream/stream-py

Length of output: 4897


Confirm type inconsistency across channel methods requires alignment.

The inconsistency is real: get_or_create_distinct_channel (line 178) and get_or_create_channel (line 525) use ChannelInput, while update_channel (line 260) uses ChannelInputRequest. The two types differ structurally—ChannelInput includes created_by_id, truncated_by_id, and filter_tags fields, while ChannelInputRequest uses ConfigOverridesRequest instead of ChannelConfig. Verify per the OpenAPI spec whether this distinction is intentional (e.g., create vs. update operations allow different fields) or if all three methods should use the same type.

message: Optional[MessageRequest] = None,
user: Optional[UserRequest] = None,
) -> StreamResponse[UpdateChannelResponse]:
Expand Down Expand Up @@ -615,6 +630,7 @@ def mark_unread(
type: str,
id: str,
message_id: Optional[str] = None,
message_timestamp: Optional[datetime] = None,
thread_id: Optional[str] = None,
user_id: Optional[str] = None,
user: Optional[UserRequest] = None,
Expand All @@ -624,7 +640,11 @@ def mark_unread(
"id": id,
}
json = build_body_dict(
message_id=message_id, thread_id=thread_id, user_id=user_id, user=user
message_id=message_id,
message_timestamp=message_timestamp,
thread_id=thread_id,
user_id=user_id,
user=user,
)
return self.post(
"/api/v2/chat/channels/{type}/{id}/unread",
Expand Down Expand Up @@ -1026,14 +1046,14 @@ def run_message_action(
form_data: Dict[str, str],
user_id: Optional[str] = None,
user: Optional[UserRequest] = None,
) -> StreamResponse[MessageResponse]:
) -> StreamResponse[MessageActionResponse]:
path_params = {
"id": id,
}
json = build_body_dict(form_data=form_data, user_id=user_id, user=user)
return self.post(
"/api/v2/chat/messages/{id}/action",
MessageResponse,
MessageActionResponse,
path_params=path_params,
json=json,
)
Expand All @@ -1042,14 +1062,14 @@ def run_message_action(
def commit_message(
self,
id: str,
) -> StreamResponse[MessageResponse]:
) -> StreamResponse[MessageActionResponse]:
path_params = {
"id": id,
}
json = build_body_dict()
return self.post(
"/api/v2/chat/messages/{id}/commit",
MessageResponse,
MessageActionResponse,
path_params=path_params,
json=json,
)
Expand Down Expand Up @@ -1167,14 +1187,14 @@ def query_reactions(
@telemetry.operation_name("getstream.api.chat.translate_message")
def translate_message(
self, id: str, language: str
) -> StreamResponse[MessageResponse]:
) -> StreamResponse[MessageActionResponse]:
path_params = {
"id": id,
}
json = build_body_dict(language=language)
return self.post(
"/api/v2/chat/messages/{id}/translate",
MessageResponse,
MessageActionResponse,
path_params=path_params,
json=json,
)
Expand Down
50 changes: 49 additions & 1 deletion getstream/common/async_rest_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,54 @@ async def create_import(
json = build_body_dict(mode=mode, path=path)
return await self.post("/api/v2/imports", CreateImportResponse, json=json)

@telemetry.operation_name("getstream.api.common.list_import_v2_tasks")
async def list_import_v2_tasks(
self, state: Optional[int] = None
) -> StreamResponse[ListImportV2TasksResponse]:
query_params = build_query_param(state=state)
return await self.get(
"/api/v2/imports/v2", ListImportV2TasksResponse, query_params=query_params
)

@telemetry.operation_name("getstream.api.common.create_import_v2_task")
async def create_import_v2_task(
self,
product: str,
settings: ImportV2TaskSettings,
user_id: Optional[str] = None,
user: Optional[UserRequest] = None,
) -> StreamResponse[CreateImportV2TaskResponse]:
json = build_body_dict(
product=product, settings=settings, user_id=user_id, user=user
)
return await self.post(
"/api/v2/imports/v2", CreateImportV2TaskResponse, json=json
)

@telemetry.operation_name("getstream.api.common.delete_import_v2_task")
async def delete_import_v2_task(
self, id: str
) -> StreamResponse[DeleteImportV2TaskResponse]:
path_params = {
"id": id,
}
return await self.delete(
"/api/v2/imports/v2/{id}",
DeleteImportV2TaskResponse,
path_params=path_params,
)

@telemetry.operation_name("getstream.api.common.get_import_v2_task")
async def get_import_v2_task(
self, id: str
) -> StreamResponse[GetImportV2TaskResponse]:
path_params = {
"id": id,
}
return await self.get(
"/api/v2/imports/v2/{id}", GetImportV2TaskResponse, path_params=path_params
)

@telemetry.operation_name("getstream.api.common.get_import")
async def get_import(self, id: str) -> StreamResponse[GetImportResponse]:
path_params = {
Expand Down Expand Up @@ -713,7 +761,7 @@ async def list_push_providers(self) -> StreamResponse[ListPushProvidersResponse]

@telemetry.operation_name("getstream.api.common.upsert_push_provider")
async def upsert_push_provider(
self, push_provider: Optional[PushProvider] = None
self, push_provider: Optional[PushProviderRequest] = None
) -> StreamResponse[UpsertPushProviderResponse]:
json = build_body_dict(push_provider=push_provider)
return await self.post(
Expand Down
46 changes: 45 additions & 1 deletion getstream/common/rest_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,50 @@ def create_import(
json = build_body_dict(mode=mode, path=path)
return self.post("/api/v2/imports", CreateImportResponse, json=json)

@telemetry.operation_name("getstream.api.common.list_import_v2_tasks")
def list_import_v2_tasks(
self, state: Optional[int] = None
) -> StreamResponse[ListImportV2TasksResponse]:
query_params = build_query_param(state=state)
return self.get(
"/api/v2/imports/v2", ListImportV2TasksResponse, query_params=query_params
)

@telemetry.operation_name("getstream.api.common.create_import_v2_task")
def create_import_v2_task(
self,
product: str,
settings: ImportV2TaskSettings,
user_id: Optional[str] = None,
user: Optional[UserRequest] = None,
) -> StreamResponse[CreateImportV2TaskResponse]:
json = build_body_dict(
product=product, settings=settings, user_id=user_id, user=user
)
return self.post("/api/v2/imports/v2", CreateImportV2TaskResponse, json=json)

@telemetry.operation_name("getstream.api.common.delete_import_v2_task")
def delete_import_v2_task(
self, id: str
) -> StreamResponse[DeleteImportV2TaskResponse]:
path_params = {
"id": id,
}
return self.delete(
"/api/v2/imports/v2/{id}",
DeleteImportV2TaskResponse,
path_params=path_params,
)

@telemetry.operation_name("getstream.api.common.get_import_v2_task")
def get_import_v2_task(self, id: str) -> StreamResponse[GetImportV2TaskResponse]:
path_params = {
"id": id,
}
return self.get(
"/api/v2/imports/v2/{id}", GetImportV2TaskResponse, path_params=path_params
)

@telemetry.operation_name("getstream.api.common.get_import")
def get_import(self, id: str) -> StreamResponse[GetImportResponse]:
path_params = {
Expand Down Expand Up @@ -703,7 +747,7 @@ def list_push_providers(self) -> StreamResponse[ListPushProvidersResponse]:

@telemetry.operation_name("getstream.api.common.upsert_push_provider")
def upsert_push_provider(
self, push_provider: Optional[PushProvider] = None
self, push_provider: Optional[PushProviderRequest] = None
) -> StreamResponse[UpsertPushProviderResponse]:
json = build_body_dict(push_provider=push_provider)
return self.post(
Expand Down
Loading