-
Notifications
You must be signed in to change notification settings - Fork 12
[CHA-0] fix unread counts api spec #175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughThe PR adds new channel update fields (history cutoff and filter tags), standardizes member payloads to ChannelMemberRequest, expands moderation submit_action with block/delete_comment/shadow_block, adds video SIP routing and trunk endpoints plus ring_call, and introduces delivery_events flags in many model classes. Changes
Sequence Diagram(s)sequenceDiagram
participant App
participant Channel
participant ChatRestClient
participant API
App->>Channel: Channel.update(hide_history_before, add_filter_tags, remove_filter_tags, add_members=ChannelMemberRequest, ...)
Channel->>ChatRestClient: update_channel(type, id, hide_history_before, add_filter_tags, remove_filter_tags, add_members, ...)
ChatRestClient->>ChatRestClient: build_body_dict(..., hide_history_before, add_filter_tags, remove_filter_tags, ...)
ChatRestClient->>API: POST /channels/{type}/{id} with payload
API-->>ChatRestClient: UpdateChannelResponse
ChatRestClient-->>Channel: StreamResponse
Channel-->>App: StreamResponse
sequenceDiagram
participant App
participant VideoRestClient
participant API
App->>VideoRestClient: create_sip_inbound_routing_rule(name, trunk_ids, caller_configs, ...)
VideoRestClient->>VideoRestClient: build_body_dict(...)
VideoRestClient->>API: POST /api/v2/video/sip/routing_rules
API-->>VideoRestClient: SIPInboundRoutingRuleResponse
VideoRestClient-->>App: StreamResponse
App->>VideoRestClient: ring_call(type, id, video?, members_ids?)
VideoRestClient->>API: POST /api/v2/video/call/{type}/{id}/ring
API-->>VideoRestClient: RingCallResponse
VideoRestClient-->>App: StreamResponse
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes
Poem
Pre-merge checks and finishing touches❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro Disabled knowledge base sources:
📒 Files selected for processing (6)
🧰 Additional context used🧬 Code graph analysis (6)getstream/models/__init__.py (2)
getstream/video/rtc/audio_track.py (1)
getstream/video/async_call.py (6)
getstream/video/async_rest_client.py (6)
getstream/video/rest_client.py (5)
getstream/video/call.py (7)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
🔇 Additional comments (7)
Warning Review ran into problems🔥 ProblemsErrors were encountered while retrieving linked issues. Errors (1)
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (9)
getstream/chat/async_channel.py(2 hunks)getstream/chat/async_rest_client.py(7 hunks)getstream/chat/channel.py(2 hunks)getstream/chat/rest_client.py(7 hunks)getstream/models/__init__.py(85 hunks)getstream/moderation/async_rest_client.py(2 hunks)getstream/moderation/rest_client.py(2 hunks)getstream/video/async_rest_client.py(1 hunks)getstream/video/rest_client.py(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (9)
getstream/moderation/async_rest_client.py (1)
getstream/models/__init__.py (3)
BlockActionRequest(2022-2025)DeleteCommentRequest(6943-6949)ShadowBlockActionRequest(16610-16613)
getstream/moderation/rest_client.py (1)
getstream/models/__init__.py (3)
BlockActionRequest(2022-2025)DeleteCommentRequest(6943-6949)ShadowBlockActionRequest(16610-16613)
getstream/chat/async_rest_client.py (5)
getstream/models/__init__.py (2)
ChannelMemberRequest(4797-4807)WrappedUnreadCountsResponse(20491-20510)getstream/chat/rest_client.py (1)
unread_counts(1568-1576)getstream/stream_response.py (1)
StreamResponse(11-36)getstream/utils/__init__.py (1)
build_query_param(94-126)getstream/base.py (2)
get(221-237)get(400-416)
getstream/models/__init__.py (2)
getstream/utils/__init__.py (2)
encode_datetime(39-51)datetime_from_unix_ns(54-91)getstream/feeds/rest_client.py (1)
activity_feedback(189-218)
getstream/chat/channel.py (1)
getstream/models/__init__.py (1)
ChannelMemberRequest(4797-4807)
getstream/chat/async_channel.py (1)
getstream/models/__init__.py (1)
ChannelMemberRequest(4797-4807)
getstream/chat/rest_client.py (5)
getstream/models/__init__.py (2)
ChannelMemberRequest(4797-4807)WrappedUnreadCountsResponse(20491-20510)getstream/chat/async_rest_client.py (1)
unread_counts(1578-1586)getstream/stream_response.py (1)
StreamResponse(11-36)getstream/utils/__init__.py (1)
build_query_param(94-126)getstream/base.py (2)
get(221-237)get(400-416)
getstream/video/rest_client.py (6)
getstream/common/telemetry.py (1)
operation_name(429-441)getstream/video/async_rest_client.py (9)
resolve_sip_inbound(1032-1047)list_sip_inbound_routing_rule(1050-1055)create_sip_inbound_routing_rule(1058-1083)delete_sip_inbound_routing_rule(1086-1096)update_sip_inbound_routing_rule(1099-1131)list_sip_trunks(1134-1135)create_sip_trunk(1138-1144)delete_sip_trunk(1147-1155)update_sip_trunk(1158-1170)getstream/models/__init__.py (15)
SIPChallenge(15924-15966)ResolveSipInboundResponse(15517-15527)ListSIPInboundRoutingRuleResponse(10492-10496)SIPCallerConfigsRequest(15908-15912)SIPCallConfigsRequest(15894-15897)SIPDirectRoutingRuleCallConfigsRequest(15970-15972)SIPPinProtectionConfigsRequest(16078-16090)SIPInboundRoutingRulePinConfigsRequest(15982-15997)SIPInboundRoutingRuleResponse(16047-16074)DeleteSIPInboundRoutingRuleResponse(7054-7055)UpdateSIPInboundRoutingRuleResponse(19044-19048)ListSIPTrunksResponse(10500-10504)CreateSIPTrunkResponse(6623-6627)DeleteSIPTrunkResponse(7059-7060)UpdateSIPTrunkResponse(19058-19062)getstream/stream_response.py (1)
StreamResponse(11-36)getstream/utils/__init__.py (1)
build_body_dict(129-153)getstream/base.py (8)
post(239-255)post(418-434)get(221-237)get(400-416)delete(275-291)delete(454-470)put(257-273)put(436-452)
getstream/video/async_rest_client.py (5)
getstream/common/telemetry.py (1)
operation_name(429-441)getstream/video/rest_client.py (9)
resolve_sip_inbound(1026-1041)list_sip_inbound_routing_rule(1044-1049)create_sip_inbound_routing_rule(1052-1077)delete_sip_inbound_routing_rule(1080-1090)update_sip_inbound_routing_rule(1093-1125)list_sip_trunks(1128-1129)create_sip_trunk(1132-1136)delete_sip_trunk(1139-1147)update_sip_trunk(1150-1162)getstream/models/__init__.py (15)
SIPChallenge(15924-15966)ResolveSipInboundResponse(15517-15527)ListSIPInboundRoutingRuleResponse(10492-10496)SIPCallerConfigsRequest(15908-15912)SIPCallConfigsRequest(15894-15897)SIPDirectRoutingRuleCallConfigsRequest(15970-15972)SIPPinProtectionConfigsRequest(16078-16090)SIPInboundRoutingRulePinConfigsRequest(15982-15997)SIPInboundRoutingRuleResponse(16047-16074)DeleteSIPInboundRoutingRuleResponse(7054-7055)UpdateSIPInboundRoutingRuleResponse(19044-19048)ListSIPTrunksResponse(10500-10504)CreateSIPTrunkResponse(6623-6627)DeleteSIPTrunkResponse(7059-7060)UpdateSIPTrunkResponse(19058-19062)getstream/utils/__init__.py (1)
build_body_dict(129-153)getstream/base.py (8)
post(239-255)post(418-434)get(221-237)get(400-416)delete(275-291)delete(454-470)put(257-273)put(436-452)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: Tests (3.13)
- GitHub Check: Tests (3.12)
- GitHub Check: Tests (3.10)
- GitHub Check: Tests (3.11)
🔇 Additional comments (12)
getstream/models/__init__.py (8)
16047-16116: Verify SIP classes match API specification for created_at/updated_at timestamp format.Lines 16055–16056 and 16115 use the
UnixTsplaceholder for timestamp fields. Confirm with API spec whether these are Unix timestamps (seconds/nanoseconds) or should be converted to datetime objects like other timestamp fields in this codebase. The inconsistency with datetime fields elsewhere (which use encode_datetime/datetime_from_unix_ns) poses a deserialization risk.
7134-7163: DenormalizedChannelFields — verify all fields match API specification for event payloads.New class with all Optional fields (lines 7134–7163) used for denormalizing channel data in message/event payloads. Fields include created_at, id, team, type, custom, etc. Confirm this structure aligns with the Stream API spec for channel denormalization in events and that nullable field defaults are intentional.
4333-4334: delivery_events field added across multiple channel/feed config classes — verify placement and consistency.The
delivery_eventsboolean flag is added to several configuration classes as a required (non-optional) field. Line 4334: ChannelTypeConfig, Line 4410: ChannelTypeUpdateRequest, Line 5291: ChannelTypeResponse, Line 6274: ChannelTypeUpdateResponse, Line 9240: GetUnreadCountsResponse, Line 18536: UpdateChannelTypeResponse. Verify:
- Field is in the correct position within each dataclass
- Defaults and nullability align across request/response pairs
- This matches the actual API schema
Also applies to: 4410-4411, 5291-5292, 6274-6275, 9240-9241, 18536-18537
2022-2025: BlockActionRequest — verify new moderation action type is complete.New
BlockActionRequestclass (lines 2022–2025) with optionalreasonfield. Cross-reference with DeleteCommentRequest (hunk 42) and ShadowBlockActionRequest (hunk 71) to ensure moderation action patterns are consistent. Verify these classes are integrated into the StreamActionRequest (hunk 74, lines 17104–17106, 17113–17115, 17128–17130).
4293-4295: filter_tags field added to channel operations — verify API spec alignment.New
filter_tagsfield (Optional[List[str]]) added to:
- Line 4293: ChannelData
- Line 5121: ChannelResponse
- Lines 18372–18374 & 18390–18392: UpdateChannelRequest (add_filter_tags / remove_filter_tags)
Confirm these additions are present in the API specification and that the add/remove pattern for tags is the intended design.
Also applies to: 5121-5123, 18372-18392
18354-18362: hide_history_before field — verify datetime encoding is correct.New
hide_history_beforefield (lines 18354–18362) in UpdateChannelRequest uses proper datetime encoding/decoding. Verify this field name and format match the API spec, and that the datetime_from_unix_ns decoder is appropriate for the server-side timestamp format.
15055-15590: Extensive SIP infrastructure classes — verify completeness against API spec.Hunks 67–70 introduce comprehensive SIP management classes (ResolveSipInbound*, SIPConfigs, SIPChallenge, SIPInboundRoutingRule, SIPPinProtectionConfigs*, SIPTrunk*). These span 400+ lines with many new nested types. Spot-check:
- All required SIP authentication fields are present (e.g., SIPChallenge has realm, nonce, response, etc.)
- Request/response pairs are symmetric (CreateSIPTrunk* at lines 6616–6627, UpdateSIPTrunk* at lines 19052–19062)
- Confidence that UnixTs timestamps (lines 16055, 16056, 16115) are correctly scoped to this feature
4796-4808: ChannelMemberRequest type propagation verified — consistent usage across all request builders.All requested spot-check locations confirm correct usage:
- Lines 4634, 4637:
invitesandmembersin request class useOptional[List[ChannelMemberRequest]]- Line 14374:
membersfield usesOptional[List[ChannelMemberRequest]]- Lines 18375, 18381, 18387:
add_members,assign_roles,invitesall useOptional[List[ChannelMemberRequest]]Response models correctly retain
ChannelMember(lines 4296, 4299). The separation of concerns is properly implemented with no type inconsistencies detected.getstream/chat/rest_client.py (4)
226-278: LGTM! Type-safe member parameters and new filtering capabilities.The changes correctly extend the
update_channelmethod with:
hide_history_beforefor timestamp-based history controladd_filter_tagsandremove_filter_tagsfor channel filtering- Type-safe
ChannelMemberRequestforadd_members,assign_roles, andinvitesAll parameters are optional and properly forwarded to the request payload.
641-710: LGTM! Delivery events configuration added.The
delivery_eventsparameter is correctly added to control delivery event notifications for the channel type. Properly typed and forwarded to the request payload.
733-813: LGTM! Consistent delivery events configuration.The
delivery_eventsparameter addition mirrors the change increate_channel_type, maintaining consistency across channel type operations.
1568-1576: LGTM! User-specific unread counts filtering.The addition of the optional
user_idparameter correctly enables filtering unread counts for a specific user. Properly uses query parameters for the GET request and maintains backward compatibility.
Summary by CodeRabbit