stream-chat 9.50.2 → 10.0.0-rc.1

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 (229) hide show
  1. package/dist/cjs/index.browser.js +18869 -13986
  2. package/dist/cjs/index.browser.js.map +4 -4
  3. package/dist/cjs/index.node.js +18888 -13992
  4. package/dist/cjs/index.node.js.map +4 -4
  5. package/dist/esm/index.mjs +18866 -13983
  6. package/dist/esm/index.mjs.map +4 -4
  7. package/dist/types/ChannelPaginatorsOrchestrator.d.ts +130 -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 +436 -480
  12. package/dist/types/channel_batch_updater.d.ts +0 -93
  13. package/dist/types/channel_manager.d.ts +8 -10
  14. package/dist/types/channel_state.d.ts +53 -201
  15. package/dist/types/client.d.ts +440 -1910
  16. package/dist/types/client_state.d.ts +4 -4
  17. package/dist/types/configuration/InstanceConfigurationService.d.ts +26 -0
  18. package/dist/types/configuration/index.d.ts +1 -0
  19. package/dist/types/configuration/types.d.ts +53 -0
  20. package/dist/types/connection.d.ts +49 -41
  21. package/dist/types/connection_fallback.d.ts +6 -4
  22. package/dist/types/constants.d.ts +0 -4
  23. package/dist/types/custom_types.d.ts +2 -0
  24. package/dist/types/errors.d.ts +2 -2
  25. package/dist/types/gen/chat/ChannelApi.d.ts +45 -0
  26. package/dist/types/gen/chat/ChatApi.d.ts +334 -0
  27. package/dist/types/gen/model-decoders/decoders.d.ts +3 -0
  28. package/dist/types/gen/model-decoders/event-decoder-mapping.d.ts +6 -0
  29. package/dist/types/gen/models/index.d.ts +8836 -0
  30. package/dist/types/gen/moderation/ModerationApi.d.ts +50 -0
  31. package/dist/types/gen-imports.d.ts +3 -0
  32. package/dist/types/index.d.ts +5 -5
  33. package/dist/types/insights.d.ts +7 -6
  34. package/dist/types/logger.d.ts +9 -0
  35. package/dist/types/messageComposer/LocationComposer.d.ts +7 -4
  36. package/dist/types/messageComposer/attachmentIdentity.d.ts +2 -2
  37. package/dist/types/messageComposer/attachmentManager.d.ts +8 -4
  38. package/dist/types/messageComposer/configuration/types.d.ts +11 -11
  39. package/dist/types/messageComposer/linkPreviewsManager.d.ts +25 -13
  40. package/dist/types/messageComposer/messageComposer.d.ts +10 -10
  41. package/dist/types/messageComposer/middleware/messageComposer/types.d.ts +3 -3
  42. package/dist/types/messageComposer/middleware/pollComposer/types.d.ts +4 -7
  43. package/dist/types/messageComposer/middleware/textComposer/commandUtils.d.ts +3 -3
  44. package/dist/types/messageComposer/middleware/textComposer/commands.d.ts +7 -7
  45. package/dist/types/messageComposer/middleware/textComposer/mentions.d.ts +218 -4
  46. package/dist/types/messageComposer/middleware/textComposer/types.d.ts +9 -4
  47. package/dist/types/messageComposer/pollComposer.d.ts +5 -4
  48. package/dist/types/messageComposer/textComposer.d.ts +8 -3
  49. package/dist/types/messageComposer/types.d.ts +6 -28
  50. package/dist/types/messageDelivery/MessageDeliveryReporter.d.ts +40 -25
  51. package/dist/types/messageDelivery/MessageReceiptsTracker.d.ts +53 -12
  52. package/dist/types/messageOperations/MessageOperationStatePolicy.d.ts +19 -0
  53. package/dist/types/messageOperations/MessageOperations.d.ts +17 -0
  54. package/dist/types/messageOperations/index.d.ts +3 -0
  55. package/dist/types/messageOperations/types.d.ts +49 -0
  56. package/dist/types/moderation.d.ts +21 -203
  57. package/dist/types/notifications/types.d.ts +8 -7
  58. package/dist/types/offline-support/offline_support_api.d.ts +110 -87
  59. package/dist/types/offline-support/types.d.ts +19 -23
  60. package/dist/types/offline-support/util.d.ts +4 -2
  61. package/dist/types/pagination/FilterBuilder.d.ts +1 -1
  62. package/dist/types/pagination/ItemIndex.d.ts +82 -0
  63. package/dist/types/pagination/cursorDerivation/createdAtAroundPaginationFlags.d.ts +9 -0
  64. package/dist/types/pagination/cursorDerivation/idAroundPaginationFlags.d.ts +6 -0
  65. package/dist/types/pagination/cursorDerivation/index.d.ts +1 -0
  66. package/dist/types/pagination/cursorDerivation/linearPaginationFlags.d.ts +6 -0
  67. package/dist/types/pagination/filterCompiler.d.ts +7 -0
  68. package/dist/types/pagination/index.d.ts +1 -3
  69. package/dist/types/pagination/paginators/BasePaginator.d.ts +709 -0
  70. package/dist/types/pagination/paginators/ChannelPaginator.d.ts +58 -0
  71. package/dist/types/pagination/paginators/MessageIntervalPaginator.d.ts +260 -0
  72. package/dist/types/pagination/paginators/MessagePaginator.d.ts +208 -0
  73. package/dist/types/pagination/paginators/PinnedMessagePaginator.d.ts +39 -0
  74. package/dist/types/pagination/paginators/ReminderPaginator.d.ts +19 -0
  75. package/dist/types/pagination/paginators/UserGroupPaginator.d.ts +24 -0
  76. package/dist/types/pagination/paginators/index.d.ts +7 -0
  77. package/dist/types/pagination/sortCompiler.d.ts +49 -0
  78. package/dist/types/pagination/types.normalization.d.ts +11 -0
  79. package/dist/types/pagination/utility.normalization.d.ts +18 -0
  80. package/dist/types/pagination/utility.queryChannel.d.ts +26 -0
  81. package/dist/types/pagination/utility.search.d.ts +13 -0
  82. package/dist/types/permissions.d.ts +1 -1
  83. package/dist/types/poll.d.ts +29 -32
  84. package/dist/types/poll_manager.d.ts +2 -2
  85. package/dist/types/reminders/Reminder.d.ts +2 -5
  86. package/dist/types/reminders/ReminderManager.d.ts +2 -9
  87. package/dist/types/search/MessageSearchSource.d.ts +4 -4
  88. package/dist/types/search/UserSearchSource.d.ts +1 -1
  89. package/dist/types/search/types.d.ts +3 -3
  90. package/dist/types/segment.d.ts +0 -34
  91. package/dist/types/signing.d.ts +105 -65
  92. package/dist/types/store.d.ts +1 -0
  93. package/dist/types/thread.d.ts +51 -34
  94. package/dist/types/thread_manager.d.ts +3 -3
  95. package/dist/types/token_manager.d.ts +15 -10
  96. package/dist/types/types.d.ts +196 -3384
  97. package/dist/types/utils/FixedSizeQueueCache.d.ts +12 -6
  98. package/dist/types/utils/WithSubscriptions.d.ts +2 -1
  99. package/dist/types/utils/concurrency.d.ts +4 -4
  100. package/dist/types/utils/mergeWith/mergeWith.d.ts +3 -3
  101. package/dist/types/utils/mergeWith/mergeWithCore.d.ts +8 -3
  102. package/dist/types/utils/retryable.d.ts +34 -0
  103. package/dist/types/utils.d.ts +104 -137
  104. package/package.json +7 -3
  105. package/src/ChannelPaginatorsOrchestrator.ts +545 -0
  106. package/src/CooldownTimer.ts +2 -2
  107. package/src/EventHandlerPipeline.ts +228 -0
  108. package/src/LiveLocationManager.ts +12 -11
  109. package/src/api-client.ts +275 -0
  110. package/src/campaign.ts +1 -77
  111. package/src/channel.ts +1262 -1277
  112. package/src/channel_batch_updater.ts +1 -211
  113. package/src/channel_manager.ts +92 -88
  114. package/src/channel_state.ts +144 -1013
  115. package/src/client.ts +888 -3944
  116. package/src/client_state.ts +4 -4
  117. package/src/configuration/InstanceConfigurationService.ts +73 -0
  118. package/src/configuration/index.ts +1 -0
  119. package/src/configuration/types.ts +81 -0
  120. package/src/connection.ts +145 -94
  121. package/src/connection_fallback.ts +29 -27
  122. package/src/constants.ts +1 -5
  123. package/src/custom_types.ts +4 -1
  124. package/src/errors.ts +2 -2
  125. package/src/gen/chat/ChannelApi.ts +275 -0
  126. package/src/gen/chat/ChatApi.ts +2554 -0
  127. package/src/gen/model-decoders/decoders.ts +2680 -0
  128. package/src/gen/model-decoders/event-decoder-mapping.ts +198 -0
  129. package/src/gen/models/index.ts +12673 -0
  130. package/src/gen/moderation/ModerationApi.ts +607 -0
  131. package/src/gen-imports.ts +3 -0
  132. package/src/index.ts +5 -10
  133. package/src/insights.ts +6 -5
  134. package/src/logger.ts +28 -0
  135. package/src/messageComposer/LocationComposer.ts +9 -5
  136. package/src/messageComposer/MessageComposerEffectHandlers.ts +1 -0
  137. package/src/messageComposer/attachmentIdentity.ts +16 -9
  138. package/src/messageComposer/attachmentManager.ts +13 -8
  139. package/src/messageComposer/configuration/types.ts +11 -11
  140. package/src/messageComposer/linkPreviewsManager.ts +9 -10
  141. package/src/messageComposer/messageComposer.ts +57 -53
  142. package/src/messageComposer/middleware/messageComposer/attachments.ts +1 -2
  143. package/src/messageComposer/middleware/messageComposer/cleanData.ts +1 -1
  144. package/src/messageComposer/middleware/messageComposer/compositionValidation.ts +2 -2
  145. package/src/messageComposer/middleware/messageComposer/messageComposerState.ts +2 -2
  146. package/src/messageComposer/middleware/messageComposer/sharedLocation.ts +4 -3
  147. package/src/messageComposer/middleware/messageComposer/textComposer.ts +2 -2
  148. package/src/messageComposer/middleware/messageComposer/types.ts +3 -4
  149. package/src/messageComposer/middleware/messageComposer/userDataInjection.ts +9 -5
  150. package/src/messageComposer/middleware/pollComposer/state.ts +0 -2
  151. package/src/messageComposer/middleware/pollComposer/types.ts +4 -7
  152. package/src/messageComposer/middleware/textComposer/TextComposerMiddlewareExecutor.ts +10 -1
  153. package/src/messageComposer/middleware/textComposer/commandEffects.ts +4 -4
  154. package/src/messageComposer/middleware/textComposer/commandUtils.ts +3 -6
  155. package/src/messageComposer/middleware/textComposer/commands.ts +3 -3
  156. package/src/messageComposer/middleware/textComposer/mentionUtils.ts +1 -1
  157. package/src/messageComposer/middleware/textComposer/mentions.ts +31 -15
  158. package/src/messageComposer/middleware/textComposer/types.ts +9 -4
  159. package/src/messageComposer/pollComposer.ts +6 -8
  160. package/src/messageComposer/textComposer.ts +27 -2
  161. package/src/messageComposer/types.ts +6 -28
  162. package/src/messageDelivery/MessageDeliveryReporter.ts +101 -45
  163. package/src/messageDelivery/MessageReceiptsTracker.ts +294 -21
  164. package/src/messageOperations/MessageOperationStatePolicy.ts +77 -0
  165. package/src/messageOperations/MessageOperations.ts +212 -0
  166. package/src/messageOperations/index.ts +10 -0
  167. package/src/messageOperations/types.ts +64 -0
  168. package/src/moderation.ts +38 -431
  169. package/src/notifications/types.ts +8 -7
  170. package/src/offline-support/offline_support_api.ts +198 -132
  171. package/src/offline-support/offline_sync_manager.ts +17 -7
  172. package/src/offline-support/types.ts +23 -26
  173. package/src/offline-support/util.ts +5 -4
  174. package/src/pagination/FilterBuilder.ts +4 -1
  175. package/src/pagination/ItemIndex.ts +112 -0
  176. package/src/pagination/cursorDerivation/createdAtAroundPaginationFlags.ts +73 -0
  177. package/src/pagination/cursorDerivation/idAroundPaginationFlags.ts +53 -0
  178. package/src/pagination/cursorDerivation/index.ts +1 -0
  179. package/src/pagination/cursorDerivation/linearPaginationFlags.ts +86 -0
  180. package/src/pagination/filterCompiler.ts +196 -0
  181. package/src/pagination/index.ts +1 -3
  182. package/src/pagination/paginators/BasePaginator.ts +2393 -0
  183. package/src/pagination/paginators/ChannelPaginator.ts +427 -0
  184. package/src/pagination/paginators/MessageIntervalPaginator.ts +1073 -0
  185. package/src/pagination/paginators/MessagePaginator.ts +496 -0
  186. package/src/pagination/paginators/PinnedMessagePaginator.ts +105 -0
  187. package/src/pagination/paginators/ReminderPaginator.ts +105 -0
  188. package/src/pagination/paginators/UserGroupPaginator.ts +125 -0
  189. package/src/pagination/paginators/index.ts +7 -0
  190. package/src/pagination/sortCompiler.ts +178 -0
  191. package/src/pagination/types.normalization.ts +14 -0
  192. package/src/pagination/utility.normalization.ts +106 -0
  193. package/src/pagination/utility.queryChannel.ts +84 -0
  194. package/src/pagination/utility.search.ts +80 -0
  195. package/src/permissions.ts +7 -8
  196. package/src/poll.ts +101 -110
  197. package/src/poll_manager.ts +14 -8
  198. package/src/reminders/Reminder.ts +2 -5
  199. package/src/reminders/ReminderManager.ts +19 -21
  200. package/src/search/BaseSearchSource.ts +0 -3
  201. package/src/search/ChannelMemberSearchSource.ts +7 -1
  202. package/src/search/ChannelSearchSource.ts +10 -3
  203. package/src/search/MessageSearchSource.ts +29 -30
  204. package/src/search/UserSearchSource.ts +12 -8
  205. package/src/search/types.ts +3 -4
  206. package/src/segment.ts +1 -95
  207. package/src/signing.ts +107 -67
  208. package/src/store.ts +2 -1
  209. package/src/thread.ts +439 -236
  210. package/src/thread_manager.ts +36 -15
  211. package/src/token_manager.ts +21 -10
  212. package/src/types.ts +375 -4524
  213. package/src/uploadManager.ts +8 -0
  214. package/src/utils/FixedSizeQueueCache.ts +12 -6
  215. package/src/utils/WithSubscriptions.ts +2 -1
  216. package/src/utils/concurrency.ts +4 -4
  217. package/src/utils/mergeWith/mergeWith.ts +3 -3
  218. package/src/utils/mergeWith/mergeWithCore.ts +140 -164
  219. package/src/utils/mergeWith/mergeWithDiff.ts +3 -3
  220. package/src/utils/retryable.ts +117 -0
  221. package/src/utils.ts +133 -524
  222. package/dist/types/events.d.ts +0 -72
  223. package/dist/types/pagination/BasePaginator.d.ts +0 -69
  224. package/dist/types/pagination/ReminderPaginator.d.ts +0 -16
  225. package/dist/types/pagination/UserGroupPaginator.d.ts +0 -21
  226. package/src/events.ts +0 -75
  227. package/src/pagination/BasePaginator.ts +0 -184
  228. package/src/pagination/ReminderPaginator.ts +0 -56
  229. package/src/pagination/UserGroupPaginator.ts +0 -93
@@ -3,26 +3,79 @@ import { ChannelState } from './channel_state';
3
3
  import { CooldownTimer } from './CooldownTimer';
4
4
  import { MessageComposer } from './messageComposer';
5
5
  import { MessageReceiptsTracker } from './messageDelivery';
6
+ import { MessagePaginator, PinnedMessagePaginator } from './pagination/paginators';
7
+ import { MessageOperations } from './messageOperations';
6
8
  import type { StreamChat } from './client';
7
- import type { AIState, APIResponse, AscDesc, BanUserOptions, ChannelAPIResponse, ChannelData, ChannelMemberAPIResponse, ChannelMemberResponse, ChannelPushPreference, ChannelQueryOptions, ChannelResponse, ChannelUpdateOptions, CreateDraftResponse, DeleteChannelAPIResponse, DraftMessagePayload, Event, EventAPIResponse, EventHandler, EventTypes, GetDraftResponse, GetMultipleMessagesAPIResponse, GetReactionsAPIResponse, GetRepliesAPIResponse, LiveLocationPayload, LocalMessage, MarkReadOptions, MarkUnreadOptions, MemberFilters, MemberSort, Message, MessageFilters, MessageOptions, MessagePaginationOptions, MessageResponse, MessageSetType, MuteChannelAPIResponse, NewMemberPayload, PartialUpdateChannel, PartialUpdateChannelAPIResponse, PartialUpdateMember, PartialUpdateMemberAPIResponse, PinnedMessagePaginationOptions, PinnedMessagesSort, PollVoteData, QueryChannelAPIResponse, QueryMembersOptions, Reaction, ReactionAPIResponse, SearchAPIResponse, SearchOptions, SendMessageAPIResponse, SendMessageOptions, SendReactionOptions, StaticLocationPayload, TruncateChannelAPIResponse, TruncateOptions, UnBanUserOptions, UpdateChannelAPIResponse, UpdateChannelOptions, UpdateLocationPayload, UserResponse } from './types';
8
- import type { Role } from './permissions';
9
+ import type { AIState, APIResponse, BanUserOptions, ChannelData, ChannelGetOrCreateRequest, ChannelMemberResponse, ChannelResponse, ChannelStateResponseFields, ChannelUpdateOptions, CreateDraftResponse, DeleteMessageOptions, Event, EventAPIResponse, EventHandler, EventPayload, EventType, GetRepliesAPIResponse, GetRepliesRequest, LocalMessage, MarkReadRequest, MarkUnreadRequest, MessageRequest, MessageResponse, MessageSetType, PinnedMessagePaginationOptions, PinnedMessagesSort, QueryMembersPayload, ReactionAPIResponse, SearchPayload, SendMessageOptions, SharedLocation, UnBanUserOptions, UpdateChannelPartialRequest, UpdateLiveLocationRequest, UpdateMessageOptions, UserResponse } from './types';
10
+ import type { RoleName } from './permissions';
11
+ import { StateStore } from './store';
12
+ import type { ChannelMemberRequest as Gen_ChannelMemberRequest, ChannelPushPreferencesResponse as Gen_ChannelPushPreferencesResponse, ChannelStopWatchingRequest as Gen_ChannelStopWatchingRequest, CreateDraftRequest as Gen_CreateDraftRequest, HideChannelRequest as Gen_HideChannelRequest, MuteChannelRequest as Gen_MuteChannelRequest, SendMessageRequest as Gen_SendMessageRequest, ShowChannelRequest as Gen_ShowChannelRequest, UnmuteChannelRequest as Gen_UnmuteChannelRequest, UpdateChannelRequest as Gen_UpdateChannelRequest, WSEvent } from './gen/models';
13
+ import type { ChatApi } from './gen/chat/ChatApi';
14
+ import { ChannelApi } from './gen/chat/ChannelApi';
15
+ export type SendMessageWithStateUpdateParams = {
16
+ localMessage: LocalMessage;
17
+ message?: MessageRequest;
18
+ options?: SendMessageOptions;
19
+ /**
20
+ * Per-call override for the send/retry request (advanced).
21
+ * If set, it takes precedence over channel instance configuration handlers.
22
+ */
23
+ sendMessageRequestFn?: CustomSendMessageRequestFn;
24
+ };
25
+ export type RetrySendMessageWithLocalUpdateParams = Omit<SendMessageWithStateUpdateParams, 'message'>;
26
+ export type UpdateMessageWithStateUpdateParams = {
27
+ localMessage: LocalMessage;
28
+ options?: UpdateMessageOptions;
29
+ /**
30
+ * Per-call override for the update request (advanced).
31
+ * If set, it takes precedence over channel instance configuration handlers.
32
+ */
33
+ updateMessageRequestFn?: CustomUpdateMessageRequestFn;
34
+ };
35
+ export type DeleteMessageWithStateUpdateParams = {
36
+ localMessage: LocalMessage;
37
+ options?: DeleteMessageOptions;
38
+ /**
39
+ * Per-call override for the delete request (advanced).
40
+ * If set, it takes precedence over channel instance configuration handlers.
41
+ */
42
+ deleteMessageRequestFn?: CustomDeleteMessageRequestFn;
43
+ };
44
+ export type CustomSendMessageRequestFn = (params: Omit<SendMessageWithStateUpdateParams, 'sendMessageRequestFn'>) => Promise<{
45
+ message: MessageResponse;
46
+ }>;
47
+ export type CustomUpdateMessageRequestFn = (params: Omit<UpdateMessageWithStateUpdateParams, 'updateMessageRequestFn'>) => Promise<{
48
+ message: MessageResponse;
49
+ }>;
50
+ export type CustomDeleteMessageRequestFn = (params: Omit<DeleteMessageWithStateUpdateParams, 'deleteMessageRequestFn'>) => Promise<{
51
+ message: MessageResponse;
52
+ }>;
53
+ export type CustomMarkReadRequestFn = (params: {
54
+ channel: Channel;
55
+ options?: MarkReadRequest;
56
+ }) => Promise<EventAPIResponse | null>;
57
+ export type ChannelInstanceConfig = {
58
+ requestHandlers?: {
59
+ deleteMessageRequest?: CustomDeleteMessageRequestFn;
60
+ markReadRequest?: CustomMarkReadRequestFn;
61
+ sendMessageRequest?: CustomSendMessageRequestFn;
62
+ retrySendMessageRequest?: CustomSendMessageRequestFn;
63
+ updateMessageRequest?: CustomUpdateMessageRequestFn;
64
+ };
65
+ };
9
66
  /**
10
- * Channel - The Channel class manages it's own state.
67
+ * The Channel class manages its own state.
11
68
  */
12
- export declare class Channel {
69
+ export declare class Channel extends ChannelApi {
13
70
  _client: StreamChat;
14
- type: string;
15
- id: string | undefined;
16
- data: Partial<ChannelData & ChannelResponse> | undefined;
17
- _data: Partial<ChannelData & ChannelResponse>;
71
+ data: Partial<ChannelResponse> | undefined;
72
+ _data: ChannelData;
18
73
  cid: string;
19
74
  /** */
20
- listeners: {
21
- [key: string]: (string | EventHandler)[];
22
- };
75
+ listeners: Map<EventType, Set<EventHandler>>;
23
76
  state: ChannelState;
24
77
  /**
25
- * This boolean is a vague indication of weather the channel exists on chat backend.
78
+ * This boolean is a vague indication of whether the channel exists on chat backend.
26
79
  *
27
80
  * If the value is true, then that means the channel has been initialized by either calling
28
81
  * channel.create() or channel.query() or channel.watch().
@@ -32,7 +85,7 @@ export declare class Channel {
32
85
  */
33
86
  initialized: boolean;
34
87
  /**
35
- * Indicates weather channel has been initialized by manually populating the state with some messages, members etc.
88
+ * Indicates whether channel has been initialized by manually populating the state with some messages, members etc.
36
89
  * Static state indicates that channel exists on backend, but is not being watched yet.
37
90
  */
38
91
  offlineMode: boolean;
@@ -40,410 +93,345 @@ export declare class Channel {
40
93
  lastTypingEvent: Date | null;
41
94
  isTyping: boolean;
42
95
  disconnected: boolean;
43
- push_preferences?: ChannelPushPreference;
96
+ push_preferences?: Gen_ChannelPushPreferencesResponse;
97
+ readonly configState: StateStore<ChannelInstanceConfig>;
44
98
  readonly messageComposer: MessageComposer;
45
99
  readonly messageReceiptsTracker: MessageReceiptsTracker;
100
+ readonly messagePaginator: MessagePaginator;
101
+ readonly pinnedMessagesPaginator: PinnedMessagePaginator;
102
+ readonly messageOperations: MessageOperations;
46
103
  readonly cooldownTimer: CooldownTimer;
47
104
  /**
48
- * constructor - Create a channel
49
- *
50
- * @param {StreamChat} client the chat client
51
- * @param {string} type the type of channel
52
- * @param {string} [id] the id of the chat
53
- * @param {ChannelData} data any additional custom params
105
+ * Creates a `Channel` instance bound to the given chat client.
54
106
  *
55
- * @return {Channel} Returns a new uninitialized channel
107
+ * @param client - The chat client.
108
+ * @param type - The type of channel.
109
+ * @param id - The ID of the chat (optional).
110
+ * @param data - Any additional custom params.
111
+ * @returns A new uninitialized channel.
56
112
  */
57
113
  constructor(client: StreamChat, type: string, id: string | undefined, data: ChannelData);
58
114
  /**
59
- * getClient - Get the chat client for this channel. If client.disconnect() was called, this function will error
115
+ * Returns the chat client for this channel. Throws if `client.disconnect()` was called.
60
116
  *
61
- * @return {StreamChat}
117
+ * @returns The chat client.
62
118
  */
63
119
  getClient(): StreamChat;
64
120
  /**
65
- * getConfig - Get the config for this channel id (cid)
121
+ * Returns the config for this channel ID (CID).
66
122
  *
67
- * @return {Record<string, unknown>}
123
+ * @returns The channel config.
68
124
  */
69
- getConfig(): import("./types").ChannelConfigWithInfo | undefined;
125
+ getConfig(): import(".").ChannelConfigWithInfo | undefined;
126
+ _sendMessage(request: Gen_SendMessageRequest): Promise<import("./types").StreamResponse<import(".").SendMessageResponse>>;
70
127
  /**
71
- * sendMessage - Send a message to this channel
128
+ * Sends a message to this channel.
72
129
  *
73
- * @param {Message} message The Message object
74
- * @param {boolean} [options.skip_enrich_url] Do not try to enrich the URLs within message
75
- * @param {boolean} [options.skip_push] Skip sending push notifications
76
- * @param {boolean} [options.is_pending_message] DEPRECATED, please use `pending` instead.
77
- * @param {boolean} [options.pending] Make this message pending
78
- * @param {Record<string,string>} [options.pending_message_metadata] Metadata for the pending message
79
- * @param {boolean} [options.force_moderation] Apply force moderation for server-side requests
80
- *
81
- * @return {Promise<SendMessageAPIResponse>} The Server Response
130
+ * @param request - The send message request payload, including the message body and optional flags
131
+ * such as `skip_enrich_url`, `skip_push`, and `keep_channel_hidden`.
132
+ * @returns The server response.
82
133
  */
83
- _sendMessage(message: Message, options?: SendMessageOptions): Promise<SendMessageAPIResponse>;
84
- sendMessage(message: Message, options?: SendMessageOptions): Promise<SendMessageAPIResponse>;
134
+ sendMessage(request: Gen_SendMessageRequest): Promise<import("./types").StreamResponse<import(".").SendMessageResponse>>;
85
135
  /**
86
- * Upload a file to this channel’s file endpoint (multipart). Forwards to the client’s `sendFile` implementation.
87
- *
88
- * @param uri File source: URL string, `File`, `Buffer`, or readable stream (Node).
89
- * @param name File name sent in the multipart body.
90
- * @param contentType MIME type; defaults are applied when omitted.
91
- * @param user Optional user payload appended to the form as JSON.
92
- * @param axiosRequestConfig Optional Axios per-request config, merged after upload defaults (e.g. `onUploadProgress`, `signal` from `AbortController`).
93
- * @return Promise resolving to `{ file: string, ... }` with the CDN URL.
136
+ * Sends a message with optimistic local state update.
94
137
  */
95
- sendFile(uri: string | NodeJS.ReadableStream | Buffer | File, name?: string, contentType?: string, user?: UserResponse, axiosRequestConfig?: AxiosRequestConfig): Promise<import("./types").SendFileAPIResponse>;
138
+ sendMessageWithLocalUpdate(params: SendMessageWithStateUpdateParams): Promise<void>;
96
139
  /**
97
- * Upload an image to this channel’s image endpoint (multipart). Uses the same transport as `sendFile`.
98
- *
99
- * @param uri Image source: URL string, `File`, or readable stream (Node). For `Buffer` uploads, use `sendFile` toward the channel file endpoint instead.
100
- * @param name File name sent in the multipart body.
101
- * @param contentType MIME type.
102
- * @param user Optional user payload appended to the form as JSON.
103
- * @param axiosRequestConfig Optional Axios per-request config, merged after upload defaults (e.g. `onUploadProgress`, `signal`).
104
- * @return Promise resolving to `{ file: string, ... }` with the CDN URL.
140
+ * Retry sending a failed message.
105
141
  */
106
- sendImage(uri: string | NodeJS.ReadableStream | File, name?: string, contentType?: string, user?: UserResponse, axiosRequestConfig?: AxiosRequestConfig): Promise<import("./types").SendFileAPIResponse>;
107
- deleteFile(url: string): Promise<APIResponse>;
108
- deleteImage(url: string): Promise<APIResponse>;
142
+ retrySendMessageWithLocalUpdate(params: Omit<SendMessageWithStateUpdateParams, 'message'>): Promise<void>;
109
143
  /**
110
- * sendEvent - Send an event on this channel
111
- *
112
- * @param {Event} event for example {type: 'message.read'}
113
- *
114
- * @return {Promise<EventAPIResponse>} The Server Response
144
+ * Updates a message with optimistic local state update.
115
145
  */
116
- sendEvent(event: Event): Promise<EventAPIResponse>;
146
+ updateMessageWithLocalUpdate(params: UpdateMessageWithStateUpdateParams): Promise<void>;
117
147
  /**
118
- * search - Query messages
119
- *
120
- * @param {MessageFilters | string} query search query or object MongoDB style filters
121
- * @param {{client_id?: string; connection_id?: string; query?: string; message_filter_conditions?: MessageFilters}} options Option object, {user_id: 'tommaso'}
122
- *
123
- * @return {Promise<SearchAPIResponse>} search messages response
148
+ * Deletes a message with local state update.
124
149
  */
125
- search(query: MessageFilters | string, options?: SearchOptions & {
126
- client_id?: string;
127
- connection_id?: string;
128
- message_filter_conditions?: MessageFilters;
129
- message_options?: MessageOptions;
130
- query?: string;
131
- }): Promise<SearchAPIResponse>;
150
+ deleteMessageWithLocalUpdate(params: DeleteMessageWithStateUpdateParams): Promise<void>;
132
151
  /**
133
- * queryMembers - Query Members
134
- *
135
- * @param {MemberFilters} filterConditions object MongoDB style filters
136
- * @param {MemberSort} [sort] Sort options, for instance [{created_at: -1}].
137
- * When using multiple fields, make sure you use array of objects to guarantee field order, for instance [{name: -1}, {created_at: 1}]
138
- * @param {{ limit?: number; offset?: number }} [options] Option object, {limit: 10, offset:10}
152
+ * Upload a file to this channel’s file endpoint (multipart). Forwards to the client’s `sendFile` implementation.
139
153
  *
140
- * @return {Promise<ChannelMemberAPIResponse>} Query Members response
154
+ * @param uri - File source: URL string, `File`, `Buffer`, or readable stream (Node).
155
+ * @param name - File name sent in the multipart body (optional).
156
+ * @param contentType - MIME type; defaults are applied when omitted (optional).
157
+ * @param user - User payload appended to the form as JSON (optional).
158
+ * @param axiosRequestConfig - Axios per-request config, merged after upload defaults, e.g. `onUploadProgress`, `signal` from `AbortController` (optional).
159
+ * @returns A promise resolving to `{ file: string, ... }` with the CDN URL.
141
160
  */
142
- queryMembers(filterConditions: MemberFilters, sort?: MemberSort, options?: QueryMembersOptions): Promise<ChannelMemberAPIResponse>;
161
+ sendFile(uri: string | NodeJS.ReadableStream | Buffer | File, name?: string, contentType?: string, user?: UserResponse, axiosRequestConfig?: AxiosRequestConfig): Promise<import("./types").SendFileAPIResponse>;
143
162
  /**
144
- * updateMemberPartial - Partial update a member
163
+ * Upload an image to this channel's image endpoint (multipart). Uses the same transport as `sendFile`.
145
164
  *
146
- * @param {PartialUpdateMember} updates
147
- * @param {{ user_id?: string }} [options] Option object, {user_id: 'jane'} to optionally specify the user id
148
-
149
- * @return {Promise<ChannelMemberResponse>} Updated member
165
+ * @param uri - Image source: URL string, `File`, or readable stream (Node). For `Buffer` uploads, use `sendFile` toward the channel file endpoint instead.
166
+ * @param name - File name sent in the multipart body (optional).
167
+ * @param contentType - MIME type (optional).
168
+ * @param user - User payload appended to the form as JSON (optional).
169
+ * @param axiosRequestConfig - Axios per-request config, merged after upload defaults, e.g. `onUploadProgress`, `signal` (optional).
170
+ * @returns A promise resolving to `{ file: string, ... }` with the CDN URL.
150
171
  */
151
- updateMemberPartial(updates: PartialUpdateMember, options?: {
152
- userId?: string;
153
- }): Promise<PartialUpdateMemberAPIResponse>;
172
+ sendImage(uri: string | NodeJS.ReadableStream | File, name?: string, contentType?: string, user?: UserResponse, axiosRequestConfig?: AxiosRequestConfig): Promise<import("./types").SendFileAPIResponse>;
173
+ deleteFile(url: string): Promise<import("./types").StreamResponse<import(".").Response>>;
174
+ deleteImage(url: string): Promise<import("./types").StreamResponse<import(".").Response>>;
154
175
  /**
155
- * @deprecated Use `updateMemberPartial` instead
156
- * partialUpdateMember - Partial update a member
176
+ * Sends an event on this channel.
157
177
  *
158
- * @param {string} user_id member user id
159
- * @param {PartialUpdateMember} updates
160
- *
161
- * @return {Promise<ChannelMemberResponse>} Updated member
178
+ * @param event - For example `{ type: 'message.read' }`.
179
+ * @returns The server response.
162
180
  */
163
- partialUpdateMember(user_id: string, updates: PartialUpdateMember): Promise<PartialUpdateMemberAPIResponse>;
181
+ sendEvent(request: {
182
+ event: Event;
183
+ }): Promise<import("./types").StreamResponse<import(".").EventResponse>>;
164
184
  /**
165
- * sendReaction - Sends a reaction to a message. If offline support is enabled, it will make sure
166
- * that sending the reaction is queued up if it fails due to bad internet conditions and executed
167
- * later.
168
- *
169
- * @param {string} messageID the message id
170
- * @param {Reaction} reaction the reaction object for instance {type: 'love'}
171
- * @param {{ enforce_unique?: boolean, skip_push?: boolean }} [options] Option object, {enforce_unique: true, skip_push: true} to override any existing reaction or skip sending push notifications
185
+ * Queries messages.
172
186
  *
173
- * @return {Promise<ReactionAPIResponse>} The Server Response
187
+ * @param request - The search request payload (optional). The inner `payload` accepts
188
+ * MongoDB-style filters and additional options such as `user_id`.
189
+ * @returns The search messages response.
174
190
  */
175
- sendReaction(messageID: string, reaction: Reaction, options?: SendReactionOptions): Promise<ReactionAPIResponse>;
191
+ search(request?: {
192
+ payload?: SearchPayload;
193
+ }): Promise<import("./types").StreamResponse<import(".").SearchResponse>>;
176
194
  /**
177
- * sendReaction - Send a reaction about a message
178
- *
179
- * @param {string} messageID the message id
180
- * @param {Reaction} reaction the reaction object for instance {type: 'love'}
181
- * @param {{ enforce_unique?: boolean, skip_push?: boolean }} [options] Option object, {enforce_unique: true, skip_push: true} to override any existing reaction or skip sending push notifications
195
+ * Queries members.
182
196
  *
183
- * @return {Promise<ReactionAPIResponse>} The Server Response
197
+ * @param request - The query members request payload (optional). The inner `payload` accepts
198
+ * MongoDB-style filters, sort directions (e.g. `[{ field: 'created_at', direction: -1 }]`),
199
+ * and pagination options (`limit`, `offset`).
200
+ * @returns The query members response.
184
201
  */
185
- _sendReaction(messageID: string, reaction: Reaction, options?: SendReactionOptions): Promise<ReactionAPIResponse>;
186
- deleteReaction(messageID: string, reactionType: string, user_id?: string): Promise<ReactionAPIResponse>;
202
+ queryMembers(request?: {
203
+ payload?: Partial<QueryMembersPayload>;
204
+ }): Promise<import("./types").StreamResponse<import(".").MembersResponse>>;
187
205
  /**
188
- * deleteReaction - Delete a reaction by user and type
189
- *
190
- * @param {string} messageID the id of the message from which te remove the reaction
191
- * @param {string} reactionType the type of reaction that should be removed
192
- * @param {string} [user_id] the id of the user (used only for server side request) default null
206
+ * Sends a reaction to a message. If offline support is enabled, it will make sure
207
+ * that sending the reaction is queued up if it fails due to bad internet conditions and executed
208
+ * later.
193
209
  *
194
- * @return {Promise<ReactionAPIResponse>} The Server Response
210
+ * @param request - The send-reaction request payload, including the target message ID, the
211
+ * reaction object (e.g. `{ type: 'love' }`), and optional flags such as `enforce_unique` and
212
+ * `skip_push`.
213
+ * @returns The server response.
195
214
  */
196
- _deleteReaction(messageID: string, reactionType: string, user_id?: string): Promise<ReactionAPIResponse>;
215
+ sendReaction(request: Parameters<ChatApi['sendReaction']>[0]): Promise<ReactionAPIResponse>;
216
+ _sendReaction(request: Parameters<ChatApi['sendReaction']>[0]): Promise<import("./types").StreamResponse<import(".").SendReactionResponse>>;
217
+ deleteReaction(request: Parameters<ChatApi['deleteReaction']>[0]): Promise<ReactionAPIResponse>;
197
218
  /**
198
- * update - Edit the channel's custom properties
219
+ * Deletes a reaction by user and type.
199
220
  *
200
- * @param {ChannelData} channelData The object to update the custom properties of this channel with
201
- * @param {Message} [updateMessage] Optional message object for channel members notification
202
- * @param {ChannelUpdateOptions} [options] Option object, configuration to control the behavior while updating
203
- * @return {Promise<UpdateChannelAPIResponse>} The server response
221
+ * @param request - The delete reaction request payload identifying the target message and reaction type.
222
+ * @returns The server response.
204
223
  */
205
- update(channelData?: Partial<ChannelData & ChannelResponse>, updateMessage?: Message, options?: ChannelUpdateOptions): Promise<UpdateChannelAPIResponse>;
224
+ _deleteReaction(request: Parameters<ChatApi['deleteReaction']>[0]): Promise<import("./types").StreamResponse<import(".").DeleteReactionResponse>>;
206
225
  /**
207
- * updatePartial - partial update channel properties
208
- *
209
- * @param {PartialUpdateChannel} partial update request
226
+ * Edit the channel using the inherited `update()` from `ChannelApi`. Caches the
227
+ * server-returned channel onto `this.data`.
210
228
  *
211
- * @return {Promise<PartialUpdateChannelAPIResponse>}
229
+ * @param request - Channel update payload, e.g. `{ data: { name: 'foo' }, message }` (optional).
230
+ * @returns The server response.
212
231
  */
213
- updatePartial(update: PartialUpdateChannel): Promise<PartialUpdateChannelAPIResponse>;
232
+ update(request?: Gen_UpdateChannelRequest): Promise<import("./types").StreamResponse<import(".").UpdateChannelResponse>>;
214
233
  /**
215
- * enableSlowMode - enable slow mode
234
+ * Partial update of channel properties.
216
235
  *
217
- * @param {number} coolDownInterval the cooldown interval in seconds
218
- * @return {Promise<UpdateChannelAPIResponse>} The server response
236
+ * @param update - The partial update request.
237
+ * @returns The server response.
219
238
  */
220
- enableSlowMode(coolDownInterval: number): Promise<UpdateChannelAPIResponse>;
239
+ updatePartial(update: UpdateChannelPartialRequest): Promise<import("./types").StreamResponse<import(".").UpdateChannelPartialResponse>>;
221
240
  /**
222
- * disableSlowMode - disable slow mode
241
+ * Enables slow mode.
223
242
  *
224
- * @return {Promise<UpdateChannelAPIResponse>} The server response
243
+ * @param coolDownInterval - The cooldown interval in seconds.
244
+ * @returns The server response.
225
245
  */
226
- disableSlowMode(): Promise<UpdateChannelAPIResponse>;
227
- sendSharedLocation(location: StaticLocationPayload | LiveLocationPayload, userId?: string): Promise<SendMessageAPIResponse>;
228
- stopLiveLocationSharing(payload: UpdateLocationPayload): Promise<void>;
246
+ enableSlowMode(coolDownInterval: number): Promise<import("./types").StreamResponse<import(".").UpdateChannelResponse>>;
229
247
  /**
230
- * delete - Delete the channel. Messages are permanently removed.
248
+ * Disables slow mode.
231
249
  *
232
- * @param {boolean} [options.hard_delete] Defines if the channel is hard deleted or not
233
- *
234
- * @return {Promise<DeleteChannelAPIResponse>} The server response
235
- */
236
- delete(options?: {
237
- hard_delete?: boolean;
238
- }): Promise<DeleteChannelAPIResponse>;
239
- /**
240
- * truncate - Removes all messages from the channel
241
- * @param {TruncateOptions} [options] Defines truncation options
242
- * @return {Promise<TruncateChannelAPIResponse>} The server response
250
+ * @returns The server response.
243
251
  */
244
- truncate(options?: TruncateOptions): Promise<TruncateChannelAPIResponse>;
252
+ disableSlowMode(): Promise<import("./types").StreamResponse<import(".").UpdateChannelResponse>>;
253
+ sendSharedLocation(location: SharedLocation & {
254
+ message_id?: string;
255
+ }): Promise<import("./types").StreamResponse<import(".").SendMessageResponse>>;
256
+ stopLiveLocationSharing(payload: UpdateLiveLocationRequest): Promise<void>;
245
257
  /**
246
- * acceptInvite - accept invitation to the channel
247
- *
248
- * @param {UpdateChannelOptions} [options] The object to update the custom properties of this channel with
258
+ * Accepts an invitation to the channel.
249
259
  *
250
- * @return {Promise<UpdateChannelAPIResponse>} The server response
260
+ * @param options - The object to update the custom properties of this channel with (optional, defaults to `{}`).
261
+ * @returns The server response.
251
262
  */
252
- acceptInvite(options?: UpdateChannelOptions): Promise<UpdateChannelAPIResponse>;
263
+ acceptInvite(options?: ChannelUpdateOptions): Promise<import("./types").StreamResponse<import(".").UpdateChannelResponse>>;
253
264
  /**
254
- * rejectInvite - reject invitation to the channel
255
- *
256
- * @param {UpdateChannelOptions} [options] The object to update the custom properties of this channel with
265
+ * Rejects an invitation to the channel.
257
266
  *
258
- * @return {Promise<UpdateChannelAPIResponse>} The server response
267
+ * @param options - The object to update the custom properties of this channel with (optional, defaults to `{}`).
268
+ * @returns The server response.
259
269
  */
260
- rejectInvite(options?: UpdateChannelOptions): Promise<UpdateChannelAPIResponse>;
270
+ rejectInvite(options?: ChannelUpdateOptions): Promise<import("./types").StreamResponse<import(".").UpdateChannelResponse>>;
261
271
  /**
262
- * addMembers - add members to the channel
272
+ * Adds members to the channel.
263
273
  *
264
- * @param {string[] | Array<NewMemberPayload>} members An array of members to add to the channel
265
- * @param {Message} [message] Optional message object for channel members notification
266
- * @param {ChannelUpdateOptions} [options] Option object, configuration to control the behavior while updating
267
- * @return {Promise<UpdateChannelAPIResponse>} The server response
274
+ * @param members - An array of members to add to the channel.
275
+ * @param message - Message object for channel members notification (optional).
276
+ * @param options - Configuration to control the behavior while updating (optional, defaults to `{}`).
277
+ * @returns The server response.
268
278
  */
269
- addMembers(members: string[] | Array<NewMemberPayload>, message?: Message, options?: ChannelUpdateOptions): Promise<UpdateChannelAPIResponse>;
279
+ addMembers(members: string[] | Array<Gen_ChannelMemberRequest>, message?: MessageRequest, options?: ChannelUpdateOptions): Promise<import("./types").StreamResponse<import(".").UpdateChannelResponse>>;
270
280
  /**
271
- * addFilterTags - add filter tags to the channel
281
+ * Adds filter tags to the channel.
272
282
  *
273
- * @param {string[]} tags An array of tags to add to the channel
274
- * @param {Message} [message] Optional message object for channel members notification
275
- * @param {ChannelUpdateOptions} [options] Option object, configuration to control the behavior while updating
276
- * @return {Promise<UpdateChannelAPIResponse>} The server response
283
+ * @param tags - An array of tags to add to the channel.
284
+ * @param message - Message object for channel members notification (optional).
285
+ * @param options - Configuration to control the behavior while updating (optional, defaults to `{}`).
286
+ * @returns The server response.
277
287
  */
278
- addFilterTags(tags: string[], message?: Message, options?: ChannelUpdateOptions): Promise<UpdateChannelAPIResponse>;
288
+ addFilterTags(tags: string[], message?: MessageRequest, options?: ChannelUpdateOptions): Promise<import("./types").StreamResponse<import(".").UpdateChannelResponse>>;
279
289
  /**
280
- * removeFilterTags - remove filter tags from the channel
290
+ * Removes filter tags from the channel.
281
291
  *
282
- * @param {string[]} tags An array of tags to remove from the channel
283
- * @param {Message} [message] Optional message object for channel members notification
284
- * @param {ChannelUpdateOptions} [options] Option object, configuration to control the behavior while updating
285
- * @return {Promise<UpdateChannelAPIResponse>} The server response
292
+ * @param tags - An array of tags to remove from the channel.
293
+ * @param message - Message object for channel members notification (optional).
294
+ * @param options - Configuration to control the behavior while updating (optional, defaults to `{}`).
295
+ * @returns The server response.
286
296
  */
287
- removeFilterTags(tags: string[], message?: Message, options?: ChannelUpdateOptions): Promise<UpdateChannelAPIResponse>;
297
+ removeFilterTags(tags: string[], message?: MessageRequest, options?: ChannelUpdateOptions): Promise<import("./types").StreamResponse<import(".").UpdateChannelResponse>>;
288
298
  /**
289
- * addModerators - add moderators to the channel
299
+ * Adds moderators to the channel.
290
300
  *
291
- * @param {string[]} members An array of member identifiers
292
- * @param {Message} [message] Optional message object for channel members notification
293
- * @param {ChannelUpdateOptions} [options] Option object, configuration to control the behavior while updating
294
- * @return {Promise<UpdateChannelAPIResponse>} The server response
301
+ * @param members - An array of member identifiers.
302
+ * @param message - Message object for channel members notification (optional).
303
+ * @param options - Configuration to control the behavior while updating (optional, defaults to `{}`).
304
+ * @returns The server response.
295
305
  */
296
- addModerators(members: string[], message?: Message, options?: ChannelUpdateOptions): Promise<UpdateChannelAPIResponse>;
306
+ addModerators(members: string[], message?: MessageRequest, options?: ChannelUpdateOptions): Promise<import("./types").StreamResponse<import(".").UpdateChannelResponse>>;
297
307
  /**
298
- * assignRoles - sets member roles in a channel
308
+ * Sets member roles in a channel.
299
309
  *
300
- * @param {{channel_role: Role, user_id: string}[]} roles List of role assignments
301
- * @param {Message} [message] Optional message object for channel members notification
302
- * @param {ChannelUpdateOptions} [options] Option object, configuration to control the behavior while updating
303
- * @return {Promise<UpdateChannelAPIResponse>} The server response
310
+ * @param roles - List of role assignments.
311
+ * @param message - Message object for channel members notification (optional).
312
+ * @param options - Configuration to control the behavior while updating (optional, defaults to `{}`).
313
+ * @returns The server response.
304
314
  */
305
315
  assignRoles(roles: {
306
- channel_role: Role;
316
+ channel_role: RoleName;
307
317
  user_id: string;
308
- }[], message?: Message, options?: ChannelUpdateOptions): Promise<UpdateChannelAPIResponse>;
318
+ }[], message?: MessageRequest, options?: ChannelUpdateOptions): Promise<import("./types").StreamResponse<import(".").UpdateChannelResponse>>;
309
319
  /**
310
- * inviteMembers - invite members to the channel
320
+ * Invite members to the channel.
311
321
  *
312
- * @param {string[] | Array<NewMemberPayload>} members An array of members to invite to the channel
313
- * @param {Message} [message] Optional message object for channel members notification
314
- * @param {ChannelUpdateOptions} [options] Option object, configuration to control the behavior while updating
315
- * @return {Promise<UpdateChannelAPIResponse>} The server response
322
+ * @param members - An array of members to invite to the channel.
323
+ * @param message - Message object for channel members notification (optional).
324
+ * @param options - Configuration to control the behavior while updating (optional, defaults to `{}`).
325
+ * @returns The server response.
316
326
  */
317
- inviteMembers(members: string[] | Required<Omit<NewMemberPayload, 'channel_role'>>[], message?: Message, options?: ChannelUpdateOptions): Promise<UpdateChannelAPIResponse>;
327
+ inviteMembers(members: string[] | Required<Omit<Gen_ChannelMemberRequest, 'channel_role'>>[], message?: MessageRequest, options?: ChannelUpdateOptions): Promise<import("./types").StreamResponse<import(".").UpdateChannelResponse>>;
318
328
  /**
319
- * removeMembers - remove members from channel
329
+ * Removes members from the channel.
320
330
  *
321
- * @param {string[]} members An array of member identifiers
322
- * @param {Message} [message] Optional message object for channel members notification
323
- * @param {ChannelUpdateOptions} [options] Option object, configuration to control the behavior while updating
324
- * @return {Promise<UpdateChannelAPIResponse>} The server response
331
+ * @param members - An array of member identifiers.
332
+ * @param message - Message object for channel members notification (optional).
333
+ * @param options - Configuration to control the behavior while updating (optional, defaults to `{}`).
334
+ * @returns The server response.
325
335
  */
326
- removeMembers(members: string[], message?: Message, options?: ChannelUpdateOptions): Promise<UpdateChannelAPIResponse>;
336
+ removeMembers(members: string[], message?: MessageRequest, options?: ChannelUpdateOptions): Promise<import("./types").StreamResponse<import(".").UpdateChannelResponse>>;
327
337
  /**
328
- * demoteModerators - remove moderator role from channel members
338
+ * Removes the moderator role from channel members.
329
339
  *
330
- * @param {string[]} members An array of member identifiers
331
- * @param {Message} [message] Optional message object for channel members notification
332
- * @param {ChannelUpdateOptions} [options] Option object, configuration to control the behavior while updating
333
- * @return {Promise<UpdateChannelAPIResponse>} The server response
334
- */
335
- demoteModerators(members: string[], message?: Message, options?: ChannelUpdateOptions): Promise<UpdateChannelAPIResponse>;
336
- /**
337
- * _update - executes channel update request
338
- * @param payload Object Update Channel payload
339
- * @return {Promise<UpdateChannelAPIResponse>} The server response
340
- * TODO: introduce new type instead of Object in the next major update
340
+ * @param members - An array of member identifiers.
341
+ * @param message - Message object for channel members notification (optional).
342
+ * @param options - Configuration to control the behavior while updating (optional, defaults to `{}`).
343
+ * @returns The server response.
341
344
  */
342
- _update(payload: object): Promise<UpdateChannelAPIResponse>;
345
+ demoteModerators(members: string[], message?: MessageRequest, options?: ChannelUpdateOptions): Promise<import("./types").StreamResponse<import(".").UpdateChannelResponse>>;
343
346
  /**
344
- * mute - mutes the current channel
345
- * @param {{ user_id?: string, expiration?: string }} opts expiration in minutes or user_id
346
- * @return {Promise<MuteChannelAPIResponse>} The server response
347
+ * Mutes the current channel.
347
348
  *
348
- * example with expiration:
349
- * await channel.mute({expiration: moment.duration(2, 'weeks')});
349
+ * @example
350
+ * // with expiration
351
+ * await channel.mute({ expiration: moment.duration(2, 'weeks') });
350
352
  *
351
- * example server side:
352
- * await channel.mute({user_id: userId});
353
+ * @example
354
+ * // server side
355
+ * await channel.mute({ user_id: userId });
353
356
  *
357
+ * @param options - Mute options (optional, defaults to `{}`).
358
+ * @param options.expiration - Expiration in minutes (optional).
359
+ * @returns The server response.
354
360
  */
355
- mute(opts?: {
356
- expiration?: number;
357
- user_id?: string;
358
- }): Promise<MuteChannelAPIResponse>;
361
+ mute(options?: Gen_MuteChannelRequest): Promise<import("./types").StreamResponse<import(".").MuteChannelResponse>>;
359
362
  /**
360
- * unmute - mutes the current channel
361
- * @param {{ user_id?: string}} opts user_id
362
- * @return {Promise<APIResponse>} The server response
363
+ * Unmutes the current channel.
363
364
  *
364
- * example server side:
365
- * await channel.unmute({user_id: userId});
365
+ * @example
366
+ * // server side
367
+ * await channel.unmute({ user_id: userId });
368
+ *
369
+ * @param options - Unmute options (optional, defaults to `{}`).
370
+ * @param options.user_id - User ID (optional).
371
+ * @returns The server response.
366
372
  */
367
- unmute(opts?: {
368
- user_id?: string;
369
- }): Promise<APIResponse>;
373
+ unmute(options?: Gen_UnmuteChannelRequest): Promise<import("./types").StreamResponse<import(".").UnmuteResponse>>;
370
374
  /**
371
- * archive - archives the current channel
372
- * @param {{ user_id?: string }} opts user_id if called server side
373
- * @return {Promise<ChannelMemberResponse>} The server response
374
- *
375
- * example:
376
- * await channel.archives();
375
+ * Archives the current channel.
377
376
  *
378
- * example server side:
379
- * await channel.archive({user_id: userId});
377
+ * @example
378
+ * await channel.archive();
380
379
  *
380
+ * @returns The server response.
381
381
  */
382
- archive(opts?: {
383
- user_id?: string;
384
- }): Promise<ChannelMemberResponse>;
382
+ archive(): Promise<import("./types").StreamResponse<import(".").UpdateMemberPartialResponse>>;
385
383
  /**
386
- * unarchive - unarchives the current channel
387
- * @param {{ user_id?: string }} opts user_id if called server side
388
- * @return {Promise<ChannelMemberResponse>} The server response
384
+ * Unarchives the current channel.
389
385
  *
390
- * example:
386
+ * @example
391
387
  * await channel.unarchive();
392
388
  *
393
- * example server side:
394
- * await channel.unarchive({user_id: userId});
395
- *
389
+ * @returns The server response.
396
390
  */
397
- unarchive(opts?: {
398
- user_id?: string;
399
- }): Promise<ChannelMemberResponse>;
391
+ unarchive(): Promise<import("./types").StreamResponse<import(".").UpdateMemberPartialResponse>>;
400
392
  /**
401
- * pin - pins the current channel
402
- * @param {{ user_id?: string }} opts user_id if called server side
403
- * @return {Promise<ChannelMemberResponse>} The server response
393
+ * Pins the current channel.
404
394
  *
405
- * example:
395
+ * @example
406
396
  * await channel.pin();
407
397
  *
408
- * example server side:
409
- * await channel.pin({user_id: userId});
410
- *
398
+ * @returns The server response.
411
399
  */
412
- pin(opts?: {
413
- user_id?: string;
414
- }): Promise<ChannelMemberResponse>;
400
+ pin(): Promise<import("./types").StreamResponse<import(".").UpdateMemberPartialResponse>>;
415
401
  /**
416
- * unpin - unpins the current channel
417
- * @param {{ user_id?: string }} opts user_id if called server side
418
- * @return {Promise<ChannelMemberResponse>} The server response
402
+ * Unpins the current channel.
419
403
  *
420
- * example:
404
+ * @example
421
405
  * await channel.unpin();
422
406
  *
423
- * example server side:
424
- * await channel.unpin({user_id: userId});
425
- *
407
+ * @returns The server response.
426
408
  */
427
- unpin(opts?: {
428
- user_id?: string;
429
- }): Promise<ChannelMemberResponse>;
409
+ unpin(): Promise<import("./types").StreamResponse<import(".").UpdateMemberPartialResponse>>;
430
410
  /**
431
- * muteStatus - returns the mute status for the current channel
432
- * @return {{ muted: boolean; createdAt: Date | null; expiresAt: Date | null }} { muted: true | false, createdAt: Date | null, expiresAt: Date | null}
411
+ * Returns the mute status for the current channel.
412
+ *
413
+ * @returns An object of the form `{ muted: true | false, createdAt: Date | null, expiresAt: Date | null }`.
433
414
  */
434
415
  muteStatus(): {
435
- createdAt: Date | null;
416
+ muted: boolean;
417
+ createdAt: Date;
436
418
  expiresAt: Date | null;
419
+ } | {
437
420
  muted: boolean;
421
+ createdAt: null;
422
+ expiresAt: null;
438
423
  };
439
- sendAction(messageID: string, formData: Record<string, string>): Promise<SendMessageAPIResponse>;
424
+ sendAction(messageId: string, formData: Record<string, string>): Promise<import("./types").StreamResponse<import(".").MessageActionResponse>>;
440
425
  /**
441
- * keystroke - First of the typing.start and typing.stop events based on the users keystrokes.
442
- * Call this on every keystroke
426
+ * First of the `typing.start` and `typing.stop` events based on the user's keystrokes.
427
+ * Call this on every keystroke.
428
+ *
443
429
  * @see {@link https://getstream.io/chat/docs/typing_indicators/?language=js|Docs}
444
- * @param {string} [parent_id] set this field to `message.id` to indicate that typing event is happening in a thread
430
+ *
431
+ * @param parentId - Set this field to `message.id` to indicate that the typing event is happening in a thread (optional).
432
+ * @param options - Optional override carrying a `user_id` (optional).
445
433
  */
446
- keystroke(parent_id?: string, options?: {
434
+ keystroke(parentId?: string, options?: {
447
435
  user_id: string;
448
436
  }): Promise<void>;
449
437
  /**
@@ -451,8 +439,9 @@ export declare class Channel {
451
439
  * Typically used by the server connected to the AI service to notify clients of state changes.
452
440
  *
453
441
  * @param messageId - The ID of the message associated with the AI state.
454
- * @param state - The new state of the AI process (e.g., thinking, generating).
455
- * @param options - Optional parameters, such as `ai_message`, to include additional details in the event.
442
+ * @param state - The new state of the AI process, e.g. thinking, generating.
443
+ * @param options - Parameters such as `ai_message` to include additional details in the event (optional, defaults to `{}`).
444
+ * @param options.ai_message - Additional message detail to include in the event (optional).
456
445
  */
457
446
  updateAIState(messageId: string, state: AIState, options?: {
458
447
  ai_message?: string;
@@ -468,43 +457,44 @@ export declare class Channel {
468
457
  */
469
458
  stopAIResponse(): Promise<void>;
470
459
  /**
471
- * stopTyping - Sets last typing to null and sends the typing.stop event
460
+ * Sets last typing to null and sends the `typing.stop` event.
461
+ *
472
462
  * @see {@link https://getstream.io/chat/docs/typing_indicators/?language=js|Docs}
473
- * @param {string} [parent_id] set this field to `message.id` to indicate that typing event is happening in a thread
463
+ *
464
+ * @param parentId - Set this field to `message.id` to indicate that the typing event is happening in a thread (optional).
465
+ * @param options - Optional override carrying a `user_id` (optional).
474
466
  */
475
- stopTyping(parent_id?: string, options?: {
467
+ stopTyping(parentId?: string, options?: {
476
468
  user_id: string;
477
469
  }): Promise<void>;
478
470
  _isTypingIndicatorsEnabled(): boolean;
479
471
  /**
480
- * lastMessage - return the last message, takes into account that last few messages might not be perfectly sorted
472
+ * Run this user's mark-read reporter for this channel. Delegates to
473
+ * `MessageDeliveryReporter`, which batches the underlying `markRead` request
474
+ * with the user's read receipts state.
481
475
  *
482
- * @return {ReturnType<ChannelState['formatMessage']> | undefined} Description
483
- */
484
- lastMessage(): LocalMessage | undefined;
485
- /**
486
- * markRead - Send the mark read event for this user, only works if the `read_events` setting is enabled. Syncs the message delivery report candidates local state.
476
+ * Use the inherited `markRead()` from `ChannelApi` for a direct, unbatched call.
487
477
  *
488
- * @param {MarkReadOptions} data
489
- * @return {Promise<EventAPIResponse | null>} Description
478
+ * @param data - Mark read options (optional, defaults to `{}`).
490
479
  */
491
- markRead(data?: MarkReadOptions): Promise<EventAPIResponse | null>;
480
+ markReadViaReporter(data?: MarkReadRequest): Promise<EventAPIResponse | import("./types").StreamResponse<import(".").MarkReadResponse> | null>;
492
481
  /**
493
- * markReadRequest - Send the mark read event for this user, only works if the `read_events` setting is enabled
482
+ * Override of the inherited `markRead()` from `ChannelApi` that requires the
483
+ * channel to be initialized and respects the `read_events` channel config.
494
484
  *
495
- * @param {MarkReadOptions} data
496
- * @return {Promise<EventAPIResponse | null>} Description
485
+ * @param data - Mark read options (optional, defaults to `{}`).
486
+ * @returns The server response, or `null` if the request was skipped.
497
487
  */
498
- markAsReadRequest(data?: MarkReadOptions): Promise<EventAPIResponse | null>;
488
+ markRead(data?: MarkReadRequest): Promise<import("./types").StreamResponse<import(".").MarkReadResponse>>;
499
489
  /**
500
- * markUnread - Mark the channel as unread from messageID, only works if the `read_events` setting is enabled
490
+ * Marks the channel as unread from `messageId`. Only works when the `read_events` setting is enabled.
501
491
  *
502
- * @param {MarkUnreadOptions} data
503
- * @return {APIResponse} An API response
492
+ * @param data - Mark unread options.
493
+ * @returns An API response, or `null` if the request was skipped.
504
494
  */
505
- markUnread(data: MarkUnreadOptions): Promise<APIResponse | null>;
495
+ markUnread(data?: MarkUnreadRequest): Promise<import("./types").StreamResponse<import(".").Response>>;
506
496
  /**
507
- * markReadLocally - Resets this user's unread count locally, without any backend call. Intended for
497
+ * Resets this user's unread count locally, without any backend call. Intended for
508
498
  * channels that have read events disabled (e.g. livestreams) when the client is created with the
509
499
  * `isLocalUnreadCountEnabled` option. Dispatches a dedicated, client-only `message.read_locally` event
510
500
  * that runs through the same `_handleChannelEvent` read logic as a real `message.read` (minus the
@@ -512,257 +502,223 @@ export declare class Channel {
512
502
  * is enabled, the offline DB persists the reset for read-events-disabled channels, so the local
513
503
  * count stays consistent across app restarts.
514
504
  *
515
- * @return {Event | undefined} The dispatched `message.read_locally` event, or `undefined` if there is no connected user.
516
- */
517
- markReadLocally(): Event | undefined;
505
+ * @returns The dispatched `message.read_locally` event, or `undefined` if there is no connected user.
506
+ */
507
+ markReadLocally(): ({
508
+ type: "message.read_locally";
509
+ } & {
510
+ channel_type: string;
511
+ cid: string;
512
+ created_at: Date;
513
+ channel_id?: string;
514
+ last_read_message_id?: string;
515
+ team?: string;
516
+ user?: UserResponse;
517
+ } & {
518
+ received_at?: Date;
519
+ }) | undefined;
518
520
  /**
519
- * clean - Cleans the channel state and fires stop typing if needed
521
+ * Cleans the channel state and fires stop typing if needed.
520
522
  */
521
523
  clean(): void;
522
524
  /**
523
- * watch - Loads the initial channel state and watches for changes
524
- *
525
- * @param {ChannelQueryOptions} options additional options for the query endpoint
525
+ * Loads the initial channel state and watches for changes.
526
526
  *
527
- * @return {Promise<QueryChannelAPIResponse>} The server response
527
+ * @param options - Additional options for the query endpoint (optional).
528
+ * @returns The server response.
528
529
  */
529
- watch(options?: ChannelQueryOptions): Promise<QueryChannelAPIResponse>;
530
+ watch(options?: ChannelGetOrCreateRequest): Promise<import("./types").StreamResponse<import(".").ChannelStateResponse>>;
530
531
  /**
531
- * stopWatching - Stops watching the channel
532
+ * Stops watching the channel.
532
533
  *
533
- * @return {Promise<APIResponse>} The server response
534
+ * @param request - The stop-watching request payload (optional).
535
+ * @returns The server response.
534
536
  */
535
- stopWatching(): Promise<APIResponse>;
537
+ stopWatching(request?: Gen_ChannelStopWatchingRequest): Promise<import("./types").StreamResponse<import(".").Response>>;
536
538
  /**
537
- * getReplies - List the message replies for a parent message.
538
- *
539
- * The recommended way of working with threads is to use the Thread class.
539
+ * List the message replies for a parent message.
540
540
  *
541
- * @param {string} parent_id The message parent id, ie the top of the thread
542
- * @param {MessagePaginationOptions & { user?: UserResponse; user_id?: string }} options Pagination params, ie {limit:10, id_lte: 10}
541
+ * The recommended way of working with threads is to use the `Thread` class.
543
542
  *
544
- * @return {Promise<GetRepliesAPIResponse>} A response with a list of messages
543
+ * @param request - The get-replies request payload, including the parent message ID, pagination
544
+ * params, and optional sort directions for `created_at`.
545
+ * @returns A response with a list of messages.
545
546
  */
546
- getReplies(parent_id: string, options: MessagePaginationOptions & {
547
- user?: UserResponse;
548
- user_id?: string;
549
- }, sort?: {
550
- created_at: AscDesc;
551
- }[]): Promise<GetRepliesAPIResponse>;
547
+ getReplies(request: GetRepliesRequest): Promise<import("./types").StreamResponse<import(".").GetRepliesResponse>>;
552
548
  /**
553
- * getPinnedMessages - List list pinned messages of the channel
554
- *
555
- * @param {PinnedMessagePaginationOptions & { user?: UserResponse; user_id?: string }} options Pagination params, ie {limit:10, id_lte: 10}
556
- * @param {PinnedMessagesSort} sort defines sorting direction of pinned messages
549
+ * List pinned messages of the channel.
557
550
  *
558
- * @return {Promise<GetRepliesAPIResponse>} A response with a list of messages
551
+ * @param options - Pagination params, e.g. `{ limit: 10, id_lte: 10 }`.
552
+ * @param sort - Defines sorting direction of pinned messages (optional, defaults to `[]`).
553
+ * @returns A response with a list of messages.
559
554
  */
560
- getPinnedMessages(options: PinnedMessagePaginationOptions & {
561
- user?: UserResponse;
562
- user_id?: string;
563
- }, sort?: PinnedMessagesSort): Promise<GetRepliesAPIResponse>;
555
+ getPinnedMessages(options: PinnedMessagePaginationOptions, sort?: PinnedMessagesSort): Promise<GetRepliesAPIResponse>;
564
556
  /**
565
- * getReactions - List the reactions, supports pagination
566
- *
567
- * @param {string} message_id The message id
568
- * @param {{ limit?: number; offset?: number }} options The pagination options
557
+ * List the reactions; supports pagination.
569
558
  *
570
- * @return {Promise<GetReactionsAPIResponse>} Server response
559
+ * @param request - The request payload, including the target message ID and
560
+ * pagination options (`limit`, `offset`).
561
+ * @returns The server response.
571
562
  */
572
- getReactions(message_id: string, options: {
573
- limit?: number;
574
- offset?: number;
575
- }): Promise<GetReactionsAPIResponse>;
563
+ getReactions(request: Parameters<ChatApi['getReactions']>[0]): Promise<import("./types").StreamResponse<import(".").GetReactionsResponse>>;
576
564
  /**
577
- * getMessagesById - Retrieves a list of messages by ID
565
+ * Retrieves a list of messages by ID.
578
566
  *
579
- * @param {string[]} messageIds The ids of the messages to retrieve from this channel
580
- *
581
- * @return {Promise<GetMultipleMessagesAPIResponse>} Server response
567
+ * @param messageIds - The IDs of the messages to retrieve from this channel.
568
+ * @returns Server response.
582
569
  */
583
- getMessagesById(messageIds: string[]): Promise<GetMultipleMessagesAPIResponse>;
570
+ getMessagesById(messageIds: string[]): Promise<import("./types").StreamResponse<import(".").GetManyMessagesResponse>>;
584
571
  /**
585
- * lastRead - returns the last time the user marked the channel as read if the user never marked the channel as read, this will return null
586
- * @return {Date | null | undefined}
572
+ * Returns the last time the user marked the channel as read. If the user never marked the channel as read, this will return `null`.
573
+ *
574
+ * @returns The last-read `Date`, `null` if never read, or `undefined` if the user is unset.
587
575
  */
588
576
  lastRead(): Date | null | undefined;
589
577
  _countMessageAsUnread(message: LocalMessage | MessageResponse): boolean;
590
578
  /**
591
- * countUnread - Count of unread messages
579
+ * Count of unread messages.
592
580
  *
593
- * @param {Date | null} [lastRead] lastRead the time that the user read a message, defaults to current user's read state
594
- *
595
- * @return {number} Unread count
581
+ * @param lastRead - The time that the user read a message (optional, defaults to the current user's read state).
582
+ * @returns Unread count.
596
583
  */
597
584
  countUnread(lastRead?: Date | null): number;
598
585
  /**
599
- * countUnreadMentions - Count the number of unread messages mentioning the current user
586
+ * Count the number of unread messages mentioning the current user.
600
587
  *
601
- * @return {number} Unread mentions count
588
+ * @returns Unread mentions count.
602
589
  */
603
590
  countUnreadMentions(): number;
604
591
  /**
605
- * create - Creates a new channel
606
- *
607
- * @return {Promise<QueryChannelAPIResponse>} The Server Response
592
+ * Creates a new channel.
608
593
  *
594
+ * @param options - Channel query options (optional).
595
+ * @returns The server response.
609
596
  */
610
- create: (options?: ChannelQueryOptions) => Promise<QueryChannelAPIResponse>;
597
+ create: (options?: ChannelGetOrCreateRequest) => Promise<import("./types").StreamResponse<import(".").ChannelStateResponse>>;
611
598
  /**
612
- * query - Query the API, get messages, members or other channel fields
613
- *
614
- * @param {ChannelQueryOptions} options The query options
615
- * @param {MessageSetType} messageSetToAddToIfDoesNotExist It's possible to load disjunct sets of a channel's messages into state, use `current` to load the initial channel state or if you want to extend the currently displayed messages, use `latest` if you want to load/extend the latest messages, `new` is used for loading a specific message and it's surroundings
599
+ * Queries the API to load messages, members, or other channel fields.
616
600
  *
617
- * @return {Promise<QueryChannelAPIResponse>} Returns a query response
601
+ * @param options - The query options (optional, defaults to `{}`).
602
+ * @param messageSetToAddToIfDoesNotExist - It's possible to load disjunct sets of a channel's
603
+ * messages into state. Use `current` to load the initial channel state or to extend the
604
+ * currently displayed messages; use `latest` to load/extend the latest messages; `new` is
605
+ * used for loading a specific message and its surroundings (optional, defaults to `'current'`).
606
+ * @returns A query response.
618
607
  */
619
- query(options?: ChannelQueryOptions, messageSetToAddToIfDoesNotExist?: MessageSetType): Promise<QueryChannelAPIResponse>;
608
+ query(options?: ChannelGetOrCreateRequest, messageSetToAddToIfDoesNotExist?: MessageSetType): Promise<import("./types").StreamResponse<import(".").ChannelStateResponse>>;
620
609
  /**
621
- * banUser - Bans a user from a channel
610
+ * Bans a user from a channel.
622
611
  *
623
- * @param {string} targetUserID
624
- * @param {BanUserOptions} options
625
- * @returns {Promise<APIResponse>}
612
+ * @param targetUserId - The user to ban.
613
+ * @param options - Ban options.
614
+ * @returns The server response.
626
615
  */
627
- banUser(targetUserID: string, options: BanUserOptions): Promise<APIResponse>;
616
+ banUser(targetUserId: string, options: BanUserOptions): Promise<APIResponse>;
628
617
  /**
629
- * hides the channel from queryChannels for the user until a message is added
630
- * If clearHistory is set to true - all messages will be removed for the user
618
+ * Hides the channel from `queryChannels` for the user until a message is added.
619
+ * If `clear_history` is set to `true`, all messages will be removed for the user.
631
620
  *
632
- * @param {string | null} userId
633
- * @param {boolean} clearHistory
634
- * @returns {Promise<APIResponse>}
621
+ * @param request - The hide channel request payload (optional). Pass `{ clear_history: true }`
622
+ * to clear message history for the user.
623
+ * @returns The server response.
635
624
  */
636
- hide(userId?: string | null, clearHistory?: boolean): Promise<APIResponse>;
625
+ hide(request?: Gen_HideChannelRequest): Promise<import("./types").StreamResponse<import(".").HideChannelResponse>>;
637
626
  /**
638
- * removes the hidden status for a channel
627
+ * Removes the hidden status for a channel. Ensures the channel is initialized first.
639
628
  *
640
- * @param {string | null} userId
641
- * @returns {Promise<APIResponse>}
629
+ * @param request - The show channel request payload (optional).
630
+ * @returns The server response.
642
631
  */
643
- show(userId?: string | null): Promise<APIResponse>;
632
+ show(request?: Gen_ShowChannelRequest): Promise<import("./types").StreamResponse<import(".").ShowChannelResponse>>;
644
633
  /**
645
- * unbanUser - Removes the bans for a user on a channel
634
+ * Removes the bans for a user on a channel.
646
635
  *
647
- * @param {string} targetUserID
648
- * @param {UnBanUserOptions} options
649
- * @returns {Promise<APIResponse>}
636
+ * @param targetUserId - The user to unban.
637
+ * @param options - Unban options (optional).
638
+ * @returns The server response.
650
639
  */
651
- unbanUser(targetUserID: string, options?: UnBanUserOptions): Promise<APIResponse>;
640
+ unbanUser(targetUserId: string, options?: UnBanUserOptions): Promise<APIResponse>;
652
641
  /**
653
- * shadowBan - Shadow bans a user from a channel
642
+ * Shadow bans a user from a channel.
654
643
  *
655
- * @param {string} targetUserID
656
- * @param {BanUserOptions} options
657
- * @returns {Promise<APIResponse>}
644
+ * @param targetUserId - The user to shadow ban.
645
+ * @param options - Ban options.
646
+ * @returns The server response.
658
647
  */
659
- shadowBan(targetUserID: string, options: BanUserOptions): Promise<APIResponse>;
648
+ shadowBan(targetUserId: string, options: BanUserOptions): Promise<APIResponse>;
660
649
  /**
661
- * removeShadowBan - Removes the shadow ban for a user on a channel
662
- *
663
- * @param {string} targetUserID
664
- * @returns {Promise<APIResponse>}
665
- */
666
- removeShadowBan(targetUserID: string): Promise<APIResponse>;
667
- /**
668
- * Cast or cancel one or more votes on a poll
669
- * @param pollId string The poll id
670
- * @param votes PollVoteData[] The votes that will be casted (or canceled in case of an empty array)
671
- * @returns {APIResponse & PollVoteResponse} The poll votes
672
- */
673
- vote(messageId: string, pollId: string, vote: PollVoteData): Promise<APIResponse & import("./types").CastVoteAPIResponse>;
674
- removeVote(messageId: string, pollId: string, voteId: string): Promise<APIResponse & {
675
- vote: import("./types").PollVote;
676
- }>;
677
- /**
678
- * createDraft - Creates or updates a draft message in a channel
679
- *
680
- * @param {DraftMessagePayload} message The draft message to create or update
650
+ * Removes the shadow ban for a user on a channel.
681
651
  *
682
- * @return {Promise<CreateDraftResponse>} Response containing the created draft
652
+ * @param targetUserId - The user to remove the shadow ban for.
653
+ * @returns The server response.
683
654
  */
684
- _createDraft(message: DraftMessagePayload): Promise<CreateDraftResponse>;
655
+ removeShadowBan(targetUserId: string): Promise<APIResponse>;
685
656
  /**
686
- * createDraft - Creates or updates a draft message in a channel. If offline support is
687
- * enabled, it will make sure that creating the draft is queued up if it fails due to
688
- * bad internet conditions and executed later.
657
+ * Casts or cancels one or more votes on a poll.
689
658
  *
690
- * @param {DraftMessagePayload} message The draft message to create or update
691
- *
692
- * @return {Promise<CreateDraftResponse>} Response containing the created draft
659
+ * @param request - The cast-poll-vote request payload, including the target message ID, poll ID,
660
+ * and the vote to cast (or an empty payload to cancel).
661
+ * @returns The poll vote response.
693
662
  */
694
- createDraft(message: DraftMessagePayload): Promise<CreateDraftResponse>;
663
+ vote(request: Parameters<ChatApi['castPollVote']>[0]): Promise<import("./types").StreamResponse<import(".").PollVoteResponse>>;
664
+ removeVote(request: Parameters<ChatApi['deletePollVote']>[0]): Promise<import("./types").StreamResponse<import(".").PollVoteResponse>>;
665
+ _createDraft(request: Gen_CreateDraftRequest): Promise<import("./types").StreamResponse<CreateDraftResponse>>;
695
666
  /**
696
- * deleteDraft - Deletes a draft message from a channel or a thread.
697
- *
698
- * @param {Object} options
699
- * @param {string} options.parent_id Optional parent message ID for drafts in threads
700
- *
701
- * @return {Promise<APIResponse>} API response
667
+ * Creates or updates a draft message in a channel. If offline support is enabled, the
668
+ * call is queued so it is replayed on reconnect.
702
669
  */
703
- _deleteDraft({ parent_id }?: {
704
- parent_id?: string;
705
- }): Promise<APIResponse>;
670
+ createDraft(request: Gen_CreateDraftRequest): Promise<import("./types").StreamResponse<CreateDraftResponse>>;
671
+ _deleteDraft(request?: Parameters<ChannelApi['deleteDraft']>[0]): Promise<import("./types").StreamResponse<import(".").Response>>;
706
672
  /**
707
- * deleteDraft - Deletes a draft message from a channel or a thread. If offline support is
708
- * enabled, it will make sure that deleting the draft is queued up if it fails due to
709
- * bad internet conditions and executed later.
710
- *
711
- * @param {Object} options
712
- * @param {string} options.parent_id Optional parent message ID for drafts in threads
713
- *
714
- * @return {Promise<APIResponse>} API response
673
+ * Deletes a draft message from a channel or a thread. If offline support is enabled, the
674
+ * call is queued so it is replayed on reconnect.
715
675
  */
716
- deleteDraft(options?: {
717
- parent_id?: string;
718
- }): Promise<APIResponse>;
676
+ deleteDraft(request?: Parameters<ChannelApi['deleteDraft']>[0]): Promise<import("./types").StreamResponse<import(".").Response>>;
719
677
  /**
720
- * getDraft - Retrieves a draft message from a channel
678
+ * Listens to events on this channel.
721
679
  *
722
- * @param {Object} options
723
- * @param {string} options.parent_id Optional parent message ID for drafts in threads
680
+ * @example
681
+ * channel.on('message.new', (event) => {
682
+ * console.log('my new message', event, channel.state.messages);
683
+ * });
724
684
  *
725
- * @return {Promise<GetDraftResponse>} Response containing the draft
726
- */
727
- getDraft({ parent_id }?: {
728
- parent_id?: string;
729
- }): Promise<GetDraftResponse>;
730
- /**
731
- * on - Listen to events on this channel.
685
+ * @example
686
+ * channel.on((event) => {
687
+ * console.log(event.type);
688
+ * });
732
689
  *
733
- * channel.on('message.new', event => {console.log("my new message", event, channel.state.messages)})
734
- * or
735
- * channel.on(event => {console.log(event.type)})
736
- *
737
- * @param {EventHandler | EventTypes} callbackOrString The event type to listen for (optional)
738
- * @param {EventHandler} [callbackOrNothing] The callback to call
690
+ * @param callbackOrString - The event type to listen for, or the callback when listening to all events.
691
+ * @param callbackOrNothing - The callback to call when an event type was provided (optional).
692
+ * @returns An object with an `unsubscribe()` method.
739
693
  */
740
- on(eventType: EventTypes, callback: EventHandler): {
694
+ on<T extends EventType | string>(eventType: T, callback: EventHandler<T>): {
741
695
  unsubscribe: () => void;
742
696
  };
743
697
  on(callback: EventHandler): {
744
698
  unsubscribe: () => void;
745
699
  };
746
700
  /**
747
- * off - Remove the event handler
701
+ * Removes the event handler.
748
702
  *
703
+ * @param callbackOrString - The event type, or the callback when removing an all-events listener.
704
+ * @param callbackOrNothing - The callback to remove when an event type was provided (optional).
749
705
  */
750
- off(eventType: EventTypes, callback: EventHandler): void;
706
+ off<T extends EventType | string>(eventType: T, callback: EventHandler): void;
751
707
  off(callback: EventHandler): void;
708
+ private _patchReadState;
709
+ private _upsertReadState;
752
710
  _handleChannelEvent(event: Event): void;
753
- _callChannelListeners: (event: Event) => void;
711
+ _callChannelListeners: (event: WSEvent) => void;
754
712
  /**
755
- * _channelURL - Returns the channel url
713
+ * Returns the channel url.
756
714
  *
757
- * @return {string} The channel url
715
+ * @returns The channel url.
758
716
  */
759
717
  _channelURL: () => string;
760
718
  _checkInitialized(): void;
761
- _initializeState(state: ChannelAPIResponse, messageSetToAddToIfDoesNotExist?: MessageSetType): {
762
- messageSet: import("./types").MessageSet;
763
- filteredMessageIds: string[];
764
- };
765
- _extendEventWithOwnReactions(event: Event): void;
719
+ _syncStateFromChannelData(data: Channel['data'], fallbackData?: Channel['data']): void;
720
+ _initializeState(state: ChannelStateResponseFields): void;
721
+ _extendEventWithOwnReactions(event: EventPayload<'message.undeleted' | 'message.updated' | 'message.deleted'>): void;
766
722
  _hydrateMembers({ members, overrideCurrentState, }: {
767
723
  members: ChannelMemberResponse[];
768
724
  /**