Repository navigation
feat!: regenerate the client from the current Stream API #313
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
618eff8
feat!: [FLU-1105] regenerate the client from the current OpenAPI spec
itsmeadi 5abe88e
Merge remote-tracking branch 'origin/main' into feat/regen-openapi-v240
mogita 7dcde9f
fix: send the generated upload methods as multipart form data
mogita 8ec1f9a
Merge remote-tracking branch 'origin/main' into feat/regen-openapi-v240
mogita 3533986
feat!: regenerate from the current spec and add the v7 to v8 migratio…
mogita 57d971d
docs: fix the feedback parameter order and required fields in the mig…
mogita 4206d05
Merge remote-tracking branch 'origin/main' into feat/regen-openapi-v240
mogita File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,114 @@ | ||
| # Migration Guide: v7 → v8 | ||
|
|
||
| v8 regenerates the client from the current Stream API. Most of the changes add new methods, models and optional parameters. This guide lists the changes that can break code written for stream-py 7.1.0. | ||
|
|
||
| ```bash | ||
| pip install "getstream==8.*" | ||
| ``` | ||
|
|
||
| ## Pass optional parameters by keyword | ||
|
|
||
| Generated method parameters are positional-or-keyword, and v8 adds new optional parameters in the middle of many signatures. A call that passes optional arguments by position can now send a value to the wrong parameter. Calls that pass them by keyword work unchanged. | ||
|
|
||
| ```python | ||
| # v7: the fourth positional argument was `user_id` | ||
| client.feeds.get_activity(activity_id, "first", 10, "jane") | ||
|
|
||
| # v8: "jane" would go to the new `skip_own_followings`, so pass it by keyword | ||
| client.feeds.get_activity(activity_id, comment_sort="first", comment_limit=10, user_id="jane") | ||
| ``` | ||
|
|
||
| These methods have new parameters before existing ones. Each async client has the same changes. | ||
|
|
||
| | Method | New parameters | First moved parameter | | ||
| |---|---|---| | ||
| | `Channel.get_or_create`, `chat.get_or_create_channel`, `chat.get_or_create_distinct_channel` | `include_scheduled_messages` | `state` | | ||
| | `Channel.send_message`, `chat.send_message` | `scheduled_at` | `skip_enrich_url` | | ||
| | `chat.query_channels` | `include_active_member_count` | `limit` | | ||
| | `chat.grouped_query_channels` | `sort` | `groups` | | ||
| | `chat.channel_batch_update` | `synchronous` | `custom_unset` | | ||
| | `chat.create_channel_type` | `quotes`, `reminders`, `automod_thresholds` | `reactions` | | ||
| | `chat.create_reminder`, `chat.update_reminder` | `expires_at` | `remind_at` | | ||
| | `chat.cast_poll_vote`, `feeds.cast_poll_vote` | `config_key`, `config_team` | `user_id` | | ||
| | `create_poll` | `config_key`, `config_team`, `team` | `description` | | ||
| | `update_poll` | `config_key`, `config_team` | `description` | | ||
| | `update_poll_partial`, `create_poll_option`, `update_poll_option` | `config_key`, `config_team` | `user_id` | | ||
| | `update_app` | `two_way_block_effect_enabled` | `user_response_time_enabled` | | ||
| | `Feed.get_or_create`, `feeds.get_or_create_feed` | `discard_actors` | `data` | | ||
| | `Feed.query_pinned_activities`, `feeds.query_pinned_activities` | `include_expired_activities`, `include_moderated_activities`, `include_soft_deleted_activities`, `user_id` | `limit` | | ||
| | `feeds.add_activity` | `skip_existing` | `skip_push` | | ||
| | `feeds.get_activity` | `skip_own_followings` | `user_id` | | ||
| | `feeds.query_activities` | `include_moderated_activities` | `include_private_activities` | | ||
| | `feeds.query_comments` | `include_soft_deleted_comments` | `limit` | | ||
| | `feeds.query_follows` | `include_group_counts` | `limit` | | ||
| | `feeds.follow_batch`, `feeds.get_or_create_follows` | `_async` | `create_users` | | ||
| | `feeds.unfollow_batch`, `feeds.get_or_create_unfollows` | `_async` | `delete_notification_activity` | | ||
| | `moderation.analyze` | `country_code`, `country_codes` | `entity_creator_id` | | ||
| | `moderation.check` | `country_code`, `country_codes` | `test_mode` | | ||
| | `moderation.appeal` | `channel_cid` | `review_queue_item_id` | | ||
| | `moderation.ban` | `ban_from_future_channels`, `delete_reactions` | `banned_by_id` | | ||
| | `moderation.unban` | `remove_future_channels_ban` | `unbanned_by_id` | | ||
| | `moderation.submit_action` | `delete_poll`, `delete_poll_answer`, `delete_poll_option` | `delete_reaction` | | ||
| | `moderation.upsert_config` | `engine`, `intent_config` | `flood_config` | | ||
|
|
||
| ## Parameters that are now optional | ||
|
|
||
| These parameters are now optional, so they moved behind the required ones. Pass them by keyword. | ||
|
|
||
| - `chat.update_channel_type`: `automod`, `automod_behavior` and `max_message_length`. `max_message_length` now comes after `mark_messages_pending`. | ||
| - `moderation.submit_moderation_feedback`: `message`, `published_at` and `reference`. They now come after `channel_id` and the new `confidence`, `entity_creator_id`, `entity_id`, `entity_type`, `false_positive` and `feedback_type` parameters, and before the new `review_queue_item_id` and `user_id`. | ||
|
|
||
| The matching request models, `UpdateChannelTypeRequest` and `SubmitModerationFeedbackRequest`, give these fields a `None` default, so they also moved in the dataclass field order. | ||
|
|
||
| ## Campaign responses | ||
|
|
||
| `update_campaign` returns `UpdateCampaignResponse` and `stop_campaign` returns `StopCampaignResponse`. v7 decoded both into `CampaignResponse`, whose fields came back as `None` because the API returns the campaign inside a `campaign` field. Read the campaign from that field. | ||
|
|
||
| ```python | ||
| # v7 | ||
| resp = client.chat.stop_campaign(id=campaign_id) | ||
| status = resp.data.status # None | ||
|
|
||
| # v8 | ||
| resp = client.chat.stop_campaign(id=campaign_id) | ||
| status = resp.data.campaign.status | ||
| ``` | ||
|
|
||
| ## Removed models | ||
|
|
||
| These request models had no fields, because their endpoints take no request body. The methods that call those endpoints keep their signatures. | ||
|
|
||
| - `CancelImportV2TaskRequest` | ||
| - `CommitMessageRequest` | ||
| - `EndCallRequest` | ||
| - `ExportFeedUserDataRequest` | ||
| - `RestoreFeedGroupRequest` | ||
| - `StartHLSBroadcastingRequest` | ||
| - `StartPolicyTestRunRequest` | ||
| - `StopAllRTMPBroadcastsRequest` | ||
| - `StopCampaignRequest` | ||
| - `StopFrameRecordingRequest` | ||
| - `StopHLSBroadcastingRequest` | ||
| - `VideoEndCallRequestPayload` | ||
| - `VideoKickUserRequestPayload` | ||
|
|
||
| `Time` was also removed. `EnrichedReaction.created_at` and `EnrichedReaction.updated_at` are now `Optional[str]`. | ||
|
|
||
| ## Removed field | ||
|
|
||
| `AIVideoConfig.provider` was removed. Drop it from `AIVideoConfig(...)` calls in your moderation config. | ||
|
|
||
| ## Type annotation changes | ||
|
|
||
| These changes affect only type checkers. Runtime values are unchanged. | ||
|
|
||
| - `own_capabilities` on call, channel and feed responses is annotated as `List[str]`. The constants classes `OwnCapability`, `ChannelOwnCapability` and `FeedOwnCapability` still exist, and their values are strings. | ||
| - `CampaignResponse.sender_mode` and `CampaignResponse.sender_visibility` are now `Optional[str]`. | ||
|
|
||
| ## Required response fields | ||
|
|
||
| `ChannelMemberResponse.user_id` and `OwnUserResponse.blocked_user_ids` are now required and have no default. Responses the SDK decodes are unaffected, but code that builds these models itself, such as test fixtures, must pass both fields, or the constructor raises `TypeError` and a direct `from_dict` without `infer_missing=True` raises `KeyError`. | ||
|
|
||
| ## Uploads | ||
|
|
||
| `upload_file`, `upload_image`, `upload_channel_file` and `upload_channel_image` keep their signatures and still send `multipart/form-data`. `file` is a keyword with a `None` default in the signature, but the upload raises `ValueError` without it. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.