feat!: add GetChannel endpoint#271
Conversation
📝 WalkthroughWalkthroughAdds chat channel retrieval, feed reactions, shares, translations, moderation queue management, expanded configuration and response models, and review-queue export webhook parsing for synchronous and asynchronous clients. ChangesChat channel retrieval
Feed reactions, shares, and translations
Configuration and moderation
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant Client
participant ModerationRestClient
participant ModerationQueueAPI
Client->>ModerationRestClient: create_queue(name, type, filters)
ModerationRestClient->>ModerationQueueAPI: POST /moderation/queues
ModerationQueueAPI-->>ModerationRestClient: QueueResponse
ModerationRestClient-->>Client: StreamResponse
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with 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.
Inline comments:
In `@getstream/chat/async_channel.py`:
- Around line 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.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: c7e79265-4d27-4eae-95ef-4c03c1827bc5
📒 Files selected for processing (12)
getstream/chat/async_channel.pygetstream/chat/async_rest_client.pygetstream/chat/channel.pygetstream/chat/rest_client.pygetstream/common/async_rest_client.pygetstream/common/rest_client.pygetstream/feeds/rest_client.pygetstream/models/__init__.pygetstream/moderation/async_rest_client.pygetstream/moderation/rest_client.pygetstream/tests/test_webhook.pygetstream/webhook.py
| @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 | ||
|
|
There was a problem hiding this comment.
🎯 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 asyncgetmethod toget_channel, or add a compatibility alias.getstream/chat/channel.py#L34-L52: rename the syncgetmethod toget_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.
There was a problem hiding this comment.
- 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.
There was a problem hiding this comment.
@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.
Regenerate from chat at the CHA-3386 commit. Adds the read-only get_channel endpoint (sync and async) and renames the shadowed moderation CallResponse to ModerationCallResponse. BREAKING CHANGE: renames moderation CallResponse to ModerationCallResponse (video CallResponse keeps its name); drops non-functional internal ModerationSettings fields no longer in the spec.
35b3720 to
62fb98d
Compare
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
getstream/common/async_rest_client.py (1)
52-68: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winAvoid inserting new optional parameters into the middle of the public signature.
Because
update_appaccepts positional arguments, existing callers that pass arguments afterenforce_unique_usernamesorreminders_max_memberswill now bind values to different parameters. Append new parameters at the end of the signature, or explicitly treat this as a breaking API change and update the major-version plan. Apply the same compatibility decision togetstream/common/rest_client.py.🤖 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/common/async_rest_client.py` around lines 52 - 68, Preserve positional compatibility in update_app by moving the newly added optional parameters out of the middle of its public signature and appending them after all existing parameters. Apply the same parameter-ordering change to the corresponding update_app signature in rest_client.py, keeping existing arguments bound exactly as before.
🤖 Prompt for all review comments with 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.
Outside diff comments:
In `@getstream/common/async_rest_client.py`:
- Around line 52-68: Preserve positional compatibility in update_app by moving
the newly added optional parameters out of the middle of its public signature
and appending them after all existing parameters. Apply the same
parameter-ordering change to the corresponding update_app signature in
rest_client.py, keeping existing arguments bound exactly as before.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 571d7a83-1023-4294-99bf-a4647b54d144
📒 Files selected for processing (13)
getstream/chat/async_channel.pygetstream/chat/async_rest_client.pygetstream/chat/channel.pygetstream/chat/rest_client.pygetstream/common/async_rest_client.pygetstream/common/rest_client.pygetstream/feeds/feeds.pygetstream/feeds/rest_client.pygetstream/models/__init__.pygetstream/moderation/async_rest_client.pygetstream/moderation/rest_client.pygetstream/tests/test_webhook.pygetstream/webhook.py
🚧 Files skipped from review as they are similar to previous changes (10)
- getstream/tests/test_webhook.py
- getstream/feeds/feeds.py
- getstream/chat/rest_client.py
- getstream/webhook.py
- getstream/chat/async_channel.py
- getstream/moderation/async_rest_client.py
- getstream/chat/async_rest_client.py
- getstream/common/rest_client.py
- getstream/moderation/rest_client.py
- getstream/models/init.py
Summary
Regenerates the SDK from the current API spec. Adds the read-only GetChannel endpoint:
client.chat.get_channel(type, id, state=..., messages_limit=..., members_limit=..., watchers_limit=...)fetches a channel by CID without creating it (404 if it does not exist). ReturnsChannelStateResponse. Sync and async variants, plus achannel.get_channel(...)wrapper.Breaking changes
Regeneration also syncs accumulated spec drift. Two
ModerationSettingsfields are removed because they are no longer in the API spec:analyze_max_image_size_byteswebhook_header_client_request_id_keyThese had no server-side binding and were non-functional, so removing them has no runtime impact, but it is source-breaking for code referencing them. Warrants a major version bump at release.
Test plan
import getstreamOK;ruff check/ruff formatclean.Summary by CodeRabbit
get) with optionalstateand limits for messages, members, and watchers.target_feeds) and new translation endpoints for activities and comments.feed_audit_logs_enabledto app updates.languageandtranslate_textoptions to multiple feeds/comment retrieval methods.ai_audio_configto moderation config upserts.Update (CHA-3386): Regenerated against current chat master. This PR now also renames the shadowed moderation
CallResponseschema toModerationCallResponse(videoCallResponseunchanged) — an additional intentional breaking change.