stream-chat 9.50.3 → 10.0.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.browser.js +19798 -14472
- package/dist/cjs/index.browser.js.map +4 -4
- package/dist/cjs/index.node.js +19817 -14482
- package/dist/cjs/index.node.js.map +4 -4
- package/dist/esm/index.mjs +19795 -14469
- package/dist/esm/index.mjs.map +4 -4
- package/dist/types/ChannelManager.d.ts +221 -0
- package/dist/types/EventHandlerPipeline.d.ts +104 -0
- package/dist/types/api-client.d.ts +26 -0
- package/dist/types/campaign.d.ts +0 -44
- package/dist/types/channel.d.ts +454 -479
- package/dist/types/channel_batch_updater.d.ts +0 -93
- package/dist/types/channel_state.d.ts +53 -201
- package/dist/types/client.d.ts +451 -1920
- package/dist/types/client_state.d.ts +4 -4
- package/dist/types/configuration/InstanceConfigurationService.d.ts +26 -0
- package/dist/types/configuration/index.d.ts +1 -0
- package/dist/types/configuration/types.d.ts +53 -0
- package/dist/types/connection.d.ts +49 -41
- package/dist/types/connection_fallback.d.ts +6 -4
- package/dist/types/constants.d.ts +0 -4
- package/dist/types/custom_types.d.ts +2 -0
- package/dist/types/entityStore/EntityStore.d.ts +111 -0
- package/dist/types/entityStore/StoreBackedItemIndex.d.ts +60 -0
- package/dist/types/entityStore/applyReactionLocally.d.ts +26 -0
- package/dist/types/entityStore/index.d.ts +2 -0
- package/dist/types/errors.d.ts +10 -2
- package/dist/types/gen/chat/ChannelApi.d.ts +45 -0
- package/dist/types/gen/chat/ChatApi.d.ts +334 -0
- package/dist/types/gen/model-decoders/decoders.d.ts +3 -0
- package/dist/types/gen/model-decoders/event-decoder-mapping.d.ts +6 -0
- package/dist/types/gen/models/index.d.ts +8836 -0
- package/dist/types/gen/moderation/ModerationApi.d.ts +50 -0
- package/dist/types/gen-imports.d.ts +3 -0
- package/dist/types/index.d.ts +8 -7
- package/dist/types/insights.d.ts +9 -8
- package/dist/types/logger.d.ts +9 -0
- package/dist/types/messageComposer/LocationComposer.d.ts +7 -4
- package/dist/types/messageComposer/attachmentIdentity.d.ts +2 -2
- package/dist/types/messageComposer/attachmentManager.d.ts +8 -4
- package/dist/types/messageComposer/configuration/types.d.ts +11 -11
- package/dist/types/messageComposer/linkPreviewsManager.d.ts +25 -13
- package/dist/types/messageComposer/messageComposer.d.ts +10 -10
- package/dist/types/messageComposer/middleware/messageComposer/types.d.ts +3 -3
- package/dist/types/messageComposer/middleware/pollComposer/types.d.ts +4 -7
- package/dist/types/messageComposer/middleware/textComposer/commandUtils.d.ts +3 -3
- package/dist/types/messageComposer/middleware/textComposer/commands.d.ts +7 -7
- package/dist/types/messageComposer/middleware/textComposer/mentions.d.ts +218 -4
- package/dist/types/messageComposer/middleware/textComposer/types.d.ts +9 -4
- package/dist/types/messageComposer/pollComposer.d.ts +5 -4
- package/dist/types/messageComposer/textComposer.d.ts +8 -3
- package/dist/types/messageComposer/types.d.ts +6 -28
- package/dist/types/messageDelivery/MessageDeliveryReporter.d.ts +40 -25
- package/dist/types/messageDelivery/MessageReceiptsTracker.d.ts +53 -12
- package/dist/types/messageOperations/MessageOperationStatePolicy.d.ts +19 -0
- package/dist/types/messageOperations/MessageOperations.d.ts +17 -0
- package/dist/types/messageOperations/index.d.ts +3 -0
- package/dist/types/messageOperations/types.d.ts +49 -0
- package/dist/types/moderation.d.ts +21 -203
- package/dist/types/notifications/types.d.ts +8 -7
- package/dist/types/offline-support/offline_support_api.d.ts +111 -87
- package/dist/types/offline-support/offline_sync_manager.d.ts +0 -7
- package/dist/types/offline-support/types.d.ts +19 -23
- package/dist/types/offline-support/util.d.ts +4 -2
- package/dist/types/pagination/FilterBuilder.d.ts +1 -1
- package/dist/types/pagination/ItemIndex.d.ts +25 -0
- package/dist/types/pagination/cursorDerivation/createdAtAroundPaginationFlags.d.ts +9 -0
- package/dist/types/pagination/cursorDerivation/idAroundPaginationFlags.d.ts +6 -0
- package/dist/types/pagination/cursorDerivation/index.d.ts +1 -0
- package/dist/types/pagination/cursorDerivation/linearPaginationFlags.d.ts +6 -0
- package/dist/types/pagination/filterCompiler.d.ts +7 -0
- package/dist/types/pagination/index.d.ts +1 -3
- package/dist/types/pagination/paginators/BasePaginator.d.ts +848 -0
- package/dist/types/pagination/paginators/ChannelPaginator.d.ts +212 -0
- package/dist/types/pagination/paginators/MessageIntervalPaginator.d.ts +282 -0
- package/dist/types/pagination/paginators/MessagePaginator.d.ts +208 -0
- package/dist/types/pagination/paginators/PinnedMessagePaginator.d.ts +39 -0
- package/dist/types/pagination/paginators/ReminderPaginator.d.ts +19 -0
- package/dist/types/pagination/paginators/UserGroupPaginator.d.ts +24 -0
- package/dist/types/pagination/paginators/index.d.ts +7 -0
- package/dist/types/pagination/paginators/stateThrottling.d.ts +2 -0
- package/dist/types/pagination/sortCompiler.d.ts +49 -0
- package/dist/types/pagination/types.normalization.d.ts +11 -0
- package/dist/types/pagination/utility.normalization.d.ts +18 -0
- package/dist/types/pagination/utility.queryChannel.d.ts +26 -0
- package/dist/types/pagination/utility.search.d.ts +13 -0
- package/dist/types/permissions.d.ts +1 -1
- package/dist/types/poll.d.ts +29 -32
- package/dist/types/poll_manager.d.ts +2 -2
- package/dist/types/reminders/Reminder.d.ts +2 -5
- package/dist/types/reminders/ReminderManager.d.ts +2 -9
- package/dist/types/search/MessageSearchSource.d.ts +4 -4
- package/dist/types/search/UserSearchSource.d.ts +1 -1
- package/dist/types/search/types.d.ts +3 -3
- package/dist/types/segment.d.ts +0 -34
- package/dist/types/signing.d.ts +105 -65
- package/dist/types/store.d.ts +1 -0
- package/dist/types/thread.d.ts +70 -34
- package/dist/types/thread_manager.d.ts +3 -3
- package/dist/types/token_manager.d.ts +15 -10
- package/dist/types/types.d.ts +197 -3404
- package/dist/types/utils/FixedSizeQueueCache.d.ts +12 -6
- package/dist/types/utils/WithSubscriptions.d.ts +2 -1
- package/dist/types/utils/concurrency.d.ts +4 -4
- package/dist/types/utils/mergeWith/mergeWith.d.ts +3 -3
- package/dist/types/utils/mergeWith/mergeWithCore.d.ts +8 -3
- package/dist/types/utils/retryable.d.ts +34 -0
- package/dist/types/utils/throttling/throttle.d.ts +36 -0
- package/dist/types/utils.d.ts +100 -194
- package/package.json +7 -3
- package/src/ChannelManager.ts +724 -0
- package/src/CooldownTimer.ts +2 -2
- package/src/EventHandlerPipeline.ts +228 -0
- package/src/LiveLocationManager.ts +12 -11
- package/src/api-client.ts +275 -0
- package/src/campaign.ts +1 -77
- package/src/channel.ts +1344 -1282
- package/src/channel_batch_updater.ts +1 -211
- package/src/channel_state.ts +144 -1013
- package/src/client.ts +936 -3995
- package/src/client_state.ts +4 -4
- package/src/configuration/InstanceConfigurationService.ts +73 -0
- package/src/configuration/index.ts +1 -0
- package/src/configuration/types.ts +81 -0
- package/src/connection.ts +145 -94
- package/src/connection_fallback.ts +29 -27
- package/src/constants.ts +1 -5
- package/src/custom_types.ts +4 -1
- package/src/entityStore/EntityStore.ts +208 -0
- package/src/entityStore/StoreBackedItemIndex.ts +115 -0
- package/src/entityStore/applyReactionLocally.ts +113 -0
- package/src/entityStore/index.ts +2 -0
- package/src/errors.ts +14 -2
- package/src/gen/chat/ChannelApi.ts +275 -0
- package/src/gen/chat/ChatApi.ts +2554 -0
- package/src/gen/model-decoders/decoders.ts +2680 -0
- package/src/gen/model-decoders/event-decoder-mapping.ts +198 -0
- package/src/gen/models/index.ts +12673 -0
- package/src/gen/moderation/ModerationApi.ts +607 -0
- package/src/gen-imports.ts +3 -0
- package/src/index.ts +11 -12
- package/src/insights.ts +6 -5
- package/src/logger.ts +28 -0
- package/src/messageComposer/LocationComposer.ts +9 -5
- package/src/messageComposer/MessageComposerEffectHandlers.ts +1 -0
- package/src/messageComposer/attachmentIdentity.ts +16 -9
- package/src/messageComposer/attachmentManager.ts +13 -8
- package/src/messageComposer/configuration/types.ts +11 -11
- package/src/messageComposer/linkPreviewsManager.ts +9 -10
- package/src/messageComposer/messageComposer.ts +57 -53
- package/src/messageComposer/middleware/messageComposer/attachments.ts +1 -2
- package/src/messageComposer/middleware/messageComposer/cleanData.ts +1 -1
- package/src/messageComposer/middleware/messageComposer/compositionValidation.ts +2 -2
- package/src/messageComposer/middleware/messageComposer/messageComposerState.ts +2 -2
- package/src/messageComposer/middleware/messageComposer/sharedLocation.ts +4 -3
- package/src/messageComposer/middleware/messageComposer/textComposer.ts +2 -2
- package/src/messageComposer/middleware/messageComposer/types.ts +3 -4
- package/src/messageComposer/middleware/messageComposer/userDataInjection.ts +9 -5
- package/src/messageComposer/middleware/pollComposer/state.ts +0 -2
- package/src/messageComposer/middleware/pollComposer/types.ts +4 -7
- package/src/messageComposer/middleware/textComposer/TextComposerMiddlewareExecutor.ts +10 -1
- package/src/messageComposer/middleware/textComposer/commandEffects.ts +4 -4
- package/src/messageComposer/middleware/textComposer/commandUtils.ts +3 -6
- package/src/messageComposer/middleware/textComposer/commands.ts +3 -3
- package/src/messageComposer/middleware/textComposer/mentionUtils.ts +1 -1
- package/src/messageComposer/middleware/textComposer/mentions.ts +31 -15
- package/src/messageComposer/middleware/textComposer/types.ts +9 -4
- package/src/messageComposer/pollComposer.ts +6 -8
- package/src/messageComposer/textComposer.ts +27 -2
- package/src/messageComposer/types.ts +6 -28
- package/src/messageDelivery/MessageDeliveryReporter.ts +101 -45
- package/src/messageDelivery/MessageReceiptsTracker.ts +294 -21
- package/src/messageOperations/MessageOperationStatePolicy.ts +77 -0
- package/src/messageOperations/MessageOperations.ts +212 -0
- package/src/messageOperations/index.ts +10 -0
- package/src/messageOperations/types.ts +64 -0
- package/src/moderation.ts +38 -431
- package/src/notifications/types.ts +8 -7
- package/src/offline-support/offline_support_api.ts +200 -133
- package/src/offline-support/offline_sync_manager.ts +23 -44
- package/src/offline-support/types.ts +23 -26
- package/src/offline-support/util.ts +5 -4
- package/src/pagination/FilterBuilder.ts +4 -1
- package/src/pagination/ItemIndex.ts +25 -0
- package/src/pagination/cursorDerivation/createdAtAroundPaginationFlags.ts +73 -0
- package/src/pagination/cursorDerivation/idAroundPaginationFlags.ts +53 -0
- package/src/pagination/cursorDerivation/index.ts +1 -0
- package/src/pagination/cursorDerivation/linearPaginationFlags.ts +86 -0
- package/src/pagination/filterCompiler.ts +196 -0
- package/src/pagination/index.ts +1 -3
- package/src/pagination/paginators/BasePaginator.ts +2859 -0
- package/src/pagination/paginators/ChannelPaginator.ts +729 -0
- package/src/pagination/paginators/MessageIntervalPaginator.ts +1116 -0
- package/src/pagination/paginators/MessagePaginator.ts +508 -0
- package/src/pagination/paginators/PinnedMessagePaginator.ts +108 -0
- package/src/pagination/paginators/ReminderPaginator.ts +107 -0
- package/src/pagination/paginators/UserGroupPaginator.ts +127 -0
- package/src/pagination/paginators/index.ts +7 -0
- package/src/pagination/paginators/stateThrottling.ts +31 -0
- package/src/pagination/sortCompiler.ts +193 -0
- package/src/pagination/types.normalization.ts +14 -0
- package/src/pagination/utility.normalization.ts +106 -0
- package/src/pagination/utility.queryChannel.ts +84 -0
- package/src/pagination/utility.search.ts +80 -0
- package/src/permissions.ts +7 -8
- package/src/poll.ts +101 -110
- package/src/poll_manager.ts +14 -8
- package/src/reminders/Reminder.ts +2 -5
- package/src/reminders/ReminderManager.ts +19 -21
- package/src/search/BaseSearchSource.ts +0 -3
- package/src/search/ChannelMemberSearchSource.ts +7 -1
- package/src/search/ChannelSearchSource.ts +10 -3
- package/src/search/MessageSearchSource.ts +29 -30
- package/src/search/UserSearchSource.ts +12 -8
- package/src/search/types.ts +3 -4
- package/src/segment.ts +1 -95
- package/src/signing.ts +107 -67
- package/src/store.ts +2 -1
- package/src/thread.ts +562 -238
- package/src/thread_manager.ts +37 -16
- package/src/token_manager.ts +21 -10
- package/src/types.ts +364 -4533
- package/src/uploadManager.ts +8 -0
- package/src/utils/FixedSizeQueueCache.ts +12 -6
- package/src/utils/WithSubscriptions.ts +2 -1
- package/src/utils/concurrency.ts +4 -4
- package/src/utils/mergeWith/mergeWith.ts +3 -3
- package/src/utils/mergeWith/mergeWithCore.ts +140 -164
- package/src/utils/mergeWith/mergeWithDiff.ts +3 -3
- package/src/utils/retryable.ts +117 -0
- package/src/utils/throttling/throttle.ts +130 -0
- package/src/utils.ts +208 -754
- package/dist/types/channel_manager.d.ts +0 -122
- package/dist/types/events.d.ts +0 -72
- package/dist/types/pagination/BasePaginator.d.ts +0 -69
- package/dist/types/pagination/ReminderPaginator.d.ts +0 -16
- package/dist/types/pagination/UserGroupPaginator.d.ts +0 -21
- package/src/channel_manager.ts +0 -830
- package/src/events.ts +0 -75
- package/src/pagination/BasePaginator.ts +0 -184
- package/src/pagination/ReminderPaginator.ts +0 -56
- package/src/pagination/UserGroupPaginator.ts +0 -93
|
@@ -0,0 +1,2554 @@
|
|
|
1
|
+
import type { ApiClient, StreamResponse } from '../../gen-imports';
|
|
2
|
+
import type {
|
|
3
|
+
AddUserGroupMembersRequest,
|
|
4
|
+
AddUserGroupMembersResponse,
|
|
5
|
+
BlockUsersRequest,
|
|
6
|
+
BlockUsersResponse,
|
|
7
|
+
CastPollVoteRequest,
|
|
8
|
+
ChannelGetOrCreateRequest,
|
|
9
|
+
ChannelStateResponse,
|
|
10
|
+
ChannelStopWatchingRequest,
|
|
11
|
+
CreateBlockListRequest,
|
|
12
|
+
CreateBlockListResponse,
|
|
13
|
+
CreateDeviceRequest,
|
|
14
|
+
CreateDraftRequest,
|
|
15
|
+
CreateDraftResponse,
|
|
16
|
+
CreateGuestRequest,
|
|
17
|
+
CreateGuestResponse,
|
|
18
|
+
CreatePollOptionRequest,
|
|
19
|
+
CreatePollRequest,
|
|
20
|
+
CreateReminderRequest,
|
|
21
|
+
CreateUserGroupRequest,
|
|
22
|
+
CreateUserGroupResponse,
|
|
23
|
+
DeleteChannelResponse,
|
|
24
|
+
DeleteChannelsRequest,
|
|
25
|
+
DeleteChannelsResponse,
|
|
26
|
+
DeleteMessageResponse,
|
|
27
|
+
DeleteReactionResponse,
|
|
28
|
+
DeleteReminderResponse,
|
|
29
|
+
EventResponse,
|
|
30
|
+
FileUploadRequest,
|
|
31
|
+
FileUploadResponse,
|
|
32
|
+
GetApplicationResponse,
|
|
33
|
+
GetBlockedUsersResponse,
|
|
34
|
+
GetDraftResponse,
|
|
35
|
+
GetManyMessagesResponse,
|
|
36
|
+
GetMessageResponse,
|
|
37
|
+
GetOGResponse,
|
|
38
|
+
GetReactionsResponse,
|
|
39
|
+
GetRepliesResponse,
|
|
40
|
+
GetThreadResponse,
|
|
41
|
+
GetUserGroupResponse,
|
|
42
|
+
GroupedQueryChannelsRequest,
|
|
43
|
+
GroupedQueryChannelsResponse,
|
|
44
|
+
HideChannelRequest,
|
|
45
|
+
HideChannelResponse,
|
|
46
|
+
ImageUploadRequest,
|
|
47
|
+
ImageUploadResponse,
|
|
48
|
+
ListBlockListResponse,
|
|
49
|
+
ListDevicesResponse,
|
|
50
|
+
ListUserGroupsResponse,
|
|
51
|
+
MarkChannelsReadRequest,
|
|
52
|
+
MarkDeliveredRequest,
|
|
53
|
+
MarkDeliveredResponse,
|
|
54
|
+
MarkReadRequest,
|
|
55
|
+
MarkReadResponse,
|
|
56
|
+
MarkUnreadRequest,
|
|
57
|
+
MembersResponse,
|
|
58
|
+
MessageActionRequest,
|
|
59
|
+
MessageActionResponse,
|
|
60
|
+
MuteChannelRequest,
|
|
61
|
+
MuteChannelResponse,
|
|
62
|
+
PollOptionResponse,
|
|
63
|
+
PollResponse,
|
|
64
|
+
PollVoteResponse,
|
|
65
|
+
PollVotesResponse,
|
|
66
|
+
QueryBannedUsersPayload,
|
|
67
|
+
QueryBannedUsersResponse,
|
|
68
|
+
QueryChannelsRequest,
|
|
69
|
+
QueryChannelsResponse,
|
|
70
|
+
QueryDraftsRequest,
|
|
71
|
+
QueryDraftsResponse,
|
|
72
|
+
QueryFutureChannelBansPayload,
|
|
73
|
+
QueryFutureChannelBansResponse,
|
|
74
|
+
QueryMembersPayload,
|
|
75
|
+
QueryMessageFlagsPayload,
|
|
76
|
+
QueryMessageFlagsResponse,
|
|
77
|
+
QueryPollsRequest,
|
|
78
|
+
QueryPollsResponse,
|
|
79
|
+
QueryPollVotesRequest,
|
|
80
|
+
QueryReactionsRequest,
|
|
81
|
+
QueryReactionsResponse,
|
|
82
|
+
QueryRemindersRequest,
|
|
83
|
+
QueryRemindersResponse,
|
|
84
|
+
QueryThreadsRequest,
|
|
85
|
+
QueryThreadsResponse,
|
|
86
|
+
QueryUsersPayload,
|
|
87
|
+
QueryUsersResponse,
|
|
88
|
+
ReminderResponseData,
|
|
89
|
+
RemoveUserGroupMembersRequest,
|
|
90
|
+
RemoveUserGroupMembersResponse,
|
|
91
|
+
Response,
|
|
92
|
+
SearchPayload,
|
|
93
|
+
SearchResponse,
|
|
94
|
+
SearchRolesResponse,
|
|
95
|
+
SearchUserGroupsResponse,
|
|
96
|
+
SendEventRequest,
|
|
97
|
+
SendMessageRequest,
|
|
98
|
+
SendMessageResponse,
|
|
99
|
+
SendReactionRequest,
|
|
100
|
+
SendReactionResponse,
|
|
101
|
+
SharedLocationResponse,
|
|
102
|
+
SharedLocationsResponse,
|
|
103
|
+
ShowChannelRequest,
|
|
104
|
+
ShowChannelResponse,
|
|
105
|
+
SortParamRequest,
|
|
106
|
+
SyncRequest,
|
|
107
|
+
SyncResponse,
|
|
108
|
+
TranslateMessageRequest,
|
|
109
|
+
TruncateChannelRequest,
|
|
110
|
+
TruncateChannelResponse,
|
|
111
|
+
UnblockUsersRequest,
|
|
112
|
+
UnblockUsersResponse,
|
|
113
|
+
UnmuteChannelRequest,
|
|
114
|
+
UnmuteResponse,
|
|
115
|
+
UpdateBlockListRequest,
|
|
116
|
+
UpdateBlockListResponse,
|
|
117
|
+
UpdateChannelPartialRequest,
|
|
118
|
+
UpdateChannelPartialResponse,
|
|
119
|
+
UpdateChannelRequest,
|
|
120
|
+
UpdateChannelResponse,
|
|
121
|
+
UpdateLiveLocationRequest,
|
|
122
|
+
UpdateMemberPartialRequest,
|
|
123
|
+
UpdateMemberPartialResponse,
|
|
124
|
+
UpdateMessagePartialRequest,
|
|
125
|
+
UpdateMessagePartialResponse,
|
|
126
|
+
UpdateMessageRequest,
|
|
127
|
+
UpdateMessageResponse,
|
|
128
|
+
UpdatePollOptionRequest,
|
|
129
|
+
UpdatePollPartialRequest,
|
|
130
|
+
UpdatePollRequest,
|
|
131
|
+
UpdateReminderRequest,
|
|
132
|
+
UpdateReminderResponse,
|
|
133
|
+
UpdateThreadPartialRequest,
|
|
134
|
+
UpdateThreadPartialResponse,
|
|
135
|
+
UpdateUserGroupRequest,
|
|
136
|
+
UpdateUserGroupResponse,
|
|
137
|
+
UpdateUsersPartialRequest,
|
|
138
|
+
UpdateUsersRequest,
|
|
139
|
+
UpdateUsersResponse,
|
|
140
|
+
UploadChannelFileRequest,
|
|
141
|
+
UploadChannelFileResponse,
|
|
142
|
+
UploadChannelRequest,
|
|
143
|
+
UploadChannelResponse,
|
|
144
|
+
UpsertPushPreferencesRequest,
|
|
145
|
+
UpsertPushPreferencesResponse,
|
|
146
|
+
WrappedUnreadCountsResponse,
|
|
147
|
+
WSAuthMessage,
|
|
148
|
+
} from '../models';
|
|
149
|
+
import { decoders } from '../model-decoders/decoders';
|
|
150
|
+
|
|
151
|
+
export class ChatApi {
|
|
152
|
+
constructor(public readonly apiClient: ApiClient) {}
|
|
153
|
+
|
|
154
|
+
async getApp(): Promise<StreamResponse<GetApplicationResponse>> {
|
|
155
|
+
const response = await this.apiClient.sendRequest<
|
|
156
|
+
StreamResponse<GetApplicationResponse>
|
|
157
|
+
>('GET', '/api/v2/app', undefined, undefined);
|
|
158
|
+
|
|
159
|
+
decoders['GetApplicationResponse']?.(response.body);
|
|
160
|
+
|
|
161
|
+
return { ...response.body, metadata: response.metadata };
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
async listBlockLists(request?: {
|
|
165
|
+
team?: string;
|
|
166
|
+
}): Promise<StreamResponse<ListBlockListResponse>> {
|
|
167
|
+
const queryParams = {
|
|
168
|
+
team: request?.team,
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
const response = await this.apiClient.sendRequest<
|
|
172
|
+
StreamResponse<ListBlockListResponse>
|
|
173
|
+
>('GET', '/api/v2/blocklists', undefined, queryParams);
|
|
174
|
+
|
|
175
|
+
decoders['ListBlockListResponse']?.(response.body);
|
|
176
|
+
|
|
177
|
+
return { ...response.body, metadata: response.metadata };
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
async createBlockList(
|
|
181
|
+
request: CreateBlockListRequest,
|
|
182
|
+
): Promise<StreamResponse<CreateBlockListResponse>> {
|
|
183
|
+
const body = {
|
|
184
|
+
name: request?.name,
|
|
185
|
+
words: request?.words,
|
|
186
|
+
is_confusable_folding_enabled: request?.is_confusable_folding_enabled,
|
|
187
|
+
is_leet_check_enabled: request?.is_leet_check_enabled,
|
|
188
|
+
is_plural_check_enabled: request?.is_plural_check_enabled,
|
|
189
|
+
is_substring_matching_enabled: request?.is_substring_matching_enabled,
|
|
190
|
+
team: request?.team,
|
|
191
|
+
type: request?.type,
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
const response = await this.apiClient.sendRequest<
|
|
195
|
+
StreamResponse<CreateBlockListResponse>
|
|
196
|
+
>('POST', '/api/v2/blocklists', undefined, undefined, body, 'application/json');
|
|
197
|
+
|
|
198
|
+
decoders['CreateBlockListResponse']?.(response.body);
|
|
199
|
+
|
|
200
|
+
return { ...response.body, metadata: response.metadata };
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
async deleteBlockList(request: {
|
|
204
|
+
name: string;
|
|
205
|
+
team?: string;
|
|
206
|
+
}): Promise<StreamResponse<Response>> {
|
|
207
|
+
const queryParams = {
|
|
208
|
+
team: request?.team,
|
|
209
|
+
};
|
|
210
|
+
const pathParams = {
|
|
211
|
+
name: request?.name,
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
const response = await this.apiClient.sendRequest<StreamResponse<Response>>(
|
|
215
|
+
'DELETE',
|
|
216
|
+
'/api/v2/blocklists/{name}',
|
|
217
|
+
pathParams,
|
|
218
|
+
queryParams,
|
|
219
|
+
);
|
|
220
|
+
|
|
221
|
+
decoders['Response']?.(response.body);
|
|
222
|
+
|
|
223
|
+
return { ...response.body, metadata: response.metadata };
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
async updateBlockList(
|
|
227
|
+
request: UpdateBlockListRequest & { name: string },
|
|
228
|
+
): Promise<StreamResponse<UpdateBlockListResponse>> {
|
|
229
|
+
const pathParams = {
|
|
230
|
+
name: request?.name,
|
|
231
|
+
};
|
|
232
|
+
const body = {
|
|
233
|
+
is_confusable_folding_enabled: request?.is_confusable_folding_enabled,
|
|
234
|
+
is_leet_check_enabled: request?.is_leet_check_enabled,
|
|
235
|
+
is_plural_check_enabled: request?.is_plural_check_enabled,
|
|
236
|
+
is_substring_matching_enabled: request?.is_substring_matching_enabled,
|
|
237
|
+
team: request?.team,
|
|
238
|
+
words: request?.words,
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
const response = await this.apiClient.sendRequest<
|
|
242
|
+
StreamResponse<UpdateBlockListResponse>
|
|
243
|
+
>(
|
|
244
|
+
'PUT',
|
|
245
|
+
'/api/v2/blocklists/{name}',
|
|
246
|
+
pathParams,
|
|
247
|
+
undefined,
|
|
248
|
+
body,
|
|
249
|
+
'application/json',
|
|
250
|
+
);
|
|
251
|
+
|
|
252
|
+
decoders['UpdateBlockListResponse']?.(response.body);
|
|
253
|
+
|
|
254
|
+
return { ...response.body, metadata: response.metadata };
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
async queryChannels(
|
|
258
|
+
request?: QueryChannelsRequest & { connection_id?: string },
|
|
259
|
+
): Promise<StreamResponse<QueryChannelsResponse>> {
|
|
260
|
+
const queryParams = {
|
|
261
|
+
connection_id: request?.connection_id,
|
|
262
|
+
};
|
|
263
|
+
const body = {
|
|
264
|
+
limit: request?.limit,
|
|
265
|
+
member_limit: request?.member_limit,
|
|
266
|
+
message_limit: request?.message_limit,
|
|
267
|
+
offset: request?.offset,
|
|
268
|
+
predefined_filter: request?.predefined_filter,
|
|
269
|
+
presence: request?.presence,
|
|
270
|
+
state: request?.state,
|
|
271
|
+
watch: request?.watch,
|
|
272
|
+
sort: request?.sort,
|
|
273
|
+
filter_conditions: request?.filter_conditions,
|
|
274
|
+
filter_values: request?.filter_values,
|
|
275
|
+
sort_values: request?.sort_values,
|
|
276
|
+
};
|
|
277
|
+
|
|
278
|
+
const response = await this.apiClient.sendRequest<
|
|
279
|
+
StreamResponse<QueryChannelsResponse>
|
|
280
|
+
>('POST', '/api/v2/chat/channels', undefined, queryParams, body, 'application/json');
|
|
281
|
+
|
|
282
|
+
decoders['QueryChannelsResponse']?.(response.body);
|
|
283
|
+
|
|
284
|
+
return { ...response.body, metadata: response.metadata };
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
async deleteChannels(
|
|
288
|
+
request: DeleteChannelsRequest,
|
|
289
|
+
): Promise<StreamResponse<DeleteChannelsResponse>> {
|
|
290
|
+
const body = {
|
|
291
|
+
cids: request?.cids,
|
|
292
|
+
hard_delete: request?.hard_delete,
|
|
293
|
+
};
|
|
294
|
+
|
|
295
|
+
const response = await this.apiClient.sendRequest<
|
|
296
|
+
StreamResponse<DeleteChannelsResponse>
|
|
297
|
+
>(
|
|
298
|
+
'POST',
|
|
299
|
+
'/api/v2/chat/channels/delete',
|
|
300
|
+
undefined,
|
|
301
|
+
undefined,
|
|
302
|
+
body,
|
|
303
|
+
'application/json',
|
|
304
|
+
);
|
|
305
|
+
|
|
306
|
+
decoders['DeleteChannelsResponse']?.(response.body);
|
|
307
|
+
|
|
308
|
+
return { ...response.body, metadata: response.metadata };
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
async markDelivered(
|
|
312
|
+
request?: MarkDeliveredRequest,
|
|
313
|
+
): Promise<StreamResponse<MarkDeliveredResponse>> {
|
|
314
|
+
const body = {
|
|
315
|
+
latest_delivered_messages: request?.latest_delivered_messages,
|
|
316
|
+
};
|
|
317
|
+
|
|
318
|
+
const response = await this.apiClient.sendRequest<
|
|
319
|
+
StreamResponse<MarkDeliveredResponse>
|
|
320
|
+
>(
|
|
321
|
+
'POST',
|
|
322
|
+
'/api/v2/chat/channels/delivered',
|
|
323
|
+
undefined,
|
|
324
|
+
undefined,
|
|
325
|
+
body,
|
|
326
|
+
'application/json',
|
|
327
|
+
);
|
|
328
|
+
|
|
329
|
+
decoders['MarkDeliveredResponse']?.(response.body);
|
|
330
|
+
|
|
331
|
+
return { ...response.body, metadata: response.metadata };
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
async groupedQueryChannels(
|
|
335
|
+
request?: GroupedQueryChannelsRequest & { connection_id?: string },
|
|
336
|
+
): Promise<StreamResponse<GroupedQueryChannelsResponse>> {
|
|
337
|
+
const queryParams = {
|
|
338
|
+
connection_id: request?.connection_id,
|
|
339
|
+
};
|
|
340
|
+
const body = {
|
|
341
|
+
limit: request?.limit,
|
|
342
|
+
presence: request?.presence,
|
|
343
|
+
watch: request?.watch,
|
|
344
|
+
groups: request?.groups,
|
|
345
|
+
};
|
|
346
|
+
|
|
347
|
+
const response = await this.apiClient.sendRequest<
|
|
348
|
+
StreamResponse<GroupedQueryChannelsResponse>
|
|
349
|
+
>(
|
|
350
|
+
'POST',
|
|
351
|
+
'/api/v2/chat/channels/grouped',
|
|
352
|
+
undefined,
|
|
353
|
+
queryParams,
|
|
354
|
+
body,
|
|
355
|
+
'application/json',
|
|
356
|
+
);
|
|
357
|
+
|
|
358
|
+
decoders['GroupedQueryChannelsResponse']?.(response.body);
|
|
359
|
+
|
|
360
|
+
return { ...response.body, metadata: response.metadata };
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
async markChannelsRead(
|
|
364
|
+
request?: MarkChannelsReadRequest,
|
|
365
|
+
): Promise<StreamResponse<MarkReadResponse>> {
|
|
366
|
+
const body = {
|
|
367
|
+
read_by_channel: request?.read_by_channel,
|
|
368
|
+
};
|
|
369
|
+
|
|
370
|
+
const response = await this.apiClient.sendRequest<StreamResponse<MarkReadResponse>>(
|
|
371
|
+
'POST',
|
|
372
|
+
'/api/v2/chat/channels/read',
|
|
373
|
+
undefined,
|
|
374
|
+
undefined,
|
|
375
|
+
body,
|
|
376
|
+
'application/json',
|
|
377
|
+
);
|
|
378
|
+
|
|
379
|
+
decoders['MarkReadResponse']?.(response.body);
|
|
380
|
+
|
|
381
|
+
return { ...response.body, metadata: response.metadata };
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
async getOrCreateDistinctChannel(
|
|
385
|
+
request: ChannelGetOrCreateRequest & { type: string; connection_id?: string },
|
|
386
|
+
): Promise<StreamResponse<ChannelStateResponse>> {
|
|
387
|
+
const queryParams = {
|
|
388
|
+
connection_id: request?.connection_id,
|
|
389
|
+
};
|
|
390
|
+
const pathParams = {
|
|
391
|
+
type: request?.type,
|
|
392
|
+
};
|
|
393
|
+
const body = {
|
|
394
|
+
hide_for_creator: request?.hide_for_creator,
|
|
395
|
+
presence: request?.presence,
|
|
396
|
+
state: request?.state,
|
|
397
|
+
thread_unread_counts: request?.thread_unread_counts,
|
|
398
|
+
watch: request?.watch,
|
|
399
|
+
data: request?.data,
|
|
400
|
+
members: request?.members,
|
|
401
|
+
messages: request?.messages,
|
|
402
|
+
watchers: request?.watchers,
|
|
403
|
+
};
|
|
404
|
+
|
|
405
|
+
const response = await this.apiClient.sendRequest<
|
|
406
|
+
StreamResponse<ChannelStateResponse>
|
|
407
|
+
>(
|
|
408
|
+
'POST',
|
|
409
|
+
'/api/v2/chat/channels/{type}/query',
|
|
410
|
+
pathParams,
|
|
411
|
+
queryParams,
|
|
412
|
+
body,
|
|
413
|
+
'application/json',
|
|
414
|
+
);
|
|
415
|
+
|
|
416
|
+
decoders['ChannelStateResponse']?.(response.body);
|
|
417
|
+
|
|
418
|
+
return { ...response.body, metadata: response.metadata };
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
async deleteChannel(request: {
|
|
422
|
+
type: string;
|
|
423
|
+
id: string;
|
|
424
|
+
hard_delete?: boolean;
|
|
425
|
+
}): Promise<StreamResponse<DeleteChannelResponse>> {
|
|
426
|
+
const queryParams = {
|
|
427
|
+
hard_delete: request?.hard_delete,
|
|
428
|
+
};
|
|
429
|
+
const pathParams = {
|
|
430
|
+
type: request?.type,
|
|
431
|
+
id: request?.id,
|
|
432
|
+
};
|
|
433
|
+
|
|
434
|
+
const response = await this.apiClient.sendRequest<
|
|
435
|
+
StreamResponse<DeleteChannelResponse>
|
|
436
|
+
>('DELETE', '/api/v2/chat/channels/{type}/{id}', pathParams, queryParams);
|
|
437
|
+
|
|
438
|
+
decoders['DeleteChannelResponse']?.(response.body);
|
|
439
|
+
|
|
440
|
+
return { ...response.body, metadata: response.metadata };
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
async updateChannelPartial(
|
|
444
|
+
request: UpdateChannelPartialRequest & { type: string; id: string },
|
|
445
|
+
): Promise<StreamResponse<UpdateChannelPartialResponse>> {
|
|
446
|
+
const pathParams = {
|
|
447
|
+
type: request?.type,
|
|
448
|
+
id: request?.id,
|
|
449
|
+
};
|
|
450
|
+
const body = {
|
|
451
|
+
unset: request?.unset,
|
|
452
|
+
set: request?.set,
|
|
453
|
+
};
|
|
454
|
+
|
|
455
|
+
const response = await this.apiClient.sendRequest<
|
|
456
|
+
StreamResponse<UpdateChannelPartialResponse>
|
|
457
|
+
>(
|
|
458
|
+
'PATCH',
|
|
459
|
+
'/api/v2/chat/channels/{type}/{id}',
|
|
460
|
+
pathParams,
|
|
461
|
+
undefined,
|
|
462
|
+
body,
|
|
463
|
+
'application/json',
|
|
464
|
+
);
|
|
465
|
+
|
|
466
|
+
decoders['UpdateChannelPartialResponse']?.(response.body);
|
|
467
|
+
|
|
468
|
+
return { ...response.body, metadata: response.metadata };
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
async updateChannel(
|
|
472
|
+
request: UpdateChannelRequest & { type: string; id: string },
|
|
473
|
+
): Promise<StreamResponse<UpdateChannelResponse>> {
|
|
474
|
+
const pathParams = {
|
|
475
|
+
type: request?.type,
|
|
476
|
+
id: request?.id,
|
|
477
|
+
};
|
|
478
|
+
const body = {
|
|
479
|
+
accept_invite: request?.accept_invite,
|
|
480
|
+
cooldown: request?.cooldown,
|
|
481
|
+
hide_history: request?.hide_history,
|
|
482
|
+
hide_history_before: request?.hide_history_before,
|
|
483
|
+
reject_invite: request?.reject_invite,
|
|
484
|
+
skip_push: request?.skip_push,
|
|
485
|
+
add_filter_tags: request?.add_filter_tags,
|
|
486
|
+
add_members: request?.add_members,
|
|
487
|
+
add_moderators: request?.add_moderators,
|
|
488
|
+
assign_roles: request?.assign_roles,
|
|
489
|
+
demote_moderators: request?.demote_moderators,
|
|
490
|
+
invites: request?.invites,
|
|
491
|
+
remove_filter_tags: request?.remove_filter_tags,
|
|
492
|
+
remove_members: request?.remove_members,
|
|
493
|
+
data: request?.data,
|
|
494
|
+
message: request?.message,
|
|
495
|
+
};
|
|
496
|
+
|
|
497
|
+
const response = await this.apiClient.sendRequest<
|
|
498
|
+
StreamResponse<UpdateChannelResponse>
|
|
499
|
+
>(
|
|
500
|
+
'POST',
|
|
501
|
+
'/api/v2/chat/channels/{type}/{id}',
|
|
502
|
+
pathParams,
|
|
503
|
+
undefined,
|
|
504
|
+
body,
|
|
505
|
+
'application/json',
|
|
506
|
+
);
|
|
507
|
+
|
|
508
|
+
decoders['UpdateChannelResponse']?.(response.body);
|
|
509
|
+
|
|
510
|
+
return { ...response.body, metadata: response.metadata };
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
async deleteDraft(request: {
|
|
514
|
+
type: string;
|
|
515
|
+
id: string;
|
|
516
|
+
parent_id?: string;
|
|
517
|
+
}): Promise<StreamResponse<Response>> {
|
|
518
|
+
const queryParams = {
|
|
519
|
+
parent_id: request?.parent_id,
|
|
520
|
+
};
|
|
521
|
+
const pathParams = {
|
|
522
|
+
type: request?.type,
|
|
523
|
+
id: request?.id,
|
|
524
|
+
};
|
|
525
|
+
|
|
526
|
+
const response = await this.apiClient.sendRequest<StreamResponse<Response>>(
|
|
527
|
+
'DELETE',
|
|
528
|
+
'/api/v2/chat/channels/{type}/{id}/draft',
|
|
529
|
+
pathParams,
|
|
530
|
+
queryParams,
|
|
531
|
+
);
|
|
532
|
+
|
|
533
|
+
decoders['Response']?.(response.body);
|
|
534
|
+
|
|
535
|
+
return { ...response.body, metadata: response.metadata };
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
async getDraft(request: {
|
|
539
|
+
type: string;
|
|
540
|
+
id: string;
|
|
541
|
+
parent_id?: string;
|
|
542
|
+
}): Promise<StreamResponse<GetDraftResponse>> {
|
|
543
|
+
const queryParams = {
|
|
544
|
+
parent_id: request?.parent_id,
|
|
545
|
+
};
|
|
546
|
+
const pathParams = {
|
|
547
|
+
type: request?.type,
|
|
548
|
+
id: request?.id,
|
|
549
|
+
};
|
|
550
|
+
|
|
551
|
+
const response = await this.apiClient.sendRequest<StreamResponse<GetDraftResponse>>(
|
|
552
|
+
'GET',
|
|
553
|
+
'/api/v2/chat/channels/{type}/{id}/draft',
|
|
554
|
+
pathParams,
|
|
555
|
+
queryParams,
|
|
556
|
+
);
|
|
557
|
+
|
|
558
|
+
decoders['GetDraftResponse']?.(response.body);
|
|
559
|
+
|
|
560
|
+
return { ...response.body, metadata: response.metadata };
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
async createDraft(
|
|
564
|
+
request: CreateDraftRequest & { type: string; id: string },
|
|
565
|
+
): Promise<StreamResponse<CreateDraftResponse>> {
|
|
566
|
+
const pathParams = {
|
|
567
|
+
type: request?.type,
|
|
568
|
+
id: request?.id,
|
|
569
|
+
};
|
|
570
|
+
const body = {
|
|
571
|
+
message: request?.message,
|
|
572
|
+
};
|
|
573
|
+
|
|
574
|
+
const response = await this.apiClient.sendRequest<
|
|
575
|
+
StreamResponse<CreateDraftResponse>
|
|
576
|
+
>(
|
|
577
|
+
'POST',
|
|
578
|
+
'/api/v2/chat/channels/{type}/{id}/draft',
|
|
579
|
+
pathParams,
|
|
580
|
+
undefined,
|
|
581
|
+
body,
|
|
582
|
+
'application/json',
|
|
583
|
+
);
|
|
584
|
+
|
|
585
|
+
decoders['CreateDraftResponse']?.(response.body);
|
|
586
|
+
|
|
587
|
+
return { ...response.body, metadata: response.metadata };
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
async sendEvent(
|
|
591
|
+
request: SendEventRequest & { type: string; id: string },
|
|
592
|
+
): Promise<StreamResponse<EventResponse>> {
|
|
593
|
+
const pathParams = {
|
|
594
|
+
type: request?.type,
|
|
595
|
+
id: request?.id,
|
|
596
|
+
};
|
|
597
|
+
const body = {
|
|
598
|
+
event: request?.event,
|
|
599
|
+
};
|
|
600
|
+
|
|
601
|
+
const response = await this.apiClient.sendRequest<StreamResponse<EventResponse>>(
|
|
602
|
+
'POST',
|
|
603
|
+
'/api/v2/chat/channels/{type}/{id}/event',
|
|
604
|
+
pathParams,
|
|
605
|
+
undefined,
|
|
606
|
+
body,
|
|
607
|
+
'application/json',
|
|
608
|
+
);
|
|
609
|
+
|
|
610
|
+
decoders['EventResponse']?.(response.body);
|
|
611
|
+
|
|
612
|
+
return { ...response.body, metadata: response.metadata };
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
async deleteChannelFile(request: {
|
|
616
|
+
type: string;
|
|
617
|
+
id: string;
|
|
618
|
+
url?: string;
|
|
619
|
+
}): Promise<StreamResponse<Response>> {
|
|
620
|
+
const queryParams = {
|
|
621
|
+
url: request?.url,
|
|
622
|
+
};
|
|
623
|
+
const pathParams = {
|
|
624
|
+
type: request?.type,
|
|
625
|
+
id: request?.id,
|
|
626
|
+
};
|
|
627
|
+
|
|
628
|
+
const response = await this.apiClient.sendRequest<StreamResponse<Response>>(
|
|
629
|
+
'DELETE',
|
|
630
|
+
'/api/v2/chat/channels/{type}/{id}/file',
|
|
631
|
+
pathParams,
|
|
632
|
+
queryParams,
|
|
633
|
+
);
|
|
634
|
+
|
|
635
|
+
decoders['Response']?.(response.body);
|
|
636
|
+
|
|
637
|
+
return { ...response.body, metadata: response.metadata };
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
async uploadChannelFile(
|
|
641
|
+
request: UploadChannelFileRequest & { type: string; id: string },
|
|
642
|
+
): Promise<StreamResponse<UploadChannelFileResponse>> {
|
|
643
|
+
const pathParams = {
|
|
644
|
+
type: request?.type,
|
|
645
|
+
id: request?.id,
|
|
646
|
+
};
|
|
647
|
+
const body = {
|
|
648
|
+
file: request?.file,
|
|
649
|
+
user: request?.user,
|
|
650
|
+
};
|
|
651
|
+
|
|
652
|
+
const response = await this.apiClient.sendRequest<
|
|
653
|
+
StreamResponse<UploadChannelFileResponse>
|
|
654
|
+
>(
|
|
655
|
+
'POST',
|
|
656
|
+
'/api/v2/chat/channels/{type}/{id}/file',
|
|
657
|
+
pathParams,
|
|
658
|
+
undefined,
|
|
659
|
+
body,
|
|
660
|
+
'multipart/form-data',
|
|
661
|
+
);
|
|
662
|
+
|
|
663
|
+
decoders['UploadChannelFileResponse']?.(response.body);
|
|
664
|
+
|
|
665
|
+
return { ...response.body, metadata: response.metadata };
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
async hideChannel(
|
|
669
|
+
request: HideChannelRequest & { type: string; id: string },
|
|
670
|
+
): Promise<StreamResponse<HideChannelResponse>> {
|
|
671
|
+
const pathParams = {
|
|
672
|
+
type: request?.type,
|
|
673
|
+
id: request?.id,
|
|
674
|
+
};
|
|
675
|
+
const body = {
|
|
676
|
+
clear_history: request?.clear_history,
|
|
677
|
+
};
|
|
678
|
+
|
|
679
|
+
const response = await this.apiClient.sendRequest<
|
|
680
|
+
StreamResponse<HideChannelResponse>
|
|
681
|
+
>(
|
|
682
|
+
'POST',
|
|
683
|
+
'/api/v2/chat/channels/{type}/{id}/hide',
|
|
684
|
+
pathParams,
|
|
685
|
+
undefined,
|
|
686
|
+
body,
|
|
687
|
+
'application/json',
|
|
688
|
+
);
|
|
689
|
+
|
|
690
|
+
decoders['HideChannelResponse']?.(response.body);
|
|
691
|
+
|
|
692
|
+
return { ...response.body, metadata: response.metadata };
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
async deleteChannelImage(request: {
|
|
696
|
+
type: string;
|
|
697
|
+
id: string;
|
|
698
|
+
url?: string;
|
|
699
|
+
}): Promise<StreamResponse<Response>> {
|
|
700
|
+
const queryParams = {
|
|
701
|
+
url: request?.url,
|
|
702
|
+
};
|
|
703
|
+
const pathParams = {
|
|
704
|
+
type: request?.type,
|
|
705
|
+
id: request?.id,
|
|
706
|
+
};
|
|
707
|
+
|
|
708
|
+
const response = await this.apiClient.sendRequest<StreamResponse<Response>>(
|
|
709
|
+
'DELETE',
|
|
710
|
+
'/api/v2/chat/channels/{type}/{id}/image',
|
|
711
|
+
pathParams,
|
|
712
|
+
queryParams,
|
|
713
|
+
);
|
|
714
|
+
|
|
715
|
+
decoders['Response']?.(response.body);
|
|
716
|
+
|
|
717
|
+
return { ...response.body, metadata: response.metadata };
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
async uploadChannelImage(
|
|
721
|
+
request: UploadChannelRequest & { type: string; id: string },
|
|
722
|
+
): Promise<StreamResponse<UploadChannelResponse>> {
|
|
723
|
+
const pathParams = {
|
|
724
|
+
type: request?.type,
|
|
725
|
+
id: request?.id,
|
|
726
|
+
};
|
|
727
|
+
const body = {
|
|
728
|
+
file: request?.file,
|
|
729
|
+
upload_sizes: request?.upload_sizes,
|
|
730
|
+
user: request?.user,
|
|
731
|
+
};
|
|
732
|
+
|
|
733
|
+
const response = await this.apiClient.sendRequest<
|
|
734
|
+
StreamResponse<UploadChannelResponse>
|
|
735
|
+
>(
|
|
736
|
+
'POST',
|
|
737
|
+
'/api/v2/chat/channels/{type}/{id}/image',
|
|
738
|
+
pathParams,
|
|
739
|
+
undefined,
|
|
740
|
+
body,
|
|
741
|
+
'multipart/form-data',
|
|
742
|
+
);
|
|
743
|
+
|
|
744
|
+
decoders['UploadChannelResponse']?.(response.body);
|
|
745
|
+
|
|
746
|
+
return { ...response.body, metadata: response.metadata };
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
async updateMemberPartial(
|
|
750
|
+
request: UpdateMemberPartialRequest & { type: string; id: string },
|
|
751
|
+
): Promise<StreamResponse<UpdateMemberPartialResponse>> {
|
|
752
|
+
const pathParams = {
|
|
753
|
+
type: request?.type,
|
|
754
|
+
id: request?.id,
|
|
755
|
+
};
|
|
756
|
+
const body = {
|
|
757
|
+
unset: request?.unset,
|
|
758
|
+
set: request?.set,
|
|
759
|
+
};
|
|
760
|
+
|
|
761
|
+
const response = await this.apiClient.sendRequest<
|
|
762
|
+
StreamResponse<UpdateMemberPartialResponse>
|
|
763
|
+
>(
|
|
764
|
+
'PATCH',
|
|
765
|
+
'/api/v2/chat/channels/{type}/{id}/member',
|
|
766
|
+
pathParams,
|
|
767
|
+
undefined,
|
|
768
|
+
body,
|
|
769
|
+
'application/json',
|
|
770
|
+
);
|
|
771
|
+
|
|
772
|
+
decoders['UpdateMemberPartialResponse']?.(response.body);
|
|
773
|
+
|
|
774
|
+
return { ...response.body, metadata: response.metadata };
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
async sendMessage(
|
|
778
|
+
request: SendMessageRequest & { type: string; id: string },
|
|
779
|
+
): Promise<StreamResponse<SendMessageResponse>> {
|
|
780
|
+
const pathParams = {
|
|
781
|
+
type: request?.type,
|
|
782
|
+
id: request?.id,
|
|
783
|
+
};
|
|
784
|
+
const body = {
|
|
785
|
+
message: request?.message,
|
|
786
|
+
keep_channel_hidden: request?.keep_channel_hidden,
|
|
787
|
+
skip_enrich_url: request?.skip_enrich_url,
|
|
788
|
+
skip_push: request?.skip_push,
|
|
789
|
+
};
|
|
790
|
+
|
|
791
|
+
const response = await this.apiClient.sendRequest<
|
|
792
|
+
StreamResponse<SendMessageResponse>
|
|
793
|
+
>(
|
|
794
|
+
'POST',
|
|
795
|
+
'/api/v2/chat/channels/{type}/{id}/message',
|
|
796
|
+
pathParams,
|
|
797
|
+
undefined,
|
|
798
|
+
body,
|
|
799
|
+
'application/json',
|
|
800
|
+
);
|
|
801
|
+
|
|
802
|
+
decoders['SendMessageResponse']?.(response.body);
|
|
803
|
+
|
|
804
|
+
return { ...response.body, metadata: response.metadata };
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
async getManyMessages(request: {
|
|
808
|
+
type: string;
|
|
809
|
+
id: string;
|
|
810
|
+
ids: Array<string>;
|
|
811
|
+
}): Promise<StreamResponse<GetManyMessagesResponse>> {
|
|
812
|
+
const queryParams = {
|
|
813
|
+
ids: request?.ids,
|
|
814
|
+
};
|
|
815
|
+
const pathParams = {
|
|
816
|
+
type: request?.type,
|
|
817
|
+
id: request?.id,
|
|
818
|
+
};
|
|
819
|
+
|
|
820
|
+
const response = await this.apiClient.sendRequest<
|
|
821
|
+
StreamResponse<GetManyMessagesResponse>
|
|
822
|
+
>('GET', '/api/v2/chat/channels/{type}/{id}/messages', pathParams, queryParams);
|
|
823
|
+
|
|
824
|
+
decoders['GetManyMessagesResponse']?.(response.body);
|
|
825
|
+
|
|
826
|
+
return { ...response.body, metadata: response.metadata };
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
async getOrCreateChannel(
|
|
830
|
+
request: ChannelGetOrCreateRequest & {
|
|
831
|
+
type: string;
|
|
832
|
+
id: string;
|
|
833
|
+
connection_id?: string;
|
|
834
|
+
},
|
|
835
|
+
): Promise<StreamResponse<ChannelStateResponse>> {
|
|
836
|
+
const queryParams = {
|
|
837
|
+
connection_id: request?.connection_id,
|
|
838
|
+
};
|
|
839
|
+
const pathParams = {
|
|
840
|
+
type: request?.type,
|
|
841
|
+
id: request?.id,
|
|
842
|
+
};
|
|
843
|
+
const body = {
|
|
844
|
+
hide_for_creator: request?.hide_for_creator,
|
|
845
|
+
presence: request?.presence,
|
|
846
|
+
state: request?.state,
|
|
847
|
+
thread_unread_counts: request?.thread_unread_counts,
|
|
848
|
+
watch: request?.watch,
|
|
849
|
+
data: request?.data,
|
|
850
|
+
members: request?.members,
|
|
851
|
+
messages: request?.messages,
|
|
852
|
+
watchers: request?.watchers,
|
|
853
|
+
};
|
|
854
|
+
|
|
855
|
+
const response = await this.apiClient.sendRequest<
|
|
856
|
+
StreamResponse<ChannelStateResponse>
|
|
857
|
+
>(
|
|
858
|
+
'POST',
|
|
859
|
+
'/api/v2/chat/channels/{type}/{id}/query',
|
|
860
|
+
pathParams,
|
|
861
|
+
queryParams,
|
|
862
|
+
body,
|
|
863
|
+
'application/json',
|
|
864
|
+
);
|
|
865
|
+
|
|
866
|
+
decoders['ChannelStateResponse']?.(response.body);
|
|
867
|
+
|
|
868
|
+
return { ...response.body, metadata: response.metadata };
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
async markRead(
|
|
872
|
+
request: MarkReadRequest & { type: string; id: string },
|
|
873
|
+
): Promise<StreamResponse<MarkReadResponse>> {
|
|
874
|
+
const pathParams = {
|
|
875
|
+
type: request?.type,
|
|
876
|
+
id: request?.id,
|
|
877
|
+
};
|
|
878
|
+
const body = {
|
|
879
|
+
message_id: request?.message_id,
|
|
880
|
+
thread_id: request?.thread_id,
|
|
881
|
+
};
|
|
882
|
+
|
|
883
|
+
const response = await this.apiClient.sendRequest<StreamResponse<MarkReadResponse>>(
|
|
884
|
+
'POST',
|
|
885
|
+
'/api/v2/chat/channels/{type}/{id}/read',
|
|
886
|
+
pathParams,
|
|
887
|
+
undefined,
|
|
888
|
+
body,
|
|
889
|
+
'application/json',
|
|
890
|
+
);
|
|
891
|
+
|
|
892
|
+
decoders['MarkReadResponse']?.(response.body);
|
|
893
|
+
|
|
894
|
+
return { ...response.body, metadata: response.metadata };
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
async showChannel(
|
|
898
|
+
request: ShowChannelRequest & { type: string; id: string },
|
|
899
|
+
): Promise<StreamResponse<ShowChannelResponse>> {
|
|
900
|
+
const pathParams = {
|
|
901
|
+
type: request?.type,
|
|
902
|
+
id: request?.id,
|
|
903
|
+
};
|
|
904
|
+
const body = {};
|
|
905
|
+
|
|
906
|
+
const response = await this.apiClient.sendRequest<
|
|
907
|
+
StreamResponse<ShowChannelResponse>
|
|
908
|
+
>(
|
|
909
|
+
'POST',
|
|
910
|
+
'/api/v2/chat/channels/{type}/{id}/show',
|
|
911
|
+
pathParams,
|
|
912
|
+
undefined,
|
|
913
|
+
body,
|
|
914
|
+
'application/json',
|
|
915
|
+
);
|
|
916
|
+
|
|
917
|
+
decoders['ShowChannelResponse']?.(response.body);
|
|
918
|
+
|
|
919
|
+
return { ...response.body, metadata: response.metadata };
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
async stopWatchingChannel(
|
|
923
|
+
request: ChannelStopWatchingRequest & {
|
|
924
|
+
type: string;
|
|
925
|
+
id: string;
|
|
926
|
+
connection_id?: string;
|
|
927
|
+
},
|
|
928
|
+
): Promise<StreamResponse<Response>> {
|
|
929
|
+
const queryParams = {
|
|
930
|
+
connection_id: request?.connection_id,
|
|
931
|
+
};
|
|
932
|
+
const pathParams = {
|
|
933
|
+
type: request?.type,
|
|
934
|
+
id: request?.id,
|
|
935
|
+
};
|
|
936
|
+
const body = {};
|
|
937
|
+
|
|
938
|
+
const response = await this.apiClient.sendRequest<StreamResponse<Response>>(
|
|
939
|
+
'POST',
|
|
940
|
+
'/api/v2/chat/channels/{type}/{id}/stop-watching',
|
|
941
|
+
pathParams,
|
|
942
|
+
queryParams,
|
|
943
|
+
body,
|
|
944
|
+
'application/json',
|
|
945
|
+
);
|
|
946
|
+
|
|
947
|
+
decoders['Response']?.(response.body);
|
|
948
|
+
|
|
949
|
+
return { ...response.body, metadata: response.metadata };
|
|
950
|
+
}
|
|
951
|
+
|
|
952
|
+
async truncateChannel(
|
|
953
|
+
request: TruncateChannelRequest & { type: string; id: string },
|
|
954
|
+
): Promise<StreamResponse<TruncateChannelResponse>> {
|
|
955
|
+
const pathParams = {
|
|
956
|
+
type: request?.type,
|
|
957
|
+
id: request?.id,
|
|
958
|
+
};
|
|
959
|
+
const body = {
|
|
960
|
+
hard_delete: request?.hard_delete,
|
|
961
|
+
skip_push: request?.skip_push,
|
|
962
|
+
truncated_at: request?.truncated_at,
|
|
963
|
+
member_ids: request?.member_ids,
|
|
964
|
+
message: request?.message,
|
|
965
|
+
};
|
|
966
|
+
|
|
967
|
+
const response = await this.apiClient.sendRequest<
|
|
968
|
+
StreamResponse<TruncateChannelResponse>
|
|
969
|
+
>(
|
|
970
|
+
'POST',
|
|
971
|
+
'/api/v2/chat/channels/{type}/{id}/truncate',
|
|
972
|
+
pathParams,
|
|
973
|
+
undefined,
|
|
974
|
+
body,
|
|
975
|
+
'application/json',
|
|
976
|
+
);
|
|
977
|
+
|
|
978
|
+
decoders['TruncateChannelResponse']?.(response.body);
|
|
979
|
+
|
|
980
|
+
return { ...response.body, metadata: response.metadata };
|
|
981
|
+
}
|
|
982
|
+
|
|
983
|
+
async markUnread(
|
|
984
|
+
request: MarkUnreadRequest & { type: string; id: string },
|
|
985
|
+
): Promise<StreamResponse<Response>> {
|
|
986
|
+
const pathParams = {
|
|
987
|
+
type: request?.type,
|
|
988
|
+
id: request?.id,
|
|
989
|
+
};
|
|
990
|
+
const body = {
|
|
991
|
+
message_id: request?.message_id,
|
|
992
|
+
message_timestamp: request?.message_timestamp,
|
|
993
|
+
thread_id: request?.thread_id,
|
|
994
|
+
};
|
|
995
|
+
|
|
996
|
+
const response = await this.apiClient.sendRequest<StreamResponse<Response>>(
|
|
997
|
+
'POST',
|
|
998
|
+
'/api/v2/chat/channels/{type}/{id}/unread',
|
|
999
|
+
pathParams,
|
|
1000
|
+
undefined,
|
|
1001
|
+
body,
|
|
1002
|
+
'application/json',
|
|
1003
|
+
);
|
|
1004
|
+
|
|
1005
|
+
decoders['Response']?.(response.body);
|
|
1006
|
+
|
|
1007
|
+
return { ...response.body, metadata: response.metadata };
|
|
1008
|
+
}
|
|
1009
|
+
|
|
1010
|
+
async queryDrafts(
|
|
1011
|
+
request?: QueryDraftsRequest,
|
|
1012
|
+
): Promise<StreamResponse<QueryDraftsResponse>> {
|
|
1013
|
+
const body = {
|
|
1014
|
+
limit: request?.limit,
|
|
1015
|
+
next: request?.next,
|
|
1016
|
+
prev: request?.prev,
|
|
1017
|
+
sort: request?.sort,
|
|
1018
|
+
filter: request?.filter,
|
|
1019
|
+
};
|
|
1020
|
+
|
|
1021
|
+
const response = await this.apiClient.sendRequest<
|
|
1022
|
+
StreamResponse<QueryDraftsResponse>
|
|
1023
|
+
>(
|
|
1024
|
+
'POST',
|
|
1025
|
+
'/api/v2/chat/drafts/query',
|
|
1026
|
+
undefined,
|
|
1027
|
+
undefined,
|
|
1028
|
+
body,
|
|
1029
|
+
'application/json',
|
|
1030
|
+
);
|
|
1031
|
+
|
|
1032
|
+
decoders['QueryDraftsResponse']?.(response.body);
|
|
1033
|
+
|
|
1034
|
+
return { ...response.body, metadata: response.metadata };
|
|
1035
|
+
}
|
|
1036
|
+
|
|
1037
|
+
async queryMembers(request?: {
|
|
1038
|
+
payload?: QueryMembersPayload;
|
|
1039
|
+
}): Promise<StreamResponse<MembersResponse>> {
|
|
1040
|
+
const queryParams = {
|
|
1041
|
+
payload: request?.payload,
|
|
1042
|
+
};
|
|
1043
|
+
|
|
1044
|
+
const response = await this.apiClient.sendRequest<StreamResponse<MembersResponse>>(
|
|
1045
|
+
'GET',
|
|
1046
|
+
'/api/v2/chat/members',
|
|
1047
|
+
undefined,
|
|
1048
|
+
queryParams,
|
|
1049
|
+
);
|
|
1050
|
+
|
|
1051
|
+
decoders['MembersResponse']?.(response.body);
|
|
1052
|
+
|
|
1053
|
+
return { ...response.body, metadata: response.metadata };
|
|
1054
|
+
}
|
|
1055
|
+
|
|
1056
|
+
async deleteMessage(request: {
|
|
1057
|
+
id: string;
|
|
1058
|
+
hard?: boolean;
|
|
1059
|
+
deleted_by?: string;
|
|
1060
|
+
delete_for_me?: boolean;
|
|
1061
|
+
}): Promise<StreamResponse<DeleteMessageResponse>> {
|
|
1062
|
+
const queryParams = {
|
|
1063
|
+
hard: request?.hard,
|
|
1064
|
+
deleted_by: request?.deleted_by,
|
|
1065
|
+
delete_for_me: request?.delete_for_me,
|
|
1066
|
+
};
|
|
1067
|
+
const pathParams = {
|
|
1068
|
+
id: request?.id,
|
|
1069
|
+
};
|
|
1070
|
+
|
|
1071
|
+
const response = await this.apiClient.sendRequest<
|
|
1072
|
+
StreamResponse<DeleteMessageResponse>
|
|
1073
|
+
>('DELETE', '/api/v2/chat/messages/{id}', pathParams, queryParams);
|
|
1074
|
+
|
|
1075
|
+
decoders['DeleteMessageResponse']?.(response.body);
|
|
1076
|
+
|
|
1077
|
+
return { ...response.body, metadata: response.metadata };
|
|
1078
|
+
}
|
|
1079
|
+
|
|
1080
|
+
async getMessage(request: { id: string }): Promise<StreamResponse<GetMessageResponse>> {
|
|
1081
|
+
const pathParams = {
|
|
1082
|
+
id: request?.id,
|
|
1083
|
+
};
|
|
1084
|
+
|
|
1085
|
+
const response = await this.apiClient.sendRequest<StreamResponse<GetMessageResponse>>(
|
|
1086
|
+
'GET',
|
|
1087
|
+
'/api/v2/chat/messages/{id}',
|
|
1088
|
+
pathParams,
|
|
1089
|
+
undefined,
|
|
1090
|
+
);
|
|
1091
|
+
|
|
1092
|
+
decoders['GetMessageResponse']?.(response.body);
|
|
1093
|
+
|
|
1094
|
+
return { ...response.body, metadata: response.metadata };
|
|
1095
|
+
}
|
|
1096
|
+
|
|
1097
|
+
async updateMessage(
|
|
1098
|
+
request: UpdateMessageRequest & { id: string },
|
|
1099
|
+
): Promise<StreamResponse<UpdateMessageResponse>> {
|
|
1100
|
+
const pathParams = {
|
|
1101
|
+
id: request?.id,
|
|
1102
|
+
};
|
|
1103
|
+
const body = {
|
|
1104
|
+
message: request?.message,
|
|
1105
|
+
skip_enrich_url: request?.skip_enrich_url,
|
|
1106
|
+
skip_push: request?.skip_push,
|
|
1107
|
+
};
|
|
1108
|
+
|
|
1109
|
+
const response = await this.apiClient.sendRequest<
|
|
1110
|
+
StreamResponse<UpdateMessageResponse>
|
|
1111
|
+
>(
|
|
1112
|
+
'POST',
|
|
1113
|
+
'/api/v2/chat/messages/{id}',
|
|
1114
|
+
pathParams,
|
|
1115
|
+
undefined,
|
|
1116
|
+
body,
|
|
1117
|
+
'application/json',
|
|
1118
|
+
);
|
|
1119
|
+
|
|
1120
|
+
decoders['UpdateMessageResponse']?.(response.body);
|
|
1121
|
+
|
|
1122
|
+
return { ...response.body, metadata: response.metadata };
|
|
1123
|
+
}
|
|
1124
|
+
|
|
1125
|
+
async updateMessagePartial(
|
|
1126
|
+
request: UpdateMessagePartialRequest & { id: string },
|
|
1127
|
+
): Promise<StreamResponse<UpdateMessagePartialResponse>> {
|
|
1128
|
+
const pathParams = {
|
|
1129
|
+
id: request?.id,
|
|
1130
|
+
};
|
|
1131
|
+
const body = {
|
|
1132
|
+
skip_enrich_url: request?.skip_enrich_url,
|
|
1133
|
+
skip_push: request?.skip_push,
|
|
1134
|
+
unset: request?.unset,
|
|
1135
|
+
set: request?.set,
|
|
1136
|
+
};
|
|
1137
|
+
|
|
1138
|
+
const response = await this.apiClient.sendRequest<
|
|
1139
|
+
StreamResponse<UpdateMessagePartialResponse>
|
|
1140
|
+
>(
|
|
1141
|
+
'PUT',
|
|
1142
|
+
'/api/v2/chat/messages/{id}',
|
|
1143
|
+
pathParams,
|
|
1144
|
+
undefined,
|
|
1145
|
+
body,
|
|
1146
|
+
'application/json',
|
|
1147
|
+
);
|
|
1148
|
+
|
|
1149
|
+
decoders['UpdateMessagePartialResponse']?.(response.body);
|
|
1150
|
+
|
|
1151
|
+
return { ...response.body, metadata: response.metadata };
|
|
1152
|
+
}
|
|
1153
|
+
|
|
1154
|
+
async runMessageAction(
|
|
1155
|
+
request: MessageActionRequest & { id: string },
|
|
1156
|
+
): Promise<StreamResponse<MessageActionResponse>> {
|
|
1157
|
+
const pathParams = {
|
|
1158
|
+
id: request?.id,
|
|
1159
|
+
};
|
|
1160
|
+
const body = {
|
|
1161
|
+
form_data: request?.form_data,
|
|
1162
|
+
};
|
|
1163
|
+
|
|
1164
|
+
const response = await this.apiClient.sendRequest<
|
|
1165
|
+
StreamResponse<MessageActionResponse>
|
|
1166
|
+
>(
|
|
1167
|
+
'POST',
|
|
1168
|
+
'/api/v2/chat/messages/{id}/action',
|
|
1169
|
+
pathParams,
|
|
1170
|
+
undefined,
|
|
1171
|
+
body,
|
|
1172
|
+
'application/json',
|
|
1173
|
+
);
|
|
1174
|
+
|
|
1175
|
+
decoders['MessageActionResponse']?.(response.body);
|
|
1176
|
+
|
|
1177
|
+
return { ...response.body, metadata: response.metadata };
|
|
1178
|
+
}
|
|
1179
|
+
|
|
1180
|
+
async sendReaction(
|
|
1181
|
+
request: SendReactionRequest & { id: string },
|
|
1182
|
+
): Promise<StreamResponse<SendReactionResponse>> {
|
|
1183
|
+
const pathParams = {
|
|
1184
|
+
id: request?.id,
|
|
1185
|
+
};
|
|
1186
|
+
const body = {
|
|
1187
|
+
reaction: request?.reaction,
|
|
1188
|
+
enforce_unique: request?.enforce_unique,
|
|
1189
|
+
skip_push: request?.skip_push,
|
|
1190
|
+
};
|
|
1191
|
+
|
|
1192
|
+
const response = await this.apiClient.sendRequest<
|
|
1193
|
+
StreamResponse<SendReactionResponse>
|
|
1194
|
+
>(
|
|
1195
|
+
'POST',
|
|
1196
|
+
'/api/v2/chat/messages/{id}/reaction',
|
|
1197
|
+
pathParams,
|
|
1198
|
+
undefined,
|
|
1199
|
+
body,
|
|
1200
|
+
'application/json',
|
|
1201
|
+
);
|
|
1202
|
+
|
|
1203
|
+
decoders['SendReactionResponse']?.(response.body);
|
|
1204
|
+
|
|
1205
|
+
return { ...response.body, metadata: response.metadata };
|
|
1206
|
+
}
|
|
1207
|
+
|
|
1208
|
+
async deleteReaction(request: {
|
|
1209
|
+
id: string;
|
|
1210
|
+
type: string;
|
|
1211
|
+
user_id?: string;
|
|
1212
|
+
}): Promise<StreamResponse<DeleteReactionResponse>> {
|
|
1213
|
+
const queryParams = {
|
|
1214
|
+
user_id: request?.user_id,
|
|
1215
|
+
};
|
|
1216
|
+
const pathParams = {
|
|
1217
|
+
id: request?.id,
|
|
1218
|
+
type: request?.type,
|
|
1219
|
+
};
|
|
1220
|
+
|
|
1221
|
+
const response = await this.apiClient.sendRequest<
|
|
1222
|
+
StreamResponse<DeleteReactionResponse>
|
|
1223
|
+
>('DELETE', '/api/v2/chat/messages/{id}/reaction/{type}', pathParams, queryParams);
|
|
1224
|
+
|
|
1225
|
+
decoders['DeleteReactionResponse']?.(response.body);
|
|
1226
|
+
|
|
1227
|
+
return { ...response.body, metadata: response.metadata };
|
|
1228
|
+
}
|
|
1229
|
+
|
|
1230
|
+
async getReactions(request: {
|
|
1231
|
+
id: string;
|
|
1232
|
+
limit?: number;
|
|
1233
|
+
offset?: number;
|
|
1234
|
+
}): Promise<StreamResponse<GetReactionsResponse>> {
|
|
1235
|
+
const queryParams = {
|
|
1236
|
+
limit: request?.limit,
|
|
1237
|
+
offset: request?.offset,
|
|
1238
|
+
};
|
|
1239
|
+
const pathParams = {
|
|
1240
|
+
id: request?.id,
|
|
1241
|
+
};
|
|
1242
|
+
|
|
1243
|
+
const response = await this.apiClient.sendRequest<
|
|
1244
|
+
StreamResponse<GetReactionsResponse>
|
|
1245
|
+
>('GET', '/api/v2/chat/messages/{id}/reactions', pathParams, queryParams);
|
|
1246
|
+
|
|
1247
|
+
decoders['GetReactionsResponse']?.(response.body);
|
|
1248
|
+
|
|
1249
|
+
return { ...response.body, metadata: response.metadata };
|
|
1250
|
+
}
|
|
1251
|
+
|
|
1252
|
+
async queryReactions(
|
|
1253
|
+
request: QueryReactionsRequest & { id: string },
|
|
1254
|
+
): Promise<StreamResponse<QueryReactionsResponse>> {
|
|
1255
|
+
const pathParams = {
|
|
1256
|
+
id: request?.id,
|
|
1257
|
+
};
|
|
1258
|
+
const body = {
|
|
1259
|
+
limit: request?.limit,
|
|
1260
|
+
next: request?.next,
|
|
1261
|
+
prev: request?.prev,
|
|
1262
|
+
sort: request?.sort,
|
|
1263
|
+
filter: request?.filter,
|
|
1264
|
+
};
|
|
1265
|
+
|
|
1266
|
+
const response = await this.apiClient.sendRequest<
|
|
1267
|
+
StreamResponse<QueryReactionsResponse>
|
|
1268
|
+
>(
|
|
1269
|
+
'POST',
|
|
1270
|
+
'/api/v2/chat/messages/{id}/reactions',
|
|
1271
|
+
pathParams,
|
|
1272
|
+
undefined,
|
|
1273
|
+
body,
|
|
1274
|
+
'application/json',
|
|
1275
|
+
);
|
|
1276
|
+
|
|
1277
|
+
decoders['QueryReactionsResponse']?.(response.body);
|
|
1278
|
+
|
|
1279
|
+
return { ...response.body, metadata: response.metadata };
|
|
1280
|
+
}
|
|
1281
|
+
|
|
1282
|
+
async translateMessage(
|
|
1283
|
+
request: TranslateMessageRequest & { id: string },
|
|
1284
|
+
): Promise<StreamResponse<MessageActionResponse>> {
|
|
1285
|
+
const pathParams = {
|
|
1286
|
+
id: request?.id,
|
|
1287
|
+
};
|
|
1288
|
+
const body = {
|
|
1289
|
+
language: request?.language,
|
|
1290
|
+
};
|
|
1291
|
+
|
|
1292
|
+
const response = await this.apiClient.sendRequest<
|
|
1293
|
+
StreamResponse<MessageActionResponse>
|
|
1294
|
+
>(
|
|
1295
|
+
'POST',
|
|
1296
|
+
'/api/v2/chat/messages/{id}/translate',
|
|
1297
|
+
pathParams,
|
|
1298
|
+
undefined,
|
|
1299
|
+
body,
|
|
1300
|
+
'application/json',
|
|
1301
|
+
);
|
|
1302
|
+
|
|
1303
|
+
decoders['MessageActionResponse']?.(response.body);
|
|
1304
|
+
|
|
1305
|
+
return { ...response.body, metadata: response.metadata };
|
|
1306
|
+
}
|
|
1307
|
+
|
|
1308
|
+
async castPollVote(
|
|
1309
|
+
request: CastPollVoteRequest & { message_id: string; poll_id: string },
|
|
1310
|
+
): Promise<StreamResponse<PollVoteResponse>> {
|
|
1311
|
+
const pathParams = {
|
|
1312
|
+
message_id: request?.message_id,
|
|
1313
|
+
poll_id: request?.poll_id,
|
|
1314
|
+
};
|
|
1315
|
+
const body = {
|
|
1316
|
+
vote: request?.vote,
|
|
1317
|
+
};
|
|
1318
|
+
|
|
1319
|
+
const response = await this.apiClient.sendRequest<StreamResponse<PollVoteResponse>>(
|
|
1320
|
+
'POST',
|
|
1321
|
+
'/api/v2/chat/messages/{message_id}/polls/{poll_id}/vote',
|
|
1322
|
+
pathParams,
|
|
1323
|
+
undefined,
|
|
1324
|
+
body,
|
|
1325
|
+
'application/json',
|
|
1326
|
+
);
|
|
1327
|
+
|
|
1328
|
+
decoders['PollVoteResponse']?.(response.body);
|
|
1329
|
+
|
|
1330
|
+
return { ...response.body, metadata: response.metadata };
|
|
1331
|
+
}
|
|
1332
|
+
|
|
1333
|
+
async deletePollVote(request: {
|
|
1334
|
+
message_id: string;
|
|
1335
|
+
poll_id: string;
|
|
1336
|
+
vote_id: string;
|
|
1337
|
+
user_id?: string;
|
|
1338
|
+
}): Promise<StreamResponse<PollVoteResponse>> {
|
|
1339
|
+
const queryParams = {
|
|
1340
|
+
user_id: request?.user_id,
|
|
1341
|
+
};
|
|
1342
|
+
const pathParams = {
|
|
1343
|
+
message_id: request?.message_id,
|
|
1344
|
+
poll_id: request?.poll_id,
|
|
1345
|
+
vote_id: request?.vote_id,
|
|
1346
|
+
};
|
|
1347
|
+
|
|
1348
|
+
const response = await this.apiClient.sendRequest<StreamResponse<PollVoteResponse>>(
|
|
1349
|
+
'DELETE',
|
|
1350
|
+
'/api/v2/chat/messages/{message_id}/polls/{poll_id}/vote/{vote_id}',
|
|
1351
|
+
pathParams,
|
|
1352
|
+
queryParams,
|
|
1353
|
+
);
|
|
1354
|
+
|
|
1355
|
+
decoders['PollVoteResponse']?.(response.body);
|
|
1356
|
+
|
|
1357
|
+
return { ...response.body, metadata: response.metadata };
|
|
1358
|
+
}
|
|
1359
|
+
|
|
1360
|
+
async deleteReminder(request: {
|
|
1361
|
+
message_id: string;
|
|
1362
|
+
}): Promise<StreamResponse<DeleteReminderResponse>> {
|
|
1363
|
+
const pathParams = {
|
|
1364
|
+
message_id: request?.message_id,
|
|
1365
|
+
};
|
|
1366
|
+
|
|
1367
|
+
const response = await this.apiClient.sendRequest<
|
|
1368
|
+
StreamResponse<DeleteReminderResponse>
|
|
1369
|
+
>('DELETE', '/api/v2/chat/messages/{message_id}/reminders', pathParams, undefined);
|
|
1370
|
+
|
|
1371
|
+
decoders['DeleteReminderResponse']?.(response.body);
|
|
1372
|
+
|
|
1373
|
+
return { ...response.body, metadata: response.metadata };
|
|
1374
|
+
}
|
|
1375
|
+
|
|
1376
|
+
async updateReminder(
|
|
1377
|
+
request: UpdateReminderRequest & { message_id: string },
|
|
1378
|
+
): Promise<StreamResponse<UpdateReminderResponse>> {
|
|
1379
|
+
const pathParams = {
|
|
1380
|
+
message_id: request?.message_id,
|
|
1381
|
+
};
|
|
1382
|
+
const body = {
|
|
1383
|
+
remind_at: request?.remind_at,
|
|
1384
|
+
};
|
|
1385
|
+
|
|
1386
|
+
const response = await this.apiClient.sendRequest<
|
|
1387
|
+
StreamResponse<UpdateReminderResponse>
|
|
1388
|
+
>(
|
|
1389
|
+
'PATCH',
|
|
1390
|
+
'/api/v2/chat/messages/{message_id}/reminders',
|
|
1391
|
+
pathParams,
|
|
1392
|
+
undefined,
|
|
1393
|
+
body,
|
|
1394
|
+
'application/json',
|
|
1395
|
+
);
|
|
1396
|
+
|
|
1397
|
+
decoders['UpdateReminderResponse']?.(response.body);
|
|
1398
|
+
|
|
1399
|
+
return { ...response.body, metadata: response.metadata };
|
|
1400
|
+
}
|
|
1401
|
+
|
|
1402
|
+
async createReminder(
|
|
1403
|
+
request: CreateReminderRequest & { message_id: string },
|
|
1404
|
+
): Promise<StreamResponse<ReminderResponseData>> {
|
|
1405
|
+
const pathParams = {
|
|
1406
|
+
message_id: request?.message_id,
|
|
1407
|
+
};
|
|
1408
|
+
const body = {
|
|
1409
|
+
remind_at: request?.remind_at,
|
|
1410
|
+
};
|
|
1411
|
+
|
|
1412
|
+
const response = await this.apiClient.sendRequest<
|
|
1413
|
+
StreamResponse<ReminderResponseData>
|
|
1414
|
+
>(
|
|
1415
|
+
'POST',
|
|
1416
|
+
'/api/v2/chat/messages/{message_id}/reminders',
|
|
1417
|
+
pathParams,
|
|
1418
|
+
undefined,
|
|
1419
|
+
body,
|
|
1420
|
+
'application/json',
|
|
1421
|
+
);
|
|
1422
|
+
|
|
1423
|
+
decoders['ReminderResponseData']?.(response.body);
|
|
1424
|
+
|
|
1425
|
+
return { ...response.body, metadata: response.metadata };
|
|
1426
|
+
}
|
|
1427
|
+
|
|
1428
|
+
async getReplies(request: {
|
|
1429
|
+
parent_id: string;
|
|
1430
|
+
limit?: number;
|
|
1431
|
+
id_gte?: string;
|
|
1432
|
+
id_gt?: string;
|
|
1433
|
+
id_lte?: string;
|
|
1434
|
+
id_lt?: string;
|
|
1435
|
+
id_around?: string;
|
|
1436
|
+
sort?: Array<SortParamRequest>;
|
|
1437
|
+
}): Promise<StreamResponse<GetRepliesResponse>> {
|
|
1438
|
+
const queryParams = {
|
|
1439
|
+
limit: request?.limit,
|
|
1440
|
+
id_gte: request?.id_gte,
|
|
1441
|
+
id_gt: request?.id_gt,
|
|
1442
|
+
id_lte: request?.id_lte,
|
|
1443
|
+
id_lt: request?.id_lt,
|
|
1444
|
+
id_around: request?.id_around,
|
|
1445
|
+
sort: request?.sort,
|
|
1446
|
+
};
|
|
1447
|
+
const pathParams = {
|
|
1448
|
+
parent_id: request?.parent_id,
|
|
1449
|
+
};
|
|
1450
|
+
|
|
1451
|
+
const response = await this.apiClient.sendRequest<StreamResponse<GetRepliesResponse>>(
|
|
1452
|
+
'GET',
|
|
1453
|
+
'/api/v2/chat/messages/{parent_id}/replies',
|
|
1454
|
+
pathParams,
|
|
1455
|
+
queryParams,
|
|
1456
|
+
);
|
|
1457
|
+
|
|
1458
|
+
decoders['GetRepliesResponse']?.(response.body);
|
|
1459
|
+
|
|
1460
|
+
return { ...response.body, metadata: response.metadata };
|
|
1461
|
+
}
|
|
1462
|
+
|
|
1463
|
+
async queryMessageFlags(request?: {
|
|
1464
|
+
payload?: QueryMessageFlagsPayload;
|
|
1465
|
+
}): Promise<StreamResponse<QueryMessageFlagsResponse>> {
|
|
1466
|
+
const queryParams = {
|
|
1467
|
+
payload: request?.payload,
|
|
1468
|
+
};
|
|
1469
|
+
|
|
1470
|
+
const response = await this.apiClient.sendRequest<
|
|
1471
|
+
StreamResponse<QueryMessageFlagsResponse>
|
|
1472
|
+
>('GET', '/api/v2/chat/moderation/flags/message', undefined, queryParams);
|
|
1473
|
+
|
|
1474
|
+
decoders['QueryMessageFlagsResponse']?.(response.body);
|
|
1475
|
+
|
|
1476
|
+
return { ...response.body, metadata: response.metadata };
|
|
1477
|
+
}
|
|
1478
|
+
|
|
1479
|
+
async muteChannel(
|
|
1480
|
+
request?: MuteChannelRequest,
|
|
1481
|
+
): Promise<StreamResponse<MuteChannelResponse>> {
|
|
1482
|
+
const body = {
|
|
1483
|
+
expiration: request?.expiration,
|
|
1484
|
+
channel_cids: request?.channel_cids,
|
|
1485
|
+
};
|
|
1486
|
+
|
|
1487
|
+
const response = await this.apiClient.sendRequest<
|
|
1488
|
+
StreamResponse<MuteChannelResponse>
|
|
1489
|
+
>(
|
|
1490
|
+
'POST',
|
|
1491
|
+
'/api/v2/chat/moderation/mute/channel',
|
|
1492
|
+
undefined,
|
|
1493
|
+
undefined,
|
|
1494
|
+
body,
|
|
1495
|
+
'application/json',
|
|
1496
|
+
);
|
|
1497
|
+
|
|
1498
|
+
decoders['MuteChannelResponse']?.(response.body);
|
|
1499
|
+
|
|
1500
|
+
return { ...response.body, metadata: response.metadata };
|
|
1501
|
+
}
|
|
1502
|
+
|
|
1503
|
+
async unmuteChannel(
|
|
1504
|
+
request?: UnmuteChannelRequest,
|
|
1505
|
+
): Promise<StreamResponse<UnmuteResponse>> {
|
|
1506
|
+
const body = {
|
|
1507
|
+
expiration: request?.expiration,
|
|
1508
|
+
channel_cids: request?.channel_cids,
|
|
1509
|
+
};
|
|
1510
|
+
|
|
1511
|
+
const response = await this.apiClient.sendRequest<StreamResponse<UnmuteResponse>>(
|
|
1512
|
+
'POST',
|
|
1513
|
+
'/api/v2/chat/moderation/unmute/channel',
|
|
1514
|
+
undefined,
|
|
1515
|
+
undefined,
|
|
1516
|
+
body,
|
|
1517
|
+
'application/json',
|
|
1518
|
+
);
|
|
1519
|
+
|
|
1520
|
+
decoders['UnmuteResponse']?.(response.body);
|
|
1521
|
+
|
|
1522
|
+
return { ...response.body, metadata: response.metadata };
|
|
1523
|
+
}
|
|
1524
|
+
|
|
1525
|
+
async queryBannedUsers(request?: {
|
|
1526
|
+
payload?: QueryBannedUsersPayload;
|
|
1527
|
+
}): Promise<StreamResponse<QueryBannedUsersResponse>> {
|
|
1528
|
+
const queryParams = {
|
|
1529
|
+
payload: request?.payload,
|
|
1530
|
+
};
|
|
1531
|
+
|
|
1532
|
+
const response = await this.apiClient.sendRequest<
|
|
1533
|
+
StreamResponse<QueryBannedUsersResponse>
|
|
1534
|
+
>('GET', '/api/v2/chat/query_banned_users', undefined, queryParams);
|
|
1535
|
+
|
|
1536
|
+
decoders['QueryBannedUsersResponse']?.(response.body);
|
|
1537
|
+
|
|
1538
|
+
return { ...response.body, metadata: response.metadata };
|
|
1539
|
+
}
|
|
1540
|
+
|
|
1541
|
+
async queryFutureChannelBans(request?: {
|
|
1542
|
+
payload?: QueryFutureChannelBansPayload;
|
|
1543
|
+
}): Promise<StreamResponse<QueryFutureChannelBansResponse>> {
|
|
1544
|
+
const queryParams = {
|
|
1545
|
+
payload: request?.payload,
|
|
1546
|
+
};
|
|
1547
|
+
|
|
1548
|
+
const response = await this.apiClient.sendRequest<
|
|
1549
|
+
StreamResponse<QueryFutureChannelBansResponse>
|
|
1550
|
+
>('GET', '/api/v2/chat/query_future_channel_bans', undefined, queryParams);
|
|
1551
|
+
|
|
1552
|
+
decoders['QueryFutureChannelBansResponse']?.(response.body);
|
|
1553
|
+
|
|
1554
|
+
return { ...response.body, metadata: response.metadata };
|
|
1555
|
+
}
|
|
1556
|
+
|
|
1557
|
+
async queryReminders(
|
|
1558
|
+
request?: QueryRemindersRequest,
|
|
1559
|
+
): Promise<StreamResponse<QueryRemindersResponse>> {
|
|
1560
|
+
const body = {
|
|
1561
|
+
limit: request?.limit,
|
|
1562
|
+
next: request?.next,
|
|
1563
|
+
prev: request?.prev,
|
|
1564
|
+
sort: request?.sort,
|
|
1565
|
+
filter: request?.filter,
|
|
1566
|
+
};
|
|
1567
|
+
|
|
1568
|
+
const response = await this.apiClient.sendRequest<
|
|
1569
|
+
StreamResponse<QueryRemindersResponse>
|
|
1570
|
+
>(
|
|
1571
|
+
'POST',
|
|
1572
|
+
'/api/v2/chat/reminders/query',
|
|
1573
|
+
undefined,
|
|
1574
|
+
undefined,
|
|
1575
|
+
body,
|
|
1576
|
+
'application/json',
|
|
1577
|
+
);
|
|
1578
|
+
|
|
1579
|
+
decoders['QueryRemindersResponse']?.(response.body);
|
|
1580
|
+
|
|
1581
|
+
return { ...response.body, metadata: response.metadata };
|
|
1582
|
+
}
|
|
1583
|
+
|
|
1584
|
+
async search(request?: {
|
|
1585
|
+
payload?: SearchPayload;
|
|
1586
|
+
}): Promise<StreamResponse<SearchResponse>> {
|
|
1587
|
+
const queryParams = {
|
|
1588
|
+
payload: request?.payload,
|
|
1589
|
+
};
|
|
1590
|
+
|
|
1591
|
+
const response = await this.apiClient.sendRequest<StreamResponse<SearchResponse>>(
|
|
1592
|
+
'GET',
|
|
1593
|
+
'/api/v2/chat/search',
|
|
1594
|
+
undefined,
|
|
1595
|
+
queryParams,
|
|
1596
|
+
);
|
|
1597
|
+
|
|
1598
|
+
decoders['SearchResponse']?.(response.body);
|
|
1599
|
+
|
|
1600
|
+
return { ...response.body, metadata: response.metadata };
|
|
1601
|
+
}
|
|
1602
|
+
|
|
1603
|
+
async sync(
|
|
1604
|
+
request: SyncRequest & {
|
|
1605
|
+
with_inaccessible_cids?: boolean;
|
|
1606
|
+
watch?: boolean;
|
|
1607
|
+
connection_id?: string;
|
|
1608
|
+
},
|
|
1609
|
+
): Promise<StreamResponse<SyncResponse>> {
|
|
1610
|
+
const queryParams = {
|
|
1611
|
+
with_inaccessible_cids: request?.with_inaccessible_cids,
|
|
1612
|
+
watch: request?.watch,
|
|
1613
|
+
connection_id: request?.connection_id,
|
|
1614
|
+
};
|
|
1615
|
+
const body = {
|
|
1616
|
+
last_sync_at: request?.last_sync_at,
|
|
1617
|
+
channel_cids: request?.channel_cids,
|
|
1618
|
+
};
|
|
1619
|
+
|
|
1620
|
+
const response = await this.apiClient.sendRequest<StreamResponse<SyncResponse>>(
|
|
1621
|
+
'POST',
|
|
1622
|
+
'/api/v2/chat/sync',
|
|
1623
|
+
undefined,
|
|
1624
|
+
queryParams,
|
|
1625
|
+
body,
|
|
1626
|
+
'application/json',
|
|
1627
|
+
);
|
|
1628
|
+
|
|
1629
|
+
decoders['SyncResponse']?.(response.body);
|
|
1630
|
+
|
|
1631
|
+
return { ...response.body, metadata: response.metadata };
|
|
1632
|
+
}
|
|
1633
|
+
|
|
1634
|
+
async queryThreads(
|
|
1635
|
+
request?: QueryThreadsRequest & { connection_id?: string },
|
|
1636
|
+
): Promise<StreamResponse<QueryThreadsResponse>> {
|
|
1637
|
+
const queryParams = {
|
|
1638
|
+
connection_id: request?.connection_id,
|
|
1639
|
+
};
|
|
1640
|
+
const body = {
|
|
1641
|
+
limit: request?.limit,
|
|
1642
|
+
member_limit: request?.member_limit,
|
|
1643
|
+
next: request?.next,
|
|
1644
|
+
participant_limit: request?.participant_limit,
|
|
1645
|
+
prev: request?.prev,
|
|
1646
|
+
reply_limit: request?.reply_limit,
|
|
1647
|
+
watch: request?.watch,
|
|
1648
|
+
sort: request?.sort,
|
|
1649
|
+
filter: request?.filter,
|
|
1650
|
+
};
|
|
1651
|
+
|
|
1652
|
+
const response = await this.apiClient.sendRequest<
|
|
1653
|
+
StreamResponse<QueryThreadsResponse>
|
|
1654
|
+
>('POST', '/api/v2/chat/threads', undefined, queryParams, body, 'application/json');
|
|
1655
|
+
|
|
1656
|
+
decoders['QueryThreadsResponse']?.(response.body);
|
|
1657
|
+
|
|
1658
|
+
return { ...response.body, metadata: response.metadata };
|
|
1659
|
+
}
|
|
1660
|
+
|
|
1661
|
+
async getThread(request: {
|
|
1662
|
+
message_id: string;
|
|
1663
|
+
watch?: boolean;
|
|
1664
|
+
connection_id?: string;
|
|
1665
|
+
reply_limit?: number;
|
|
1666
|
+
participant_limit?: number;
|
|
1667
|
+
member_limit?: number;
|
|
1668
|
+
}): Promise<StreamResponse<GetThreadResponse>> {
|
|
1669
|
+
const queryParams = {
|
|
1670
|
+
watch: request?.watch,
|
|
1671
|
+
connection_id: request?.connection_id,
|
|
1672
|
+
reply_limit: request?.reply_limit,
|
|
1673
|
+
participant_limit: request?.participant_limit,
|
|
1674
|
+
member_limit: request?.member_limit,
|
|
1675
|
+
};
|
|
1676
|
+
const pathParams = {
|
|
1677
|
+
message_id: request?.message_id,
|
|
1678
|
+
};
|
|
1679
|
+
|
|
1680
|
+
const response = await this.apiClient.sendRequest<StreamResponse<GetThreadResponse>>(
|
|
1681
|
+
'GET',
|
|
1682
|
+
'/api/v2/chat/threads/{message_id}',
|
|
1683
|
+
pathParams,
|
|
1684
|
+
queryParams,
|
|
1685
|
+
);
|
|
1686
|
+
|
|
1687
|
+
decoders['GetThreadResponse']?.(response.body);
|
|
1688
|
+
|
|
1689
|
+
return { ...response.body, metadata: response.metadata };
|
|
1690
|
+
}
|
|
1691
|
+
|
|
1692
|
+
async updateThreadPartial(
|
|
1693
|
+
request: UpdateThreadPartialRequest & { message_id: string },
|
|
1694
|
+
): Promise<StreamResponse<UpdateThreadPartialResponse>> {
|
|
1695
|
+
const pathParams = {
|
|
1696
|
+
message_id: request?.message_id,
|
|
1697
|
+
};
|
|
1698
|
+
const body = {
|
|
1699
|
+
unset: request?.unset,
|
|
1700
|
+
set: request?.set,
|
|
1701
|
+
};
|
|
1702
|
+
|
|
1703
|
+
const response = await this.apiClient.sendRequest<
|
|
1704
|
+
StreamResponse<UpdateThreadPartialResponse>
|
|
1705
|
+
>(
|
|
1706
|
+
'PATCH',
|
|
1707
|
+
'/api/v2/chat/threads/{message_id}',
|
|
1708
|
+
pathParams,
|
|
1709
|
+
undefined,
|
|
1710
|
+
body,
|
|
1711
|
+
'application/json',
|
|
1712
|
+
);
|
|
1713
|
+
|
|
1714
|
+
decoders['UpdateThreadPartialResponse']?.(response.body);
|
|
1715
|
+
|
|
1716
|
+
return { ...response.body, metadata: response.metadata };
|
|
1717
|
+
}
|
|
1718
|
+
|
|
1719
|
+
async unreadCounts(): Promise<StreamResponse<WrappedUnreadCountsResponse>> {
|
|
1720
|
+
const response = await this.apiClient.sendRequest<
|
|
1721
|
+
StreamResponse<WrappedUnreadCountsResponse>
|
|
1722
|
+
>('GET', '/api/v2/chat/unread', undefined, undefined);
|
|
1723
|
+
|
|
1724
|
+
decoders['WrappedUnreadCountsResponse']?.(response.body);
|
|
1725
|
+
|
|
1726
|
+
return { ...response.body, metadata: response.metadata };
|
|
1727
|
+
}
|
|
1728
|
+
|
|
1729
|
+
async deleteDevice(request: { id: string }): Promise<StreamResponse<Response>> {
|
|
1730
|
+
const queryParams = {
|
|
1731
|
+
id: request?.id,
|
|
1732
|
+
};
|
|
1733
|
+
|
|
1734
|
+
const response = await this.apiClient.sendRequest<StreamResponse<Response>>(
|
|
1735
|
+
'DELETE',
|
|
1736
|
+
'/api/v2/devices',
|
|
1737
|
+
undefined,
|
|
1738
|
+
queryParams,
|
|
1739
|
+
);
|
|
1740
|
+
|
|
1741
|
+
decoders['Response']?.(response.body);
|
|
1742
|
+
|
|
1743
|
+
return { ...response.body, metadata: response.metadata };
|
|
1744
|
+
}
|
|
1745
|
+
|
|
1746
|
+
async listDevices(): Promise<StreamResponse<ListDevicesResponse>> {
|
|
1747
|
+
const response = await this.apiClient.sendRequest<
|
|
1748
|
+
StreamResponse<ListDevicesResponse>
|
|
1749
|
+
>('GET', '/api/v2/devices', undefined, undefined);
|
|
1750
|
+
|
|
1751
|
+
decoders['ListDevicesResponse']?.(response.body);
|
|
1752
|
+
|
|
1753
|
+
return { ...response.body, metadata: response.metadata };
|
|
1754
|
+
}
|
|
1755
|
+
|
|
1756
|
+
async createDevice(request: CreateDeviceRequest): Promise<StreamResponse<Response>> {
|
|
1757
|
+
const body = {
|
|
1758
|
+
id: request?.id,
|
|
1759
|
+
push_provider: request?.push_provider,
|
|
1760
|
+
hardware_id: request?.hardware_id,
|
|
1761
|
+
push_provider_name: request?.push_provider_name,
|
|
1762
|
+
voip_token: request?.voip_token,
|
|
1763
|
+
};
|
|
1764
|
+
|
|
1765
|
+
const response = await this.apiClient.sendRequest<StreamResponse<Response>>(
|
|
1766
|
+
'POST',
|
|
1767
|
+
'/api/v2/devices',
|
|
1768
|
+
undefined,
|
|
1769
|
+
undefined,
|
|
1770
|
+
body,
|
|
1771
|
+
'application/json',
|
|
1772
|
+
);
|
|
1773
|
+
|
|
1774
|
+
decoders['Response']?.(response.body);
|
|
1775
|
+
|
|
1776
|
+
return { ...response.body, metadata: response.metadata };
|
|
1777
|
+
}
|
|
1778
|
+
|
|
1779
|
+
async createGuest(
|
|
1780
|
+
request: CreateGuestRequest,
|
|
1781
|
+
): Promise<StreamResponse<CreateGuestResponse>> {
|
|
1782
|
+
const body = {
|
|
1783
|
+
user: request?.user,
|
|
1784
|
+
};
|
|
1785
|
+
|
|
1786
|
+
const response = await this.apiClient.sendRequest<
|
|
1787
|
+
StreamResponse<CreateGuestResponse>
|
|
1788
|
+
>('POST', '/api/v2/guest', undefined, undefined, body, 'application/json');
|
|
1789
|
+
|
|
1790
|
+
decoders['CreateGuestResponse']?.(response.body);
|
|
1791
|
+
|
|
1792
|
+
return { ...response.body, metadata: response.metadata };
|
|
1793
|
+
}
|
|
1794
|
+
|
|
1795
|
+
async longPoll(request?: {
|
|
1796
|
+
connection_id?: string;
|
|
1797
|
+
json?: WSAuthMessage;
|
|
1798
|
+
}): Promise<StreamResponse<{}>> {
|
|
1799
|
+
const queryParams = {
|
|
1800
|
+
connection_id: request?.connection_id,
|
|
1801
|
+
json: request?.json,
|
|
1802
|
+
};
|
|
1803
|
+
|
|
1804
|
+
const response = await this.apiClient.sendRequest<StreamResponse<{}>>(
|
|
1805
|
+
'GET',
|
|
1806
|
+
'/api/v2/longpoll',
|
|
1807
|
+
undefined,
|
|
1808
|
+
queryParams,
|
|
1809
|
+
);
|
|
1810
|
+
|
|
1811
|
+
decoders['{}']?.(response.body);
|
|
1812
|
+
|
|
1813
|
+
return { ...response.body, metadata: response.metadata };
|
|
1814
|
+
}
|
|
1815
|
+
|
|
1816
|
+
async getOG(request: { url: string }): Promise<StreamResponse<GetOGResponse>> {
|
|
1817
|
+
const queryParams = {
|
|
1818
|
+
url: request?.url,
|
|
1819
|
+
};
|
|
1820
|
+
|
|
1821
|
+
const response = await this.apiClient.sendRequest<StreamResponse<GetOGResponse>>(
|
|
1822
|
+
'GET',
|
|
1823
|
+
'/api/v2/og',
|
|
1824
|
+
undefined,
|
|
1825
|
+
queryParams,
|
|
1826
|
+
);
|
|
1827
|
+
|
|
1828
|
+
decoders['GetOGResponse']?.(response.body);
|
|
1829
|
+
|
|
1830
|
+
return { ...response.body, metadata: response.metadata };
|
|
1831
|
+
}
|
|
1832
|
+
|
|
1833
|
+
async createPoll(request: CreatePollRequest): Promise<StreamResponse<PollResponse>> {
|
|
1834
|
+
const body = {
|
|
1835
|
+
name: request?.name,
|
|
1836
|
+
allow_answers: request?.allow_answers,
|
|
1837
|
+
allow_user_suggested_options: request?.allow_user_suggested_options,
|
|
1838
|
+
description: request?.description,
|
|
1839
|
+
enforce_unique_vote: request?.enforce_unique_vote,
|
|
1840
|
+
id: request?.id,
|
|
1841
|
+
is_closed: request?.is_closed,
|
|
1842
|
+
max_votes_allowed: request?.max_votes_allowed,
|
|
1843
|
+
voting_visibility: request?.voting_visibility,
|
|
1844
|
+
options: request?.options,
|
|
1845
|
+
custom: request?.custom,
|
|
1846
|
+
};
|
|
1847
|
+
|
|
1848
|
+
const response = await this.apiClient.sendRequest<StreamResponse<PollResponse>>(
|
|
1849
|
+
'POST',
|
|
1850
|
+
'/api/v2/polls',
|
|
1851
|
+
undefined,
|
|
1852
|
+
undefined,
|
|
1853
|
+
body,
|
|
1854
|
+
'application/json',
|
|
1855
|
+
);
|
|
1856
|
+
|
|
1857
|
+
decoders['PollResponse']?.(response.body);
|
|
1858
|
+
|
|
1859
|
+
return { ...response.body, metadata: response.metadata };
|
|
1860
|
+
}
|
|
1861
|
+
|
|
1862
|
+
async updatePoll(request: UpdatePollRequest): Promise<StreamResponse<PollResponse>> {
|
|
1863
|
+
const body = {
|
|
1864
|
+
id: request?.id,
|
|
1865
|
+
name: request?.name,
|
|
1866
|
+
allow_answers: request?.allow_answers,
|
|
1867
|
+
allow_user_suggested_options: request?.allow_user_suggested_options,
|
|
1868
|
+
description: request?.description,
|
|
1869
|
+
enforce_unique_vote: request?.enforce_unique_vote,
|
|
1870
|
+
is_closed: request?.is_closed,
|
|
1871
|
+
max_votes_allowed: request?.max_votes_allowed,
|
|
1872
|
+
voting_visibility: request?.voting_visibility,
|
|
1873
|
+
options: request?.options,
|
|
1874
|
+
custom: request?.custom,
|
|
1875
|
+
};
|
|
1876
|
+
|
|
1877
|
+
const response = await this.apiClient.sendRequest<StreamResponse<PollResponse>>(
|
|
1878
|
+
'PUT',
|
|
1879
|
+
'/api/v2/polls',
|
|
1880
|
+
undefined,
|
|
1881
|
+
undefined,
|
|
1882
|
+
body,
|
|
1883
|
+
'application/json',
|
|
1884
|
+
);
|
|
1885
|
+
|
|
1886
|
+
decoders['PollResponse']?.(response.body);
|
|
1887
|
+
|
|
1888
|
+
return { ...response.body, metadata: response.metadata };
|
|
1889
|
+
}
|
|
1890
|
+
|
|
1891
|
+
async queryPolls(
|
|
1892
|
+
request?: QueryPollsRequest & { user_id?: string },
|
|
1893
|
+
): Promise<StreamResponse<QueryPollsResponse>> {
|
|
1894
|
+
const queryParams = {
|
|
1895
|
+
user_id: request?.user_id,
|
|
1896
|
+
};
|
|
1897
|
+
const body = {
|
|
1898
|
+
limit: request?.limit,
|
|
1899
|
+
next: request?.next,
|
|
1900
|
+
prev: request?.prev,
|
|
1901
|
+
sort: request?.sort,
|
|
1902
|
+
filter: request?.filter,
|
|
1903
|
+
};
|
|
1904
|
+
|
|
1905
|
+
const response = await this.apiClient.sendRequest<StreamResponse<QueryPollsResponse>>(
|
|
1906
|
+
'POST',
|
|
1907
|
+
'/api/v2/polls/query',
|
|
1908
|
+
undefined,
|
|
1909
|
+
queryParams,
|
|
1910
|
+
body,
|
|
1911
|
+
'application/json',
|
|
1912
|
+
);
|
|
1913
|
+
|
|
1914
|
+
decoders['QueryPollsResponse']?.(response.body);
|
|
1915
|
+
|
|
1916
|
+
return { ...response.body, metadata: response.metadata };
|
|
1917
|
+
}
|
|
1918
|
+
|
|
1919
|
+
async deletePoll(request: {
|
|
1920
|
+
poll_id: string;
|
|
1921
|
+
user_id?: string;
|
|
1922
|
+
}): Promise<StreamResponse<Response>> {
|
|
1923
|
+
const queryParams = {
|
|
1924
|
+
user_id: request?.user_id,
|
|
1925
|
+
};
|
|
1926
|
+
const pathParams = {
|
|
1927
|
+
poll_id: request?.poll_id,
|
|
1928
|
+
};
|
|
1929
|
+
|
|
1930
|
+
const response = await this.apiClient.sendRequest<StreamResponse<Response>>(
|
|
1931
|
+
'DELETE',
|
|
1932
|
+
'/api/v2/polls/{poll_id}',
|
|
1933
|
+
pathParams,
|
|
1934
|
+
queryParams,
|
|
1935
|
+
);
|
|
1936
|
+
|
|
1937
|
+
decoders['Response']?.(response.body);
|
|
1938
|
+
|
|
1939
|
+
return { ...response.body, metadata: response.metadata };
|
|
1940
|
+
}
|
|
1941
|
+
|
|
1942
|
+
async getPoll(request: {
|
|
1943
|
+
poll_id: string;
|
|
1944
|
+
user_id?: string;
|
|
1945
|
+
}): Promise<StreamResponse<PollResponse>> {
|
|
1946
|
+
const queryParams = {
|
|
1947
|
+
user_id: request?.user_id,
|
|
1948
|
+
};
|
|
1949
|
+
const pathParams = {
|
|
1950
|
+
poll_id: request?.poll_id,
|
|
1951
|
+
};
|
|
1952
|
+
|
|
1953
|
+
const response = await this.apiClient.sendRequest<StreamResponse<PollResponse>>(
|
|
1954
|
+
'GET',
|
|
1955
|
+
'/api/v2/polls/{poll_id}',
|
|
1956
|
+
pathParams,
|
|
1957
|
+
queryParams,
|
|
1958
|
+
);
|
|
1959
|
+
|
|
1960
|
+
decoders['PollResponse']?.(response.body);
|
|
1961
|
+
|
|
1962
|
+
return { ...response.body, metadata: response.metadata };
|
|
1963
|
+
}
|
|
1964
|
+
|
|
1965
|
+
async updatePollPartial(
|
|
1966
|
+
request: UpdatePollPartialRequest & { poll_id: string },
|
|
1967
|
+
): Promise<StreamResponse<PollResponse>> {
|
|
1968
|
+
const pathParams = {
|
|
1969
|
+
poll_id: request?.poll_id,
|
|
1970
|
+
};
|
|
1971
|
+
const body = {
|
|
1972
|
+
unset: request?.unset,
|
|
1973
|
+
set: request?.set,
|
|
1974
|
+
};
|
|
1975
|
+
|
|
1976
|
+
const response = await this.apiClient.sendRequest<StreamResponse<PollResponse>>(
|
|
1977
|
+
'PATCH',
|
|
1978
|
+
'/api/v2/polls/{poll_id}',
|
|
1979
|
+
pathParams,
|
|
1980
|
+
undefined,
|
|
1981
|
+
body,
|
|
1982
|
+
'application/json',
|
|
1983
|
+
);
|
|
1984
|
+
|
|
1985
|
+
decoders['PollResponse']?.(response.body);
|
|
1986
|
+
|
|
1987
|
+
return { ...response.body, metadata: response.metadata };
|
|
1988
|
+
}
|
|
1989
|
+
|
|
1990
|
+
async createPollOption(
|
|
1991
|
+
request: CreatePollOptionRequest & { poll_id: string },
|
|
1992
|
+
): Promise<StreamResponse<PollOptionResponse>> {
|
|
1993
|
+
const pathParams = {
|
|
1994
|
+
poll_id: request?.poll_id,
|
|
1995
|
+
};
|
|
1996
|
+
const body = {
|
|
1997
|
+
text: request?.text,
|
|
1998
|
+
custom: request?.custom,
|
|
1999
|
+
};
|
|
2000
|
+
|
|
2001
|
+
const response = await this.apiClient.sendRequest<StreamResponse<PollOptionResponse>>(
|
|
2002
|
+
'POST',
|
|
2003
|
+
'/api/v2/polls/{poll_id}/options',
|
|
2004
|
+
pathParams,
|
|
2005
|
+
undefined,
|
|
2006
|
+
body,
|
|
2007
|
+
'application/json',
|
|
2008
|
+
);
|
|
2009
|
+
|
|
2010
|
+
decoders['PollOptionResponse']?.(response.body);
|
|
2011
|
+
|
|
2012
|
+
return { ...response.body, metadata: response.metadata };
|
|
2013
|
+
}
|
|
2014
|
+
|
|
2015
|
+
async updatePollOption(
|
|
2016
|
+
request: UpdatePollOptionRequest & { poll_id: string },
|
|
2017
|
+
): Promise<StreamResponse<PollOptionResponse>> {
|
|
2018
|
+
const pathParams = {
|
|
2019
|
+
poll_id: request?.poll_id,
|
|
2020
|
+
};
|
|
2021
|
+
const body = {
|
|
2022
|
+
id: request?.id,
|
|
2023
|
+
text: request?.text,
|
|
2024
|
+
custom: request?.custom,
|
|
2025
|
+
};
|
|
2026
|
+
|
|
2027
|
+
const response = await this.apiClient.sendRequest<StreamResponse<PollOptionResponse>>(
|
|
2028
|
+
'PUT',
|
|
2029
|
+
'/api/v2/polls/{poll_id}/options',
|
|
2030
|
+
pathParams,
|
|
2031
|
+
undefined,
|
|
2032
|
+
body,
|
|
2033
|
+
'application/json',
|
|
2034
|
+
);
|
|
2035
|
+
|
|
2036
|
+
decoders['PollOptionResponse']?.(response.body);
|
|
2037
|
+
|
|
2038
|
+
return { ...response.body, metadata: response.metadata };
|
|
2039
|
+
}
|
|
2040
|
+
|
|
2041
|
+
async deletePollOption(request: {
|
|
2042
|
+
poll_id: string;
|
|
2043
|
+
option_id: string;
|
|
2044
|
+
user_id?: string;
|
|
2045
|
+
}): Promise<StreamResponse<Response>> {
|
|
2046
|
+
const queryParams = {
|
|
2047
|
+
user_id: request?.user_id,
|
|
2048
|
+
};
|
|
2049
|
+
const pathParams = {
|
|
2050
|
+
poll_id: request?.poll_id,
|
|
2051
|
+
option_id: request?.option_id,
|
|
2052
|
+
};
|
|
2053
|
+
|
|
2054
|
+
const response = await this.apiClient.sendRequest<StreamResponse<Response>>(
|
|
2055
|
+
'DELETE',
|
|
2056
|
+
'/api/v2/polls/{poll_id}/options/{option_id}',
|
|
2057
|
+
pathParams,
|
|
2058
|
+
queryParams,
|
|
2059
|
+
);
|
|
2060
|
+
|
|
2061
|
+
decoders['Response']?.(response.body);
|
|
2062
|
+
|
|
2063
|
+
return { ...response.body, metadata: response.metadata };
|
|
2064
|
+
}
|
|
2065
|
+
|
|
2066
|
+
async getPollOption(request: {
|
|
2067
|
+
poll_id: string;
|
|
2068
|
+
option_id: string;
|
|
2069
|
+
user_id?: string;
|
|
2070
|
+
}): Promise<StreamResponse<PollOptionResponse>> {
|
|
2071
|
+
const queryParams = {
|
|
2072
|
+
user_id: request?.user_id,
|
|
2073
|
+
};
|
|
2074
|
+
const pathParams = {
|
|
2075
|
+
poll_id: request?.poll_id,
|
|
2076
|
+
option_id: request?.option_id,
|
|
2077
|
+
};
|
|
2078
|
+
|
|
2079
|
+
const response = await this.apiClient.sendRequest<StreamResponse<PollOptionResponse>>(
|
|
2080
|
+
'GET',
|
|
2081
|
+
'/api/v2/polls/{poll_id}/options/{option_id}',
|
|
2082
|
+
pathParams,
|
|
2083
|
+
queryParams,
|
|
2084
|
+
);
|
|
2085
|
+
|
|
2086
|
+
decoders['PollOptionResponse']?.(response.body);
|
|
2087
|
+
|
|
2088
|
+
return { ...response.body, metadata: response.metadata };
|
|
2089
|
+
}
|
|
2090
|
+
|
|
2091
|
+
async queryPollVotes(
|
|
2092
|
+
request: QueryPollVotesRequest & { poll_id: string; user_id?: string },
|
|
2093
|
+
): Promise<StreamResponse<PollVotesResponse>> {
|
|
2094
|
+
const queryParams = {
|
|
2095
|
+
user_id: request?.user_id,
|
|
2096
|
+
};
|
|
2097
|
+
const pathParams = {
|
|
2098
|
+
poll_id: request?.poll_id,
|
|
2099
|
+
};
|
|
2100
|
+
const body = {
|
|
2101
|
+
limit: request?.limit,
|
|
2102
|
+
next: request?.next,
|
|
2103
|
+
prev: request?.prev,
|
|
2104
|
+
sort: request?.sort,
|
|
2105
|
+
filter: request?.filter,
|
|
2106
|
+
};
|
|
2107
|
+
|
|
2108
|
+
const response = await this.apiClient.sendRequest<StreamResponse<PollVotesResponse>>(
|
|
2109
|
+
'POST',
|
|
2110
|
+
'/api/v2/polls/{poll_id}/votes',
|
|
2111
|
+
pathParams,
|
|
2112
|
+
queryParams,
|
|
2113
|
+
body,
|
|
2114
|
+
'application/json',
|
|
2115
|
+
);
|
|
2116
|
+
|
|
2117
|
+
decoders['PollVotesResponse']?.(response.body);
|
|
2118
|
+
|
|
2119
|
+
return { ...response.body, metadata: response.metadata };
|
|
2120
|
+
}
|
|
2121
|
+
|
|
2122
|
+
async updatePushNotificationPreferences(
|
|
2123
|
+
request: UpsertPushPreferencesRequest,
|
|
2124
|
+
): Promise<StreamResponse<UpsertPushPreferencesResponse>> {
|
|
2125
|
+
const body = {
|
|
2126
|
+
preferences: request?.preferences,
|
|
2127
|
+
};
|
|
2128
|
+
|
|
2129
|
+
const response = await this.apiClient.sendRequest<
|
|
2130
|
+
StreamResponse<UpsertPushPreferencesResponse>
|
|
2131
|
+
>('POST', '/api/v2/push_preferences', undefined, undefined, body, 'application/json');
|
|
2132
|
+
|
|
2133
|
+
decoders['UpsertPushPreferencesResponse']?.(response.body);
|
|
2134
|
+
|
|
2135
|
+
return { ...response.body, metadata: response.metadata };
|
|
2136
|
+
}
|
|
2137
|
+
|
|
2138
|
+
async searchRoles(request: {
|
|
2139
|
+
query: string;
|
|
2140
|
+
limit?: number;
|
|
2141
|
+
name_gt?: string;
|
|
2142
|
+
role_type?: string;
|
|
2143
|
+
include_global_roles?: boolean;
|
|
2144
|
+
}): Promise<StreamResponse<SearchRolesResponse>> {
|
|
2145
|
+
const queryParams = {
|
|
2146
|
+
query: request?.query,
|
|
2147
|
+
limit: request?.limit,
|
|
2148
|
+
name_gt: request?.name_gt,
|
|
2149
|
+
role_type: request?.role_type,
|
|
2150
|
+
include_global_roles: request?.include_global_roles,
|
|
2151
|
+
};
|
|
2152
|
+
|
|
2153
|
+
const response = await this.apiClient.sendRequest<
|
|
2154
|
+
StreamResponse<SearchRolesResponse>
|
|
2155
|
+
>('GET', '/api/v2/roles/search', undefined, queryParams);
|
|
2156
|
+
|
|
2157
|
+
decoders['SearchRolesResponse']?.(response.body);
|
|
2158
|
+
|
|
2159
|
+
return { ...response.body, metadata: response.metadata };
|
|
2160
|
+
}
|
|
2161
|
+
|
|
2162
|
+
async deleteFile(request?: { url?: string }): Promise<StreamResponse<Response>> {
|
|
2163
|
+
const queryParams = {
|
|
2164
|
+
url: request?.url,
|
|
2165
|
+
};
|
|
2166
|
+
|
|
2167
|
+
const response = await this.apiClient.sendRequest<StreamResponse<Response>>(
|
|
2168
|
+
'DELETE',
|
|
2169
|
+
'/api/v2/uploads/file',
|
|
2170
|
+
undefined,
|
|
2171
|
+
queryParams,
|
|
2172
|
+
);
|
|
2173
|
+
|
|
2174
|
+
decoders['Response']?.(response.body);
|
|
2175
|
+
|
|
2176
|
+
return { ...response.body, metadata: response.metadata };
|
|
2177
|
+
}
|
|
2178
|
+
|
|
2179
|
+
async uploadFile(
|
|
2180
|
+
request?: FileUploadRequest,
|
|
2181
|
+
): Promise<StreamResponse<FileUploadResponse>> {
|
|
2182
|
+
const body = {
|
|
2183
|
+
file: request?.file,
|
|
2184
|
+
user: request?.user,
|
|
2185
|
+
};
|
|
2186
|
+
|
|
2187
|
+
const response = await this.apiClient.sendRequest<StreamResponse<FileUploadResponse>>(
|
|
2188
|
+
'POST',
|
|
2189
|
+
'/api/v2/uploads/file',
|
|
2190
|
+
undefined,
|
|
2191
|
+
undefined,
|
|
2192
|
+
body,
|
|
2193
|
+
'multipart/form-data',
|
|
2194
|
+
);
|
|
2195
|
+
|
|
2196
|
+
decoders['FileUploadResponse']?.(response.body);
|
|
2197
|
+
|
|
2198
|
+
return { ...response.body, metadata: response.metadata };
|
|
2199
|
+
}
|
|
2200
|
+
|
|
2201
|
+
async deleteImage(request?: { url?: string }): Promise<StreamResponse<Response>> {
|
|
2202
|
+
const queryParams = {
|
|
2203
|
+
url: request?.url,
|
|
2204
|
+
};
|
|
2205
|
+
|
|
2206
|
+
const response = await this.apiClient.sendRequest<StreamResponse<Response>>(
|
|
2207
|
+
'DELETE',
|
|
2208
|
+
'/api/v2/uploads/image',
|
|
2209
|
+
undefined,
|
|
2210
|
+
queryParams,
|
|
2211
|
+
);
|
|
2212
|
+
|
|
2213
|
+
decoders['Response']?.(response.body);
|
|
2214
|
+
|
|
2215
|
+
return { ...response.body, metadata: response.metadata };
|
|
2216
|
+
}
|
|
2217
|
+
|
|
2218
|
+
async uploadImage(
|
|
2219
|
+
request?: ImageUploadRequest,
|
|
2220
|
+
): Promise<StreamResponse<ImageUploadResponse>> {
|
|
2221
|
+
const body = {
|
|
2222
|
+
file: request?.file,
|
|
2223
|
+
upload_sizes: request?.upload_sizes,
|
|
2224
|
+
user: request?.user,
|
|
2225
|
+
};
|
|
2226
|
+
|
|
2227
|
+
const response = await this.apiClient.sendRequest<
|
|
2228
|
+
StreamResponse<ImageUploadResponse>
|
|
2229
|
+
>('POST', '/api/v2/uploads/image', undefined, undefined, body, 'multipart/form-data');
|
|
2230
|
+
|
|
2231
|
+
decoders['ImageUploadResponse']?.(response.body);
|
|
2232
|
+
|
|
2233
|
+
return { ...response.body, metadata: response.metadata };
|
|
2234
|
+
}
|
|
2235
|
+
|
|
2236
|
+
async listUserGroups(request?: {
|
|
2237
|
+
limit?: number;
|
|
2238
|
+
id_gt?: string;
|
|
2239
|
+
created_at_gt?: string;
|
|
2240
|
+
team_id?: string;
|
|
2241
|
+
}): Promise<StreamResponse<ListUserGroupsResponse>> {
|
|
2242
|
+
const queryParams = {
|
|
2243
|
+
limit: request?.limit,
|
|
2244
|
+
id_gt: request?.id_gt,
|
|
2245
|
+
created_at_gt: request?.created_at_gt,
|
|
2246
|
+
team_id: request?.team_id,
|
|
2247
|
+
};
|
|
2248
|
+
|
|
2249
|
+
const response = await this.apiClient.sendRequest<
|
|
2250
|
+
StreamResponse<ListUserGroupsResponse>
|
|
2251
|
+
>('GET', '/api/v2/usergroups', undefined, queryParams);
|
|
2252
|
+
|
|
2253
|
+
decoders['ListUserGroupsResponse']?.(response.body);
|
|
2254
|
+
|
|
2255
|
+
return { ...response.body, metadata: response.metadata };
|
|
2256
|
+
}
|
|
2257
|
+
|
|
2258
|
+
async createUserGroup(
|
|
2259
|
+
request: CreateUserGroupRequest,
|
|
2260
|
+
): Promise<StreamResponse<CreateUserGroupResponse>> {
|
|
2261
|
+
const body = {
|
|
2262
|
+
name: request?.name,
|
|
2263
|
+
description: request?.description,
|
|
2264
|
+
id: request?.id,
|
|
2265
|
+
team_id: request?.team_id,
|
|
2266
|
+
member_ids: request?.member_ids,
|
|
2267
|
+
};
|
|
2268
|
+
|
|
2269
|
+
const response = await this.apiClient.sendRequest<
|
|
2270
|
+
StreamResponse<CreateUserGroupResponse>
|
|
2271
|
+
>('POST', '/api/v2/usergroups', undefined, undefined, body, 'application/json');
|
|
2272
|
+
|
|
2273
|
+
decoders['CreateUserGroupResponse']?.(response.body);
|
|
2274
|
+
|
|
2275
|
+
return { ...response.body, metadata: response.metadata };
|
|
2276
|
+
}
|
|
2277
|
+
|
|
2278
|
+
async searchUserGroups(request: {
|
|
2279
|
+
query: string;
|
|
2280
|
+
limit?: number;
|
|
2281
|
+
name_gt?: string;
|
|
2282
|
+
id_gt?: string;
|
|
2283
|
+
team_id?: string;
|
|
2284
|
+
}): Promise<StreamResponse<SearchUserGroupsResponse>> {
|
|
2285
|
+
const queryParams = {
|
|
2286
|
+
query: request?.query,
|
|
2287
|
+
limit: request?.limit,
|
|
2288
|
+
name_gt: request?.name_gt,
|
|
2289
|
+
id_gt: request?.id_gt,
|
|
2290
|
+
team_id: request?.team_id,
|
|
2291
|
+
};
|
|
2292
|
+
|
|
2293
|
+
const response = await this.apiClient.sendRequest<
|
|
2294
|
+
StreamResponse<SearchUserGroupsResponse>
|
|
2295
|
+
>('GET', '/api/v2/usergroups/search', undefined, queryParams);
|
|
2296
|
+
|
|
2297
|
+
decoders['SearchUserGroupsResponse']?.(response.body);
|
|
2298
|
+
|
|
2299
|
+
return { ...response.body, metadata: response.metadata };
|
|
2300
|
+
}
|
|
2301
|
+
|
|
2302
|
+
async deleteUserGroup(request: {
|
|
2303
|
+
id: string;
|
|
2304
|
+
team_id?: string;
|
|
2305
|
+
}): Promise<StreamResponse<Response>> {
|
|
2306
|
+
const queryParams = {
|
|
2307
|
+
team_id: request?.team_id,
|
|
2308
|
+
};
|
|
2309
|
+
const pathParams = {
|
|
2310
|
+
id: request?.id,
|
|
2311
|
+
};
|
|
2312
|
+
|
|
2313
|
+
const response = await this.apiClient.sendRequest<StreamResponse<Response>>(
|
|
2314
|
+
'DELETE',
|
|
2315
|
+
'/api/v2/usergroups/{id}',
|
|
2316
|
+
pathParams,
|
|
2317
|
+
queryParams,
|
|
2318
|
+
);
|
|
2319
|
+
|
|
2320
|
+
decoders['Response']?.(response.body);
|
|
2321
|
+
|
|
2322
|
+
return { ...response.body, metadata: response.metadata };
|
|
2323
|
+
}
|
|
2324
|
+
|
|
2325
|
+
async getUserGroup(request: {
|
|
2326
|
+
id: string;
|
|
2327
|
+
team_id?: string;
|
|
2328
|
+
}): Promise<StreamResponse<GetUserGroupResponse>> {
|
|
2329
|
+
const queryParams = {
|
|
2330
|
+
team_id: request?.team_id,
|
|
2331
|
+
};
|
|
2332
|
+
const pathParams = {
|
|
2333
|
+
id: request?.id,
|
|
2334
|
+
};
|
|
2335
|
+
|
|
2336
|
+
const response = await this.apiClient.sendRequest<
|
|
2337
|
+
StreamResponse<GetUserGroupResponse>
|
|
2338
|
+
>('GET', '/api/v2/usergroups/{id}', pathParams, queryParams);
|
|
2339
|
+
|
|
2340
|
+
decoders['GetUserGroupResponse']?.(response.body);
|
|
2341
|
+
|
|
2342
|
+
return { ...response.body, metadata: response.metadata };
|
|
2343
|
+
}
|
|
2344
|
+
|
|
2345
|
+
async updateUserGroup(
|
|
2346
|
+
request: UpdateUserGroupRequest & { id: string },
|
|
2347
|
+
): Promise<StreamResponse<UpdateUserGroupResponse>> {
|
|
2348
|
+
const pathParams = {
|
|
2349
|
+
id: request?.id,
|
|
2350
|
+
};
|
|
2351
|
+
const body = {
|
|
2352
|
+
description: request?.description,
|
|
2353
|
+
name: request?.name,
|
|
2354
|
+
team_id: request?.team_id,
|
|
2355
|
+
};
|
|
2356
|
+
|
|
2357
|
+
const response = await this.apiClient.sendRequest<
|
|
2358
|
+
StreamResponse<UpdateUserGroupResponse>
|
|
2359
|
+
>('PUT', '/api/v2/usergroups/{id}', pathParams, undefined, body, 'application/json');
|
|
2360
|
+
|
|
2361
|
+
decoders['UpdateUserGroupResponse']?.(response.body);
|
|
2362
|
+
|
|
2363
|
+
return { ...response.body, metadata: response.metadata };
|
|
2364
|
+
}
|
|
2365
|
+
|
|
2366
|
+
async addUserGroupMembers(
|
|
2367
|
+
request: AddUserGroupMembersRequest & { id: string },
|
|
2368
|
+
): Promise<StreamResponse<AddUserGroupMembersResponse>> {
|
|
2369
|
+
const pathParams = {
|
|
2370
|
+
id: request?.id,
|
|
2371
|
+
};
|
|
2372
|
+
const body = {
|
|
2373
|
+
member_ids: request?.member_ids,
|
|
2374
|
+
as_admin: request?.as_admin,
|
|
2375
|
+
team_id: request?.team_id,
|
|
2376
|
+
};
|
|
2377
|
+
|
|
2378
|
+
const response = await this.apiClient.sendRequest<
|
|
2379
|
+
StreamResponse<AddUserGroupMembersResponse>
|
|
2380
|
+
>(
|
|
2381
|
+
'POST',
|
|
2382
|
+
'/api/v2/usergroups/{id}/members',
|
|
2383
|
+
pathParams,
|
|
2384
|
+
undefined,
|
|
2385
|
+
body,
|
|
2386
|
+
'application/json',
|
|
2387
|
+
);
|
|
2388
|
+
|
|
2389
|
+
decoders['AddUserGroupMembersResponse']?.(response.body);
|
|
2390
|
+
|
|
2391
|
+
return { ...response.body, metadata: response.metadata };
|
|
2392
|
+
}
|
|
2393
|
+
|
|
2394
|
+
async removeUserGroupMembers(
|
|
2395
|
+
request: RemoveUserGroupMembersRequest & { id: string },
|
|
2396
|
+
): Promise<StreamResponse<RemoveUserGroupMembersResponse>> {
|
|
2397
|
+
const pathParams = {
|
|
2398
|
+
id: request?.id,
|
|
2399
|
+
};
|
|
2400
|
+
const body = {
|
|
2401
|
+
member_ids: request?.member_ids,
|
|
2402
|
+
team_id: request?.team_id,
|
|
2403
|
+
};
|
|
2404
|
+
|
|
2405
|
+
const response = await this.apiClient.sendRequest<
|
|
2406
|
+
StreamResponse<RemoveUserGroupMembersResponse>
|
|
2407
|
+
>(
|
|
2408
|
+
'POST',
|
|
2409
|
+
'/api/v2/usergroups/{id}/members/delete',
|
|
2410
|
+
pathParams,
|
|
2411
|
+
undefined,
|
|
2412
|
+
body,
|
|
2413
|
+
'application/json',
|
|
2414
|
+
);
|
|
2415
|
+
|
|
2416
|
+
decoders['RemoveUserGroupMembersResponse']?.(response.body);
|
|
2417
|
+
|
|
2418
|
+
return { ...response.body, metadata: response.metadata };
|
|
2419
|
+
}
|
|
2420
|
+
|
|
2421
|
+
async queryUsers(request?: {
|
|
2422
|
+
payload?: QueryUsersPayload;
|
|
2423
|
+
}): Promise<StreamResponse<QueryUsersResponse>> {
|
|
2424
|
+
const queryParams = {
|
|
2425
|
+
payload: request?.payload,
|
|
2426
|
+
};
|
|
2427
|
+
|
|
2428
|
+
const response = await this.apiClient.sendRequest<StreamResponse<QueryUsersResponse>>(
|
|
2429
|
+
'GET',
|
|
2430
|
+
'/api/v2/users',
|
|
2431
|
+
undefined,
|
|
2432
|
+
queryParams,
|
|
2433
|
+
);
|
|
2434
|
+
|
|
2435
|
+
decoders['QueryUsersResponse']?.(response.body);
|
|
2436
|
+
|
|
2437
|
+
return { ...response.body, metadata: response.metadata };
|
|
2438
|
+
}
|
|
2439
|
+
|
|
2440
|
+
async updateUsersPartial(
|
|
2441
|
+
request: UpdateUsersPartialRequest,
|
|
2442
|
+
): Promise<StreamResponse<UpdateUsersResponse>> {
|
|
2443
|
+
const body = {
|
|
2444
|
+
users: request?.users,
|
|
2445
|
+
};
|
|
2446
|
+
|
|
2447
|
+
const response = await this.apiClient.sendRequest<
|
|
2448
|
+
StreamResponse<UpdateUsersResponse>
|
|
2449
|
+
>('PATCH', '/api/v2/users', undefined, undefined, body, 'application/json');
|
|
2450
|
+
|
|
2451
|
+
decoders['UpdateUsersResponse']?.(response.body);
|
|
2452
|
+
|
|
2453
|
+
return { ...response.body, metadata: response.metadata };
|
|
2454
|
+
}
|
|
2455
|
+
|
|
2456
|
+
async updateUsers(
|
|
2457
|
+
request: UpdateUsersRequest,
|
|
2458
|
+
): Promise<StreamResponse<UpdateUsersResponse>> {
|
|
2459
|
+
const body = {
|
|
2460
|
+
users: request?.users,
|
|
2461
|
+
};
|
|
2462
|
+
|
|
2463
|
+
const response = await this.apiClient.sendRequest<
|
|
2464
|
+
StreamResponse<UpdateUsersResponse>
|
|
2465
|
+
>('POST', '/api/v2/users', undefined, undefined, body, 'application/json');
|
|
2466
|
+
|
|
2467
|
+
decoders['UpdateUsersResponse']?.(response.body);
|
|
2468
|
+
|
|
2469
|
+
return { ...response.body, metadata: response.metadata };
|
|
2470
|
+
}
|
|
2471
|
+
|
|
2472
|
+
async getBlockedUsers(): Promise<StreamResponse<GetBlockedUsersResponse>> {
|
|
2473
|
+
const response = await this.apiClient.sendRequest<
|
|
2474
|
+
StreamResponse<GetBlockedUsersResponse>
|
|
2475
|
+
>('GET', '/api/v2/users/block', undefined, undefined);
|
|
2476
|
+
|
|
2477
|
+
decoders['GetBlockedUsersResponse']?.(response.body);
|
|
2478
|
+
|
|
2479
|
+
return { ...response.body, metadata: response.metadata };
|
|
2480
|
+
}
|
|
2481
|
+
|
|
2482
|
+
async blockUsers(
|
|
2483
|
+
request: BlockUsersRequest,
|
|
2484
|
+
): Promise<StreamResponse<BlockUsersResponse>> {
|
|
2485
|
+
const body = {
|
|
2486
|
+
blocked_user_id: request?.blocked_user_id,
|
|
2487
|
+
};
|
|
2488
|
+
|
|
2489
|
+
const response = await this.apiClient.sendRequest<StreamResponse<BlockUsersResponse>>(
|
|
2490
|
+
'POST',
|
|
2491
|
+
'/api/v2/users/block',
|
|
2492
|
+
undefined,
|
|
2493
|
+
undefined,
|
|
2494
|
+
body,
|
|
2495
|
+
'application/json',
|
|
2496
|
+
);
|
|
2497
|
+
|
|
2498
|
+
decoders['BlockUsersResponse']?.(response.body);
|
|
2499
|
+
|
|
2500
|
+
return { ...response.body, metadata: response.metadata };
|
|
2501
|
+
}
|
|
2502
|
+
|
|
2503
|
+
async getUserLiveLocations(): Promise<StreamResponse<SharedLocationsResponse>> {
|
|
2504
|
+
const response = await this.apiClient.sendRequest<
|
|
2505
|
+
StreamResponse<SharedLocationsResponse>
|
|
2506
|
+
>('GET', '/api/v2/users/live_locations', undefined, undefined);
|
|
2507
|
+
|
|
2508
|
+
decoders['SharedLocationsResponse']?.(response.body);
|
|
2509
|
+
|
|
2510
|
+
return { ...response.body, metadata: response.metadata };
|
|
2511
|
+
}
|
|
2512
|
+
|
|
2513
|
+
async updateLiveLocation(
|
|
2514
|
+
request: UpdateLiveLocationRequest,
|
|
2515
|
+
): Promise<StreamResponse<SharedLocationResponse>> {
|
|
2516
|
+
const body = {
|
|
2517
|
+
message_id: request?.message_id,
|
|
2518
|
+
end_at: request?.end_at,
|
|
2519
|
+
latitude: request?.latitude,
|
|
2520
|
+
longitude: request?.longitude,
|
|
2521
|
+
};
|
|
2522
|
+
|
|
2523
|
+
const response = await this.apiClient.sendRequest<
|
|
2524
|
+
StreamResponse<SharedLocationResponse>
|
|
2525
|
+
>(
|
|
2526
|
+
'PUT',
|
|
2527
|
+
'/api/v2/users/live_locations',
|
|
2528
|
+
undefined,
|
|
2529
|
+
undefined,
|
|
2530
|
+
body,
|
|
2531
|
+
'application/json',
|
|
2532
|
+
);
|
|
2533
|
+
|
|
2534
|
+
decoders['SharedLocationResponse']?.(response.body);
|
|
2535
|
+
|
|
2536
|
+
return { ...response.body, metadata: response.metadata };
|
|
2537
|
+
}
|
|
2538
|
+
|
|
2539
|
+
async unblockUsers(
|
|
2540
|
+
request: UnblockUsersRequest,
|
|
2541
|
+
): Promise<StreamResponse<UnblockUsersResponse>> {
|
|
2542
|
+
const body = {
|
|
2543
|
+
blocked_user_id: request?.blocked_user_id,
|
|
2544
|
+
};
|
|
2545
|
+
|
|
2546
|
+
const response = await this.apiClient.sendRequest<
|
|
2547
|
+
StreamResponse<UnblockUsersResponse>
|
|
2548
|
+
>('POST', '/api/v2/users/unblock', undefined, undefined, body, 'application/json');
|
|
2549
|
+
|
|
2550
|
+
decoders['UnblockUsersResponse']?.(response.body);
|
|
2551
|
+
|
|
2552
|
+
return { ...response.body, metadata: response.metadata };
|
|
2553
|
+
}
|
|
2554
|
+
}
|