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
19 changes: 19 additions & 0 deletions getstream/chat/async_channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,25 @@ async def delete(
self._sync_from_response(response.data)
return response

@attach_channel_cid_async
async def get(
self,
state: Optional[bool] = None,
messages_limit: Optional[int] = None,
members_limit: Optional[int] = None,
watchers_limit: Optional[int] = None,
) -> StreamResponse[ChannelStateResponse]:
response = await self.client.get_channel(
type=self.channel_type,
id=self.channel_id,
state=state,
messages_limit=messages_limit,
members_limit=members_limit,
watchers_limit=watchers_limit,
)
self._sync_from_response(response.data)
return response

Comment on lines +34 to +52

@coderabbitai coderabbitai Bot Jul 13, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Align both channel wrappers with the promised get_channel API.

The REST clients correctly expose get_channel, but both public Channel wrappers are named get, so channel.get_channel(...) is unavailable.

  • getstream/chat/async_channel.py#L34-L52: rename the async get method to get_channel, or add a compatibility alias.
  • getstream/chat/channel.py#L34-L52: rename the sync get method to get_channel, or add a compatibility alias.
📍 Affects 2 files
  • getstream/chat/async_channel.py#L34-L52 (this comment)
  • getstream/chat/channel.py#L34-L52
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@getstream/chat/async_channel.py` around lines 34 - 52, Expose the promised
get_channel API on both Channel wrappers: rename or alias the async Channel.get
method in getstream/chat/async_channel.py lines 34-52 and the sync Channel.get
method in getstream/chat/channel.py lines 34-52 as get_channel, while preserving
existing get compatibility if needed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

  • The REST client correctly has get_channel (client.chat.get_channel(type, id, …)) — that's the endpoint method.
  • The bound Channel wrapper is get() by design — the channel's type/id are already bound to the object, so you don't repeat "channel". This matches go's channel.Get() wrapper, and it's exactly what CHA-3741 proposed ("likely channel.get(options)"). Renaming it to get_channel would be redundant (channel.get_channel()) and inconsistent with the other SDKs.
  • It's generated code anyway — if the team ever wanted a different wrapper name, that's a template decision, not a py hand-edit.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@mogita Fair points, and looking at the existing wrapper methods in this same file (delete, update, hide, truncate, etc.) that also use unqualified verbs since the type/id are already bound to the instance, get() is indeed consistent with the established convention here. Thanks for the context on the Go SDK parity and CHA-3741 — withdrawing this one.

@attach_channel_cid_async
async def update_channel_partial(
self,
Expand Down
29 changes: 29 additions & 0 deletions getstream/chat/async_rest_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,35 @@ async def delete_channel(
path_params=path_params,
)

@telemetry.operation_name("getstream.api.chat.get_channel")
async def get_channel(
self,
type: str,
id: str,
state: Optional[bool] = None,
messages_limit: Optional[int] = None,
members_limit: Optional[int] = None,
watchers_limit: Optional[int] = None,
) -> StreamResponse[ChannelStateResponse]:
query_params = build_query_param(
**{
"state": state,
"messages_limit": messages_limit,
"members_limit": members_limit,
"watchers_limit": watchers_limit,
}
)
path_params = {
"type": type,
"id": id,
}
return await self.get(
"/api/v2/chat/channels/{type}/{id}",
ChannelStateResponse,
query_params=query_params,
path_params=path_params,
)

@telemetry.operation_name("getstream.api.chat.update_channel_partial")
async def update_channel_partial(
self,
Expand Down
19 changes: 19 additions & 0 deletions getstream/chat/channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,25 @@ def delete(
self._sync_from_response(response.data)
return response

@attach_channel_cid
def get(
self,
state: Optional[bool] = None,
messages_limit: Optional[int] = None,
members_limit: Optional[int] = None,
watchers_limit: Optional[int] = None,
) -> StreamResponse[ChannelStateResponse]:
response = self.client.get_channel(
type=self.channel_type,
id=self.channel_id,
state=state,
messages_limit=messages_limit,
members_limit=members_limit,
watchers_limit=watchers_limit,
)
self._sync_from_response(response.data)
return response

@attach_channel_cid
def update_channel_partial(
self,
Expand Down
29 changes: 29 additions & 0 deletions getstream/chat/rest_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,35 @@ def delete_channel(
path_params=path_params,
)

@telemetry.operation_name("getstream.api.chat.get_channel")
def get_channel(
self,
type: str,
id: str,
state: Optional[bool] = None,
messages_limit: Optional[int] = None,
members_limit: Optional[int] = None,
watchers_limit: Optional[int] = None,
) -> StreamResponse[ChannelStateResponse]:
query_params = build_query_param(
**{
"state": state,
"messages_limit": messages_limit,
"members_limit": members_limit,
"watchers_limit": watchers_limit,
}
)
path_params = {
"type": type,
"id": id,
}
return self.get(
"/api/v2/chat/channels/{type}/{id}",
ChannelStateResponse,
query_params=query_params,
path_params=path_params,
)

@telemetry.operation_name("getstream.api.chat.update_channel_partial")
def update_channel_partial(
self,
Expand Down
4 changes: 4 additions & 0 deletions getstream/common/async_rest_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ async def update_app(
disable_permissions_checks: Optional[bool] = None,
enable_hook_payload_compression: Optional[bool] = None,
enforce_unique_usernames: Optional[str] = None,
feed_audit_logs_enabled: Optional[bool] = None,
feeds_moderation_enabled: Optional[bool] = None,
feeds_v2_region: Optional[str] = None,
guest_user_creation_disabled: Optional[bool] = None,
Expand All @@ -64,6 +65,7 @@ async def update_app(
permission_version: Optional[str] = None,
reminders_interval: Optional[int] = None,
reminders_max_members: Optional[int] = None,
reminders_max_per_user: Optional[int] = None,
revoke_tokens_issued_before: Optional[datetime] = None,
sns_key: Optional[str] = None,
sns_secret: Optional[str] = None,
Expand Down Expand Up @@ -107,6 +109,7 @@ async def update_app(
disable_permissions_checks=disable_permissions_checks,
enable_hook_payload_compression=enable_hook_payload_compression,
enforce_unique_usernames=enforce_unique_usernames,
feed_audit_logs_enabled=feed_audit_logs_enabled,
feeds_moderation_enabled=feeds_moderation_enabled,
feeds_v2_region=feeds_v2_region,
guest_user_creation_disabled=guest_user_creation_disabled,
Expand All @@ -122,6 +125,7 @@ async def update_app(
permission_version=permission_version,
reminders_interval=reminders_interval,
reminders_max_members=reminders_max_members,
reminders_max_per_user=reminders_max_per_user,
revoke_tokens_issued_before=revoke_tokens_issued_before,
sns_key=sns_key,
sns_secret=sns_secret,
Expand Down
4 changes: 4 additions & 0 deletions getstream/common/rest_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ def update_app(
disable_permissions_checks: Optional[bool] = None,
enable_hook_payload_compression: Optional[bool] = None,
enforce_unique_usernames: Optional[str] = None,
feed_audit_logs_enabled: Optional[bool] = None,
feeds_moderation_enabled: Optional[bool] = None,
feeds_v2_region: Optional[str] = None,
guest_user_creation_disabled: Optional[bool] = None,
Expand All @@ -64,6 +65,7 @@ def update_app(
permission_version: Optional[str] = None,
reminders_interval: Optional[int] = None,
reminders_max_members: Optional[int] = None,
reminders_max_per_user: Optional[int] = None,
revoke_tokens_issued_before: Optional[datetime] = None,
sns_key: Optional[str] = None,
sns_secret: Optional[str] = None,
Expand Down Expand Up @@ -107,6 +109,7 @@ def update_app(
disable_permissions_checks=disable_permissions_checks,
enable_hook_payload_compression=enable_hook_payload_compression,
enforce_unique_usernames=enforce_unique_usernames,
feed_audit_logs_enabled=feed_audit_logs_enabled,
feeds_moderation_enabled=feeds_moderation_enabled,
feeds_v2_region=feeds_v2_region,
guest_user_creation_disabled=guest_user_creation_disabled,
Expand All @@ -122,6 +125,7 @@ def update_app(
permission_version=permission_version,
reminders_interval=reminders_interval,
reminders_max_members=reminders_max_members,
reminders_max_per_user=reminders_max_per_user,
revoke_tokens_issued_before=revoke_tokens_issued_before,
sns_key=sns_key,
sns_secret=sns_secret,
Expand Down
8 changes: 8 additions & 0 deletions getstream/feeds/feeds.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ def delete(

def get_or_create(
self,
language: Optional[str] = None,
translate_text: Optional[bool] = None,
id_around: Optional[str] = None,
limit: Optional[int] = None,
next: Optional[str] = None,
Expand All @@ -52,6 +54,8 @@ def get_or_create(
response = self.client.get_or_create_feed(
feed_group_id=self.feed_group,
feed_id=self.id,
language=language,
translate_text=translate_text,
id_around=id_around,
limit=limit,
next=next,
Expand Down Expand Up @@ -230,6 +234,8 @@ def reject_feed_member_invite(

def query_pinned_activities(
self,
language: Optional[str] = None,
translate_text: Optional[bool] = None,
enrich_own_fields: Optional[bool] = None,
limit: Optional[int] = None,
next: Optional[str] = None,
Expand All @@ -240,6 +246,8 @@ def query_pinned_activities(
response = self.client.query_pinned_activities(
feed_group_id=self.feed_group,
feed_id=self.id,
language=language,
translate_text=translate_text,
enrich_own_fields=enrich_own_fields,
limit=limit,
next=next,
Expand Down
Loading
Loading