-
Notifications
You must be signed in to change notification settings - Fork 232
OpenAPI: Migrate create draft, send message, update message #4220
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
base: develop
Are you sure you want to change the base?
Changes from 3 commits
9db32d7
632d587
a266d90
1c9cb6f
822f7b8
b62d694
31cfe2e
d5cc4e6
57edd9e
b4fd299
105688d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,6 +15,7 @@ allowed_endpoints=( | |
| blockUsers | ||
| castPollVote | ||
| createDevice | ||
| createDraft | ||
| createPoll | ||
| createPollOption | ||
| createUserGroup | ||
|
|
@@ -44,13 +45,16 @@ allowed_endpoints=( | |
| removeUserGroupMembers | ||
| searchRoles | ||
| searchUserGroups | ||
| sendMessage | ||
| showChannel | ||
| stopWatchingChannel | ||
| unblockUsers | ||
| unmuteChannel | ||
| unreadCounts | ||
| updateLiveLocation | ||
| updateMemberPartial | ||
| updateMessage | ||
| updateMessagePartial | ||
| updatePollPartial | ||
| updatePushNotificationPreferences | ||
| updateUserGroup | ||
|
|
@@ -63,22 +67,28 @@ allowed_models=( | |
| Action | ||
| AddUserGroupMembersRequest | ||
| AppResponseFields | ||
| Attachment | ||
| BlockedUserResponse | ||
| BlockUsersRequest | ||
| BlockUsersResponse | ||
| CastPollVoteRequest | ||
| ChannelMemberPartialResponse | ||
| ChannelMemberRequest | ||
| ChannelMemberResponse | ||
| ChannelMute | ||
| ChannelOwnCapability | ||
| ChannelResponse | ||
| CreateDeviceRequest | ||
| CreateDraftRequest | ||
| CreateDraftResponse | ||
| CreatePollOptionRequest | ||
| CreatePollRequest | ||
| CreateUserGroupRequest | ||
| DeleteChannelResponse | ||
| DeliveredMessagePayload | ||
| DeviceResponse | ||
| DraftPayloadResponse | ||
| DraftResponse | ||
| Field | ||
| FileUploadConfig | ||
| FileUploadResponse | ||
|
|
@@ -96,6 +106,8 @@ allowed_models=( | |
| ListUserGroupsResponse | ||
| MarkDeliveredRequest | ||
| MembersResponse | ||
| MessageRequest | ||
| ModerationV2Response | ||
| MuteChannelRequest | ||
| MuteChannelResponse | ||
| PollOptionInput | ||
|
|
@@ -111,10 +123,16 @@ allowed_models=( | |
| QueryMembersPayload | ||
| QueryPollVotesRequest | ||
| QueryReactionsRequest | ||
| ReactionGroupResponse | ||
| ReactionResponse | ||
| ReminderResponseData | ||
| RemoveUserGroupMembersRequest | ||
| Role | ||
| SearchResultMessage | ||
| SearchRolesResponse | ||
| SendMessageRequest | ||
| SendMessageResponse | ||
| SharedLocation | ||
| SharedLocationResponseData | ||
| SharedLocationsResponse | ||
| SortParamRequest | ||
|
|
@@ -127,6 +145,10 @@ allowed_models=( | |
| UpdateLiveLocationRequest | ||
| UpdateMemberPartialRequest | ||
| UpdateMemberPartialResponse | ||
| UpdateMessagePartialRequest | ||
| UpdateMessagePartialResponse | ||
| UpdateMessageRequest | ||
| UpdateMessageResponse | ||
| UpdatePollPartialRequest | ||
| UpdateUserGroupRequest | ||
| UploadChannelFileResponse | ||
|
|
@@ -377,6 +399,7 @@ rename_generated_type CreateUserGroupResponse UserGroupResponse | |
| rename_generated_type RemoveUserGroupMembersResponse UserGroupResponse | ||
| rename_generated_type UpdateUserGroupResponse UserGroupResponse | ||
| rename_generated_type SearchUserGroupsResponse ListUserGroupsResponse | ||
| rename_generated SharedLocation NewLocationRequestPayload | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Naming conflict with our public API layer and what generator uses. |
||
| rename_generated SharedLocationResponseData SharedLocation | ||
| rename_generated_type SharedLocationResponse SharedLocation | ||
| rename_generated MarkDeliveredRequest ChannelDeliveredRequestPayload | ||
|
|
@@ -400,6 +423,16 @@ rename_generated ChannelMemberResponse MemberPayload | |
| rename_generated ChannelMute MutedChannelPayload | ||
| rename_generated ChannelResponse ChannelDetailPayload | ||
| rename_generated MuteChannelResponse MutedChannelPayloadResponse | ||
| rename_generated Attachment MessageAttachmentPayload | ||
| rename_generated ChannelMemberPartialResponse MemberInfoPayload | ||
| rename_generated DraftPayloadResponse DraftMessagePayload | ||
| rename_generated DraftResponse DraftPayload | ||
| rename_generated ModerationV2Response MessageModerationDetailsPayload | ||
| rename_generated ReactionGroupResponse MessageReactionGroupPayload | ||
| rename_generated ReminderResponseData ReminderPayload | ||
| rename_generated SearchResultMessage MessagePayload | ||
| rename_generated SendMessageResponse SendMessageResponsePayload | ||
| rename_generated_type MessageResponse MessagePayload | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Keeping the old payload names to reduce the PR size just because of type renames. Note:
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hmm, how does that exactly work? Both being renamed to the same payload?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am gonna try using 2 types: MessageResponse and SearchResultMessage (used by message search) (the most correct solution)
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done, opened up a nice cleanup in saveMessage flows as well
laevandus marked this conversation as resolved.
Outdated
|
||
|
|
||
| rename_generated_type HideChannelResponse EmptyResponse | ||
| rename_generated_type MarkDeliveredResponse EmptyResponse | ||
|
|
@@ -479,12 +512,45 @@ remove_property DeleteChannelResponse duration | |
| remove_property MutedChannelPayloadResponse channelMutes | ||
| remove_property MutedChannelPayloadResponse duration | ||
| remove_property MutedChannelPayloadResponse ownUser | ||
| remove_property CreateDraftResponse duration | ||
| # include_channel_context flag is never set and this value is always nil | ||
| remove_property SendMessageResponsePayload channelContext | ||
|
laevandus marked this conversation as resolved.
Outdated
|
||
| remove_property SendMessageResponsePayload duration | ||
| remove_property UpdateMessagePartialResponse duration | ||
| remove_property UpdateMessageResponse duration | ||
|
|
||
| # Server-side only: client-side requests cannot set these fields | ||
| remove_property SendMessageResponsePayload pendingMessageMetadata | ||
| remove_property UpdateMessagePartialResponse pendingMessageMetadata | ||
| remove_property UpdateMessageResponse pendingMessageMetadata | ||
|
laevandus marked this conversation as resolved.
Comment on lines
+520
to
+523
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. CHA-4779 |
||
|
|
||
| # TODO: reaction group reactors need CoreData and public API design first | ||
| remove_property MessageReactionGroupPayload latestReactionsBy | ||
|
Comment on lines
+525
to
+526
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is for later (separate PR). Captured in IOS-1972 |
||
|
|
||
| retype_property ChannelDetailPayload cid String ChannelId | ||
| retype_property ChannelDetailPayload config ChannelConfigWithInfo ChannelConfig | ||
| # Will be changed on the generation side later | ||
| require_property ChannelDetailPayload config | ||
|
|
||
| # TODO: v1 and v2 require this field; removing compatibility requires JSON fixture normalization. | ||
| optionalize_property DraftPayload channelCid | ||
| # TODO: v1 and v2 require this field; removing compatibility requires JSON fixture normalization. | ||
| optionalize_property MessagePayload cid | ||
| # TODO: v1 and v2 require this field; removing compatibility requires JSON fixture normalization. | ||
| optionalize_property MessagePayload deletedReplyCount | ||
| # TODO: v1 and v2 require this field; removing compatibility requires JSON fixture normalization. | ||
| optionalize_property MessagePayload mentionedChannel | ||
| # TODO: v1 and v2 require this field; removing compatibility requires JSON fixture normalization. | ||
| optionalize_property MessagePayload mentionedHere | ||
| # TODO: v1 and v2 require this field; removing compatibility requires JSON fixture normalization. | ||
| optionalize_property MessagePayload pinned | ||
| # TODO: Legacy v1 payloads may contain null; keep optional until legacy compatibility is removed. | ||
| optionalize_property MessagePayload reactionCounts | ||
| # TODO: v1 and v2 require this field; removing compatibility requires JSON fixture normalization. | ||
| optionalize_property MessagePayload restrictedVisibility | ||
| # TODO: v1 and v2 require this field; removing compatibility requires JSON fixture normalization. | ||
| optionalize_property MessagePayload shadowed | ||
|
|
||
| remove_nested_enum() { | ||
| local file="$OUTPUT_DIR_CHAT/models/$1.swift" | ||
| awk -v e="$2" ' | ||
|
|
@@ -590,12 +656,8 @@ inject_v1_endpoint_paths() { | |
| case channelEvent(String) | ||
| case pinnedMessages(String) | ||
|
|
||
| case sendMessage(ChannelId) | ||
| case message(MessageId) | ||
| case editMessage(MessageId) | ||
| case deleteMessage(MessageId) | ||
| case pinMessage(MessageId) | ||
| case unpinMessage(MessageId) | ||
| case replies(MessageId) | ||
| case addReaction(MessageId) | ||
| case deleteReaction(MessageId, MessageReactionType) | ||
|
|
@@ -649,12 +711,8 @@ EOF | |
| case let .channelEvent(channelId): return "channels/\(channelId)/event" | ||
| case let .pinnedMessages(channelId): return "channels/\(channelId)/pinned_messages" | ||
|
|
||
| case let .sendMessage(channelId): return "channels/\(channelId.apiPath)/message" | ||
| case let .message(messageId): return "messages/\(messageId)" | ||
| case let .editMessage(messageId): return "messages/\(messageId)" | ||
| case let .deleteMessage(messageId): return "messages/\(messageId)" | ||
| case let .pinMessage(messageId): return "messages/\(messageId)" | ||
| case let .unpinMessage(messageId): return "messages/\(messageId)" | ||
| case let .replies(messageId): return "messages/\(messageId)/replies" | ||
| case let .addReaction(messageId): return "messages/\(messageId)/reaction" | ||
| case let .deleteReaction(messageId, reaction): return "messages/\(messageId)/reaction/\(reaction.rawValue)" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| // | ||
| // Copyright © 2026 Stream.io Inc. All rights reserved. | ||
| // | ||
|
|
||
| import Foundation | ||
|
|
||
| // Generated properties are slightly different from the previously hand-written ones. | ||
| extension DraftMessagePayload { | ||
| var command: String? { custom[MessagePayloadsCodingKeys.command.rawValue]?.stringValue } | ||
| var args: String? { custom[MessagePayloadsCodingKeys.args.rawValue]?.stringValue } | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.