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.
Files changed (242) hide show
  1. package/dist/cjs/index.browser.js +19798 -14472
  2. package/dist/cjs/index.browser.js.map +4 -4
  3. package/dist/cjs/index.node.js +19817 -14482
  4. package/dist/cjs/index.node.js.map +4 -4
  5. package/dist/esm/index.mjs +19795 -14469
  6. package/dist/esm/index.mjs.map +4 -4
  7. package/dist/types/ChannelManager.d.ts +221 -0
  8. package/dist/types/EventHandlerPipeline.d.ts +104 -0
  9. package/dist/types/api-client.d.ts +26 -0
  10. package/dist/types/campaign.d.ts +0 -44
  11. package/dist/types/channel.d.ts +454 -479
  12. package/dist/types/channel_batch_updater.d.ts +0 -93
  13. package/dist/types/channel_state.d.ts +53 -201
  14. package/dist/types/client.d.ts +451 -1920
  15. package/dist/types/client_state.d.ts +4 -4
  16. package/dist/types/configuration/InstanceConfigurationService.d.ts +26 -0
  17. package/dist/types/configuration/index.d.ts +1 -0
  18. package/dist/types/configuration/types.d.ts +53 -0
  19. package/dist/types/connection.d.ts +49 -41
  20. package/dist/types/connection_fallback.d.ts +6 -4
  21. package/dist/types/constants.d.ts +0 -4
  22. package/dist/types/custom_types.d.ts +2 -0
  23. package/dist/types/entityStore/EntityStore.d.ts +111 -0
  24. package/dist/types/entityStore/StoreBackedItemIndex.d.ts +60 -0
  25. package/dist/types/entityStore/applyReactionLocally.d.ts +26 -0
  26. package/dist/types/entityStore/index.d.ts +2 -0
  27. package/dist/types/errors.d.ts +10 -2
  28. package/dist/types/gen/chat/ChannelApi.d.ts +45 -0
  29. package/dist/types/gen/chat/ChatApi.d.ts +334 -0
  30. package/dist/types/gen/model-decoders/decoders.d.ts +3 -0
  31. package/dist/types/gen/model-decoders/event-decoder-mapping.d.ts +6 -0
  32. package/dist/types/gen/models/index.d.ts +8836 -0
  33. package/dist/types/gen/moderation/ModerationApi.d.ts +50 -0
  34. package/dist/types/gen-imports.d.ts +3 -0
  35. package/dist/types/index.d.ts +8 -7
  36. package/dist/types/insights.d.ts +9 -8
  37. package/dist/types/logger.d.ts +9 -0
  38. package/dist/types/messageComposer/LocationComposer.d.ts +7 -4
  39. package/dist/types/messageComposer/attachmentIdentity.d.ts +2 -2
  40. package/dist/types/messageComposer/attachmentManager.d.ts +8 -4
  41. package/dist/types/messageComposer/configuration/types.d.ts +11 -11
  42. package/dist/types/messageComposer/linkPreviewsManager.d.ts +25 -13
  43. package/dist/types/messageComposer/messageComposer.d.ts +10 -10
  44. package/dist/types/messageComposer/middleware/messageComposer/types.d.ts +3 -3
  45. package/dist/types/messageComposer/middleware/pollComposer/types.d.ts +4 -7
  46. package/dist/types/messageComposer/middleware/textComposer/commandUtils.d.ts +3 -3
  47. package/dist/types/messageComposer/middleware/textComposer/commands.d.ts +7 -7
  48. package/dist/types/messageComposer/middleware/textComposer/mentions.d.ts +218 -4
  49. package/dist/types/messageComposer/middleware/textComposer/types.d.ts +9 -4
  50. package/dist/types/messageComposer/pollComposer.d.ts +5 -4
  51. package/dist/types/messageComposer/textComposer.d.ts +8 -3
  52. package/dist/types/messageComposer/types.d.ts +6 -28
  53. package/dist/types/messageDelivery/MessageDeliveryReporter.d.ts +40 -25
  54. package/dist/types/messageDelivery/MessageReceiptsTracker.d.ts +53 -12
  55. package/dist/types/messageOperations/MessageOperationStatePolicy.d.ts +19 -0
  56. package/dist/types/messageOperations/MessageOperations.d.ts +17 -0
  57. package/dist/types/messageOperations/index.d.ts +3 -0
  58. package/dist/types/messageOperations/types.d.ts +49 -0
  59. package/dist/types/moderation.d.ts +21 -203
  60. package/dist/types/notifications/types.d.ts +8 -7
  61. package/dist/types/offline-support/offline_support_api.d.ts +111 -87
  62. package/dist/types/offline-support/offline_sync_manager.d.ts +0 -7
  63. package/dist/types/offline-support/types.d.ts +19 -23
  64. package/dist/types/offline-support/util.d.ts +4 -2
  65. package/dist/types/pagination/FilterBuilder.d.ts +1 -1
  66. package/dist/types/pagination/ItemIndex.d.ts +25 -0
  67. package/dist/types/pagination/cursorDerivation/createdAtAroundPaginationFlags.d.ts +9 -0
  68. package/dist/types/pagination/cursorDerivation/idAroundPaginationFlags.d.ts +6 -0
  69. package/dist/types/pagination/cursorDerivation/index.d.ts +1 -0
  70. package/dist/types/pagination/cursorDerivation/linearPaginationFlags.d.ts +6 -0
  71. package/dist/types/pagination/filterCompiler.d.ts +7 -0
  72. package/dist/types/pagination/index.d.ts +1 -3
  73. package/dist/types/pagination/paginators/BasePaginator.d.ts +848 -0
  74. package/dist/types/pagination/paginators/ChannelPaginator.d.ts +212 -0
  75. package/dist/types/pagination/paginators/MessageIntervalPaginator.d.ts +282 -0
  76. package/dist/types/pagination/paginators/MessagePaginator.d.ts +208 -0
  77. package/dist/types/pagination/paginators/PinnedMessagePaginator.d.ts +39 -0
  78. package/dist/types/pagination/paginators/ReminderPaginator.d.ts +19 -0
  79. package/dist/types/pagination/paginators/UserGroupPaginator.d.ts +24 -0
  80. package/dist/types/pagination/paginators/index.d.ts +7 -0
  81. package/dist/types/pagination/paginators/stateThrottling.d.ts +2 -0
  82. package/dist/types/pagination/sortCompiler.d.ts +49 -0
  83. package/dist/types/pagination/types.normalization.d.ts +11 -0
  84. package/dist/types/pagination/utility.normalization.d.ts +18 -0
  85. package/dist/types/pagination/utility.queryChannel.d.ts +26 -0
  86. package/dist/types/pagination/utility.search.d.ts +13 -0
  87. package/dist/types/permissions.d.ts +1 -1
  88. package/dist/types/poll.d.ts +29 -32
  89. package/dist/types/poll_manager.d.ts +2 -2
  90. package/dist/types/reminders/Reminder.d.ts +2 -5
  91. package/dist/types/reminders/ReminderManager.d.ts +2 -9
  92. package/dist/types/search/MessageSearchSource.d.ts +4 -4
  93. package/dist/types/search/UserSearchSource.d.ts +1 -1
  94. package/dist/types/search/types.d.ts +3 -3
  95. package/dist/types/segment.d.ts +0 -34
  96. package/dist/types/signing.d.ts +105 -65
  97. package/dist/types/store.d.ts +1 -0
  98. package/dist/types/thread.d.ts +70 -34
  99. package/dist/types/thread_manager.d.ts +3 -3
  100. package/dist/types/token_manager.d.ts +15 -10
  101. package/dist/types/types.d.ts +197 -3404
  102. package/dist/types/utils/FixedSizeQueueCache.d.ts +12 -6
  103. package/dist/types/utils/WithSubscriptions.d.ts +2 -1
  104. package/dist/types/utils/concurrency.d.ts +4 -4
  105. package/dist/types/utils/mergeWith/mergeWith.d.ts +3 -3
  106. package/dist/types/utils/mergeWith/mergeWithCore.d.ts +8 -3
  107. package/dist/types/utils/retryable.d.ts +34 -0
  108. package/dist/types/utils/throttling/throttle.d.ts +36 -0
  109. package/dist/types/utils.d.ts +100 -194
  110. package/package.json +7 -3
  111. package/src/ChannelManager.ts +724 -0
  112. package/src/CooldownTimer.ts +2 -2
  113. package/src/EventHandlerPipeline.ts +228 -0
  114. package/src/LiveLocationManager.ts +12 -11
  115. package/src/api-client.ts +275 -0
  116. package/src/campaign.ts +1 -77
  117. package/src/channel.ts +1344 -1282
  118. package/src/channel_batch_updater.ts +1 -211
  119. package/src/channel_state.ts +144 -1013
  120. package/src/client.ts +936 -3995
  121. package/src/client_state.ts +4 -4
  122. package/src/configuration/InstanceConfigurationService.ts +73 -0
  123. package/src/configuration/index.ts +1 -0
  124. package/src/configuration/types.ts +81 -0
  125. package/src/connection.ts +145 -94
  126. package/src/connection_fallback.ts +29 -27
  127. package/src/constants.ts +1 -5
  128. package/src/custom_types.ts +4 -1
  129. package/src/entityStore/EntityStore.ts +208 -0
  130. package/src/entityStore/StoreBackedItemIndex.ts +115 -0
  131. package/src/entityStore/applyReactionLocally.ts +113 -0
  132. package/src/entityStore/index.ts +2 -0
  133. package/src/errors.ts +14 -2
  134. package/src/gen/chat/ChannelApi.ts +275 -0
  135. package/src/gen/chat/ChatApi.ts +2554 -0
  136. package/src/gen/model-decoders/decoders.ts +2680 -0
  137. package/src/gen/model-decoders/event-decoder-mapping.ts +198 -0
  138. package/src/gen/models/index.ts +12673 -0
  139. package/src/gen/moderation/ModerationApi.ts +607 -0
  140. package/src/gen-imports.ts +3 -0
  141. package/src/index.ts +11 -12
  142. package/src/insights.ts +6 -5
  143. package/src/logger.ts +28 -0
  144. package/src/messageComposer/LocationComposer.ts +9 -5
  145. package/src/messageComposer/MessageComposerEffectHandlers.ts +1 -0
  146. package/src/messageComposer/attachmentIdentity.ts +16 -9
  147. package/src/messageComposer/attachmentManager.ts +13 -8
  148. package/src/messageComposer/configuration/types.ts +11 -11
  149. package/src/messageComposer/linkPreviewsManager.ts +9 -10
  150. package/src/messageComposer/messageComposer.ts +57 -53
  151. package/src/messageComposer/middleware/messageComposer/attachments.ts +1 -2
  152. package/src/messageComposer/middleware/messageComposer/cleanData.ts +1 -1
  153. package/src/messageComposer/middleware/messageComposer/compositionValidation.ts +2 -2
  154. package/src/messageComposer/middleware/messageComposer/messageComposerState.ts +2 -2
  155. package/src/messageComposer/middleware/messageComposer/sharedLocation.ts +4 -3
  156. package/src/messageComposer/middleware/messageComposer/textComposer.ts +2 -2
  157. package/src/messageComposer/middleware/messageComposer/types.ts +3 -4
  158. package/src/messageComposer/middleware/messageComposer/userDataInjection.ts +9 -5
  159. package/src/messageComposer/middleware/pollComposer/state.ts +0 -2
  160. package/src/messageComposer/middleware/pollComposer/types.ts +4 -7
  161. package/src/messageComposer/middleware/textComposer/TextComposerMiddlewareExecutor.ts +10 -1
  162. package/src/messageComposer/middleware/textComposer/commandEffects.ts +4 -4
  163. package/src/messageComposer/middleware/textComposer/commandUtils.ts +3 -6
  164. package/src/messageComposer/middleware/textComposer/commands.ts +3 -3
  165. package/src/messageComposer/middleware/textComposer/mentionUtils.ts +1 -1
  166. package/src/messageComposer/middleware/textComposer/mentions.ts +31 -15
  167. package/src/messageComposer/middleware/textComposer/types.ts +9 -4
  168. package/src/messageComposer/pollComposer.ts +6 -8
  169. package/src/messageComposer/textComposer.ts +27 -2
  170. package/src/messageComposer/types.ts +6 -28
  171. package/src/messageDelivery/MessageDeliveryReporter.ts +101 -45
  172. package/src/messageDelivery/MessageReceiptsTracker.ts +294 -21
  173. package/src/messageOperations/MessageOperationStatePolicy.ts +77 -0
  174. package/src/messageOperations/MessageOperations.ts +212 -0
  175. package/src/messageOperations/index.ts +10 -0
  176. package/src/messageOperations/types.ts +64 -0
  177. package/src/moderation.ts +38 -431
  178. package/src/notifications/types.ts +8 -7
  179. package/src/offline-support/offline_support_api.ts +200 -133
  180. package/src/offline-support/offline_sync_manager.ts +23 -44
  181. package/src/offline-support/types.ts +23 -26
  182. package/src/offline-support/util.ts +5 -4
  183. package/src/pagination/FilterBuilder.ts +4 -1
  184. package/src/pagination/ItemIndex.ts +25 -0
  185. package/src/pagination/cursorDerivation/createdAtAroundPaginationFlags.ts +73 -0
  186. package/src/pagination/cursorDerivation/idAroundPaginationFlags.ts +53 -0
  187. package/src/pagination/cursorDerivation/index.ts +1 -0
  188. package/src/pagination/cursorDerivation/linearPaginationFlags.ts +86 -0
  189. package/src/pagination/filterCompiler.ts +196 -0
  190. package/src/pagination/index.ts +1 -3
  191. package/src/pagination/paginators/BasePaginator.ts +2859 -0
  192. package/src/pagination/paginators/ChannelPaginator.ts +729 -0
  193. package/src/pagination/paginators/MessageIntervalPaginator.ts +1116 -0
  194. package/src/pagination/paginators/MessagePaginator.ts +508 -0
  195. package/src/pagination/paginators/PinnedMessagePaginator.ts +108 -0
  196. package/src/pagination/paginators/ReminderPaginator.ts +107 -0
  197. package/src/pagination/paginators/UserGroupPaginator.ts +127 -0
  198. package/src/pagination/paginators/index.ts +7 -0
  199. package/src/pagination/paginators/stateThrottling.ts +31 -0
  200. package/src/pagination/sortCompiler.ts +193 -0
  201. package/src/pagination/types.normalization.ts +14 -0
  202. package/src/pagination/utility.normalization.ts +106 -0
  203. package/src/pagination/utility.queryChannel.ts +84 -0
  204. package/src/pagination/utility.search.ts +80 -0
  205. package/src/permissions.ts +7 -8
  206. package/src/poll.ts +101 -110
  207. package/src/poll_manager.ts +14 -8
  208. package/src/reminders/Reminder.ts +2 -5
  209. package/src/reminders/ReminderManager.ts +19 -21
  210. package/src/search/BaseSearchSource.ts +0 -3
  211. package/src/search/ChannelMemberSearchSource.ts +7 -1
  212. package/src/search/ChannelSearchSource.ts +10 -3
  213. package/src/search/MessageSearchSource.ts +29 -30
  214. package/src/search/UserSearchSource.ts +12 -8
  215. package/src/search/types.ts +3 -4
  216. package/src/segment.ts +1 -95
  217. package/src/signing.ts +107 -67
  218. package/src/store.ts +2 -1
  219. package/src/thread.ts +562 -238
  220. package/src/thread_manager.ts +37 -16
  221. package/src/token_manager.ts +21 -10
  222. package/src/types.ts +364 -4533
  223. package/src/uploadManager.ts +8 -0
  224. package/src/utils/FixedSizeQueueCache.ts +12 -6
  225. package/src/utils/WithSubscriptions.ts +2 -1
  226. package/src/utils/concurrency.ts +4 -4
  227. package/src/utils/mergeWith/mergeWith.ts +3 -3
  228. package/src/utils/mergeWith/mergeWithCore.ts +140 -164
  229. package/src/utils/mergeWith/mergeWithDiff.ts +3 -3
  230. package/src/utils/retryable.ts +117 -0
  231. package/src/utils/throttling/throttle.ts +130 -0
  232. package/src/utils.ts +208 -754
  233. package/dist/types/channel_manager.d.ts +0 -122
  234. package/dist/types/events.d.ts +0 -72
  235. package/dist/types/pagination/BasePaginator.d.ts +0 -69
  236. package/dist/types/pagination/ReminderPaginator.d.ts +0 -16
  237. package/dist/types/pagination/UserGroupPaginator.d.ts +0 -21
  238. package/src/channel_manager.ts +0 -830
  239. package/src/events.ts +0 -75
  240. package/src/pagination/BasePaginator.ts +0 -184
  241. package/src/pagination/ReminderPaginator.ts +0 -56
  242. package/src/pagination/UserGroupPaginator.ts +0 -93
@@ -1,78 +1,89 @@
1
- import type { AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios';
1
+ import type { AxiosInstance, AxiosRequestConfig } from 'axios';
2
2
  import { Channel } from './channel';
3
3
  import { ClientState } from './client_state';
4
4
  import { StableWSConnection } from './connection';
5
5
  import { UploadManager } from './uploadManager';
6
- import { TokenManager } from './token_manager';
6
+ import { TokenManager, type TokenManagerMinimalUser } from './token_manager';
7
7
  import { WSConnectionFallback } from './connection_fallback';
8
- import { Campaign } from './campaign';
9
- import { ChannelBatchUpdater } from './channel_batch_updater';
10
- import { Segment } from './segment';
11
- import type { ActiveLiveLocationsAPIResponse, AddUserGroupMembersOptions, AddUserGroupMembersResponse, APIErrorResponse, APIResponse, AppIdentifier, AppSettings, AppSettingsAPIResponse, BannedUsersFilters, BannedUsersPaginationOptions, BannedUsersResponse, BannedUsersSort, BanUserOptions, BaseDeviceFields, BlockList, BlockListResponse, BlockUserAPIResponse, CampaignData, CampaignFilters, CampaignQueryOptions, CampaignResponse, CampaignSort, CastVoteAPIResponse, ChannelAPIResponse, ChannelData, ChannelFilters, ChannelMute, ChannelOptions, ChannelResponse, ChannelSort, ChannelStateOptions, CheckPushResponse, CheckSNSResponse, CheckSQSResponse, Configs, ConnectAPIResponse, CreateChannelOptions, CreateChannelResponse, CreateCommandOptions, CreateCommandResponse, CreateImportOptions, CreateImportResponse, CreateImportURLResponse, CreatePollAPIResponse, CreatePollData, CreatePollOptionAPIResponse, CreatePredefinedFilterOptions, CreateReminderOptions, CreateRoleAPIResponse, CreateUserGroupOptions, CreateUserGroupResponse, CustomPermissionOptions, DeactivateUsersOptions, DeleteCommandResponse, DeleteMessageOptions, DeleteUserGroupOptions, DeleteUserOptions, Device, DeviceIdentifier, DraftFilters, DraftSort, EndpointName, Event, EventAPIResponse, EventHandler, ExportChannelOptions, ExportChannelRequest, ExportChannelResponse, ExportChannelStatusResponse, ExportUsersRequest, ExportUsersResponse, FlagMessageResponse, FlagReportsFilters, FlagReportsPaginationOptions, FlagReportsResponse, FlagsFilters, FlagsPaginationOptions, FlagsResponse, FlagUserResponse, FutureChannelBansResponse, GetBlockedUsersAPIResponse, GetCampaignOptions, GetChannelTypeResponse, GetCommandResponse, GetHookEventsResponse, GetImportResponse, GetMessageOptions, GetPollAPIResponse, GetRateLimitsResponse, GetRetentionPolicyResponse, GetRetentionPolicyRunsOptions, GetRetentionPolicyRunsResponse, GetThreadAPIResponse, GetThreadOptions, GetUnreadCountAPIResponse, GetUnreadCountBatchAPIResponse, GetUserGroupOptions, GetUserGroupResponse, ListChannelResponse, ListCommandsResponse, ListImportsPaginationOptions, ListImportsResponse, ListPredefinedFiltersOptions, ListPredefinedFiltersResponse, ListRolesAPIResponse, LocalMessage, Logger, MarkChannelsReadOptions, MarkDeliveredOptions, MessageFilters, MessageFlagsFilters, MessageFlagsPaginationOptions, MessageFlagsResponse, MessageResponse, Mute, MuteUserOptions, MuteUserResponse, OGAttachment, OwnUserResponse, Pager, PartialMessageUpdate, PartialPollUpdate, PartialThreadUpdate, PartialUserUpdate, PermissionAPIResponse, PermissionsAPIResponse, PollAnswersAPIResponse, PollData, PollOptionData, PollSort, PollVote, PollVoteData, PollVotesAPIResponse, PredefinedFilterResponse, Product, PushPreference, PushProvider, PushProviderConfig, PushProviderID, PushProviderListResponse, PushProviderUpsertResponse, QueryChannelsAPIResponse, QueryDraftsResponse, QueryFutureChannelBansOptions, QueryMessageHistoryFilters, QueryMessageHistoryOptions, QueryMessageHistoryResponse, QueryMessageHistorySort, QueryPollsFilters, QueryPollsOptions, QueryPollsResponse, QueryReactionsAPIResponse, QueryReactionsOptions, QueryRemindersOptions, QueryRemindersResponse, QuerySegmentsOptions, QuerySegmentTargetsFilter, QueryTeamUsageStatsOptions, QueryTeamUsageStatsResponse, QueryThreadsOptions, QueryUserGroupsOptions, QueryUserGroupsResponse, QueryVotesFilters, QueryVotesOptions, ReactionFilters, ReactionResponse, ReactionSort, ReactivateUserOptions, ReactivateUsersOptions, ReminderAPIResponse, RemoveUserGroupMembersOptions, RemoveUserGroupMembersResponse, ReviewFlagReportOptions, ReviewFlagReportResponse, SdkIdentifier, SearchAPIResponse, SearchOptions, SearchRolesAPIResponse, SearchRolesOptions, SearchUserGroupsOptions, SearchUserGroupsResponse, SegmentData, SegmentResponse, SegmentTargetsResponse, SegmentType, SendFileAPIResponse, SetRetentionPolicyResponse, SharedLocationResponse, SortParam, StreamChatOptions, SyncOptions, SyncResponse, TaskResponse, TaskStatus, TestPushDataInput, TestSNSDataInput, TestSQSDataInput, TokenOrProvider, TranslateResponse, UnBanUserOptions, UpdateChannelsBatchOptions, UpdateChannelTypeRequest, UpdateChannelTypeResponse, UpdateCommandOptions, UpdateCommandResponse, UpdateLocationPayload, UpdateMessageAPIResponse, UpdateMessageOptions, UpdatePollAPIResponse, UpdatePredefinedFilterOptions, UpdateReminderOptions, UpdateSegmentData, UpdateUserGroupOptions, UpdateUserGroupResponse, UpdateUsersAPIResponse, UpsertPushPreferencesResponse, UserCustomEvent, UserFilters, UserOptions, UserResponse, UserSort, VoteSort } from './types';
12
- import { ErrorFromResponse } from './types';
8
+ import { ApiClient } from './api-client';
9
+ import type { APIResponse, AppIdentifier, BanUserOptions, BaseDeviceFields, ChannelData, ChannelMute, ChannelOptions, ChannelResponse, ChannelStateOptions, ChannelStateResponseFields, Configs, ConnectAPIResponse, DeviceIdentifier, Event, EventHandler, EventType, FlagMessageResponse, FlagUserResponse, GetThreadOptions, LocalMessage, MuteUserOptions, MuteUserResponse, OwnUserResponse, PartializeAllBut, PartialThreadUpdate, QueryBannedUsersPayload, QueryChannelsRequest, QueryChannelsResponse, QueryReactionsRequestWithId, QueryThreadsRequest, SdkIdentifier, SearchPayload, StreamChatOptions, TokenOrProvider, UnBanUserOptions, UserMuteResponse, UserResponse } from './types';
13
10
  import { InsightMetrics } from './insights';
14
11
  import { Thread } from './thread';
15
12
  import { Moderation } from './moderation';
16
13
  import { ThreadManager } from './thread_manager';
17
14
  import { PollManager } from './poll_manager';
18
- import type { ChannelManagerEventHandlerOverrides, ChannelManagerOptions, QueryChannelsRequestType } from './channel_manager';
19
- import { ChannelManager } from './channel_manager';
15
+ import { EntityStore } from './entityStore/EntityStore';
16
+ import { ChannelManager } from './ChannelManager';
20
17
  import { MessageDeliveryReporter } from './messageDelivery';
21
18
  import { NotificationManager } from './notifications';
22
19
  import { ReminderManager } from './reminders';
23
- import { StateStore } from './store';
24
- import type { MessageComposer } from './messageComposer';
25
20
  import type { AbstractOfflineDB } from './offline-support';
26
21
  import { FixedSizeQueueCache } from './utils/FixedSizeQueueCache';
27
- type MessageComposerTearDownFunction = () => void;
28
- export type QueryChannelsResponseWithChannels = Omit<QueryChannelsAPIResponse, 'channels'> & {
22
+ import type { MessageComposer } from './messageComposer';
23
+ import type { MessageComposerSetupState, SetInstanceConfigurationFunctions } from './configuration';
24
+ import { InstanceConfigurationService } from './configuration/InstanceConfigurationService';
25
+ import { StateStore } from './store';
26
+ import type { GetApplicationResponse as Gen_GetApplicationResponse, MarkDeliveredRequest as Gen_MarkDeliveredRequest, QueryUsersPayload as Gen_QueryUsersPayload, WSEvent } from './gen/models';
27
+ import { ChatApi } from './gen-imports';
28
+ import type { StreamResponse } from './types';
29
+ export type QueryChannelsResponseWithChannels = Omit<QueryChannelsResponse, 'channels'> & {
29
30
  channels: Channel[];
30
31
  };
31
- type MessageComposerSetupFunction = ({ composer, }: {
32
- composer: MessageComposer;
33
- }) => void | MessageComposerTearDownFunction;
34
32
  export type BlockedUsersState = {
35
33
  userIds: string[];
36
34
  };
37
- export type MessageComposerSetupState = {
38
- /**
39
- * Each `MessageComposer` runs this function each time its signature changes or
40
- * whenever you run `MessageComposer.registerSubscriptions`. Function returned
41
- * from `applyModifications` will be used as a cleanup function - it will be stored
42
- * and ran before new modification is applied. Cleaning up only the
43
- * modified parts is the general way to go but if your setup gets a bit
44
- * complicated, feel free to restore the whole composer with `MessageComposer.restore`.
45
- */
46
- setupFunction: MessageComposerSetupFunction | null;
35
+ export type ChannelConfigsState = {
36
+ configs: Configs;
37
+ };
38
+ export type ClientUser = PartializeAllBut<OwnUserResponse, 'id'> & {
39
+ anon?: boolean;
47
40
  };
48
- export declare class StreamChat {
41
+ export declare class StreamChat extends ChatApi {
49
42
  private static _instance?;
50
43
  messageDeliveryReporter: MessageDeliveryReporter;
51
44
  /**
52
45
  * @internal
53
46
  */
54
47
  uploadManager: UploadManager;
55
- _user?: OwnUserResponse | UserResponse;
56
- appSettingsPromise?: Promise<AppSettingsAPIResponse>;
48
+ /**
49
+ * @private
50
+ */
51
+ _user?: ClientUser;
52
+ appSettingsPromise?: Promise<StreamResponse<Gen_GetApplicationResponse>>;
57
53
  activeChannels: {
58
54
  [key: string]: Channel;
59
55
  };
60
56
  threads: ThreadManager;
61
57
  polls: PollManager;
58
+ /**
59
+ * Channel lists — one or more `ChannelPaginator`s kept in sync with WS events, with ownership
60
+ * arbitration between them. Instantiated with the client and living as long as it does; register
61
+ * the lists with `client.channelManager.insertPaginator()` and drop them again with
62
+ * `removePaginator()`. It only starts handling events once something calls its (ref-counted)
63
+ * `registerSubscriptions()`.
64
+ *
65
+ * It is deliberately not configurable through the client options — everything is set on the
66
+ * manager itself (`setOwnershipResolver`, `addEventHandler` / `setEventHandlers` /
67
+ * `removeEventHandlers`), which is also the only way to reconfigure it later.
68
+ */
69
+ channelManager: ChannelManager;
70
+ /**
71
+ * Client-global, normalized store holding one canonical copy of each message. The channel main
72
+ * list and thread reply paginators read/write message content through it, so a message held in
73
+ * more than one of them stays consistent without copy-to-copy fan-out.
74
+ */
75
+ messageStore: EntityStore<LocalMessage>;
62
76
  offlineDb?: AbstractOfflineDB;
63
77
  notifications: NotificationManager;
64
78
  reminders: ReminderManager;
65
- anonymous: boolean;
66
79
  persistUserOnConnectionFailure?: boolean;
67
80
  axiosInstance: AxiosInstance;
68
81
  baseURL?: string;
69
82
  browser: boolean;
70
83
  cleaningIntervalRef?: NodeJS.Timeout;
71
- clientID?: string;
72
- configs: Configs;
84
+ clientId?: string;
73
85
  key: string;
74
- listeners: Record<string, Array<(event: Event) => void>>;
75
- logger: Logger;
86
+ listeners: Map<EventType, Set<EventHandler>>;
76
87
  /**
77
88
  * When network is recovered, we re-query the active channels on client. But in single query, you can recover
78
89
  * only 30 channels. So its not guaranteed that all the channels in activeChannels object have updated state.
@@ -90,22 +101,34 @@ export declare class StreamChat {
90
101
  preventThreadCleanup: boolean;
91
102
  moderation: Moderation;
92
103
  mutedChannels: ChannelMute[];
93
- mutedUsers: Mute[];
104
+ readonly mutedUsersStore: StateStore<{
105
+ mutedUsers: UserMuteResponse[];
106
+ }>;
107
+ readonly configsStore: StateStore<ChannelConfigsState>;
94
108
  blockedUsers: StateStore<BlockedUsersState>;
95
109
  node: boolean;
96
110
  options: StreamChatOptions;
97
- secret?: string;
98
111
  setUserPromise: ConnectAPIResponse | null;
99
112
  state: ClientState;
100
113
  tokenManager: TokenManager;
101
- user?: OwnUserResponse | UserResponse;
114
+ user?: ClientUser;
102
115
  userAgent?: string;
103
- userID?: string;
104
116
  wsBaseURL?: string;
105
117
  wsConnection: StableWSConnection | null;
106
118
  wsFallback?: WSConnectionFallback;
107
119
  wsPromise: ConnectAPIResponse | null;
108
- consecutiveFailures: number;
120
+ get anonymous(): boolean;
121
+ get userId(): string | undefined;
122
+ /**
123
+ * @deprecated Use `userId` instead.
124
+ */
125
+ get userID(): string | undefined;
126
+ /**
127
+ * @deprecated Use `clientId` instead.
128
+ */
129
+ get clientID(): string | undefined;
130
+ set clientID(id: string | undefined);
131
+ get api(): ApiClient;
109
132
  insightMetrics: InsightMetrics;
110
133
  defaultWSTimeoutWithFallback: number;
111
134
  defaultWSTimeout: number;
@@ -115,350 +138,230 @@ export declare class StreamChat {
115
138
  private cachedUserAgent?;
116
139
  readonly messageComposerCache: FixedSizeQueueCache<string, MessageComposer>;
117
140
  private nextRequestAbortController;
141
+ instanceConfigurationService: InstanceConfigurationService;
118
142
  /**
119
- * @private
120
- */
121
- _messageComposerSetupState: StateStore<MessageComposerSetupState>;
122
- /**
123
- * Initialize a client
143
+ * Initializes a client.
144
+ *
145
+ * **Only use constructor for advanced usages. It is strongly advised to use `StreamChat.getInstance()` instead of `new StreamChat()` to reduce integration issues due to multiple WebSocket connections.**
124
146
  *
125
- * **Only use constructor for advanced usages. It is strongly advised to use `StreamChat.getInstance()` instead of `new StreamChat()` to reduce integration issues due to multiple WebSocket connections**
126
- * @param {string} key - the api key
127
- * @param {string} [secret] - the api secret
128
- * @param {StreamChatOptions} [options] - additional options, here you can pass custom options to axios instance
129
- * @param {boolean} [options.browser] - enforce the client to be in browser mode
130
- * @param {boolean} [options.warmUp] - default to false, if true, client will open a connection as soon as possible to speed up following requests
131
- * @param {Logger} [options.Logger] - custom logger
132
- * @param {number} [options.timeout] - default to 3000
133
- * @param {httpsAgent} [options.httpsAgent] - custom httpsAgent, in node it's default to https.agent()
134
147
  * @example <caption>initialize the client in user mode</caption>
135
148
  * new StreamChat('api_key')
136
149
  * @example <caption>initialize the client in user mode with options</caption>
137
- * new StreamChat('api_key', { warmUp:true, timeout:5000 })
150
+ * new StreamChat('api_key', { warmUp: true, timeout: 5000 })
138
151
  * @example <caption>secret is optional and only used in server side mode</caption>
139
- * new StreamChat('api_key', "secret", { httpsAgent: customAgent })
152
+ * new StreamChat('api_key', 'secret', { httpsAgent: customAgent })
153
+ *
154
+ * @param key - The API key.
155
+ * @param options - Additional options; here you can pass custom options to the axios instance (optional).
156
+ * @param options.browser - Enforce the client to be in browser mode (optional).
157
+ * @param options.warmUp - If `true`, the client will open a connection as soon as possible to speed up following requests (optional, defaults to `false`).
158
+ * @param options.logLevel - Minimum log level for the default sink (optional, defaults to `'info'`).
159
+ * @param options.logOptions - Per-scope sink/level overrides for `chatLoggerSystem` (optional).
160
+ * @param options.timeout - Request timeout (optional, defaults to `3000`).
161
+ * @param options.httpsAgent - Custom `httpsAgent` (optional, in Node defaults to `https.agent()`).
140
162
  */
141
163
  constructor(key: string, options?: StreamChatOptions);
142
- constructor(key: string, secret?: string, options?: StreamChatOptions);
164
+ get mutedUsers(): UserMuteResponse[];
165
+ set mutedUsers(mutedUsers: UserMuteResponse[]);
166
+ get configs(): Configs;
167
+ set configs(configs: Configs);
143
168
  /**
144
- * Get a client instance
169
+ * Returns a client instance.
145
170
  *
146
- * This function always returns the same Client instance to avoid issues raised by multiple Client and WS connections
171
+ * This function always returns the same client instance to avoid issues raised by multiple client and WS connections.
147
172
  *
148
- * **After the first call, the client configuration will not change if the key or options parameters change**
173
+ * **After the first call, the client configuration will not change if the key or options parameters change.**
149
174
  *
150
- * @param {string} key - the api key
151
- * @param {string} [secret] - the api secret
152
- * @param {StreamChatOptions} [options] - additional options, here you can pass custom options to axios instance
153
- * @param {boolean} [options.browser] - enforce the client to be in browser mode
154
- * @param {boolean} [options.warmUp] - default to false, if true, client will open a connection as soon as possible to speed up following requests
155
- * @param {Logger} [options.Logger] - custom logger
156
- * @param {number} [options.timeout] - default to 3000
157
- * @param {httpsAgent} [options.httpsAgent] - custom httpsAgent, in node it's default to https.agent()
158
175
  * @example <caption>initialize the client in user mode</caption>
159
176
  * StreamChat.getInstance('api_key')
160
177
  * @example <caption>initialize the client in user mode with options</caption>
161
- * StreamChat.getInstance('api_key', { timeout:5000 })
178
+ * StreamChat.getInstance('api_key', { timeout: 5000 })
162
179
  * @example <caption>secret is optional and only used in server side mode</caption>
163
- * StreamChat.getInstance('api_key', "secret", { httpsAgent: customAgent })
180
+ * StreamChat.getInstance('api_key', 'secret', { httpsAgent: customAgent })
181
+ *
182
+ * @param key - The API key.
183
+ * @param options - Additional options; here you can pass custom options to the axios instance (optional).
184
+ * @param options.browser - Enforce the client to be in browser mode (optional).
185
+ * @param options.warmUp - If `true`, the client will open a connection as soon as possible to speed up following requests (optional, defaults to `false`).
186
+ * @param options.logLevel - Minimum log level for the default sink (optional, defaults to `'info'`).
187
+ * @param options.logOptions - Per-scope sink/level overrides for `chatLoggerSystem` (optional).
188
+ * @param options.timeout - Request timeout (optional, defaults to `3000`).
189
+ * @param options.httpsAgent - Custom `httpsAgent` (optional, in Node defaults to `https.agent()`).
190
+ * @returns The shared client instance.
164
191
  */
165
192
  static getInstance(key: string, options?: StreamChatOptions): StreamChat;
166
- static getInstance(key: string, secret?: string, options?: StreamChatOptions): StreamChat;
167
193
  setOfflineDBApi(offlineDBInstance: AbstractOfflineDB): void;
168
- devToken(userID: string): string;
169
194
  getAuthType(): "anonymous" | "jwt";
170
195
  setBaseURL(baseURL: string): void;
171
196
  _getConnectionID: () => string | undefined;
172
197
  _hasConnectionID: () => boolean;
173
198
  setMessageComposerSetupFunction: (setupFunction: MessageComposerSetupState["setupFunction"]) => void;
199
+ setInstanceConfigurationFunction: (setupFunctions: SetInstanceConfigurationFunctions) => void;
174
200
  /**
175
- * connectUser - Set the current user and open a WebSocket connection
176
- *
177
- * @param {OwnUserResponse | UserResponse} user Data about this user. IE {name: "john"}
178
- * @param {TokenOrProvider} userTokenOrProvider Token or provider
201
+ * Sets the current user and opens a WebSocket connection.
179
202
  *
180
- * @return {ConnectAPIResponse} Returns a promise that resolves when the connection is setup
203
+ * @param user - Data about this user, e.g. `{ name: 'john' }`.
204
+ * @param userTokenOrProvider - A token string or an async provider that returns one.
205
+ * @returns A promise that resolves when the connection is set up.
181
206
  */
182
- connectUser: (user: OwnUserResponse | UserResponse, userTokenOrProvider: TokenOrProvider) => Promise<void | import("./types").ConnectionOpen>;
207
+ connectUser: (user: ClientUser, userTokenOrProvider: TokenOrProvider) => Promise<void | ({
208
+ type: "health.check";
209
+ } & import(".").HealthCheckEvent)>;
183
210
  /**
184
- * @deprecated Please use connectUser() function instead. Its naming is more consistent with its functionality.
211
+ * Sets the current user and opens a WebSocket connection.
185
212
  *
186
- * setUser - Set the current user and open a WebSocket connection
213
+ * @deprecated Use {@link StreamChat.connectUser} instead. Its naming is more consistent with its functionality.
187
214
  *
188
- * @param {OwnUserResponse | UserResponse} user Data about this user. IE {name: "john"}
189
- * @param {TokenOrProvider} userTokenOrProvider Token or provider
190
- *
191
- * @return {ConnectAPIResponse} Returns a promise that resolves when the connection is setup
215
+ * @param user - Data about this user, e.g. `{ name: 'john' }`.
216
+ * @param userTokenOrProvider - A token string or an async provider that returns one.
217
+ * @returns A promise that resolves when the connection is set up.
192
218
  */
193
- setUser: (user: OwnUserResponse | UserResponse, userTokenOrProvider: TokenOrProvider) => Promise<void | import("./types").ConnectionOpen>;
194
- _setToken: (user: UserResponse, userTokenOrProvider: TokenOrProvider) => Promise<void>;
195
- _setUser(user: OwnUserResponse | UserResponse): void;
219
+ setUser: (user: ClientUser, userTokenOrProvider: TokenOrProvider) => Promise<void | ({
220
+ type: "health.check";
221
+ } & import(".").HealthCheckEvent)>;
222
+ _setToken: (user: TokenManagerMinimalUser, userTokenOrProvider: TokenOrProvider) => Promise<void>;
223
+ _setUser(user: TokenManagerMinimalUser): void;
196
224
  /**
197
- * Disconnects the websocket connection, without removing the user set on client.
225
+ * Disconnects the WebSocket connection, without removing the user set on client.
198
226
  * client.closeConnection will not trigger default auto-retry mechanism for reconnection. You need
199
- * to call client.openConnection to reconnect to websocket.
227
+ * to call `client.openConnection` to reconnect to the WebSocket.
200
228
  *
201
229
  * This is mainly useful on mobile side. You can only receive push notifications
202
- * if you don't have active websocket connection.
230
+ * if you don't have an active WebSocket connection.
203
231
  * So when your app goes to background, you can call `client.closeConnection`.
204
232
  * And when app comes back to foreground, call `client.openConnection`.
205
233
  *
206
- * @param timeout Max number of ms, to wait for close event of websocket, before forcefully assuming succesful disconnection.
207
- * https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent
234
+ * @param timeout - Max number of milliseconds to wait for the WebSocket close event before forcefully assuming
235
+ * successful disconnection. See https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent (optional).
208
236
  */
209
237
  closeConnection: (timeout?: number) => Promise<void>;
210
238
  /**
211
- * Creates an instance of ChannelManager.
239
+ * Creates a new WebSocket connection with the current user.
212
240
  *
213
- * @internal
241
+ * @returns The WebSocket connect promise, or an empty resolved promise if a connection is already active.
242
+ */
243
+ openConnection: () => ConnectAPIResponse | undefined;
244
+ /**
245
+ * Revokes tokens for a connected user issued before the given time.
214
246
  *
215
- * @param eventHandlerOverrides - the overrides for event handlers to be used
216
- * @param options - the options used for the channel manager
247
+ * @param before - Cutoff date; tokens issued before this are revoked (optional, defaults to the current time).
248
+ * @returns The updated users response.
217
249
  */
218
- createChannelManager: ({ eventHandlerOverrides, options, queryChannelsOverride, }: {
219
- eventHandlerOverrides?: ChannelManagerEventHandlerOverrides;
220
- options?: ChannelManagerOptions;
221
- queryChannelsOverride?: QueryChannelsRequestType;
222
- }) => ChannelManager;
250
+ revokeTokens(before?: Date | null): Promise<StreamResponse<import(".").UpdateUsersResponse>>;
223
251
  /**
224
- * Creates a new WebSocket connection with the current user. Returns empty promise, if there is an active connection
252
+ * Retrieves application settings.
253
+ *
254
+ * @returns The application settings response.
225
255
  */
226
- openConnection: () => ConnectAPIResponse | undefined;
256
+ getAppSettings(): Promise<StreamResponse<Gen_GetApplicationResponse>>;
227
257
  /**
228
- * @deprecated Please use client.openConnction instead.
229
- * @private
258
+ * Disconnects the WebSocket and removes the user from client.
230
259
  *
231
- * Creates a new websocket connection with current user.
232
- */
233
- _setupConnection: () => ConnectAPIResponse | undefined;
234
- /**
235
- * updateAppSettings - updates application settings
236
- *
237
- * @param {AppSettings} options App settings.
238
- * IE: {
239
- 'apn_config': {
240
- 'auth_type': 'token',
241
- 'auth_key": fs.readFileSync(
242
- './apn-push-auth-key.p8',
243
- 'utf-8',
244
- ),
245
- 'key_id': 'keyid',
246
- 'team_id': 'teamid',
247
- 'notification_template": 'notification handlebars template',
248
- 'bundle_id': 'com.apple.your.app',
249
- 'development': true
250
- },
251
- 'firebase_config': {
252
- 'server_key': 'server key from fcm',
253
- 'notification_template': 'notification handlebars template',
254
- 'data_template': 'data handlebars template',
255
- 'apn_template': 'apn notification handlebars template under v2'
256
- },
257
- 'webhook_url': 'https://acme.com/my/awesome/webhook/',
258
- 'event_hooks': [
259
- {
260
- 'hook_type': 'webhook',
261
- 'enabled': true,
262
- 'event_types': ['message.new'],
263
- 'webhook_url': 'https://acme.com/my/awesome/webhook/'
264
- },
265
- {
266
- 'hook_type': 'sqs',
267
- 'enabled': true,
268
- 'event_types': ['message.new'],
269
- 'sqs_url': 'https://sqs.us-east-1.amazonaws.com/1234567890/my-queue',
270
- 'sqs_auth_type': 'key',
271
- 'sqs_key': 'my-access-key',
272
- 'sqs_secret': 'my-secret-key'
273
- }
274
- ]
275
- }
276
- */
277
- updateAppSettings(options: AppSettings): Promise<APIResponse>;
278
- _normalizeDate: (before: Date | string | null) => string | null;
279
- /**
280
- * Revokes all tokens on application level issued before given time
281
- */
282
- revokeTokens(before: Date | string | null): Promise<APIResponse>;
283
- /**
284
- * Revokes token for a user issued before given time
285
- */
286
- revokeUserToken(userID: string, before?: Date | string | null): Promise<UpdateUsersAPIResponse>;
287
- /**
288
- * Revokes tokens for a list of users issued before given time
289
- */
290
- revokeUsersToken(userIDs: string[], before?: Date | string | null): Promise<UpdateUsersAPIResponse>;
291
- /**
292
- * getAppSettings - retrieves application settings
293
- */
294
- getAppSettings(): Promise<AppSettingsAPIResponse>;
295
- /**
296
- * testPushSettings - Tests the push settings for a user with a random chat message and the configured push templates
297
- *
298
- * @param {string} userID User ID. If user has no devices, it will error
299
- * @param {TestPushDataInput} [data] Overrides for push templates/message used
300
- * IE: {
301
- messageID: 'id-of-message', // will error if message does not exist
302
- apnTemplate: '{}', // if app doesn't have apn configured it will error
303
- firebaseTemplate: '{}', // if app doesn't have firebase configured it will error
304
- firebaseDataTemplate: '{}', // if app doesn't have firebase configured it will error
305
- skipDevices: true, // skip config/device checks and sending to real devices
306
- pushProviderName: 'staging' // one of your configured push providers
307
- pushProviderType: 'apn' // one of supported provider types
308
- }
309
- */
310
- testPushSettings(userID: string, data?: TestPushDataInput): Promise<CheckPushResponse>;
311
- /**
312
- * testSQSSettings - Tests that the given or configured SQS configuration is valid
313
- *
314
- * @param {TestSQSDataInput} [data] Overrides SQS settings for testing if needed
315
- * IE: {
316
- sqs_key: 'auth_key',
317
- sqs_secret: 'auth_secret',
318
- sqs_url: 'url_to_queue',
319
- }
320
- */
321
- testSQSSettings(data?: TestSQSDataInput): Promise<CheckSQSResponse>;
322
- /**
323
- * testSNSSettings - Tests that the given or configured SNS configuration is valid
324
- *
325
- * @param {TestSNSDataInput} [data] Overrides SNS settings for testing if needed
326
- * IE: {
327
- sns_key: 'auth_key',
328
- sns_secret: 'auth_secret',
329
- sns_topic_arn: 'topic_to_publish_to',
330
- }
331
- */
332
- testSNSSettings(data?: TestSNSDataInput): Promise<CheckSNSResponse>;
333
- /**
334
- * Disconnects the websocket and removes the user from client.
335
- *
336
- * @param timeout Max number of ms, to wait for close event of websocket, before forcefully assuming successful disconnection.
337
- * https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent
260
+ * @param timeout - Max number of milliseconds to wait for the WebSocket close event before forcefully assuming
261
+ * successful disconnection. See https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent (optional).
262
+ * @returns The close-connection promise.
338
263
  */
339
264
  disconnectUser: (timeout?: number) => Promise<void>;
340
265
  /**
341
266
  *
342
267
  * @deprecated Please use client.disconnectUser instead.
343
268
  *
344
- * Disconnects the websocket and removes the user from client.
269
+ * Disconnects the WebSocket and removes the user from client.
345
270
  */
346
271
  disconnect: (timeout?: number) => Promise<void>;
347
272
  /**
348
- * connectAnonymousUser - Set an anonymous user and open a WebSocket connection
349
- */
350
- connectAnonymousUser: () => ConnectAPIResponse | undefined;
351
- /**
352
- * @deprecated Please use connectAnonymousUser. Its naming is more consistent with its functionality.
353
- */
354
- setAnonymousUser: () => ConnectAPIResponse | undefined;
355
- /**
356
- * setGuestUser - Setup a temporary guest user
357
- *
358
- * @param {UserResponse} user Data about this user. IE {name: "john"}
273
+ * Sets an anonymous user and opens a WebSocket connection.
359
274
  *
360
- * @return {ConnectAPIResponse} Returns a promise that resolves when the connection is setup
275
+ * @returns A promise that resolves when the connection is set up.
361
276
  */
362
- setGuestUser(user: UserResponse): Promise<void | import("./types").ConnectionOpen>;
277
+ connectAnonymousUser: () => ConnectAPIResponse | undefined;
363
278
  /**
364
- * createToken - Creates a token to authenticate this user. This function is used server side.
365
- * The resulting token should be passed to the client side when the users registers or logs in.
366
- *
367
- * @param {string} userID The User ID
368
- * @param {number} [exp] The expiration time for the token expressed in the number of seconds since the epoch
279
+ * Sets up a temporary guest user.
369
280
  *
370
- * @return {string} Returns a token
281
+ * @param user - Data about this user, e.g. `{ name: 'john' }`.
282
+ * @returns A promise that resolves when the connection is set up.
371
283
  */
372
- createToken(userID: string, exp?: number, iat?: number): string;
284
+ setGuestUser(user: UserResponse): Promise<void | ({
285
+ type: "health.check";
286
+ } & import(".").HealthCheckEvent)>;
373
287
  /**
374
- * on - Listen to events on all channels and users your watching
288
+ * Listens to events on all channels and users you're watching.
375
289
  *
376
- * client.on('message.new', event => {console.log("my new message", event, channel.state.messages)})
377
- * or
378
- * client.on(event => {console.log(event.type)})
290
+ * @example
291
+ * client.on('message.new', (event) => {
292
+ * console.log('my new message', event, channel.state.messages);
293
+ * });
379
294
  *
380
- * @param {EventHandler | string} callbackOrString The event type to listen for (optional)
381
- * @param {EventHandler} [callbackOrNothing] The callback to call
295
+ * @example
296
+ * client.on((event) => {
297
+ * console.log(event.type);
298
+ * });
382
299
  *
383
- * @return {{ unsubscribe: () => void }} Description
300
+ * @param callbackOrString - The event type to listen for, or the callback when listening to all events.
301
+ * @param callbackOrNothing - The callback to call when an event type was provided (optional).
302
+ * @returns An object with an `unsubscribe()` method.
384
303
  */
385
304
  on(callback: EventHandler): {
386
305
  unsubscribe: () => void;
387
306
  };
388
- on(eventType: string, callback: EventHandler): {
307
+ on<T extends EventType | string>(eventType: T, callback: EventHandler<T>): {
389
308
  unsubscribe: () => void;
390
309
  };
391
310
  /**
392
- * off - Remove the event handler
311
+ * Removes the event handler.
393
312
  *
313
+ * @param callbackOrString - The event type, or the callback when removing an all-events listener.
314
+ * @param callbackOrNothing - The callback to remove when an event type was provided (optional).
394
315
  */
395
316
  off(callback: EventHandler): void;
396
317
  off(eventType: string, callback: EventHandler): void;
397
- _logApiRequest(type: string, url: string, data: unknown, config: AxiosRequestConfig & {
398
- config?: AxiosRequestConfig & {
399
- maxBodyLength?: number;
400
- };
401
- }): void;
402
- _logApiResponse<T>(type: string, url: string, response: AxiosResponse<T>): void;
403
- _logApiError(type: string, url: string, error: unknown): void;
404
- doAxiosRequest: <T>(type: string, url: string, data?: unknown, options?: AxiosRequestConfig & {
405
- config?: AxiosRequestConfig & {
406
- maxBodyLength?: number;
407
- };
408
- }) => Promise<T>;
409
- get<T>(url: string, params?: AxiosRequestConfig['params']): Promise<T>;
410
- put<T>(url: string, data?: unknown): Promise<T>;
411
- post<T>(url: string, data?: unknown): Promise<T>;
412
- patch<T>(url: string, data?: unknown): Promise<T>;
413
- delete<T>(url: string, params?: AxiosRequestConfig['params']): Promise<T>;
414
- sendFile(url: string, uri: string | NodeJS.ReadableStream | Buffer | File, name?: string, contentType?: string, user?: UserResponse, axiosRequestConfig?: AxiosRequestConfig): Promise<SendFileAPIResponse>;
415
- errorFromResponse(response: AxiosResponse<APIErrorResponse>): ErrorFromResponse<APIErrorResponse>;
416
- handleResponse<T>(response: AxiosResponse<T>): T;
417
318
  dispatchEvent: (event: Event) => void;
418
319
  /**
419
- * Updates the members, watchers and read references of the currently active channels that contain this user
320
+ * Updates the members, watchers and read references of the currently active channels that contain this user.
420
321
  *
421
- * @param {UserResponse} user
322
+ * @param user - The updated user.
422
323
  */
423
324
  _updateMemberWatcherReferences: (user: UserResponse) => void;
424
325
  /**
425
- * @deprecated Please _updateMemberWatcherReferences instead.
326
+ * @deprecated Please use `_updateMemberWatcherReferences` instead.
426
327
  * @private
427
328
  */
428
329
  _updateUserReferences: (user: UserResponse) => void;
429
330
  /**
430
- * @private
331
+ * Updates the messages from the currently active channels that contain this user, with the updated user object.
431
332
  *
432
- * Updates the messages from the currently active channels that contain this user,
433
- * with updated user object.
333
+ * @private
434
334
  *
435
- * @param {UserResponse} user
335
+ * @param user - The updated user.
436
336
  */
437
337
  _updateUserMessageReferences: (user: UserResponse) => void;
438
338
  /**
439
- * @private
339
+ * Deletes the messages from the currently active channels that contain this user.
440
340
  *
441
- * Deletes the messages from the currently active channels that contain this user
341
+ * If `hardDelete` is `true`, all the content of the message will be stripped down.
342
+ * Otherwise, only `message.type` will be set as `'deleted'`.
442
343
  *
443
- * If hardDelete is true, all the content of message will be stripped down.
444
- * Otherwise, only 'message.type' will be set as 'deleted'.
344
+ * @private
445
345
  *
446
- * @param {UserResponse} user
447
- * @param {boolean} hardDelete
346
+ * @param user - The user whose messages should be deleted.
347
+ * @param hardDelete - Whether to fully strip the message content (optional, defaults to `false`).
348
+ * @param deletedAt - Timestamp to mark messages as deleted at (optional).
448
349
  */
449
350
  _deleteUserMessageReference: (user: UserResponse, hardDelete?: boolean, deletedAt?: LocalMessage["deleted_at"]) => void;
450
351
  /**
451
- * @private
352
+ * Handle the following user-related events:
353
+ * - `user.presence.changed`
354
+ * - `user.updated`
355
+ * - `user.deleted`
452
356
  *
453
- * Handle following user related events:
454
- * - user.presence.changed
455
- * - user.updated
456
- * - user.deleted
357
+ * @private
457
358
  *
458
- * @param {Event} event
359
+ * @param event - The user event.
459
360
  */
460
- _handleUserEvent: (event: Event) => void;
461
- _handleClientEvent(event: Event): (() => void)[];
361
+ _handleUserEvent: (event: Extract<WSEvent, {
362
+ type: "user.presence.changed" | "user.updated" | "user.deleted";
363
+ }>) => void;
364
+ _handleClientEvent(event: WSEvent): (() => void)[];
462
365
  _muteStatus(cid: string): {
463
366
  muted: boolean;
464
367
  createdAt: Date;
@@ -473,295 +376,128 @@ export declare class StreamChat {
473
376
  /**
474
377
  * @private
475
378
  */
476
- connect(): Promise<void | import("./types").ConnectionOpen>;
379
+ connect(): Promise<void | ({
380
+ type: "health.check";
381
+ } & import(".").HealthCheckEvent)>;
477
382
  /**
478
- * Check the connectivity with server for warmup purpose.
383
+ * Checks connectivity with the server for warmup purposes.
479
384
  *
480
385
  * @private
481
386
  */
482
387
  _sayHi(): void;
483
388
  /**
484
- * queryUsers - Query users and watch user presence
485
- *
486
- * @param {UserFilters} filterConditions MongoDB style filter conditions
487
- * @param {UserSort} sort Sort options, for instance [{last_active: -1}].
488
- * When using multiple fields, make sure you use array of objects to guarantee field order, for instance [{last_active: -1}, {created_at: 1}]
489
- * @param {UserOptions} options Option object, {presence: true}
490
- *
491
- * @return {Promise<{ users: Array<UserResponse> }>} User Query Response
492
- */
493
- queryUsers(filterConditions: UserFilters, sort?: UserSort, options?: UserOptions): Promise<APIResponse & {
494
- users: Array<UserResponse>;
495
- }>;
496
- /**
497
- * queryUserGroups - List user groups with cursor-based pagination.
498
- *
499
- * @param {QueryUserGroupsOptions} options The query options
500
- *
501
- * @return {Promise<QueryUserGroupsResponse>} User Group Query Response
502
- */
503
- queryUserGroups(options?: QueryUserGroupsOptions): Promise<QueryUserGroupsResponse>;
504
- /**
505
- * createUserGroup - Create a user group
506
- *
507
- * @param {CreateUserGroupOptions} options The create options
508
- *
509
- * @return {Promise<CreateUserGroupResponse>} User Group Create Response
510
- */
511
- createUserGroup(options: CreateUserGroupOptions): Promise<CreateUserGroupResponse>;
512
- /**
513
- * getUserGroup - Get a user group by ID
514
- *
515
- * @param {string} id The user group ID
516
- * @param {GetUserGroupOptions} options Optional query options
517
- *
518
- * @return {Promise<GetUserGroupResponse>} User Group Get Response
519
- */
520
- getUserGroup(id: string, options?: GetUserGroupOptions): Promise<GetUserGroupResponse>;
521
- /**
522
- * searchUserGroups - Search user groups by prefix for autocomplete
523
- *
524
- * @param {SearchUserGroupsOptions} options The search options
525
- *
526
- * @return {Promise<SearchUserGroupsResponse>} User Group Search Response
527
- */
528
- searchUserGroups(options: SearchUserGroupsOptions): Promise<SearchUserGroupsResponse>;
529
- /**
530
- * updateUserGroup - Update a user group by ID
531
- *
532
- * @param {string} id The user group ID
533
- * @param {UpdateUserGroupOptions} options The update options
534
- *
535
- * @return {Promise<UpdateUserGroupResponse>} User Group Update Response
536
- */
537
- updateUserGroup(id: string, options: UpdateUserGroupOptions): Promise<UpdateUserGroupResponse>;
538
- /**
539
- * deleteUserGroup - Delete a user group by ID
540
- *
541
- * @param {string} id The user group ID
542
- * @param {DeleteUserGroupOptions} options Optional query options
543
- *
544
- * @return {Promise<APIResponse>} User Group Delete Response
545
- */
546
- deleteUserGroup(id: string, options?: DeleteUserGroupOptions): Promise<APIResponse>;
547
- /**
548
- * addUserGroupMembers - Add members to a user group
549
- *
550
- * @param {string} id The user group ID
551
- * @param {AddUserGroupMembersOptions} options The add-members options
552
- *
553
- * @return {Promise<AddUserGroupMembersResponse>} User Group Add Members Response
554
- */
555
- addUserGroupMembers(id: string, options: AddUserGroupMembersOptions): Promise<AddUserGroupMembersResponse>;
556
- /**
557
- * removeUserGroupMembers - Remove members from a user group
558
- *
559
- * @param {string} id The user group ID
560
- * @param {RemoveUserGroupMembersOptions} options The remove-members options
561
- *
562
- * @return {Promise<RemoveUserGroupMembersResponse>} User Group Remove Members Response
563
- */
564
- removeUserGroupMembers(id: string, options: RemoveUserGroupMembersOptions): Promise<RemoveUserGroupMembersResponse>;
565
- /**
566
- * queryBannedUsers - Query user bans
567
- *
568
- * @param {BannedUsersFilters} filterConditions MongoDB style filter conditions
569
- * @param {BannedUsersSort} sort Sort options [{created_at: 1}].
570
- * @param {BannedUsersPaginationOptions} options Option object, {limit: 10, offset:0, exclude_expired_bans: true}
571
- *
572
- * @return {Promise<BannedUsersResponse>} Ban Query Response
573
- */
574
- queryBannedUsers(filterConditions?: BannedUsersFilters, sort?: BannedUsersSort, options?: BannedUsersPaginationOptions): Promise<BannedUsersResponse>;
575
- /**
576
- * queryFutureChannelBans - Query future channel bans created by a user
389
+ * Queries users and watches user presence.
577
390
  *
578
- * @param {QueryFutureChannelBansOptions} options Option object with user_id, exclude_expired_bans, limit, offset
579
- * @returns {Promise<FutureChannelBansResponse>} Future Channel Bans Response
391
+ * @param request - The query users request payload (optional). The inner `payload` accepts
392
+ * MongoDB-style filter conditions, sort directions (e.g. `[{ field: 'last_active', direction: -1 }]`),
393
+ * and options such as `presence`.
394
+ * @returns The user query response.
580
395
  */
581
- queryFutureChannelBans(options?: QueryFutureChannelBansOptions): Promise<FutureChannelBansResponse>;
396
+ queryUsers(request?: {
397
+ payload?: Gen_QueryUsersPayload;
398
+ }): Promise<StreamResponse<import(".").QueryUsersResponse>>;
582
399
  /**
583
- * queryMessageFlags - Query message flags
584
- *
585
- * @param {MessageFlagsFilters} filterConditions MongoDB style filter conditions
586
- * @param {MessageFlagsPaginationOptions} options Option object, {limit: 10, offset:0}
400
+ * Queries user bans.
587
401
  *
588
- * @return {Promise<MessageFlagsResponse>} Message Flags Response
402
+ * @param request - The query banned users request payload (optional). The inner `payload`
403
+ * accepts MongoDB-style filter conditions, sort directions
404
+ * (e.g. `[{ field: 'created_at', direction: 1 }]`), and options such as `limit`, `offset`,
405
+ * and `exclude_expired_bans`.
406
+ * @returns The ban query response.
589
407
  */
590
- queryMessageFlags(filterConditions?: MessageFlagsFilters, options?: MessageFlagsPaginationOptions): Promise<MessageFlagsResponse>;
408
+ queryBannedUsers(request?: {
409
+ payload?: QueryBannedUsersPayload;
410
+ }): Promise<StreamResponse<import(".").QueryBannedUsersResponse>>;
591
411
  /**
592
- * queryChannelsRequestWithResponse - Queries channels and returns the full API response
593
- * including top-level metadata such as `predefined_filter`.
412
+ * Queries channels and returns the full API response including top-level metadata such as
413
+ * `predefined_filter`.
594
414
  *
595
415
  * This exists as a compatibility bridge, as changing `queryChannelsRequest()` to return
596
- * `QueryChannelsAPIResponse` would be a breaking change because it currently returns
416
+ * `QueryChannelsResponse` would be a breaking change because it currently returns
597
417
  * only the channel list. In the next major release, the request/response APIs should
598
418
  * be consolidated so callers can access the full response through the primary API.
599
419
  *
600
- * @param {ChannelFilters} filterConditions object MongoDB style filters. Can be empty object when using predefined_filter in options.
601
- * @param {ChannelSort} [sort] Sort options, for instance {created_at: -1}.
602
- * When using multiple fields, make sure you use array of objects to guarantee field order, for instance [{last_updated: -1}, {created_at: 1}]
603
- * @param {ChannelOptions} [options] Options object. Can include predefined_filter, filter_values, and sort_values for using predefined filters.
604
- *
605
- * @return {Promise<QueryChannelsAPIResponse>} full search channels response
606
- */
607
- queryChannelsRequestWithResponse(filterConditions: ChannelFilters, sort?: ChannelSort, options?: ChannelOptions): Promise<QueryChannelsAPIResponse>;
608
- /**
609
- * queryChannelsRequest - Queries channels and returns the raw channel response list.
610
- *
611
- * This preserves the historical return shape for backwards compatibility. Use
612
- * `queryChannelsRequestWithResponse()` when response level metadata such as
613
- * `predefined_filter` is needed. In the next major release these APIs should be
614
- * consolidated into a single full-response API.
615
- *
616
- * @param {ChannelFilters} filterConditions object MongoDB style filters. Can be empty object when using predefined_filter in options.
617
- * @param {ChannelSort} [sort] Sort options, for instance {created_at: -1}.
618
- * When using multiple fields, make sure you use array of objects to guarantee field order, for instance [{last_updated: -1}, {created_at: 1}]
619
- * @param {ChannelOptions} [options] Options object. Can include predefined_filter, filter_values, and sort_values for using predefined filters.
620
- *
621
- * @return {Promise<Array<ChannelAPIResponse>>} search channels response
622
- */
623
- queryChannelsRequest(filterConditions: ChannelFilters, sort?: ChannelSort, options?: ChannelOptions): Promise<Omit<ChannelAPIResponse, keyof APIResponse>[]>;
624
- /**
625
- * queryChannels - Query channels
626
- *
627
- * @param {ChannelFilters} filterConditions object MongoDB style filters
628
- * @param {ChannelSort} [sort] Sort options, for instance {created_at: -1}.
629
- * When using multiple fields, make sure you use array of objects to guarantee field order, for instance [{last_updated: -1}, {created_at: 1}]
630
- * @param {ChannelOptions} [options] Options object
631
- * @param {ChannelStateOptions} [stateOptions] State options object. These options will only be used for state management and won't be sent in the request.
632
- * - stateOptions.skipInitialization - Skips the initialization of the state for the channels matching the ids in the list.
633
- * - stateOptions.skipHydration - Skips returning the channels as instances of the Channel class and rather returns the raw query response.
634
- * - stateOptions.withResponse - Returns the full query response with hydrated channels. This is a compatibility bridge for internal callers that need response-level metadata while the default return value remains `Channel[]`.
635
- *
636
- * @return {Promise<Array<Channel>>} search channels response
637
- */
638
- queryChannels(filterConditions: ChannelFilters, sort: ChannelSort, options: ChannelOptions, stateOptions: ChannelStateOptions & {
420
+ * @param request - The query channels request payload (optional). Accepts MongoDB-style filter
421
+ * conditions, sort directions (e.g. `[{ field: 'created_at', direction: -1 }]`), and options
422
+ * such as `predefined_filter`, `filter_values`, and `sort_values`.
423
+ * @returns The full query channels response.
424
+ */
425
+ queryChannels(request?: QueryChannelsRequest): Promise<StreamResponse<QueryChannelsResponse>>;
426
+ /**
427
+ * Queries channels and hydrates them into `Channel` instances on this client.
428
+ *
429
+ * Use the inherited `queryChannels()` from `ChatApi` when only the raw API response
430
+ * is needed; this method wraps it with state hydration, `channels.queried` dispatch,
431
+ * and offline-db sync.
432
+ *
433
+ * @param options - The query channels request payload (optional). Accepts MongoDB-style filter
434
+ * conditions, sort directions (e.g. `[{ field: 'created_at', direction: -1 }]`), and options
435
+ * such as `predefined_filter`, `filter_values`, and `sort_values`.
436
+ * @param stateOptions - Options that only affect state management and aren't sent in the request
437
+ * (optional, defaults to `{}`).
438
+ * @param stateOptions.skipInitialization - Skips the initialization of the state for the
439
+ * channels matching the IDs in the list (optional).
440
+ * @param stateOptions.skipHydration - Skips returning the channels as instances of the `Channel`
441
+ * class and instead returns the raw query response (optional).
442
+ * @param stateOptions.withResponse - Returns the full query response with hydrated channels.
443
+ * This is a compatibility bridge for internal callers that need response-level metadata while
444
+ * the default return value remains `Channel[]` (optional).
445
+ * @returns The hydrated channel list, or the full response when `withResponse` is `true`.
446
+ */
447
+ queryChannelsAndHydrate(options?: QueryChannelsRequest, stateOptions?: ChannelStateOptions & {
639
448
  withResponse: true;
640
449
  }): Promise<QueryChannelsResponseWithChannels>;
641
- queryChannels(filterConditions?: ChannelFilters, sort?: ChannelSort, options?: ChannelOptions, stateOptions?: ChannelStateOptions): Promise<Channel[]>;
450
+ queryChannelsAndHydrate(options?: QueryChannelsRequest, stateOptions?: ChannelStateOptions): Promise<Channel[]>;
642
451
  /**
643
- * queryReactions - Query reactions
644
- *
645
- * @param {ReactionFilters} filter object MongoDB style filters
646
- * @param {ReactionSort} [sort] Sort options, for instance {created_at: -1}.
647
- * @param {QueryReactionsOptions} [options] Pagination object
452
+ * Queries reactions for a message and hydrates any cached offline reactions before the network
453
+ * request.
648
454
  *
649
- * @return {Promise<{ QueryReactionsAPIResponse } search channels response
455
+ * @param request - The query reactions request payload, including the target message ID,
456
+ * MongoDB-style filters, sort directions (e.g. `[{ field: 'created_at', direction: -1 }]`),
457
+ * and pagination options.
458
+ * @returns The query reactions response.
650
459
  */
651
- queryReactions(messageID: string, filter: ReactionFilters, sort?: ReactionSort, options?: QueryReactionsOptions): Promise<QueryReactionsAPIResponse>;
652
- hydrateActiveChannels(channelsFromApi?: ChannelAPIResponse[], stateOptions?: ChannelStateOptions, queryChannelsOptions?: ChannelOptions): Channel[];
460
+ queryReactionsAndHydrate(request: QueryReactionsRequestWithId): Promise<StreamResponse<import(".").QueryReactionsResponse>>;
461
+ hydrateActiveChannels(channelsFromApi?: ChannelStateResponseFields[], stateOptions?: ChannelStateOptions, queryChannelsOptions?: ChannelOptions): Channel[];
653
462
  /**
654
- * search - Query messages
463
+ * Queries messages.
655
464
  *
656
- * @param {ChannelFilters} filterConditions MongoDB style filter conditions
657
- * @param {MessageFilters | string} query search query or object MongoDB style filters
658
- * @param {SearchOptions} [options] Option object, {user_id: 'tommaso'}
659
- *
660
- * @return {Promise<SearchAPIResponse>} search messages response
465
+ * @param request - The search request payload (optional). The inner `payload` accepts
466
+ * MongoDB-style filter conditions, a search query, and options such as `user_id`.
467
+ * @returns The search messages response.
661
468
  */
662
- search(filterConditions: ChannelFilters, query: string | MessageFilters, options?: SearchOptions): Promise<SearchAPIResponse>;
469
+ search(request?: {
470
+ payload?: SearchPayload;
471
+ }): Promise<StreamResponse<import(".").SearchResponse>>;
663
472
  /**
664
- * setLocalDevice - Set the device info for the current client(device) that will be sent via WS connection automatically
665
- *
666
- * @param {BaseDeviceFields} device the device object
667
- * @param {string} device.id device id
668
- * @param {string} device.push_provider the push provider
473
+ * Sets the device info for the current client. It will be sent via the WS connection automatically.
669
474
  *
475
+ * @param device - The device object.
476
+ * @param device.id - Device ID.
477
+ * @param device.push_provider - The push provider.
670
478
  */
671
479
  setLocalDevice(device: BaseDeviceFields): void;
672
- /**
673
- * addDevice - Adds a push device for a user.
674
- *
675
- * @param {string} id the device id
676
- * @param {PushProvider} push_provider the push provider
677
- * @param {string} [userID] the user id (defaults to current user)
678
- * @param {string} [push_provider_name] user provided push provider name for multi bundle support
679
- *
680
- */
681
- addDevice(id: string, push_provider: PushProvider, userID?: string, push_provider_name?: string): Promise<APIResponse>;
682
- /**
683
- * getDevices - Returns the devices associated with a current user
684
- *
685
- * @param {string} [userID] User ID. Only works on serverside
686
- *
687
- * @return {Device[]} Array of devices
688
- */
689
- getDevices(userID?: string): Promise<APIResponse & {
690
- devices?: Device[];
691
- }>;
692
- /**
693
- * getUnreadCount - Returns unread counts for a single user
694
- *
695
- * @param {string} [userID] User ID.
696
- *
697
- * @return {<GetUnreadCountAPIResponse>}
698
- */
699
- getUnreadCount(userID?: string): Promise<GetUnreadCountAPIResponse>;
700
- /**
701
- * getUnreadCountBatch - Returns unread counts for multiple users at once. Only works server side.
702
- *
703
- * @param {string[]} [userIDs] List of user IDs to fetch unread counts for.
704
- *
705
- * @return {<GetUnreadCountBatchAPIResponse>}
706
- */
707
- getUnreadCountBatch(userIDs: string[]): Promise<GetUnreadCountBatchAPIResponse>;
708
- /**
709
- * setPushPreferences - Applies the list of push preferences.
710
- *
711
- * @param {PushPreference[]} A list of push preferences.
712
- *
713
- * @return {<UpsertPushPreferencesResponse>}
714
- */
715
- setPushPreferences(preferences: PushPreference[]): Promise<UpsertPushPreferencesResponse>;
716
- /**
717
- * removeDevice - Removes the device with the given id. Clientside users can only delete their own devices
718
- *
719
- * @param {string} id The device id
720
- * @param {string} [userID] The user id. Only specify this for serverside requests
721
- *
722
- */
723
- removeDevice(id: string, userID?: string): Promise<APIResponse>;
724
- /**
725
- * getRateLimits - Returns the rate limits quota and usage for the current app, possibly filter for a specific platform and/or endpoints.
726
- * Only available server-side.
727
- *
728
- * @param {object} [params] The params for the call. If none of the params are set, all limits for all platforms are returned.
729
- * @returns {Promise<GetRateLimitsResponse>}
730
- */
731
- getRateLimits(params?: {
732
- android?: boolean;
733
- endpoints?: EndpointName[];
734
- ios?: boolean;
735
- serverSide?: boolean;
736
- web?: boolean;
737
- }): Promise<GetRateLimitsResponse>;
738
- /**
739
- * getHookEvents - Get available events for hooks (webhook, SQS, and SNS)
740
- *
741
- * @param {Product[]} [products] Optional array of products to filter events by (e.g., [Product.Chat, Product.Video])
742
- * @returns {Promise<GetHookEventsResponse>} Response containing available hook events
743
- */
744
- getHookEvents(products?: Product[]): Promise<GetHookEventsResponse>;
745
480
  _addChannelConfig({ cid, config }: ChannelResponse): void;
746
481
  /**
747
- * channel - Returns a new channel with the given type, id and custom data
748
- *
749
- * If you want to create a unique conversation between 2 or more users; you can leave out the ID parameter and provide the list of members.
750
- * Make sure to await channel.create() or channel.watch() before accessing channel functions:
751
- * ie. channel = client.channel("messaging", {members: ["tommaso", "thierry"]})
752
- * await channel.create() to assign an ID to channel
482
+ * Returns a new channel with the given type, ID and custom data.
753
483
  *
754
- * @param {string} channelType The channel type
755
- * @param {string | ChannelData | null} [channelIDOrCustom] The channel ID, you can leave this out if you want to create a conversation channel
756
- * @param {object} [custom] Custom data to attach to the channel
484
+ * If you want to create a unique conversation between 2 or more users, you can leave out the ID
485
+ * parameter and provide the list of members.
486
+ * Make sure to await `channel.create()` or `channel.watch()` before accessing channel functions,
487
+ * i.e. `channel = client.channel('messaging', { members: ['tommaso', 'thierry'] })` then
488
+ * `await channel.create()` to assign an ID to the channel.
757
489
  *
758
- * @return {channel} The channel object, initialize it using channel.watch()
490
+ * @param channelType - The channel type.
491
+ * @param channelIdOrCustom - The channel ID; you can leave this out if you want to create a
492
+ * conversation channel (optional).
493
+ * @param custom - Custom data to attach to the channel (optional, defaults to `{}`).
494
+ * @returns The channel object; initialize it using `channel.watch()`.
759
495
  */
760
- channel(channelType: string, channelID?: string | null, custom?: ChannelData): Channel;
496
+ channel(channelType: string, channelId?: string | null, custom?: ChannelData): Channel;
761
497
  channel(channelType: string, custom?: ChannelData): Channel;
762
498
  /**
763
499
  * It's a helper method for `client.channel()` method, used to create unique conversation or
764
- * channel based on member list instead of id.
500
+ * channel based on member list instead of ID.
765
501
  *
766
502
  * If the channel already exists in `activeChannels` list, then we simply return it, since that
767
503
  * means the same channel was already requested or created.
@@ -770,1484 +506,279 @@ export declare class StreamChat {
770
506
  *
771
507
  * @private
772
508
  *
773
- * @param {string} channelType The channel type
774
- * @param {object} [custom] Custom data to attach to the channel
775
- *
776
- * @return {channel} The channel object, initialize it using channel.watch()
509
+ * @param channelType - The channel type.
510
+ * @param custom - Custom data to attach to the channel.
511
+ * @returns The channel object; initialize it using `channel.watch()`.
777
512
  */
778
513
  getChannelByMembers: (channelType: string, custom: ChannelData) => Channel;
779
514
  /**
780
- * Its a helper method for `client.channel()` method, used to channel given the id of channel.
515
+ * It's a helper method for `client.channel()`, used to retrieve a channel given its ID.
781
516
  *
782
517
  * If the channel already exists in `activeChannels` list, then we simply return it, since that
783
518
  * means the same channel was already requested or created.
784
519
  *
785
- * Otherwise we create a new instance of Channel class and return it.
520
+ * Otherwise we create a new instance of `Channel` class and return it.
786
521
  *
787
522
  * @private
788
523
  *
789
- * @param {string} channelType The channel type
790
- * @param {string} [channelID] The channel ID
791
- * @param {object} [custom] Custom data to attach to the channel
792
- *
793
- * @return {channel} The channel object, initialize it using channel.watch()
794
- */
795
- getChannelById: (channelType: string, channelID: string, custom: ChannelData) => Channel;
796
- /**
797
- * partialUpdateUser - Update the given user object
798
- *
799
- * @param {PartialUserUpdate} partialUserObject which should contain id and any of "set" or "unset" params;
800
- * example: {id: "user1", set:{field: value}, unset:["field2"]}
801
- *
802
- * @return {Promise<{ users: { [key: string]: UserResponse } }>} list of updated users
803
- */
804
- partialUpdateUser(partialUserObject: PartialUserUpdate): Promise<UpdateUsersAPIResponse>;
805
- /**
806
- * upsertUsers - Batch upsert the list of users
807
- *
808
- * @param {UserResponse[]} users list of users
809
- *
810
- * @return {Promise<{ users: { [key: string]: UserResponse } }>}
811
- */
812
- upsertUsers(users: UserResponse[]): Promise<UpdateUsersAPIResponse>;
813
- /**
814
- * @deprecated Please use upsertUsers() function instead.
815
- *
816
- * updateUsers - Batch update the list of users
817
- *
818
- * @param {UserResponse[]} users list of users
819
- * @return {Promise<{ users: { [key: string]: UserResponse } }>}
524
+ * @param channelType - The channel type.
525
+ * @param channelId - The channel ID.
526
+ * @param custom - Custom data to attach to the channel.
527
+ * @returns The channel object; initialize it using `channel.watch()`.
820
528
  */
821
- updateUsers: (users: UserResponse[]) => Promise<UpdateUsersAPIResponse>;
529
+ getChannelById: (channelType: string, channelId: string, custom: ChannelData) => Channel;
822
530
  /**
823
- * upsertUser - Update or Create the given user object
824
- *
825
- * @param {UserResponse} userObject user object, the only required field is the user id. IE {id: "myuser"} is valid
531
+ * Bans a user from all channels.
826
532
  *
827
- * @return {Promise<{ users: { [key: string]: UserResponse } }>}
533
+ * @param targetUserId - The user to ban.
534
+ * @param options - Ban options (optional).
535
+ * @returns The server response.
828
536
  */
829
- upsertUser(userObject: UserResponse): Promise<UpdateUsersAPIResponse>;
537
+ banUser(targetUserId: string, options?: BanUserOptions): Promise<APIResponse>;
830
538
  /**
831
- * @deprecated Please use upsertUser() function instead.
539
+ * Revoke a global ban for a user.
832
540
  *
833
- * updateUser - Update or Create the given user object
834
- *
835
- * @param {UserResponse} userObject user object, the only required field is the user id. IE {id: "myuser"} is valid
836
- * @return {Promise<{ users: { [key: string]: UserResponse } }>}
541
+ * @param targetUserId - The user to unban.
542
+ * @param options - Unban options (optional).
543
+ * @returns The server response.
837
544
  */
838
- updateUser: (userObject: UserResponse) => Promise<UpdateUsersAPIResponse>;
545
+ unbanUser(targetUserId: string, options?: UnBanUserOptions): Promise<APIResponse>;
839
546
  /**
840
- * partialUpdateUsers - Batch partial update of users
841
- *
842
- * @param {PartialUserUpdate[]} users list of partial update requests
547
+ * Shadow bans a user from all channels.
843
548
  *
844
- * @return {Promise<{ users: { [key: string]: UserResponse } }>}
549
+ * @param targetUserId - The user to shadow ban.
550
+ * @param options - Ban options (optional).
551
+ * @returns The server response.
845
552
  */
846
- partialUpdateUsers(users: PartialUserUpdate[]): Promise<UpdateUsersAPIResponse>;
847
- deleteUser(userID: string, params?: {
848
- delete_conversation_channels?: boolean;
849
- hard_delete?: boolean;
850
- mark_messages_deleted?: boolean;
851
- }): Promise<APIResponse & {
852
- user: UserResponse;
853
- } & {
854
- task_id?: string;
855
- }>;
553
+ shadowBan(targetUserId: string, options?: BanUserOptions): Promise<APIResponse>;
856
554
  /**
857
- * restoreUsers - Restore soft deleted users
858
- *
859
- * @param {string[]} user_ids which users to restore
555
+ * Revoke a global shadow ban for a user.
860
556
  *
861
- * @return {APIResponse} An API response
557
+ * @param targetUserId - The user to remove the shadow ban for.
558
+ * @param options - Unban options (optional).
559
+ * @returns The server response.
862
560
  */
863
- restoreUsers(user_ids: string[]): Promise<APIResponse>;
561
+ removeShadowBan(targetUserId: string, options?: UnBanUserOptions): Promise<APIResponse>;
562
+ blockUser(blockedUserId: string): Promise<StreamResponse<import(".").BlockUsersResponse>>;
563
+ getBlockedUsers(): Promise<StreamResponse<import(".").GetBlockedUsersResponse>>;
564
+ unblockUser(blockedUserId: string): Promise<StreamResponse<import(".").UnblockUsersResponse>>;
864
565
  /**
865
- * reactivateUser - Reactivate one user
566
+ * Mutes a user.
866
567
  *
867
- * @param {string} userID which user to reactivate
868
- * @param {ReactivateUserOptions} [options]
869
- *
870
- * @return {UserResponse} Reactivated user
568
+ * @param targetId - The user to mute.
569
+ * @param options - UserMuteResponse options (optional, defaults to `{}`).
570
+ * @returns The server response.
871
571
  */
872
- reactivateUser(userID: string, options?: ReactivateUserOptions): Promise<APIResponse & {
873
- user: UserResponse;
874
- }>;
572
+ muteUser(targetId: string, options?: MuteUserOptions): Promise<MuteUserResponse>;
875
573
  /**
876
- * reactivateUsers - Reactivate many users asynchronously
574
+ * Unmutes a user.
877
575
  *
878
- * @param {string[]} user_ids which users to reactivate
879
- * @param {ReactivateUsersOptions} [options]
880
- *
881
- * @return {TaskResponse} A task ID
576
+ * @param targetId - The user to unmute.
577
+ * @returns The server response.
882
578
  */
883
- reactivateUsers(user_ids: string[], options?: ReactivateUsersOptions): Promise<APIResponse & TaskResponse>;
579
+ unmuteUser(targetId: string): Promise<APIResponse>;
884
580
  /**
885
- * deactivateUser - Deactivate one user
886
- *
887
- * @param {string} userID which user to deactivate
888
- * @param {DeactivateUsersOptions} [options]
581
+ * Checks whether a user is muted. Can be used after `connectUser()` is called.
889
582
  *
890
- * @return {UserResponse} Deactivated user
583
+ * @param targetId - The user ID to check.
584
+ * @returns `true` if the user is muted, otherwise `false`.
891
585
  */
892
- deactivateUser(userID: string, options?: DeactivateUsersOptions): Promise<APIResponse & {
893
- user: UserResponse;
894
- }>;
586
+ userMuteStatus(targetId: string): boolean;
895
587
  /**
896
- * deactivateUsers - Deactivate many users asynchronously
897
- *
898
- * @param {string[]} user_ids which users to deactivate
899
- * @param {DeactivateUsersOptions} [options]
900
- *
901
- * @return {TaskResponse} A task ID
902
- */
903
- deactivateUsers(user_ids: string[], options?: DeactivateUsersOptions): Promise<APIResponse & TaskResponse>;
904
- exportUser(userID: string, options?: Record<string, string>): Promise<APIResponse & {
905
- messages: MessageResponse[];
906
- reactions: ReactionResponse[];
907
- user: UserResponse;
908
- }>;
909
- /** banUser - bans a user from all channels
910
- *
911
- * @param {string} targetUserID
912
- * @param {BanUserOptions} [options]
913
- * @returns {Promise<APIResponse>}
914
- */
915
- banUser(targetUserID: string, options?: BanUserOptions): Promise<APIResponse>;
916
- /** unbanUser - revoke global ban for a user
917
- *
918
- * @param {string} targetUserID
919
- * @param {UnBanUserOptions} [options]
920
- * @returns {Promise<APIResponse>}
921
- */
922
- unbanUser(targetUserID: string, options?: UnBanUserOptions): Promise<APIResponse>;
923
- /** shadowBan - shadow bans a user from all channels
924
- *
925
- * @param {string} targetUserID
926
- * @param {BanUserOptions} [options]
927
- * @returns {Promise<APIResponse>}
928
- */
929
- shadowBan(targetUserID: string, options?: BanUserOptions): Promise<APIResponse>;
930
- /** removeShadowBan - revoke global shadow ban for a user
931
- *
932
- * @param {string} targetUserID
933
- * @param {UnBanUserOptions} [options]
934
- * @returns {Promise<APIResponse>}
935
- */
936
- removeShadowBan(targetUserID: string, options?: UnBanUserOptions): Promise<APIResponse>;
937
- blockUser(blockedUserID: string, user_id?: string): Promise<BlockUserAPIResponse>;
938
- getBlockedUsers(user_id?: string): Promise<GetBlockedUsersAPIResponse>;
939
- unBlockUser(blockedUserID: string, userID?: string): Promise<APIResponse>;
940
- /** getSharedLocations
941
- *
942
- * @returns {Promise<ActiveLiveLocationsAPIResponse>} The server response
943
- *
944
- */
945
- getSharedLocations(): Promise<ActiveLiveLocationsAPIResponse>;
946
- /** muteUser - mutes a user
947
- *
948
- * @param {string} targetID
949
- * @param {string} [userID] Only used with serverside auth
950
- * @param {MuteUserOptions} [options]
951
- * @returns {Promise<MuteUserResponse>}
952
- */
953
- muteUser(targetID: string, userID?: string, options?: MuteUserOptions): Promise<MuteUserResponse>;
954
- /** unmuteUser - unmutes a user
955
- *
956
- * @param {string} targetID
957
- * @param {string} [currentUserID] Only used with serverside auth
958
- * @returns {Promise<APIResponse>}
959
- */
960
- unmuteUser(targetID: string, currentUserID?: string): Promise<APIResponse>;
961
- /** userMuteStatus - check if a user is muted or not, can be used after connectUser() is called
588
+ * Flag a message.
962
589
  *
963
- * @param {string} targetID
964
- * @returns {boolean}
590
+ * @param targetMessageId - The message to flag.
591
+ * @param options - Flag options (optional, defaults to `{}`).
592
+ * @param options.reason - Reason for flagging (optional).
593
+ * @returns The server response.
965
594
  */
966
- userMuteStatus(targetID: string): boolean;
967
- /**
968
- * flagMessage - flag a message
969
- * @param {string} targetMessageID
970
- * @param {string} [options.user_id] currentUserID, only used with serverside auth
971
- * @returns {Promise<APIResponse>}
972
- */
973
- flagMessage(targetMessageID: string, options?: {
595
+ flagMessage(targetMessageId: string, options?: {
974
596
  reason?: string;
975
- user_id?: string;
976
597
  }): Promise<FlagMessageResponse>;
977
598
  /**
978
- * flagUser - flag a user
979
- * @param {string} targetID
980
- * @param {string} [options.user_id] currentUserID, only used with serverside auth
981
- * @returns {Promise<APIResponse>}
599
+ * Flag a user.
600
+ *
601
+ * @param targetId - The user to flag.
602
+ * @param options - Flag options (optional, defaults to `{}`).
603
+ * @param options.reason - Reason for flagging (optional).
604
+ * @returns The server response.
982
605
  */
983
- flagUser(targetID: string, options?: {
606
+ flagUser(targetId: string, options?: {
984
607
  reason?: string;
985
- user_id?: string;
986
- }): Promise<FlagUserResponse>;
987
- /**
988
- * unflagMessage - unflag a message
989
- * @param {string} targetMessageID
990
- * @param {string} [options.user_id] currentUserID, only used with serverside auth
991
- * @returns {Promise<APIResponse>}
992
- */
993
- unflagMessage(targetMessageID: string, options?: {
994
- user_id?: string;
995
- }): Promise<FlagMessageResponse>;
996
- /**
997
- * unflagUser - unflag a user
998
- * @param {string} targetID
999
- * @param {string} [options.user_id] currentUserID, only used with serverside auth
1000
- * @returns {Promise<APIResponse>}
1001
- */
1002
- unflagUser(targetID: string, options?: {
1003
- user_id?: string;
1004
608
  }): Promise<FlagUserResponse>;
1005
609
  /**
1006
- * _queryFlags - Query flags.
1007
- *
1008
- * Note: Do not use this.
1009
- * It is present for internal usage only.
1010
- * This function can, and will, break and/or be removed at any point in time.
1011
- *
1012
- * @private
1013
- * @param {FlagsFilters} filterConditions MongoDB style filter conditions
1014
- * @param {FlagsPaginationOptions} options Option object, {limit: 10, offset:0}
610
+ * Unflag a message.
1015
611
  *
1016
- * @return {Promise<FlagsResponse>} Flags Response
612
+ * @param targetMessageId - The message to unflag.
613
+ * @returns The server response.
1017
614
  */
1018
- _queryFlags(filterConditions?: FlagsFilters, options?: FlagsPaginationOptions): Promise<FlagsResponse>;
615
+ unflagMessage(targetMessageId: string): Promise<FlagMessageResponse>;
1019
616
  /**
1020
- * _queryFlagReports - Query flag reports.
617
+ * Unflag a user.
1021
618
  *
1022
- * Note: Do not use this.
1023
- * It is present for internal usage only.
1024
- * This function can, and will, break and/or be removed at any point in time.
1025
- *
1026
- * @private
1027
- * @param {FlagReportsFilters} filterConditions MongoDB style filter conditions
1028
- * @param {FlagReportsPaginationOptions} options Option object, {limit: 10, offset:0}
1029
- *
1030
- * @return {Promise<FlagReportsResponse>} Flag Reports Response
619
+ * @param targetId - The user to unflag.
620
+ * @returns The server response.
1031
621
  */
1032
- _queryFlagReports(filterConditions?: FlagReportsFilters, options?: FlagReportsPaginationOptions): Promise<FlagReportsResponse>;
622
+ unflagUser(targetId: string): Promise<FlagUserResponse>;
1033
623
  /**
1034
- * _reviewFlagReport - review flag report
1035
- *
1036
- * Note: Do not use this.
1037
- * It is present for internal usage only.
1038
- * This function can, and will, break and/or be removed at any point in time.
624
+ * Unblocks a message blocked by automod.
1039
625
  *
1040
- * @private
1041
- * @param {string} [id] flag report to review
1042
- * @param {string} [reviewResult] flag report review result
1043
- * @param {string} [options.user_id] currentUserID, only used with serverside auth
1044
- * @param {string} [options.review_details] custom information about review result
1045
- * @returns {Promise<ReviewFlagReportResponse>>}
626
+ * @param targetMessageId - The message to unblock.
627
+ * @returns The server response.
1046
628
  */
1047
- _reviewFlagReport(id: string, reviewResult: string, options?: ReviewFlagReportOptions): Promise<ReviewFlagReportResponse>;
629
+ unblockMessage(targetMessageId: string): Promise<APIResponse>;
1048
630
  /**
1049
- * unblockMessage - unblocks message blocked by automod
1050
- *
631
+ * Transforms an expiration value into an ISO string.
1051
632
  *
1052
- * @param {string} targetMessageID
1053
- * @param {string} [options.user_id] currentUserID, only used with serverside auth
1054
- * @returns {Promise<APIResponse>}
633
+ * @param timeoutOrExpirationDate - Expiration date or timeout. Use `number` to set the timeout
634
+ * in seconds, `string` or `Date` to set the exact expiration date (optional).
635
+ * @returns The expiration as an ISO string, or `null`.
1055
636
  */
1056
- unblockMessage(targetMessageID: string, options?: {
1057
- user_id?: string;
1058
- }): Promise<APIResponse>;
1059
- _unblockMessage: (targetMessageID: string, options?: {
1060
- user_id?: string;
1061
- }) => Promise<APIResponse>;
637
+ _normalizeExpiration(timeoutOrExpirationDate?: null | number | string | Date): string | null;
1062
638
  /**
1063
- * @deprecated use markChannelsRead instead
1064
- *
1065
- * markAllRead - marks all channels for this user as read
1066
- * @param {MarkAllReadOptions} [data]
639
+ * Extracts a string message ID from either a message object or a message ID.
1067
640
  *
1068
- * @return {Promise<APIResponse>}
641
+ * @param messageOrMessageId - MessageRequest object or message ID.
642
+ * @param errorText - Error message to report in case of message ID absence.
643
+ * @returns The extracted message ID.
1069
644
  */
1070
- markAllRead: (data?: MarkChannelsReadOptions) => Promise<void>;
645
+ _validateAndGetMessageId(messageOrMessageId: string | {
646
+ id: string;
647
+ }, errorText: string): string;
1071
648
  /**
1072
- * markChannelsRead - marks channels read -
1073
- * it accepts a map of cid:messageid pairs, if messageid is empty, the whole channel will be marked as read
1074
- *
1075
- * @param {MarkChannelsReadOptions } [data]
649
+ * Pins the message.
1076
650
  *
1077
- * @return {Promise<APIResponse>}
651
+ * @param messageOrMessageId - MessageRequest object or message ID.
652
+ * @param timeoutOrExpirationDate - Expiration date or timeout. Use `number` to set the timeout
653
+ * in seconds, `string` or `Date` to set the exact expiration date (optional).
654
+ * @param pinnedAt - Date when the message should be pinned. It affects the order of pinned
655
+ * messages. Use a negative number to set relative time in the past, `string` or `Date` to
656
+ * set the exact date of pin (optional).
657
+ * @returns The updated message response.
1078
658
  */
1079
- markChannelsRead(data?: MarkChannelsReadOptions): Promise<void>;
1080
- createCommand(data: CreateCommandOptions): Promise<CreateCommandResponse>;
1081
- getCommand(name: string): Promise<GetCommandResponse>;
1082
- updateCommand(name: string, data: UpdateCommandOptions): Promise<UpdateCommandResponse>;
1083
- deleteCommand(name: string): Promise<DeleteCommandResponse>;
1084
- listCommands(): Promise<ListCommandsResponse>;
1085
- createChannelType(data: CreateChannelOptions): Promise<CreateChannelResponse>;
1086
- getChannelType(channelType: string): Promise<GetChannelTypeResponse>;
1087
- updateChannelType(channelType: string, data: UpdateChannelTypeRequest): Promise<UpdateChannelTypeResponse>;
1088
- deleteChannelType(channelType: string): Promise<APIResponse>;
1089
- listChannelTypes(): Promise<ListChannelResponse>;
659
+ pinMessage(messageOrMessageId: string | {
660
+ id: string;
661
+ }, timeoutOrExpirationDate?: null | number | string | Date, pinnedAt?: number | string | Date): Promise<StreamResponse<import(".").UpdateMessagePartialResponse>>;
1090
662
  /**
1091
- * translateMessage - adds the translation to the message
663
+ * Unpins the message that was previously pinned.
1092
664
  *
1093
- * @param {string} messageId
1094
- * @param {string} language
1095
- *
1096
- * @return {MessageResponse} Response that includes the message
665
+ * @param messageOrMessageId - MessageRequest object or message ID.
666
+ * @returns The updated message response.
1097
667
  */
1098
- translateMessage(messageId: string, language: string): Promise<APIResponse & import("./custom_types").CustomMessageData & {
668
+ unpinMessage(messageOrMessageId: string | {
1099
669
  id: string;
1100
- attachments?: import("./types").Attachment[];
1101
- html?: string;
1102
- mml?: string;
1103
- parent_id?: string;
1104
- pin_expires?: string | null;
1105
- pinned?: boolean;
1106
- pinned_at?: string | null;
1107
- poll_id?: string;
1108
- quoted_message_id?: string;
1109
- restricted_visibility?: string[];
1110
- show_in_channel?: boolean;
1111
- silent?: boolean;
1112
- text?: string;
1113
- type?: import("./types").MessageLabel;
1114
- user?: UserResponse | null;
1115
- user_id?: string;
1116
- } & {
1117
- type: import("./types").MessageLabel;
1118
- args?: string;
1119
- before_message_send_failed?: boolean;
1120
- channel?: ChannelResponse;
1121
- cid?: string;
1122
- command?: string;
1123
- command_info?: {
1124
- name?: string;
1125
- };
1126
- created_at?: string;
1127
- deleted_at?: string;
1128
- deleted_reply_count?: number;
1129
- i18n?: import("./types").RequireAtLeastOne<Record<`${import("./types").TranslationLanguages}_text`, string>> & {
1130
- language: import("./types").TranslationLanguages;
1131
- };
1132
- latest_reactions?: ReactionResponse[];
1133
- member?: import("./types").ChannelMemberResponse;
1134
- mentioned_users?: UserResponse[];
1135
- mentioned_channel?: boolean;
1136
- mentioned_here?: boolean;
1137
- mentioned_group_ids?: string[];
1138
- mentioned_groups?: import("./types").UserGroupResponse[];
1139
- mentioned_roles?: string[];
1140
- message_text_updated_at?: string;
1141
- moderation?: import("./types").ModerationResponse;
1142
- moderation_details?: import("./types").ModerationDetailsResponse;
1143
- own_reactions?: ReactionResponse[] | null;
1144
- pin_expires?: string | null;
1145
- pinned_at?: string | null;
1146
- pinned_by?: UserResponse | null;
1147
- poll?: import("./types").PollResponse;
1148
- reaction_counts?: {
1149
- [key: string]: number;
1150
- } | null;
1151
- reaction_groups?: {
1152
- [key: string]: import("./types").ReactionGroupResponse;
1153
- } | null;
1154
- reaction_scores?: {
1155
- [key: string]: number;
1156
- } | null;
1157
- reminder?: import("./types").ReminderResponseBase;
1158
- reply_count?: number;
1159
- shadowed?: boolean;
1160
- shared_location?: SharedLocationResponse;
1161
- status?: string;
1162
- thread_participants?: UserResponse[];
1163
- updated_at?: string;
1164
- deleted_for_me?: boolean;
1165
- } & {
1166
- quoted_message?: import("./types").MessageResponseBase;
1167
- }>;
670
+ }): Promise<StreamResponse<import(".").UpdateMessagePartialResponse>>;
1168
671
  /**
1169
- * translate - translates the given text to provided language
1170
- *
1171
- * @param {string} text
1172
- * @param {string} destination_language
1173
- * @param {string} source_language
1174
- *
1175
- * @return {TranslateResponse} Response that includes the message
672
+ * Updates the given message. When an `offlineDb` is registered the call is queued
673
+ * so it is replayed on reconnect.
1176
674
  */
1177
- translate(text: string, destination_language: string, source_language: string): Promise<APIResponse & TranslateResponse>;
675
+ updateMessage(request: Parameters<ChatApi['updateMessage']>[0] & {
676
+ message: {
677
+ cid?: string;
678
+ };
679
+ }): Promise<StreamResponse<import(".").UpdateMessageResponse>>;
680
+ _updateMessage(request: Parameters<ChatApi['updateMessage']>[0]): Promise<StreamResponse<import(".").UpdateMessageResponse>>;
1178
681
  /**
1179
- * _normalizeExpiration - transforms expiration value into ISO string
1180
- * @param {undefined|null|number|string|Date} timeoutOrExpirationDate expiration date or timeout. Use number type to set timeout in seconds, string or Date to set exact expiration date
682
+ * Deletes a message. When an `offlineDb` is registered the call is queued so it
683
+ * is replayed on reconnect.
1181
684
  */
1182
- _normalizeExpiration(timeoutOrExpirationDate?: null | number | string | Date): string | null;
685
+ deleteMessage(request: Parameters<ChatApi['deleteMessage']>[0]): Promise<StreamResponse<import(".").DeleteMessageResponse>>;
686
+ _deleteMessage(request: Parameters<ChatApi['deleteMessage']>[0]): Promise<StreamResponse<import(".").DeleteMessageResponse>>;
1183
687
  /**
1184
- * _messageId - extracts string message id from either message object or message id
1185
- * @param {string | { id: string }} messageOrMessageId message object or message id
1186
- * @param {string} errorText error message to report in case of message id absence
688
+ * Returns the list of threads of the current user.
689
+ *
690
+ * @param options - Options object for pagination and limiting the participants and replies
691
+ * (optional, defaults to `{}`).
692
+ * @param options.limit - Limits the number of threads to be returned (optional).
693
+ * @param options.watch - Subscribes the user to the channels of the threads (optional).
694
+ * @param options.participant_limit - Limits the number of participants returned per thread (optional).
695
+ * @param options.reply_limit - Limits the number of replies returned per thread (optional).
696
+ * @param options.filter - MongoDB style filters for threads (optional).
697
+ * @param options.sort - MongoDB style sort for threads (optional).
698
+ * @returns The list of threads and the next cursor.
1187
699
  */
1188
- _validateAndGetMessageId(messageOrMessageId: string | {
1189
- id: string;
1190
- }, errorText: string): string;
700
+ queryThreadsAndHydrate(options?: QueryThreadsRequest): Promise<{
701
+ threads: Thread[];
702
+ next: string | undefined;
703
+ }>;
1191
704
  /**
1192
- * pinMessage - pins the message
1193
- * @param {string | { id: string }} messageOrMessageId message object or message id
1194
- * @param {undefined|null|number|string|Date} timeoutOrExpirationDate expiration date or timeout. Use number type to set timeout in seconds, string or Date to set exact expiration date
1195
- * @param {undefined|string | { id: string }} [pinnedBy] who will appear as a user who pinned a message. Only for server-side use. Provide `undefined` when pinning message client-side
1196
- * @param {undefined|number|string|Date} pinnedAt date when message should be pinned. It affects the order of pinned messages. Use negative number to set relative time in the past, string or Date to set exact date of pin
705
+ * Returns the thread of a message by its ID, wrapped in a hydrated `Thread` instance.
706
+ *
707
+ * @param messageId - The message ID.
708
+ * @param options - Options object for pagination and limiting the participants and replies
709
+ * (optional, defaults to `{}`).
710
+ * @param options.watch - Subscribes the user to the channel of the thread (optional).
711
+ * @param options.participant_limit - Limits the number of participants returned per thread (optional).
712
+ * @param options.reply_limit - Limits the number of replies returned per thread (optional).
713
+ * @returns The thread.
1197
714
  */
1198
- pinMessage(messageOrMessageId: string | {
1199
- id: string;
1200
- }, timeoutOrExpirationDate?: null | number | string | Date, pinnedBy?: string | {
1201
- id: string;
1202
- }, pinnedAt?: number | string | Date): Promise<UpdateMessageAPIResponse>;
715
+ getThreadAndHydrate(messageId: string, options?: GetThreadOptions): Promise<Thread>;
1203
716
  /**
1204
- * unpinMessage - unpins the message that was previously pinned
1205
- * @param {string | { id: string }} messageOrMessageId message object or message id
1206
- * @param {string | { id: string }} [userId]
717
+ * Updates the given thread.
718
+ *
719
+ * @param messageId - The ID of the thread message which needs to be updated.
720
+ * @param partialThreadObject - Should contain `set` or `unset` params for any of the thread's non-reserved fields.
721
+ * @returns The updated thread.
1207
722
  */
1208
- unpinMessage(messageOrMessageId: string | {
1209
- id: string;
1210
- }, userId?: string | {
1211
- id: string;
1212
- }): Promise<UpdateMessageAPIResponse>;
723
+ partialUpdateThread(messageId: string, partialThreadObject: PartialThreadUpdate): Promise<StreamResponse<import(".").UpdateThreadPartialResponse>>;
724
+ getUserAgent: () => string;
1213
725
  /**
1214
- * updateMessage - Update the given message
726
+ * Sets the user agent string.
1215
727
  *
1216
- * @param {Omit<MessageResponse, 'mentioned_users'> & { mentioned_users?: string[] }} message object, id needs to be specified
1217
- * @param {string | { id: string }} [partialUserOrUserId]
1218
- * @param {boolean} [options.skip_enrich_url] Do not try to enrich the URLs within message
728
+ * @deprecated Use `sdkIdentifier` instead.
1219
729
  *
1220
- * @return {{ message: LocalMessage | MessageResponse }} Response that includes the message
730
+ * @param userAgent - The user agent string.
1221
731
  */
1222
- updateMessage(message: LocalMessage | Partial<MessageResponse>, partialUserOrUserId?: string | {
1223
- id: string;
1224
- }, options?: UpdateMessageOptions): Promise<UpdateMessageAPIResponse>;
1225
- _updateMessage(message: LocalMessage | Partial<MessageResponse>, partialUserOrUserId?: string | {
1226
- id: string;
1227
- }, options?: UpdateMessageOptions): Promise<UpdateMessageAPIResponse>;
732
+ setUserAgent(userAgent: string): void;
733
+ _cacheEnabled: () => boolean;
734
+ _startCleaning(): void;
1228
735
  /**
1229
- * partialUpdateMessage - Update the given message id while retaining additional properties
736
+ * Encodes the WS URL payload.
1230
737
  *
1231
- * @param {string} id the message id
1232
- *
1233
- * @param {PartialUpdateMessage} partialMessageObject which should contain id and any of "set" or "unset" params;
1234
- * example: {id: "user1", set:{text: "hi"}, unset:["color"]}
1235
- * @param {string | { id: string }} [userId]
1236
- *
1237
- * @param {boolean} [options.skip_enrich_url] Do not try to enrich the URLs within message
738
+ * @private
1238
739
  *
1239
- * @return {{ message: MessageResponse }} Response that includes the updated message
740
+ * @param client_request_id - The client request ID (optional).
741
+ * @returns The JSON-encoded payload string.
1240
742
  */
1241
- partialUpdateMessage(id: string, partialMessageObject: PartialMessageUpdate, partialUserOrUserId?: string | {
1242
- id: string;
1243
- }, options?: UpdateMessageOptions): Promise<UpdateMessageAPIResponse>;
743
+ _buildWSPayload: (client_request_id?: string) => string;
1244
744
  /**
1245
- * Updates message fields without storing them in the database, only sends update event.
1246
- *
1247
- * Available only on the server-side.
745
+ * Queries poll answers.
1248
746
  *
1249
- * @param messageId the message id to update.
1250
- * @param partialMessageObject the message payload.
1251
- * @param partialUserOrUserId the user id linked to this action.
1252
- * @param options additional options.
747
+ * @param request - The query poll answers request payload, including the poll ID, optional vote
748
+ * filter conditions, sort directions, and pagination options (`limit`, `offset`).
749
+ * @param request.poll_id - The poll ID.
750
+ * @param request.filter - Vote filter conditions.
751
+ * @returns The poll answers.
1253
752
  */
1254
- ephemeralUpdateMessage(messageId: string, partialMessageObject: PartialMessageUpdate, partialUserOrUserId?: string | {
1255
- id: string;
1256
- }, options?: UpdateMessageOptions): Promise<UpdateMessageAPIResponse>;
753
+ queryPollAnswers({ poll_id, filter, ...options }: Parameters<ChatApi['queryPollVotes']>[0]): Promise<StreamResponse<import(".").PollVotesResponse>>;
1257
754
  /**
1258
- * deleteMessage - Delete a message
755
+ * Uploads a file to the configured storage (defaults to Stream CDN).
1259
756
  *
1260
- * @param {string} messageID The id of the message to delete
1261
- * @param {boolean | DeleteMessageOptions | undefined} [optionsOrHardDelete]
1262
- * @return {Promise<APIResponse & { message: MessageResponse }>} The API response
757
+ * @param uri - The file to upload.
758
+ * @param name - The name of the file (optional).
759
+ * @param contentType - The content type of the file (optional).
760
+ * @param user - User information (optional).
761
+ * @param axiosRequestConfig - Axios config, e.g. `onUploadProgress` for progress tracking (optional).
762
+ * @returns Response containing the file URL.
1263
763
  */
1264
- deleteMessage(messageID: string, optionsOrHardDelete?: DeleteMessageOptions | boolean): Promise<APIResponse & {
1265
- message: MessageResponse;
1266
- }>;
1267
- _deleteMessage(messageID: string, optionsOrHardDelete?: DeleteMessageOptions | boolean): Promise<APIResponse & {
1268
- message: MessageResponse;
1269
- }>;
764
+ uploadFile_(uri: string | NodeJS.ReadableStream | Buffer | File, name?: string, contentType?: string, user?: UserResponse, axiosRequestConfig?: AxiosRequestConfig): Promise<import("./types").SendFileAPIResponse>;
1270
765
  /**
1271
- * undeleteMessage - Undelete a message
1272
- *
1273
- * undeletes a message that was previous soft deleted. Hard deleted messages
1274
- * cannot be undeleted. This is only allowed to be called from server-side
1275
- * clients.
766
+ * Uploads an image to the configured storage (defaults to Stream CDN).
1276
767
  *
1277
- * @param {string} messageID The id of the message to undelete
1278
- * @param {string} userID The id of the user who undeleted the message
1279
- *
1280
- * @return {{ message: MessageResponse }} Response that includes the message
768
+ * @param uri - The image to upload.
769
+ * @param name - The name of the image (optional).
770
+ * @param contentType - The content type of the image (optional).
771
+ * @param user - User information (optional).
772
+ * @param axiosRequestConfig - Axios config, e.g. `onUploadProgress` for progress tracking (optional).
773
+ * @returns Response containing the image URL.
1281
774
  */
1282
- undeleteMessage(messageID: string, userID: string): Promise<APIResponse & {
1283
- message: MessageResponse;
1284
- }>;
1285
- getMessage(messageID: string, options?: GetMessageOptions): Promise<import("./types").SendMessageAPIResponse>;
775
+ uploadImage_(uri: string | NodeJS.ReadableStream | File, name?: string, contentType?: string, user?: UserResponse, axiosRequestConfig?: AxiosRequestConfig): Promise<import("./types").SendFileAPIResponse>;
1286
776
  /**
1287
- * queryThreads - returns the list of threads of current user.
777
+ * Marks the channels as delivered for the given messages and the user.
1288
778
  *
1289
- * @param {QueryThreadsOptions} options Options object for pagination and limiting the participants and replies.
1290
- * @param {number} options.limit Limits the number of threads to be returned.
1291
- * @param {boolean} options.watch Subscribes the user to the channels of the threads.
1292
- * @param {number} options.participant_limit Limits the number of participants returned per threads.
1293
- * @param {number} options.reply_limit Limits the number of replies returned per threads.
1294
- * @param {ThreadFilters} options.filter MongoDB style filters for threads
1295
- * @param {ThreadSort} options.sort MongoDB style sort for threads
1296
- *
1297
- * @returns {{ threads: Thread[], next: string }} Returns the list of threads and the next cursor.
779
+ * @param request - Mark delivered options.
780
+ * @returns The server response, or `undefined` if there are no messages to mark.
1298
781
  */
1299
- queryThreads(options?: QueryThreadsOptions): Promise<{
1300
- threads: Thread[];
1301
- next: string | undefined;
1302
- }>;
1303
- /**
1304
- * getThread - returns the thread of a message by its id.
1305
- *
1306
- * @param {string} messageId The message id
1307
- * @param {GetThreadOptions} options Options object for pagination and limiting the participants and replies.
1308
- * @param {boolean} options.watch Subscribes the user to the channel of the thread.
1309
- * @param {number} options.participant_limit Limits the number of participants returned per threads.
1310
- * @param {number} options.reply_limit Limits the number of replies returned per threads.
1311
- *
1312
- * @returns {Thread} Returns the thread.
1313
- */
1314
- getThread(messageId: string, options?: GetThreadOptions): Promise<Thread>;
1315
- /**
1316
- * partialUpdateThread - updates the given thread
1317
- *
1318
- * @param {string} messageId The id of the thread message which needs to be updated.
1319
- * @param {PartialThreadUpdate} partialThreadObject should contain "set" or "unset" params for any of the thread's non-reserved fields.
1320
- *
1321
- * @returns {GetThreadAPIResponse} Returns the updated thread.
1322
- */
1323
- partialUpdateThread(messageId: string, partialThreadObject: PartialThreadUpdate): Promise<GetThreadAPIResponse>;
1324
- getUserAgent: () => string;
1325
- /**
1326
- * @deprecated use sdkIdentifier instead
1327
- * @param userAgent
1328
- */
1329
- setUserAgent(userAgent: string): void;
1330
- /**
1331
- * _isUsingServerAuth - Returns true if we're using server side auth
1332
- */
1333
- _isUsingServerAuth: () => boolean;
1334
- _cacheEnabled: () => boolean;
1335
- _enrichAxiosOptions(options?: AxiosRequestConfig & {
1336
- config?: AxiosRequestConfig;
1337
- }): AxiosRequestConfig;
1338
- _getToken(): string | null | undefined;
1339
- _startCleaning(): void;
1340
- /**
1341
- * encode ws url payload
1342
- * @private
1343
- * @returns json string
1344
- */
1345
- _buildWSPayload: (client_request_id?: string) => string;
1346
- /**
1347
- * checks signature of a request
1348
- * @param {string | Buffer} rawBody
1349
- * @param {string} signature from HTTP header
1350
- * @returns {boolean}
1351
- */
1352
- verifyWebhook(requestBody: string | Buffer, xSignature: string): boolean;
1353
- /**
1354
- * Verify and parse an HTTP webhook event.
1355
- *
1356
- * Decompresses `rawBody` when gzipped (detected from the body bytes),
1357
- * verifies the `X-Signature` header against the app's API secret, and
1358
- * returns the parsed `Event`. Works whether or not Stream is currently
1359
- * compressing payloads for this app, and stays correct behind
1360
- * middleware that auto-decompresses the request.
1361
- *
1362
- * @param rawBody Raw HTTP request body bytes Stream signed
1363
- * @param signature Value of the `X-Signature` header
1364
- * @throws {InvalidWebhookError} When the signature does not match or
1365
- * the gzip envelope is malformed.
1366
- */
1367
- verifyAndParseWebhook(rawBody: string | Buffer, signature: string): Event;
1368
- /**
1369
- * Parse an SQS firehose event: decodes the message `Body` (base64 +
1370
- * optional gzip) and returns the parsed `Event`. No HMAC verification
1371
- * (Stream does not sign SQS bodies).
1372
- *
1373
- * @param messageBody SQS message `Body` string
1374
- * @throws {InvalidWebhookError} When the base64 / gzip envelope is malformed.
1375
- */
1376
- parseSqs(messageBody: string): Event;
1377
- /**
1378
- * Parse an SNS-delivered event (unwraps envelope JSON when needed, then
1379
- * same decode path as SQS). No HMAC verification.
1380
- *
1381
- * @param notificationBody Raw SNS POST body or pre-extracted `Message` string
1382
- * @throws {InvalidWebhookError} When the envelope cannot be decoded.
1383
- */
1384
- parseSns(notificationBody: string): Event;
1385
- /** getPermission - gets the definition for a permission
1386
- *
1387
- * @param {string} name
1388
- * @returns {Promise<PermissionAPIResponse>}
1389
- */
1390
- getPermission(name: string): Promise<PermissionAPIResponse>;
1391
- /** createPermission - creates a custom permission
1392
- *
1393
- * @param {CustomPermissionOptions} permissionData the permission data
1394
- * @returns {Promise<APIResponse>}
1395
- */
1396
- createPermission(permissionData: CustomPermissionOptions): Promise<APIResponse>;
1397
- /** updatePermission - updates an existing custom permission
1398
- *
1399
- * @param {string} id
1400
- * @param {Omit<CustomPermissionOptions, 'id'>} permissionData the permission data
1401
- * @returns {Promise<APIResponse>}
1402
- */
1403
- updatePermission(id: string, permissionData: Omit<CustomPermissionOptions, 'id'>): Promise<APIResponse>;
1404
- /** deletePermission - deletes a custom permission
1405
- *
1406
- * @param {string} name
1407
- * @returns {Promise<APIResponse>}
1408
- */
1409
- deletePermission(name: string): Promise<APIResponse>;
1410
- /** listPermissions - returns the list of all permissions for this application
1411
- *
1412
- * @returns {Promise<APIResponse>}
1413
- */
1414
- listPermissions(): Promise<PermissionsAPIResponse>;
1415
- /** createRole - creates a custom role
1416
- *
1417
- * @param {string} name the new role name
1418
- * @returns {Promise<APIResponse>}
1419
- */
1420
- createRole(name: string): Promise<CreateRoleAPIResponse>;
1421
- /** listRoles - returns the list of all roles for this application
1422
- *
1423
- * @returns {Promise<APIResponse>}
1424
- */
1425
- listRoles(): Promise<ListRolesAPIResponse>;
1426
- /** listRoles - returns the list of all roles for this application
1427
- *
1428
- * @returns {Promise<APIResponse>}
1429
- */
1430
- searchRoles(options: SearchRolesOptions): Promise<SearchRolesAPIResponse>;
1431
- /** deleteRole - deletes a custom role
1432
- *
1433
- * @param {string} name the role name
1434
- * @returns {Promise<APIResponse>}
1435
- */
1436
- deleteRole(name: string): Promise<APIResponse>;
1437
- /** sync - returns all events that happened for a list of channels since last sync
1438
- * @param {string[]} channel_cids list of channel CIDs
1439
- * @param {string} last_sync_at last time the user was online and in sync. RFC3339 ie. "2020-05-06T15:05:01.207Z"
1440
- * @param {SyncOptions} options See JSDoc in the type fields for more info
1441
- *
1442
- * @returns {Promise<SyncResponse>}
1443
- */
1444
- sync(channel_cids: string[], last_sync_at: string, options?: SyncOptions): Promise<SyncResponse>;
1445
- /**
1446
- * sendUserCustomEvent - Send a custom event to a user
1447
- *
1448
- * @param {string} targetUserID target user id
1449
- * @param {UserCustomEvent} event for example {type: 'friendship-request'}
1450
- *
1451
- * @return {Promise<APIResponse>} The Server Response
1452
- */
1453
- sendUserCustomEvent(targetUserID: string, event: UserCustomEvent): Promise<APIResponse>;
1454
- /**
1455
- * Creates a new block list
1456
- *
1457
- * @param {BlockList} blockList - The block list to create
1458
- * @param {string} blockList.name - The name of the block list
1459
- * @param {string[]} blockList.words - List of words to block
1460
- * @param {string} [blockList.team] - Team ID the block list belongs to
1461
- *
1462
- * @returns {Promise<APIResponse>} The server response
1463
- */
1464
- createBlockList(blockList: BlockList): Promise<APIResponse>;
1465
- /**
1466
- * Lists all block lists
1467
- *
1468
- * @param {Object} [data] - Query parameters
1469
- * @param {string} [data.team] - Team ID to filter block lists by
1470
- *
1471
- * @returns {Promise<APIResponse & {blocklists: BlockListResponse[]}>} Response containing array of block lists
1472
- */
1473
- listBlockLists(data?: {
1474
- team?: string;
1475
- }): Promise<APIResponse & {
1476
- blocklists: BlockListResponse[];
1477
- }>;
1478
- /**
1479
- * Gets a specific block list
1480
- *
1481
- * @param {string} name - The name of the block list to retrieve
1482
- * @param {Object} [data] - Query parameters
1483
- * @param {string} [data.team] - Team ID that blocklist belongs to
1484
- *
1485
- * @returns {Promise<APIResponse & {blocklist: BlockListResponse}>} Response containing the block list
1486
- */
1487
- getBlockList(name: string, data?: {
1488
- team?: string;
1489
- }): Promise<APIResponse & {
1490
- blocklist: BlockListResponse;
1491
- }>;
1492
- /**
1493
- * Updates an existing block list
1494
- *
1495
- * @param {string} name - The name of the block list to update
1496
- * @param {Object} data - The update data
1497
- * @param {string[]} data.words - New list of words to block
1498
- * @param {string} [data.team] - Team ID that blocklist belongs to
1499
- *
1500
- * @returns {Promise<APIResponse>} The server response
1501
- */
1502
- updateBlockList(name: string, data: {
1503
- words: string[];
1504
- team?: string;
1505
- }): Promise<APIResponse>;
1506
- /**
1507
- * Deletes a block list
1508
- *
1509
- * @param {string} name - The name of the block list to delete
1510
- * @param {Object} [data] - Query parameters
1511
- * @param {string} [data.team] - Team ID that blocklist belongs to
1512
- *
1513
- * @returns {Promise<APIResponse>} The server response
1514
- */
1515
- deleteBlockList(name: string, data?: {
1516
- team?: string;
1517
- }): Promise<APIResponse>;
1518
- exportChannels(request: Array<ExportChannelRequest>, options?: ExportChannelOptions): Promise<APIResponse & ExportChannelResponse>;
1519
- exportUsers(request: ExportUsersRequest): Promise<APIResponse & ExportUsersResponse>;
1520
- exportChannel(request: ExportChannelRequest, options?: ExportChannelOptions): Promise<APIResponse & ExportChannelResponse>;
1521
- getExportChannelStatus(id: string): Promise<APIResponse & ExportChannelStatusResponse>;
1522
- campaign(idOrData: string | CampaignData, data?: CampaignData): Campaign;
1523
- /**
1524
- * channelBatchUpdater - Returns a ChannelBatchUpdater instance for batch channel operations
1525
- *
1526
- * @return {ChannelBatchUpdater} A ChannelBatchUpdater instance
1527
- */
1528
- channelBatchUpdater(): ChannelBatchUpdater;
1529
- segment(type: SegmentType, idOrData: string | SegmentData, data?: SegmentData): Segment;
1530
- validateServerSideAuth(): void;
1531
- /**
1532
- * createSegment - Creates a segment
1533
- *
1534
- * @private
1535
- * @param {SegmentType} type Segment type
1536
- * @param {string} id Segment ID
1537
- * @param {string} name Segment name
1538
- * @param {SegmentData} params Segment data
1539
- *
1540
- * @return {{segment: SegmentResponse} & APIResponse} The created Segment
1541
- */
1542
- createSegment(type: SegmentType, id: string | null, data?: SegmentData): Promise<{
1543
- segment: SegmentResponse;
1544
- }>;
1545
- /**
1546
- * createUserSegment - Creates a user segment
1547
- *
1548
- * @param {string} id Segment ID
1549
- * @param {string} name Segment name
1550
- * @param {SegmentData} data Segment data
1551
- *
1552
- * @return {Segment} The created Segment
1553
- */
1554
- createUserSegment(id: string | null, data?: SegmentData): Promise<{
1555
- segment: SegmentResponse;
1556
- }>;
1557
- /**
1558
- * createChannelSegment - Creates a channel segment
1559
- *
1560
- * @param {string} id Segment ID
1561
- * @param {string} name Segment name
1562
- * @param {SegmentData} data Segment data
1563
- *
1564
- * @return {Segment} The created Segment
1565
- */
1566
- createChannelSegment(id: string | null, data?: SegmentData): Promise<{
1567
- segment: SegmentResponse;
1568
- }>;
1569
- getSegment(id: string): Promise<{
1570
- segment: SegmentResponse;
1571
- } & APIResponse>;
1572
- /**
1573
- * updateSegment - Update a segment
1574
- *
1575
- * @param {string} id Segment ID
1576
- * @param {Partial<UpdateSegmentData>} data Data to update
1577
- *
1578
- * @return {Segment} Updated Segment
1579
- */
1580
- updateSegment(id: string, data: Partial<UpdateSegmentData>): Promise<{
1581
- segment: SegmentResponse;
1582
- }>;
1583
- /**
1584
- * addSegmentTargets - Add targets to a segment
1585
- *
1586
- * @param {string} id Segment ID
1587
- * @param {string[]} targets Targets to add to the segment
1588
- *
1589
- * @return {APIResponse} API response
1590
- */
1591
- addSegmentTargets(id: string, targets: string[]): Promise<APIResponse>;
1592
- querySegmentTargets(id: string, filter?: QuerySegmentTargetsFilter | null, sort?: SortParam[] | null | [], options?: {}): Promise<{
1593
- targets: SegmentTargetsResponse[];
1594
- next?: string;
1595
- } & APIResponse>;
1596
- /**
1597
- * removeSegmentTargets - Remove targets from a segment
1598
- *
1599
- * @param {string} id Segment ID
1600
- * @param {string[]} targets Targets to add to the segment
1601
- *
1602
- * @return {APIResponse} API response
1603
- */
1604
- removeSegmentTargets(id: string, targets: string[]): Promise<APIResponse>;
1605
- /**
1606
- * querySegments - Query Segments
1607
- *
1608
- * @param {filter} filter MongoDB style filter conditions
1609
- * @param {QuerySegmentsOptions} options Options for sorting/paginating the results
1610
- *
1611
- * @return {Segment[]} Segments
1612
- */
1613
- querySegments(filter: {}, sort?: SortParam[], options?: QuerySegmentsOptions): Promise<{
1614
- segments: SegmentResponse[];
1615
- next?: string;
1616
- prev?: string;
1617
- } & APIResponse>;
1618
- /**
1619
- * deleteSegment - Delete a Campaign Segment
1620
- *
1621
- * @param {string} id Segment ID
1622
- *
1623
- * @return {Promise<APIResponse>} The Server Response
1624
- */
1625
- deleteSegment(id: string): Promise<APIResponse>;
1626
- /**
1627
- * segmentTargetExists - Check if a target exists in a segment
1628
- *
1629
- * @param {string} segmentId Segment ID
1630
- * @param {string} targetId Target ID
1631
- *
1632
- * @return {Promise<APIResponse>} The Server Response
1633
- */
1634
- segmentTargetExists(segmentId: string, targetId: string): Promise<APIResponse>;
1635
- /**
1636
- * createCampaign - Creates a Campaign
1637
- *
1638
- * @param {CampaignData} params Campaign data
1639
- *
1640
- * @return {Campaign} The Created Campaign
1641
- */
1642
- createCampaign(params: CampaignData): Promise<{
1643
- campaign: CampaignResponse;
1644
- users: {
1645
- next?: string;
1646
- prev?: string;
1647
- };
1648
- } & APIResponse>;
1649
- getCampaign(id: string, options?: GetCampaignOptions): Promise<{
1650
- campaign: CampaignResponse;
1651
- users: {
1652
- next?: string;
1653
- prev?: string;
1654
- };
1655
- } & APIResponse>;
1656
- startCampaign(id: string, options?: {
1657
- scheduledFor?: string;
1658
- stopAt?: string;
1659
- }): Promise<{
1660
- campaign: CampaignResponse;
1661
- users: {
1662
- next?: string;
1663
- prev?: string;
1664
- };
1665
- } & APIResponse>;
1666
- /**
1667
- * queryCampaigns - Query Campaigns
1668
- *
1669
- *
1670
- * @return {Campaign[]} Campaigns
1671
- */
1672
- queryCampaigns(filter: CampaignFilters, sort?: CampaignSort, options?: CampaignQueryOptions): Promise<{
1673
- campaigns: CampaignResponse[];
1674
- next?: string;
1675
- prev?: string;
1676
- } & APIResponse>;
1677
- /**
1678
- * updateCampaign - Update a Campaign
1679
- *
1680
- * @param {string} id Campaign ID
1681
- * @param {Partial<CampaignData>} params Campaign data
1682
- *
1683
- * @return {Campaign} Updated Campaign
1684
- */
1685
- updateCampaign(id: string, params: Partial<CampaignData>): Promise<{
1686
- campaign: CampaignResponse;
1687
- users: {
1688
- next?: string;
1689
- prev?: string;
1690
- };
1691
- }>;
1692
- /**
1693
- * deleteCampaign - Delete a Campaign
1694
- *
1695
- * @param {string} id Campaign ID
1696
- *
1697
- * @return {Promise<APIResponse>} The Server Response
1698
- */
1699
- deleteCampaign(id: string): Promise<APIResponse>;
1700
- /**
1701
- * stopCampaign - Stop a Campaign
1702
- *
1703
- * @param {string} id Campaign ID
1704
- *
1705
- * @return {Campaign} Stopped Campaign
1706
- */
1707
- stopCampaign(id: string): Promise<{
1708
- campaign: CampaignResponse;
1709
- }>;
1710
- /**
1711
- * enrichURL - Get OpenGraph data of the given link
1712
- *
1713
- * @param {string} url link
1714
- * @return {OGAttachment} OG Attachment
1715
- */
1716
- enrichURL(url: string): Promise<APIResponse & OGAttachment>;
1717
- /**
1718
- * getTask - Gets status of a long running task
1719
- *
1720
- * @param {string} id Task ID
1721
- *
1722
- * @return {TaskStatus} The task status
1723
- */
1724
- getTask(id: string): Promise<APIResponse & TaskStatus>;
1725
- /**
1726
- * deleteChannels - Deletes a list of channel
1727
- *
1728
- * @param {string[]} cids Channel CIDs
1729
- * @param {boolean} [options.hard_delete] Defines if the channel is hard deleted or not
1730
- *
1731
- * @return {DeleteChannelsResponse} Result of the soft deletion, if server-side, it holds the task ID as well
1732
- */
1733
- deleteChannels(cids: string[], options?: {
1734
- hard_delete?: boolean;
1735
- }): Promise<APIResponse & {
1736
- result: Record<string, string>;
1737
- } & Partial<TaskResponse>>;
1738
- /**
1739
- * deleteUsers - Batch Delete Users
1740
- *
1741
- * @param {string[]} user_ids which users to delete
1742
- * @param {DeleteUserOptions} options Configuration how to delete users
1743
- *
1744
- * @return {TaskResponse} A task ID
1745
- */
1746
- deleteUsers(user_ids: string[], options?: DeleteUserOptions): Promise<APIResponse & TaskResponse>;
1747
- /**
1748
- * _createImportURL - Create an Import upload url.
1749
- *
1750
- * Note: Do not use this.
1751
- * It is present for internal usage only.
1752
- * This function can, and will, break and/or be removed at any point in time.
1753
- *
1754
- * @private
1755
- * @param {string} filename filename of uploaded data
1756
- * @return {APIResponse & CreateImportResponse} An ImportTask
1757
- */
1758
- _createImportURL(filename: string): Promise<APIResponse & CreateImportURLResponse>;
1759
- /**
1760
- * _createImport - Create an Import Task.
1761
- *
1762
- * Note: Do not use this.
1763
- * It is present for internal usage only.
1764
- * This function can, and will, break and/or be removed at any point in time.
1765
- *
1766
- * @private
1767
- * @param {string} path path of uploaded data
1768
- * @param {CreateImportOptions} options import options
1769
- * @return {APIResponse & CreateImportResponse} An ImportTask
1770
- */
1771
- _createImport(path: string, options?: CreateImportOptions): Promise<APIResponse & CreateImportResponse>;
1772
- /**
1773
- * _getImport - Get an Import Task.
1774
- *
1775
- * Note: Do not use this.
1776
- * It is present for internal usage only.
1777
- * This function can, and will, break and/or be removed at any point in time.
1778
- *
1779
- * @private
1780
- * @param {string} id id of Import Task
1781
- *
1782
- * @return {APIResponse & GetImportResponse} An ImportTask
1783
- */
1784
- _getImport(id: string): Promise<APIResponse & GetImportResponse>;
1785
- /**
1786
- * _listImports - Lists Import Tasks.
1787
- *
1788
- * Note: Do not use this.
1789
- * It is present for internal usage only.
1790
- * This function can, and will, break and/or be removed at any point in time.
1791
- *
1792
- * @private
1793
- * @param {ListImportsPaginationOptions} options pagination options
1794
- *
1795
- * @return {APIResponse & ListImportsResponse} An ImportTask
1796
- */
1797
- _listImports(options: ListImportsPaginationOptions): Promise<APIResponse & ListImportsResponse>;
1798
- /**
1799
- * upsertPushProvider - Create or Update a push provider
1800
- *
1801
- * Note: Works only for v2 push version is enabled on app settings.
1802
- *
1803
- * @param {PushProviderConfig} configuration of the provider you want to create or update
1804
- *
1805
- * @return {APIResponse & PushProviderUpsertResponse} A push provider
1806
- */
1807
- upsertPushProvider(pushProvider: PushProviderConfig): Promise<APIResponse & PushProviderUpsertResponse>;
1808
- /**
1809
- * deletePushProvider - Delete a push provider
1810
- *
1811
- * Note: Works only for v2 push version is enabled on app settings.
1812
- *
1813
- * @param {PushProviderID} type and foreign id of the push provider to be deleted
1814
- *
1815
- * @return {APIResponse} An API response
1816
- */
1817
- deletePushProvider({ type, name }: PushProviderID): Promise<APIResponse>;
1818
- /**
1819
- * listPushProviders - Get all push providers in the app
1820
- *
1821
- * Note: Works only for v2 push version is enabled on app settings.
1822
- *
1823
- * @return {APIResponse & PushProviderListResponse} A push provider
1824
- */
1825
- listPushProviders(): Promise<APIResponse & PushProviderListResponse>;
1826
- /**
1827
- * creates an abort controller that will be used by the next HTTP Request.
1828
- */
1829
- createAbortControllerForNextRequest(): AbortController;
1830
- /**
1831
- * commits a pending message, making it visible in the channel and for other users
1832
- * @param id the message id
1833
- *
1834
- * @return {APIResponse & MessageResponse} The message
1835
- */
1836
- commitMessage(id: string): Promise<APIResponse & import("./custom_types").CustomMessageData & {
1837
- id: string;
1838
- attachments?: import("./types").Attachment[];
1839
- html?: string;
1840
- mml?: string;
1841
- parent_id?: string;
1842
- pin_expires?: string | null;
1843
- pinned?: boolean;
1844
- pinned_at?: string | null;
1845
- poll_id?: string;
1846
- quoted_message_id?: string;
1847
- restricted_visibility?: string[];
1848
- show_in_channel?: boolean;
1849
- silent?: boolean;
1850
- text?: string;
1851
- type?: import("./types").MessageLabel;
1852
- user?: UserResponse | null;
1853
- user_id?: string;
1854
- } & {
1855
- type: import("./types").MessageLabel;
1856
- args?: string;
1857
- before_message_send_failed?: boolean;
1858
- channel?: ChannelResponse;
1859
- cid?: string;
1860
- command?: string;
1861
- command_info?: {
1862
- name?: string;
1863
- };
1864
- created_at?: string;
1865
- deleted_at?: string;
1866
- deleted_reply_count?: number;
1867
- i18n?: import("./types").RequireAtLeastOne<Record<`${import("./types").TranslationLanguages}_text`, string>> & {
1868
- language: import("./types").TranslationLanguages;
1869
- };
1870
- latest_reactions?: ReactionResponse[];
1871
- member?: import("./types").ChannelMemberResponse;
1872
- mentioned_users?: UserResponse[];
1873
- mentioned_channel?: boolean;
1874
- mentioned_here?: boolean;
1875
- mentioned_group_ids?: string[];
1876
- mentioned_groups?: import("./types").UserGroupResponse[];
1877
- mentioned_roles?: string[];
1878
- message_text_updated_at?: string;
1879
- moderation?: import("./types").ModerationResponse;
1880
- moderation_details?: import("./types").ModerationDetailsResponse;
1881
- own_reactions?: ReactionResponse[] | null;
1882
- pin_expires?: string | null;
1883
- pinned_at?: string | null;
1884
- pinned_by?: UserResponse | null;
1885
- poll?: import("./types").PollResponse;
1886
- reaction_counts?: {
1887
- [key: string]: number;
1888
- } | null;
1889
- reaction_groups?: {
1890
- [key: string]: import("./types").ReactionGroupResponse;
1891
- } | null;
1892
- reaction_scores?: {
1893
- [key: string]: number;
1894
- } | null;
1895
- reminder?: import("./types").ReminderResponseBase;
1896
- reply_count?: number;
1897
- shadowed?: boolean;
1898
- shared_location?: SharedLocationResponse;
1899
- status?: string;
1900
- thread_participants?: UserResponse[];
1901
- updated_at?: string;
1902
- deleted_for_me?: boolean;
1903
- } & {
1904
- quoted_message?: import("./types").MessageResponseBase;
1905
- }>;
1906
- /**
1907
- * Creates a poll
1908
- * @param poll PollData The poll that will be created
1909
- * @param userId string The user id (only serverside)
1910
- * @returns {APIResponse & CreatePollAPIResponse} The poll
1911
- */
1912
- createPoll(poll: CreatePollData, userId?: string): Promise<APIResponse & CreatePollAPIResponse>;
1913
- /**
1914
- * Retrieves a poll
1915
- * @param id string The poll id
1916
- * @param userId string The user id (only serverside)
1917
- * @returns {APIResponse & GetPollAPIResponse} The poll
1918
- */
1919
- getPoll(id: string, userId?: string): Promise<APIResponse & GetPollAPIResponse>;
1920
- /**
1921
- * Updates a poll
1922
- * @param poll PollData The poll that will be updated
1923
- * @param userId string The user id (only serverside)
1924
- * @returns {APIResponse & PollResponse} The poll
1925
- */
1926
- updatePoll(poll: PollData, userId?: string): Promise<APIResponse & UpdatePollAPIResponse>;
1927
- /**
1928
- * Partially updates a poll
1929
- * @param id string The poll id
1930
- * @param {PartialPollUpdate} partialPollObject which should contain id and any of "set" or "unset" params;
1931
- * @param userId string The user id (only serverside)
1932
- * example: {id: "44f26af5-f2be-4fa7-9dac-71cf893781de", set:{field: value}, unset:["field2"]}
1933
- * @returns {APIResponse & UpdatePollAPIResponse} The poll
1934
- */
1935
- partialUpdatePoll(id: string, partialPollObject: PartialPollUpdate, userId?: string): Promise<APIResponse & UpdatePollAPIResponse>;
1936
- /**
1937
- * Delete a poll
1938
- * @param id string The poll id
1939
- * @param userId string The user id (only serverside)
1940
- * @returns
1941
- */
1942
- deletePoll(id: string, userId?: string): Promise<APIResponse>;
1943
- /**
1944
- * Close a poll
1945
- * @param id string The poll id
1946
- * @param userId string The user id (only serverside)
1947
- * @returns {APIResponse & UpdatePollAPIResponse} The poll
1948
- */
1949
- closePoll(id: string, userId?: string): Promise<APIResponse & UpdatePollAPIResponse>;
1950
- /**
1951
- * Creates a poll option
1952
- * @param pollId string The poll id
1953
- * @param option PollOptionData The poll option that will be created
1954
- * @param userId string The user id (only serverside)
1955
- * @returns {APIResponse & PollOptionResponse} The poll option
1956
- */
1957
- createPollOption(pollId: string, option: PollOptionData, userId?: string): Promise<APIResponse & CreatePollOptionAPIResponse>;
1958
- /**
1959
- * Retrieves a poll option
1960
- * @param pollId string The poll id
1961
- * @param optionId string The poll option id
1962
- * @param userId string The user id (only serverside)
1963
- * @returns {APIResponse & PollOptionResponse} The poll option
1964
- */
1965
- getPollOption(pollId: string, optionId: string, userId?: string): Promise<APIResponse & CreatePollOptionAPIResponse>;
1966
- /**
1967
- * Updates a poll option
1968
- * @param pollId string The poll id
1969
- * @param option PollOptionData The poll option that will be updated
1970
- * @param userId string The user id (only serverside)
1971
- * @returns
1972
- */
1973
- updatePollOption(pollId: string, option: PollOptionData, userId?: string): Promise<APIResponse & CreatePollOptionAPIResponse>;
1974
- /**
1975
- * Delete a poll option
1976
- * @param pollId string The poll id
1977
- * @param optionId string The poll option id
1978
- * @param userId string The user id (only serverside)
1979
- * @returns {APIResponse} The poll option
1980
- */
1981
- deletePollOption(pollId: string, optionId: string, userId?: string): Promise<APIResponse>;
1982
- /**
1983
- * Cast vote on a poll
1984
- * @param messageId string The message id
1985
- * @param pollId string The poll id
1986
- * @param vote PollVoteData The vote that will be casted
1987
- * @param userId string The user id (only serverside)
1988
- * @returns {APIResponse & CastVoteAPIResponse} The poll vote
1989
- */
1990
- castPollVote(messageId: string, pollId: string, vote: PollVoteData, userId?: string): Promise<APIResponse & CastVoteAPIResponse>;
1991
- /**
1992
- * Add a poll answer
1993
- * @param messageId string The message id
1994
- * @param pollId string The poll id
1995
- * @param answerText string The answer text
1996
- * @param userId string The user id (only serverside)
1997
- */
1998
- addPollAnswer(messageId: string, pollId: string, answerText: string, userId?: string): Promise<APIResponse & CastVoteAPIResponse>;
1999
- removePollVote(messageId: string, pollId: string, voteId: string, userId?: string): Promise<APIResponse & {
2000
- vote: PollVote;
2001
- }>;
2002
- /**
2003
- * Queries polls
2004
- * @param filter
2005
- * @param sort
2006
- * @param options Option object, {limit: 10, offset:0}
2007
- * @param userId string The user id (only serverside)
2008
- * @returns {APIResponse & QueryPollsResponse} The polls
2009
- */
2010
- queryPolls(filter?: QueryPollsFilters, sort?: PollSort, options?: QueryPollsOptions, userId?: string): Promise<APIResponse & QueryPollsResponse>;
2011
- /**
2012
- * Queries poll votes
2013
- * @param pollId
2014
- * @param filter
2015
- * @param sort
2016
- * @param options Option object, {limit: 10, offset:0}
2017
- * @param userId string The user id (only serverside)
2018
- * @returns {APIResponse & PollVotesAPIResponse} The poll votes
2019
- */
2020
- queryPollVotes(pollId: string, filter?: QueryVotesFilters, sort?: VoteSort, options?: QueryVotesOptions, userId?: string): Promise<APIResponse & PollVotesAPIResponse>;
2021
- /**
2022
- * Queries poll answers
2023
- * @param pollId
2024
- * @param filter
2025
- * @param sort
2026
- * @param options Option object, {limit: 10, offset:0}
2027
- * @param userId string The user id (only serverside)
2028
- * @returns {APIResponse & PollAnswersAPIResponse} The poll votes
2029
- */
2030
- queryPollAnswers(pollId: string, filter?: QueryVotesFilters, sort?: VoteSort, options?: QueryVotesOptions, userId?: string): Promise<APIResponse & PollAnswersAPIResponse>;
2031
- /**
2032
- * Query message history
2033
- * @param filter
2034
- * @param sort
2035
- * @param options Option object, {limit: 10}
2036
- * @returns {APIResponse & QueryMessageHistoryResponse} The message histories
2037
- */
2038
- queryMessageHistory(filter?: QueryMessageHistoryFilters, sort?: QueryMessageHistorySort, options?: QueryMessageHistoryOptions): Promise<APIResponse & QueryMessageHistoryResponse>;
2039
- /**
2040
- * updateFlags - reviews/unflags flagged message
2041
- *
2042
- * @param {string[]} message_ids list of message IDs
2043
- * @param {string} options Option object in case user ID is set to review all the flagged messages by the user
2044
- * @param {string} reviewed_by user ID who reviewed the flagged message
2045
- * @returns {APIResponse}
2046
- */
2047
- updateFlags(message_ids: string[], reviewed_by: string, options?: {
2048
- user_id?: string;
2049
- }): Promise<APIResponse>;
2050
- /**
2051
- * queryDrafts - Queries drafts for the current user
2052
- *
2053
- * @param {object} [options] Query options
2054
- * @param {object} [options.filter] Filters for the query
2055
- * @param {number} [options.sort] Sort parameters
2056
- * @param {number} [options.limit] Limit the number of results
2057
- * @param {string} [options.next] Pagination parameter
2058
- * @param {string} [options.prev] Pagination parameter
2059
- * @param {string} [options.user_id] Has to be provided when called server-side
2060
- *
2061
- * @return {Promise<APIResponse & { drafts: DraftResponse[]; next?: string }>} Response containing the drafts
2062
- */
2063
- queryDrafts(options?: Pager & {
2064
- filter?: DraftFilters;
2065
- sort?: DraftSort;
2066
- user_id?: string;
2067
- }): Promise<QueryDraftsResponse>;
2068
- /**
2069
- * createReminder - Creates a reminder for a message
2070
- *
2071
- * @param {CreateReminderOptions} options The options for creating the reminder
2072
- * @returns {Promise<ReminderAPIResponse>}
2073
- */
2074
- createReminder({ messageId, ...options }: CreateReminderOptions): Promise<ReminderAPIResponse>;
2075
- /**
2076
- * updateReminder - Updates an existing reminder for a message
2077
- *
2078
- * @param {UpdateReminderOptions} options The options for updating the reminder
2079
- * @returns {Promise<ReminderAPIResponse>}
2080
- */
2081
- updateReminder({ messageId, ...options }: UpdateReminderOptions): Promise<ReminderAPIResponse>;
2082
- /**
2083
- * deleteReminder - Deletes a reminder for a message
2084
- *
2085
- * @param {string} messageId The ID of the message whose reminder to delete
2086
- * @param {string} [userId] Optional user ID, required for server-side operations
2087
- * @returns {Promise<APIResponse>}
2088
- */
2089
- deleteReminder(messageId: string, userId?: string): Promise<APIResponse>;
2090
- /**
2091
- * queryReminders - Queries reminders based on given filters
2092
- *
2093
- * @param {QueryRemindersOptions} options The options for querying reminders
2094
- * @returns {Promise<QueryRemindersResponse>}
2095
- */
2096
- queryReminders({ filter, sort, ...rest }?: QueryRemindersOptions): Promise<QueryRemindersResponse>;
2097
- /**
2098
- * queryTeamUsageStats - Queries team-level usage statistics from the warehouse database
2099
- *
2100
- * Returns all 16 metrics grouped by team with cursor-based pagination.
2101
- *
2102
- * Date Range Options (mutually exclusive):
2103
- * - Use 'month' parameter (YYYY-MM format) for monthly aggregated values
2104
- * - Use 'start_date'/'end_date' parameters (YYYY-MM-DD format) for daily breakdown
2105
- * - If neither provided, defaults to current month (monthly mode)
2106
- *
2107
- * This endpoint is server-side only.
2108
- *
2109
- * @param {QueryTeamUsageStatsOptions} options The options for querying team usage stats
2110
- * @returns {Promise<QueryTeamUsageStatsResponse>}
2111
- */
2112
- queryTeamUsageStats(options?: QueryTeamUsageStatsOptions): Promise<QueryTeamUsageStatsResponse>;
2113
- /**
2114
- * updateLocation - Updates a location
2115
- *
2116
- * @param location SharedLocationRequest the location data to update
2117
- *
2118
- * @returns {Promise<SharedLocationResponse>} The server response
2119
- */
2120
- updateLocation(location: UpdateLocationPayload): Promise<SharedLocationResponse>;
2121
- /**
2122
- * uploadFile - Uploads a file to the configured storage (defaults to Stream CDN)
2123
- *
2124
- * @param {string|NodeJS.ReadableStream|Buffer|File} uri The file to upload
2125
- * @param {string} [name] The name of the file
2126
- * @param {string} [contentType] The content type of the file
2127
- * @param {UserResponse} [user] Optional user information
2128
- * @param {AxiosRequestConfig} [axiosRequestConfig] Optional axios config (e.g. onUploadProgress for progress tracking)
2129
- *
2130
- * @return {Promise<SendFileAPIResponse>} Response containing the file URL
2131
- */
2132
- uploadFile(uri: string | NodeJS.ReadableStream | Buffer | File, name?: string, contentType?: string, user?: UserResponse, axiosRequestConfig?: AxiosRequestConfig): Promise<SendFileAPIResponse>;
2133
- /**
2134
- * uploadImage - Uploads an image to the configured storage (defaults to Stream CDN)
2135
- *
2136
- * @param {string|NodeJS.ReadableStream|File} uri The image to upload
2137
- * @param {string} [name] The name of the image
2138
- * @param {string} [contentType] The content type of the image
2139
- * @param {UserResponse} [user] Optional user information
2140
- * @param {AxiosRequestConfig} [axiosRequestConfig] Optional axios config (e.g. onUploadProgress for progress tracking)
2141
- *
2142
- * @return {Promise<SendFileAPIResponse>} Response containing the image URL
2143
- */
2144
- uploadImage(uri: string | NodeJS.ReadableStream | File, name?: string, contentType?: string, user?: UserResponse, axiosRequestConfig?: AxiosRequestConfig): Promise<SendFileAPIResponse>;
2145
- /**
2146
- * deleteFile - Deletes a file from the configured storage
2147
- *
2148
- * @param {string} url The URL of the file to delete
2149
- *
2150
- * @return {Promise<APIResponse>} The server response
2151
- */
2152
- deleteFile(url: string): Promise<APIResponse>;
2153
- /**
2154
- * deleteImage - Deletes an image from the configured storage
2155
- *
2156
- * @param {string} url The URL of the image to delete
2157
- *
2158
- * @return {Promise<APIResponse>} The server response
2159
- */
2160
- deleteImage(url: string): Promise<APIResponse>;
2161
- /**
2162
- * Mark the channels delivered for the given messages and the user
2163
- *
2164
- * @param {MarkDeliveredOptions} data
2165
- * @return {Promise<EventAPIResponse | void>} Description
2166
- */
2167
- markChannelsDelivered(data: MarkDeliveredOptions): Promise<EventAPIResponse | undefined>;
782
+ markChannelsDelivered(request?: Gen_MarkDeliveredRequest): Promise<StreamResponse<import(".").MarkDeliveredResponse> | undefined>;
2168
783
  syncDeliveredCandidates(collections: Channel[]): void;
2169
- /**
2170
- * Update Channels Batch
2171
- *
2172
- * @param {UpdateChannelsBatchOptions} payload for updating channels in batch
2173
- * @return {Promise<APIResponse & UpdateChannelsBatchResponse>} The server response
2174
- */
2175
- updateChannelsBatch(payload: UpdateChannelsBatchOptions): Promise<APIResponse & {
2176
- result: Record<string, string>;
2177
- } & Partial<TaskResponse>>;
2178
- /**
2179
- * createPredefinedFilter - Creates a new predefined filter (server-side only)
2180
- *
2181
- * @param {CreatePredefinedFilterOptions} options Predefined filter options
2182
- *
2183
- * @return {Promise<PredefinedFilterResponse>} The created predefined filter
2184
- */
2185
- createPredefinedFilter<F extends Record<string, unknown> = Record<string, unknown>>(options: CreatePredefinedFilterOptions<F>): Promise<PredefinedFilterResponse<F>>;
2186
- /**
2187
- * getPredefinedFilter - Gets a predefined filter by name (server-side only)
2188
- *
2189
- * @param {string} name Predefined filter name
2190
- *
2191
- * @return {Promise<PredefinedFilterResponse>} The predefined filter
2192
- */
2193
- getPredefinedFilter<F extends Record<string, unknown> = Record<string, unknown>>(name: string): Promise<PredefinedFilterResponse<F>>;
2194
- /**
2195
- * updatePredefinedFilter - Updates a predefined filter (server-side only)
2196
- *
2197
- * @param {string} name Predefined filter name
2198
- * @param {UpdatePredefinedFilterOptions} options Predefined filter options
2199
- *
2200
- * @return {Promise<PredefinedFilterResponse>} The updated predefined filter
2201
- */
2202
- updatePredefinedFilter<F extends Record<string, unknown> = Record<string, unknown>>(name: string, options: UpdatePredefinedFilterOptions<F>): Promise<PredefinedFilterResponse<F>>;
2203
- /**
2204
- * deletePredefinedFilter - Deletes a predefined filter (server-side only)
2205
- *
2206
- * @param {string} name Predefined filter name
2207
- *
2208
- * @return {Promise<APIResponse>} The server response
2209
- */
2210
- deletePredefinedFilter(name: string): Promise<APIResponse>;
2211
- /**
2212
- * listPredefinedFilters - Lists all predefined filters (server-side only)
2213
- *
2214
- * @param {ListPredefinedFiltersOptions} options Query options
2215
- *
2216
- * @return {Promise<ListPredefinedFiltersResponse>} The list of predefined filters
2217
- */
2218
- listPredefinedFilters<F extends Record<string, unknown> = Record<string, unknown>>(options?: ListPredefinedFiltersOptions): Promise<ListPredefinedFiltersResponse<F>>;
2219
- /**
2220
- * setRetentionPolicy - Creates or updates a retention policy for the app.
2221
- * Server-side only.
2222
- *
2223
- * @param {string} policy The policy type ('old-messages' or 'inactive-channels')
2224
- * @param {number} maxAgeHours Max age in hours (24-43800)
2225
- * @returns {Promise<SetRetentionPolicyResponse>}
2226
- */
2227
- setRetentionPolicy(policy: string, maxAgeHours: number): Promise<SetRetentionPolicyResponse>;
2228
- /**
2229
- * deleteRetentionPolicy - Deletes a retention policy for the app.
2230
- * Server-side only.
2231
- *
2232
- * @param {string} policy The policy type ('old-messages' or 'inactive-channels')
2233
- * @returns {Promise<DeleteRetentionPolicyResponse>}
2234
- */
2235
- deleteRetentionPolicy(policy: string): Promise<APIResponse>;
2236
- /**
2237
- * getRetentionPolicy - Returns all retention policies configured for the app.
2238
- * Server-side only.
2239
- *
2240
- * @returns {Promise<GetRetentionPolicyResponse>}
2241
- */
2242
- getRetentionPolicy(): Promise<GetRetentionPolicyResponse>;
2243
- /**
2244
- * getRetentionPolicyRuns - Returns filtered and sorted retention cleanup run history.
2245
- * Supports filter_conditions on 'policy' and 'date' fields.
2246
- * Server-side only.
2247
- *
2248
- * @param {GetRetentionPolicyRunsOptions} options Filter, sort, and pagination options
2249
- * @returns {Promise<GetRetentionPolicyRunsResponse>}
2250
- */
2251
- getRetentionPolicyRuns(options?: GetRetentionPolicyRunsOptions): Promise<GetRetentionPolicyRunsResponse>;
2252
784
  }
2253
- export {};