stream-chat 5.5.0 → 6.1.0

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 (40) hide show
  1. package/README.md +21 -13
  2. package/dist/browser.es.js +424 -366
  3. package/dist/browser.es.js.map +1 -1
  4. package/dist/browser.full-bundle.min.js +1 -1
  5. package/dist/browser.full-bundle.min.js.map +1 -1
  6. package/dist/browser.js +424 -366
  7. package/dist/browser.js.map +1 -1
  8. package/dist/index.es.js +424 -366
  9. package/dist/index.es.js.map +1 -1
  10. package/dist/index.js +424 -366
  11. package/dist/index.js.map +1 -1
  12. package/dist/types/channel.d.ts +124 -124
  13. package/dist/types/channel.d.ts.map +1 -1
  14. package/dist/types/channel_state.d.ts +41 -41
  15. package/dist/types/channel_state.d.ts.map +1 -1
  16. package/dist/types/client.d.ts +176 -169
  17. package/dist/types/client.d.ts.map +1 -1
  18. package/dist/types/client_state.d.ts +6 -6
  19. package/dist/types/client_state.d.ts.map +1 -1
  20. package/dist/types/connection.d.ts +10 -10
  21. package/dist/types/connection.d.ts.map +1 -1
  22. package/dist/types/connection_fallback.d.ts +7 -7
  23. package/dist/types/connection_fallback.d.ts.map +1 -1
  24. package/dist/types/insights.d.ts +2 -2
  25. package/dist/types/token_manager.d.ts +6 -6
  26. package/dist/types/token_manager.d.ts.map +1 -1
  27. package/dist/types/types.d.ts +388 -233
  28. package/dist/types/types.d.ts.map +1 -1
  29. package/dist/types/utils.d.ts +2 -2
  30. package/dist/types/utils.d.ts.map +1 -1
  31. package/package.json +4 -4
  32. package/src/channel.ts +197 -290
  33. package/src/channel_state.ts +54 -219
  34. package/src/client.ts +275 -521
  35. package/src/client_state.ts +6 -6
  36. package/src/connection.ts +7 -22
  37. package/src/connection_fallback.ts +9 -21
  38. package/src/token_manager.ts +6 -6
  39. package/src/types.ts +518 -484
  40. package/src/utils.ts +7 -11
@@ -6,13 +6,13 @@ import { ClientState } from './client_state';
6
6
  import { StableWSConnection } from './connection';
7
7
  import { TokenManager } from './token_manager';
8
8
  import { WSConnectionFallback } from './connection_fallback';
9
- import { APIResponse, AppSettings, AppSettingsAPIResponse, BaseDeviceFields, BannedUsersFilters, BannedUsersPaginationOptions, BannedUsersResponse, BannedUsersSort, BanUserOptions, BlockList, BlockListResponse, ChannelAPIResponse, ChannelData, ChannelFilters, ChannelMute, ChannelOptions, ChannelSort, ChannelStateOptions, CheckPushResponse, CheckSQSResponse, Configs, ConnectAPIResponse, CreateChannelOptions, CreateChannelResponse, CreateCommandOptions, CreateCommandResponse, CustomPermissionOptions, DeleteCommandResponse, Device, EndpointName, Event, EventHandler, ExportChannelOptions, ExportChannelRequest, ExportChannelResponse, ExportChannelStatusResponse, MessageFlagsFilters, MessageFlagsPaginationOptions, MessageFlagsResponse, FlagMessageResponse, FlagUserResponse, GetChannelTypeResponse, GetCommandResponse, GetRateLimitsResponse, ListChannelResponse, ListCommandsResponse, LiteralStringForUnion, Logger, MarkChannelsReadOptions, MessageFilters, MessageResponse, Mute, MuteUserOptions, MuteUserResponse, OwnUserResponse, PartialMessageUpdate, PartialUserUpdate, PermissionAPIResponse, PermissionsAPIResponse, PushProvider, ReactionResponse, SearchOptions, SearchAPIResponse, SendFileAPIResponse, StreamChatOptions, TestPushDataInput, TestSQSDataInput, TokenOrProvider, UnBanUserOptions, UR, UpdateChannelOptions, UpdateChannelResponse, UpdateCommandOptions, UpdateCommandResponse, UpdatedMessage, UpdateMessageAPIResponse, UserCustomEvent, UserFilters, UserOptions, UserResponse, UserSort, SegmentData, Segment, Campaign, CampaignData, OGAttachment, TaskStatus, DeleteUserOptions, TaskResponse, ReviewFlagReportResponse, FlagReportsFilters, FlagReportsResponse, ReviewFlagReportOptions, FlagReportsPaginationOptions, ExportUsersRequest, ExportUsersResponse, CreateImportResponse, GetImportResponse, ListImportsResponse, ListImportsPaginationOptions } from './types';
9
+ import { APIResponse, AppSettings, AppSettingsAPIResponse, BaseDeviceFields, BannedUsersFilters, BannedUsersPaginationOptions, BannedUsersResponse, BannedUsersSort, BanUserOptions, BlockList, BlockListResponse, ChannelAPIResponse, ChannelData, ChannelFilters, ChannelMute, ChannelOptions, ChannelSort, ChannelStateOptions, CheckPushResponse, CheckSQSResponse, Configs, ConnectAPIResponse, CreateChannelOptions, CreateChannelResponse, CreateCommandOptions, CreateCommandResponse, CustomPermissionOptions, DeleteCommandResponse, Device, EndpointName, Event, EventHandler, ExportChannelOptions, ExportChannelRequest, ExportChannelResponse, ExportChannelStatusResponse, MessageFlagsFilters, MessageFlagsPaginationOptions, MessageFlagsResponse, FlagMessageResponse, FlagUserResponse, GetChannelTypeResponse, GetCommandResponse, GetRateLimitsResponse, ListChannelResponse, ListCommandsResponse, Logger, MarkChannelsReadOptions, MessageFilters, MessageResponse, Mute, MuteUserOptions, MuteUserResponse, OwnUserResponse, PartialMessageUpdate, PartialUserUpdate, PermissionAPIResponse, PermissionsAPIResponse, PushProvider, ReactionResponse, SearchOptions, SearchAPIResponse, SendFileAPIResponse, StreamChatOptions, TestPushDataInput, TestSQSDataInput, TokenOrProvider, UnBanUserOptions, UpdateChannelOptions, UpdateChannelResponse, UpdateCommandOptions, UpdateCommandResponse, UpdatedMessage, UpdateMessageAPIResponse, UserCustomEvent, UserFilters, UserOptions, UserResponse, UserSort, SegmentData, Segment, Campaign, CampaignData, OGAttachment, TaskStatus, DeleteUserOptions, TaskResponse, ExtendableGenerics, DefaultGenerics, ReviewFlagReportResponse, FlagReportsFilters, FlagReportsResponse, ReviewFlagReportOptions, FlagReportsPaginationOptions, ExportUsersRequest, ExportUsersResponse, CreateImportResponse, GetImportResponse, ListImportsResponse, ListImportsPaginationOptions, FlagsFilters, FlagsPaginationOptions, FlagsResponse } from './types';
10
10
  import { InsightMetrics } from './insights';
11
- export declare class StreamChat<AttachmentType extends UR = UR, ChannelType extends UR = UR, CommandType extends string = LiteralStringForUnion, EventType extends UR = UR, MessageType extends UR = UR, ReactionType extends UR = UR, UserType extends UR = UR> {
11
+ export declare class StreamChat<StreamChatGenerics extends ExtendableGenerics = DefaultGenerics> {
12
12
  private static _instance?;
13
- _user?: OwnUserResponse<ChannelType, CommandType, UserType> | UserResponse<UserType>;
13
+ _user?: OwnUserResponse<StreamChatGenerics> | UserResponse<StreamChatGenerics>;
14
14
  activeChannels: {
15
- [key: string]: Channel<AttachmentType, ChannelType, CommandType, EventType, MessageType, ReactionType, UserType>;
15
+ [key: string]: Channel<StreamChatGenerics>;
16
16
  };
17
17
  anonymous: boolean;
18
18
  axiosInstance: AxiosInstance;
@@ -20,10 +20,10 @@ export declare class StreamChat<AttachmentType extends UR = UR, ChannelType exte
20
20
  browser: boolean;
21
21
  cleaningIntervalRef?: NodeJS.Timeout;
22
22
  clientID?: string;
23
- configs: Configs<CommandType>;
23
+ configs: Configs<StreamChatGenerics>;
24
24
  key: string;
25
25
  listeners: {
26
- [key: string]: Array<(event: Event<AttachmentType, ChannelType, CommandType, EventType, MessageType, ReactionType, UserType>) => void>;
26
+ [key: string]: Array<(event: Event<StreamChatGenerics>) => void>;
27
27
  };
28
28
  logger: Logger;
29
29
  /**
@@ -36,21 +36,21 @@ export declare class StreamChat<AttachmentType extends UR = UR, ChannelType exte
36
36
  * manually calling queryChannels endpoint.
37
37
  */
38
38
  recoverStateOnReconnect?: boolean;
39
- mutedChannels: ChannelMute<ChannelType, CommandType, UserType>[];
40
- mutedUsers: Mute<UserType>[];
39
+ mutedChannels: ChannelMute<StreamChatGenerics>[];
40
+ mutedUsers: Mute<StreamChatGenerics>[];
41
41
  node: boolean;
42
42
  options: StreamChatOptions;
43
43
  secret?: string;
44
- setUserPromise: ConnectAPIResponse<ChannelType, CommandType, UserType> | null;
45
- state: ClientState<UserType>;
46
- tokenManager: TokenManager<UserType>;
47
- user?: OwnUserResponse<ChannelType, CommandType, UserType> | UserResponse<UserType>;
44
+ setUserPromise: ConnectAPIResponse<StreamChatGenerics> | null;
45
+ state: ClientState<StreamChatGenerics>;
46
+ tokenManager: TokenManager<StreamChatGenerics>;
47
+ user?: OwnUserResponse<StreamChatGenerics> | UserResponse<StreamChatGenerics>;
48
48
  userAgent?: string;
49
49
  userID?: string;
50
50
  wsBaseURL?: string;
51
- wsConnection: StableWSConnection<ChannelType, CommandType, UserType, AttachmentType, EventType, MessageType, ReactionType> | null;
52
- wsFallback?: WSConnectionFallback<AttachmentType, ChannelType, CommandType, EventType, MessageType, ReactionType, UserType>;
53
- wsPromise: ConnectAPIResponse<ChannelType, CommandType, UserType> | null;
51
+ wsConnection: StableWSConnection<StreamChatGenerics> | null;
52
+ wsFallback?: WSConnectionFallback<StreamChatGenerics>;
53
+ wsPromise: ConnectAPIResponse<StreamChatGenerics> | null;
54
54
  consecutiveFailures: number;
55
55
  insightMetrics: InsightMetrics;
56
56
  defaultWSTimeoutWithFallback: number;
@@ -98,8 +98,8 @@ export declare class StreamChat<AttachmentType extends UR = UR, ChannelType exte
98
98
  * @example <caption>secret is optional and only used in server side mode</caption>
99
99
  * StreamChat.getInstance('api_key', "secret", { httpsAgent: customAgent })
100
100
  */
101
- static getInstance<AttachmentType extends UR = UR, ChannelType extends UR = UR, CommandType extends string = LiteralStringForUnion, EventType extends UR = UR, MessageType extends UR = UR, ReactionType extends UR = UR, UserType extends UR = UR>(key: string, options?: StreamChatOptions): StreamChat<AttachmentType, ChannelType, CommandType, EventType, MessageType, ReactionType, UserType>;
102
- static getInstance<AttachmentType extends UR = UR, ChannelType extends UR = UR, CommandType extends string = LiteralStringForUnion, EventType extends UR = UR, MessageType extends UR = UR, ReactionType extends UR = UR, UserType extends UR = UR>(key: string, secret?: string, options?: StreamChatOptions): StreamChat<AttachmentType, ChannelType, CommandType, EventType, MessageType, ReactionType, UserType>;
101
+ static getInstance<StreamChatGenerics extends ExtendableGenerics = DefaultGenerics>(key: string, options?: StreamChatOptions): StreamChat<StreamChatGenerics>;
102
+ static getInstance<StreamChatGenerics extends ExtendableGenerics = DefaultGenerics>(key: string, secret?: string, options?: StreamChatOptions): StreamChat<StreamChatGenerics>;
103
103
  devToken(userID: string): string;
104
104
  getAuthType(): "anonymous" | "jwt";
105
105
  setBaseURL(baseURL: string): void;
@@ -108,25 +108,25 @@ export declare class StreamChat<AttachmentType extends UR = UR, ChannelType exte
108
108
  /**
109
109
  * connectUser - Set the current user and open a WebSocket connection
110
110
  *
111
- * @param {OwnUserResponse<ChannelType, CommandType, UserType> | UserResponse<UserType>} user Data about this user. IE {name: "john"}
111
+ * @param {OwnUserResponse<StreamChatGenerics> | UserResponse<StreamChatGenerics>} user Data about this user. IE {name: "john"}
112
112
  * @param {TokenOrProvider} userTokenOrProvider Token or provider
113
113
  *
114
- * @return {ConnectAPIResponse<ChannelType, CommandType, UserType>} Returns a promise that resolves when the connection is setup
114
+ * @return {ConnectAPIResponse<StreamChatGenerics>} Returns a promise that resolves when the connection is setup
115
115
  */
116
- connectUser: (user: OwnUserResponse<ChannelType, CommandType, UserType> | UserResponse<UserType>, userTokenOrProvider: TokenOrProvider) => Promise<void | import("./types").ConnectionOpen<ChannelType, CommandType, UserType>>;
116
+ connectUser: (user: OwnUserResponse<StreamChatGenerics> | UserResponse<StreamChatGenerics>, userTokenOrProvider: TokenOrProvider) => Promise<void | import("./types").ConnectionOpen<StreamChatGenerics>>;
117
117
  /**
118
118
  * @deprecated Please use connectUser() function instead. Its naming is more consistent with its functionality.
119
119
  *
120
120
  * setUser - Set the current user and open a WebSocket connection
121
121
  *
122
- * @param {OwnUserResponse<ChannelType, CommandType, UserType> | UserResponse<UserType>} user Data about this user. IE {name: "john"}
122
+ * @param {OwnUserResponse<StreamChatGenerics> | UserResponse<StreamChatGenerics>} user Data about this user. IE {name: "john"}
123
123
  * @param {TokenOrProvider} userTokenOrProvider Token or provider
124
124
  *
125
- * @return {ConnectAPIResponse<ChannelType, CommandType, UserType>} Returns a promise that resolves when the connection is setup
125
+ * @return {ConnectAPIResponse<StreamChatGenerics>} Returns a promise that resolves when the connection is setup
126
126
  */
127
- setUser: (user: OwnUserResponse<ChannelType, CommandType, UserType> | UserResponse<UserType>, userTokenOrProvider: TokenOrProvider) => Promise<void | import("./types").ConnectionOpen<ChannelType, CommandType, UserType>>;
128
- _setToken: (user: UserResponse<UserType>, userTokenOrProvider: TokenOrProvider) => Promise<void>;
129
- _setUser(user: OwnUserResponse<ChannelType, CommandType, UserType> | UserResponse<UserType>): void;
127
+ setUser: (user: OwnUserResponse<StreamChatGenerics> | UserResponse<StreamChatGenerics>, userTokenOrProvider: TokenOrProvider) => Promise<void | import("./types").ConnectionOpen<StreamChatGenerics>>;
128
+ _setToken: (user: UserResponse<StreamChatGenerics>, userTokenOrProvider: TokenOrProvider) => Promise<void>;
129
+ _setUser(user: OwnUserResponse<StreamChatGenerics> | UserResponse<StreamChatGenerics>): void;
130
130
  /**
131
131
  * Disconnects the websocket connection, without removing the user set on client.
132
132
  * client.closeConnection will not trigger default auto-retry mechanism for reconnection. You need
@@ -144,14 +144,14 @@ export declare class StreamChat<AttachmentType extends UR = UR, ChannelType exte
144
144
  /**
145
145
  * Creates a new WebSocket connection with the current user. Returns empty promise, if there is an active connection
146
146
  */
147
- openConnection: () => Promise<void | import("./types").ConnectionOpen<ChannelType, CommandType, UserType>>;
147
+ openConnection: () => Promise<void | import("./types").ConnectionOpen<StreamChatGenerics>>;
148
148
  /**
149
149
  * @deprecated Please use client.openConnction instead.
150
150
  * @private
151
151
  *
152
152
  * Creates a new websocket connection with current user.
153
153
  */
154
- _setupConnection: () => Promise<void | import("./types").ConnectionOpen<ChannelType, CommandType, UserType>>;
154
+ _setupConnection: () => Promise<void | import("./types").ConnectionOpen<StreamChatGenerics>>;
155
155
  /**
156
156
  * updateAppSettings - updates application settings
157
157
  *
@@ -188,7 +188,7 @@ export declare class StreamChat<AttachmentType extends UR = UR, ChannelType exte
188
188
  */
189
189
  revokeUserToken(userID: string, before?: Date | string | null): Promise<APIResponse & {
190
190
  users: {
191
- [key: string]: UserResponse<UserType>;
191
+ [key: string]: UserResponse<StreamChatGenerics>;
192
192
  };
193
193
  }>;
194
194
  /**
@@ -196,13 +196,13 @@ export declare class StreamChat<AttachmentType extends UR = UR, ChannelType exte
196
196
  */
197
197
  revokeUsersToken(userIDs: string[], before?: Date | string | null): Promise<APIResponse & {
198
198
  users: {
199
- [key: string]: UserResponse<UserType>;
199
+ [key: string]: UserResponse<StreamChatGenerics>;
200
200
  };
201
201
  }>;
202
202
  /**
203
203
  * getAppSettings - retrieves application settings
204
204
  */
205
- getAppSettings(): Promise<AppSettingsAPIResponse<CommandType>>;
205
+ getAppSettings(): Promise<AppSettingsAPIResponse<StreamChatGenerics>>;
206
206
  /**
207
207
  * testPushSettings - Tests the push settings for a user with a random chat message and the configured push templates
208
208
  *
@@ -245,19 +245,19 @@ export declare class StreamChat<AttachmentType extends UR = UR, ChannelType exte
245
245
  /**
246
246
  * connectAnonymousUser - Set an anonymous user and open a WebSocket connection
247
247
  */
248
- connectAnonymousUser: () => Promise<void | import("./types").ConnectionOpen<ChannelType, CommandType, UserType>>;
248
+ connectAnonymousUser: () => Promise<void | import("./types").ConnectionOpen<StreamChatGenerics>>;
249
249
  /**
250
250
  * @deprecated Please use connectAnonymousUser. Its naming is more consistent with its functionality.
251
251
  */
252
- setAnonymousUser: () => Promise<void | import("./types").ConnectionOpen<ChannelType, CommandType, UserType>>;
252
+ setAnonymousUser: () => Promise<void | import("./types").ConnectionOpen<StreamChatGenerics>>;
253
253
  /**
254
254
  * setGuestUser - Setup a temporary guest user
255
255
  *
256
- * @param {UserResponse<UserType>} user Data about this user. IE {name: "john"}
256
+ * @param {UserResponse<StreamChatGenerics>} user Data about this user. IE {name: "john"}
257
257
  *
258
- * @return {ConnectAPIResponse<ChannelType, CommandType, UserType>} Returns a promise that resolves when the connection is setup
258
+ * @return {ConnectAPIResponse<StreamChatGenerics>} Returns a promise that resolves when the connection is setup
259
259
  */
260
- setGuestUser(user: UserResponse<UserType>): Promise<void | import("./types").ConnectionOpen<ChannelType, CommandType, UserType>>;
260
+ setGuestUser(user: UserResponse<StreamChatGenerics>): Promise<void | import("./types").ConnectionOpen<StreamChatGenerics>>;
261
261
  /**
262
262
  * createToken - Creates a token to authenticate this user. This function is used server side.
263
263
  * The resulting token should be passed to the client side when the users registers or logs in
@@ -275,23 +275,23 @@ export declare class StreamChat<AttachmentType extends UR = UR, ChannelType exte
275
275
  * or
276
276
  * client.on(event => {console.log(event.type)})
277
277
  *
278
- * @param {EventHandler<AttachmentType, ChannelType, CommandType, EventType, MessageType, ReactionType, UserType> | string} callbackOrString The event type to listen for (optional)
279
- * @param {EventHandler<AttachmentType, ChannelType, CommandType, EventType, MessageType, ReactionType, UserType>} [callbackOrNothing] The callback to call
278
+ * @param {EventHandler<StreamChatGenerics> | string} callbackOrString The event type to listen for (optional)
279
+ * @param {EventHandler<StreamChatGenerics>} [callbackOrNothing] The callback to call
280
280
  *
281
281
  * @return {{ unsubscribe: () => void }} Description
282
282
  */
283
- on(callback: EventHandler<AttachmentType, ChannelType, CommandType, EventType, MessageType, ReactionType, UserType>): {
283
+ on(callback: EventHandler<StreamChatGenerics>): {
284
284
  unsubscribe: () => void;
285
285
  };
286
- on(eventType: string, callback: EventHandler<AttachmentType, ChannelType, CommandType, EventType, MessageType, ReactionType, UserType>): {
286
+ on(eventType: string, callback: EventHandler<StreamChatGenerics>): {
287
287
  unsubscribe: () => void;
288
288
  };
289
289
  /**
290
290
  * off - Remove the event handler
291
291
  *
292
292
  */
293
- off(callback: EventHandler<AttachmentType, ChannelType, CommandType, EventType, MessageType, ReactionType, UserType>): void;
294
- off(eventType: string, callback: EventHandler<AttachmentType, ChannelType, CommandType, EventType, MessageType, ReactionType, UserType>): void;
293
+ off(callback: EventHandler<StreamChatGenerics>): void;
294
+ off(eventType: string, callback: EventHandler<StreamChatGenerics>): void;
295
295
  _logApiRequest(type: string, url: string, data: unknown, config: AxiosRequestConfig & {
296
296
  config?: AxiosRequestConfig & {
297
297
  maxBodyLength?: number;
@@ -309,7 +309,7 @@ export declare class StreamChat<AttachmentType extends UR = UR, ChannelType exte
309
309
  post<T>(url: string, data?: unknown): Promise<T>;
310
310
  patch<T>(url: string, data?: unknown): Promise<T>;
311
311
  delete<T>(url: string, params?: AxiosRequestConfig['params']): Promise<T>;
312
- sendFile(url: string, uri: string | NodeJS.ReadableStream | Buffer | File, name?: string, contentType?: string, user?: UserResponse<UserType>): Promise<SendFileAPIResponse>;
312
+ sendFile(url: string, uri: string | NodeJS.ReadableStream | Buffer | File, name?: string, contentType?: string, user?: UserResponse<StreamChatGenerics>): Promise<SendFileAPIResponse>;
313
313
  errorFromResponse<T>(response: AxiosResponse<T & {
314
314
  code?: number;
315
315
  message?: string;
@@ -319,28 +319,28 @@ export declare class StreamChat<AttachmentType extends UR = UR, ChannelType exte
319
319
  status?: number | undefined;
320
320
  };
321
321
  handleResponse<T>(response: AxiosResponse<T>): T;
322
- dispatchEvent: (event: Event<AttachmentType, ChannelType, CommandType, EventType, MessageType, ReactionType, UserType>) => void;
322
+ dispatchEvent: (event: Event<StreamChatGenerics>) => void;
323
323
  handleEvent: (messageEvent: WebSocket.MessageEvent) => void;
324
324
  /**
325
325
  * Updates the members and watchers of the currently active channels that contain this user
326
326
  *
327
- * @param {UserResponse<UserType>} user
327
+ * @param {UserResponse<StreamChatGenerics>} user
328
328
  */
329
- _updateMemberWatcherReferences: (user: UserResponse<UserType>) => void;
329
+ _updateMemberWatcherReferences: (user: UserResponse<StreamChatGenerics>) => void;
330
330
  /**
331
331
  * @deprecated Please _updateMemberWatcherReferences instead.
332
332
  * @private
333
333
  */
334
- _updateUserReferences: (user: UserResponse<UserType>) => void;
334
+ _updateUserReferences: (user: UserResponse<StreamChatGenerics>) => void;
335
335
  /**
336
336
  * @private
337
337
  *
338
338
  * Updates the messages from the currently active channels that contain this user,
339
339
  * with updated user object.
340
340
  *
341
- * @param {UserResponse<UserType>} user
341
+ * @param {UserResponse<StreamChatGenerics>} user
342
342
  */
343
- _updateUserMessageReferences: (user: UserResponse<UserType>) => void;
343
+ _updateUserMessageReferences: (user: UserResponse<StreamChatGenerics>) => void;
344
344
  /**
345
345
  * @private
346
346
  *
@@ -349,10 +349,10 @@ export declare class StreamChat<AttachmentType extends UR = UR, ChannelType exte
349
349
  * If hardDelete is true, all the content of message will be stripped down.
350
350
  * Otherwise, only 'message.type' will be set as 'deleted'.
351
351
  *
352
- * @param {UserResponse<UserType>} user
352
+ * @param {UserResponse<StreamChatGenerics>} user
353
353
  * @param {boolean} hardDelete
354
354
  */
355
- _deleteUserMessageReference: (user: UserResponse<UserType>, hardDelete?: boolean) => void;
355
+ _deleteUserMessageReference: (user: UserResponse<StreamChatGenerics>, hardDelete?: boolean) => void;
356
356
  /**
357
357
  * @private
358
358
  *
@@ -363,8 +363,8 @@ export declare class StreamChat<AttachmentType extends UR = UR, ChannelType exte
363
363
  *
364
364
  * @param {Event} event
365
365
  */
366
- _handleUserEvent: (event: Event<AttachmentType, ChannelType, CommandType, EventType, MessageType, ReactionType, UserType>) => void;
367
- _handleClientEvent(event: Event<AttachmentType, ChannelType, CommandType, EventType, MessageType, ReactionType, UserType>): (() => void)[];
366
+ _handleUserEvent: (event: Event<StreamChatGenerics>) => void;
367
+ _handleClientEvent(event: Event<StreamChatGenerics>): (() => void)[];
368
368
  _muteStatus(cid: string): {
369
369
  muted: boolean;
370
370
  createdAt: Date;
@@ -374,12 +374,12 @@ export declare class StreamChat<AttachmentType extends UR = UR, ChannelType exte
374
374
  createdAt: null;
375
375
  expiresAt: null;
376
376
  };
377
- _callClientListeners: (event: Event<AttachmentType, ChannelType, CommandType, EventType, MessageType, ReactionType, UserType>) => void;
377
+ _callClientListeners: (event: Event<StreamChatGenerics>) => void;
378
378
  recoverState: () => Promise<void>;
379
379
  /**
380
380
  * @private
381
381
  */
382
- connect(): Promise<void | import("./types").ConnectionOpen<ChannelType, CommandType, UserType>>;
382
+ connect(): Promise<void | import("./types").ConnectionOpen<StreamChatGenerics>>;
383
383
  /**
384
384
  * Check the connectivity with server for warmup purpose.
385
385
  *
@@ -389,15 +389,15 @@ export declare class StreamChat<AttachmentType extends UR = UR, ChannelType exte
389
389
  /**
390
390
  * queryUsers - Query users and watch user presence
391
391
  *
392
- * @param {UserFilters<UserType>} filterConditions MongoDB style filter conditions
393
- * @param {UserSort<UserType>} sort Sort options, for instance [{last_active: -1}].
392
+ * @param {UserFilters<StreamChatGenerics>} filterConditions MongoDB style filter conditions
393
+ * @param {UserSort<StreamChatGenerics>} sort Sort options, for instance [{last_active: -1}].
394
394
  * When using multiple fields, make sure you use array of objects to guarantee field order, for instance [{last_active: -1}, {created_at: 1}]
395
395
  * @param {UserOptions} options Option object, {presence: true}
396
396
  *
397
- * @return {Promise<APIResponse & { users: Array<UserResponse<UserType>> }>} User Query Response
397
+ * @return {Promise<{ users: Array<UserResponse<StreamChatGenerics>> }>} User Query Response
398
398
  */
399
- queryUsers(filterConditions: UserFilters<UserType>, sort?: UserSort<UserType>, options?: UserOptions): Promise<APIResponse & {
400
- users: Array<UserResponse<UserType>>;
399
+ queryUsers(filterConditions: UserFilters<StreamChatGenerics>, sort?: UserSort<StreamChatGenerics>, options?: UserOptions): Promise<APIResponse & {
400
+ users: Array<UserResponse<StreamChatGenerics>>;
401
401
  }>;
402
402
  /**
403
403
  * queryBannedUsers - Query user bans
@@ -406,41 +406,41 @@ export declare class StreamChat<AttachmentType extends UR = UR, ChannelType exte
406
406
  * @param {BannedUsersSort} sort Sort options [{created_at: 1}].
407
407
  * @param {BannedUsersPaginationOptions} options Option object, {limit: 10, offset:0}
408
408
  *
409
- * @return {Promise<BannedUsersResponse<ChannelType, CommandType, UserType>>} Ban Query Response
409
+ * @return {Promise<BannedUsersResponse<StreamChatGenerics>>} Ban Query Response
410
410
  */
411
- queryBannedUsers(filterConditions?: BannedUsersFilters, sort?: BannedUsersSort, options?: BannedUsersPaginationOptions): Promise<BannedUsersResponse<ChannelType, CommandType, UserType>>;
411
+ queryBannedUsers(filterConditions?: BannedUsersFilters, sort?: BannedUsersSort, options?: BannedUsersPaginationOptions): Promise<BannedUsersResponse<StreamChatGenerics>>;
412
412
  /**
413
413
  * queryMessageFlags - Query message flags
414
414
  *
415
415
  * @param {MessageFlagsFilters} filterConditions MongoDB style filter conditions
416
416
  * @param {MessageFlagsPaginationOptions} options Option object, {limit: 10, offset:0}
417
417
  *
418
- * @return {Promise<MessageFlagsResponse<ChannelType, CommandType, UserType>>} Message Flags Response
418
+ * @return {Promise<MessageFlagsResponse<StreamChatGenerics>>} Message Flags Response
419
419
  */
420
- queryMessageFlags(filterConditions?: MessageFlagsFilters, options?: MessageFlagsPaginationOptions): Promise<MessageFlagsResponse<ChannelType, CommandType, UserType, UR, UR, UR>>;
420
+ queryMessageFlags(filterConditions?: MessageFlagsFilters, options?: MessageFlagsPaginationOptions): Promise<MessageFlagsResponse<StreamChatGenerics>>;
421
421
  /**
422
422
  * queryChannels - Query channels
423
423
  *
424
- * @param {ChannelFilters<ChannelType, CommandType, UserType>} filterConditions object MongoDB style filters
425
- * @param {ChannelSort<ChannelType>} [sort] Sort options, for instance {created_at: -1}.
424
+ * @param {ChannelFilters<StreamChatGenerics>} filterConditions object MongoDB style filters
425
+ * @param {ChannelSort<StreamChatGenerics>} [sort] Sort options, for instance {created_at: -1}.
426
426
  * When using multiple fields, make sure you use array of objects to guarantee field order, for instance [{last_updated: -1}, {created_at: 1}]
427
427
  * @param {ChannelOptions} [options] Options object
428
428
  * @param {ChannelStateOptions} [stateOptions] State options object. These options will only be used for state management and won't be sent in the request.
429
429
  * - stateOptions.skipInitialization - Skips the initialization of the state for the channels matching the ids in the list.
430
430
  *
431
- * @return {Promise<APIResponse & { channels: Array<ChannelAPIResponse<AttachmentType,ChannelType,CommandType,MessageType,ReactionType,UserType>>}> } search channels response
431
+ * @return {Promise<{ channels: Array<ChannelAPIResponse<AStreamChatGenerics>>}> } search channels response
432
432
  */
433
- queryChannels(filterConditions: ChannelFilters<ChannelType, CommandType, UserType>, sort?: ChannelSort<ChannelType>, options?: ChannelOptions, stateOptions?: ChannelStateOptions): Promise<Channel<AttachmentType, ChannelType, CommandType, EventType, MessageType, ReactionType, UserType>[]>;
433
+ queryChannels(filterConditions: ChannelFilters<StreamChatGenerics>, sort?: ChannelSort<StreamChatGenerics>, options?: ChannelOptions, stateOptions?: ChannelStateOptions): Promise<Channel<StreamChatGenerics>[]>;
434
434
  /**
435
435
  * search - Query messages
436
436
  *
437
- * @param {ChannelFilters<ChannelType, CommandType, UserType>} filterConditions MongoDB style filter conditions
438
- * @param {MessageFilters<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType> | string} query search query or object MongoDB style filters
439
- * @param {SearchOptions<MessageType>} [options] Option object, {user_id: 'tommaso'}
437
+ * @param {ChannelFilters<StreamChatGenerics>} filterConditions MongoDB style filter conditions
438
+ * @param {MessageFilters<StreamChatGenerics> | string} query search query or object MongoDB style filters
439
+ * @param {SearchOptions<StreamChatGenerics>} [options] Option object, {user_id: 'tommaso'}
440
440
  *
441
- * @return {Promise<SearchAPIResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>>} search messages response
441
+ * @return {Promise<SearchAPIResponse<StreamChatGenerics>>} search messages response
442
442
  */
443
- search(filterConditions: ChannelFilters<ChannelType, CommandType, UserType>, query: string | MessageFilters<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>, options?: SearchOptions<MessageType>): Promise<SearchAPIResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>>;
443
+ search(filterConditions: ChannelFilters<StreamChatGenerics>, query: string | MessageFilters<StreamChatGenerics>, options?: SearchOptions<StreamChatGenerics>): Promise<SearchAPIResponse<StreamChatGenerics>>;
444
444
  /**
445
445
  * setLocalDevice - Set the device info for the current client(device) that will be sent via WS connection automatically
446
446
  *
@@ -464,10 +464,10 @@ export declare class StreamChat<AttachmentType extends UR = UR, ChannelType exte
464
464
  *
465
465
  * @param {string} [userID] User ID. Only works on serverside
466
466
  *
467
- * @return {APIResponse & Device<UserType>[]} Array of devices
467
+ * @return {Device<StreamChatGenerics>[]} Array of devices
468
468
  */
469
469
  getDevices(userID?: string): Promise<APIResponse & {
470
- devices?: Device<UserType>[] | undefined;
470
+ devices?: Device<StreamChatGenerics>[] | undefined;
471
471
  }>;
472
472
  /**
473
473
  * removeDevice - Removes the device with the given id. Clientside users can only delete their own devices
@@ -491,7 +491,7 @@ export declare class StreamChat<AttachmentType extends UR = UR, ChannelType exte
491
491
  serverSide?: boolean;
492
492
  web?: boolean;
493
493
  }): Promise<GetRateLimitsResponse>;
494
- _addChannelConfig(channelState: ChannelAPIResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>): void;
494
+ _addChannelConfig(channelState: ChannelAPIResponse<StreamChatGenerics>): void;
495
495
  /**
496
496
  * channel - Returns a new channel with the given type, id and custom data
497
497
  *
@@ -501,13 +501,13 @@ export declare class StreamChat<AttachmentType extends UR = UR, ChannelType exte
501
501
  * await channel.create() to assign an ID to channel
502
502
  *
503
503
  * @param {string} channelType The channel type
504
- * @param {string | ChannelData<ChannelType> | null} [channelIDOrCustom] The channel ID, you can leave this out if you want to create a conversation channel
504
+ * @param {string | ChannelData<StreamChatGenerics> | null} [channelIDOrCustom] The channel ID, you can leave this out if you want to create a conversation channel
505
505
  * @param {object} [custom] Custom data to attach to the channel
506
506
  *
507
507
  * @return {channel} The channel object, initialize it using channel.watch()
508
508
  */
509
- channel(channelType: string, channelID?: string | null, custom?: ChannelData<ChannelType>): Channel<AttachmentType, ChannelType, CommandType, EventType, MessageType, ReactionType, UserType>;
510
- channel(channelType: string, custom?: ChannelData<ChannelType>): Channel<AttachmentType, ChannelType, CommandType, EventType, MessageType, ReactionType, UserType>;
509
+ channel(channelType: string, channelID?: string | null, custom?: ChannelData<StreamChatGenerics>): Channel<StreamChatGenerics>;
510
+ channel(channelType: string, custom?: ChannelData<StreamChatGenerics>): Channel<StreamChatGenerics>;
511
511
  /**
512
512
  * It's a helper method for `client.channel()` method, used to create unique conversation or
513
513
  * channel based on member list instead of id.
@@ -524,7 +524,7 @@ export declare class StreamChat<AttachmentType extends UR = UR, ChannelType exte
524
524
  *
525
525
  * @return {channel} The channel object, initialize it using channel.watch()
526
526
  */
527
- getChannelByMembers: (channelType: string, custom: ChannelData<ChannelType>) => Channel<AttachmentType, ChannelType, CommandType, EventType, MessageType, ReactionType, UserType>;
527
+ getChannelByMembers: (channelType: string, custom: ChannelData<StreamChatGenerics>) => Channel<StreamChatGenerics>;
528
528
  /**
529
529
  * Its a helper method for `client.channel()` method, used to channel given the id of channel.
530
530
  *
@@ -541,30 +541,30 @@ export declare class StreamChat<AttachmentType extends UR = UR, ChannelType exte
541
541
  *
542
542
  * @return {channel} The channel object, initialize it using channel.watch()
543
543
  */
544
- getChannelById: (channelType: string, channelID: string, custom: ChannelData<ChannelType>) => Channel<AttachmentType, ChannelType, CommandType, EventType, MessageType, ReactionType, UserType>;
544
+ getChannelById: (channelType: string, channelID: string, custom: ChannelData<StreamChatGenerics>) => Channel<StreamChatGenerics>;
545
545
  /**
546
546
  * partialUpdateUser - Update the given user object
547
547
  *
548
- * @param {PartialUserUpdate<UserType>} partialUserObject which should contain id and any of "set" or "unset" params;
548
+ * @param {PartialUserUpdate<StreamChatGenerics>} partialUserObject which should contain id and any of "set" or "unset" params;
549
549
  * example: {id: "user1", set:{field: value}, unset:["field2"]}
550
550
  *
551
- * @return {Promise<APIResponse & { users: { [key: string]: UserResponse<UserType> } }>} list of updated users
551
+ * @return {Promise<{ users: { [key: string]: UserResponse<StreamChatGenerics> } }>} list of updated users
552
552
  */
553
- partialUpdateUser(partialUserObject: PartialUserUpdate<UserType>): Promise<APIResponse & {
553
+ partialUpdateUser(partialUserObject: PartialUserUpdate<StreamChatGenerics>): Promise<APIResponse & {
554
554
  users: {
555
- [key: string]: UserResponse<UserType>;
555
+ [key: string]: UserResponse<StreamChatGenerics>;
556
556
  };
557
557
  }>;
558
558
  /**
559
559
  * upsertUsers - Batch upsert the list of users
560
560
  *
561
- * @param {UserResponse<UserType>[]} users list of users
561
+ * @param {UserResponse<StreamChatGenerics>[]} users list of users
562
562
  *
563
- * @return {Promise<APIResponse & { users: { [key: string]: UserResponse<UserType> } }>}
563
+ * @return {Promise<{ users: { [key: string]: UserResponse<StreamChatGenerics> } }>}
564
564
  */
565
- upsertUsers(users: UserResponse<UserType>[]): Promise<APIResponse & {
565
+ upsertUsers(users: UserResponse<StreamChatGenerics>[]): Promise<APIResponse & {
566
566
  users: {
567
- [key: string]: UserResponse<UserType>;
567
+ [key: string]: UserResponse<StreamChatGenerics>;
568
568
  };
569
569
  }>;
570
570
  /**
@@ -572,24 +572,24 @@ export declare class StreamChat<AttachmentType extends UR = UR, ChannelType exte
572
572
  *
573
573
  * updateUsers - Batch update the list of users
574
574
  *
575
- * @param {UserResponse<UserType>[]} users list of users
576
- * @return {Promise<APIResponse & { users: { [key: string]: UserResponse<UserType> } }>}
575
+ * @param {UserResponse<StreamChatGenerics>[]} users list of users
576
+ * @return {Promise<{ users: { [key: string]: UserResponse<StreamChatGenerics> } }>}
577
577
  */
578
- updateUsers: (users: UserResponse<UserType>[]) => Promise<APIResponse & {
578
+ updateUsers: (users: UserResponse<StreamChatGenerics>[]) => Promise<APIResponse & {
579
579
  users: {
580
- [key: string]: UserResponse<UserType>;
580
+ [key: string]: UserResponse<StreamChatGenerics>;
581
581
  };
582
582
  }>;
583
583
  /**
584
584
  * upsertUser - Update or Create the given user object
585
585
  *
586
- * @param {UserResponse<UserType>} userObject user object, the only required field is the user id. IE {id: "myuser"} is valid
586
+ * @param {UserResponse<StreamChatGenerics>} userObject user object, the only required field is the user id. IE {id: "myuser"} is valid
587
587
  *
588
- * @return {Promise<APIResponse & { users: { [key: string]: UserResponse<UserType> } }>}
588
+ * @return {Promise<{ users: { [key: string]: UserResponse<StreamChatGenerics> } }>}
589
589
  */
590
- upsertUser(userObject: UserResponse<UserType>): Promise<APIResponse & {
590
+ upsertUser(userObject: UserResponse<StreamChatGenerics>): Promise<APIResponse & {
591
591
  users: {
592
- [key: string]: UserResponse<UserType>;
592
+ [key: string]: UserResponse<StreamChatGenerics>;
593
593
  };
594
594
  }>;
595
595
  /**
@@ -597,24 +597,24 @@ export declare class StreamChat<AttachmentType extends UR = UR, ChannelType exte
597
597
  *
598
598
  * updateUser - Update or Create the given user object
599
599
  *
600
- * @param {UserResponse<UserType>} userObject user object, the only required field is the user id. IE {id: "myuser"} is valid
601
- * @return {Promise<APIResponse & { users: { [key: string]: UserResponse<UserType> } }>}
600
+ * @param {UserResponse<StreamChatGenerics>} userObject user object, the only required field is the user id. IE {id: "myuser"} is valid
601
+ * @return {Promise<{ users: { [key: string]: UserResponse<StreamChatGenerics> } }>}
602
602
  */
603
- updateUser: (userObject: UserResponse<UserType>) => Promise<APIResponse & {
603
+ updateUser: (userObject: UserResponse<StreamChatGenerics>) => Promise<APIResponse & {
604
604
  users: {
605
- [key: string]: UserResponse<UserType>;
605
+ [key: string]: UserResponse<StreamChatGenerics>;
606
606
  };
607
607
  }>;
608
608
  /**
609
609
  * partialUpdateUsers - Batch partial update of users
610
610
  *
611
- * @param {PartialUserUpdate<UserType>[]} users list of partial update requests
611
+ * @param {PartialUserUpdate<StreamChatGenerics>[]} users list of partial update requests
612
612
  *
613
- * @return {Promise<APIResponse & { users: { [key: string]: UserResponse<UserType> } }>}
613
+ * @return {Promise<{ users: { [key: string]: UserResponse<StreamChatGenerics> } }>}
614
614
  */
615
- partialUpdateUsers(users: PartialUserUpdate<UserType>[]): Promise<APIResponse & {
615
+ partialUpdateUsers(users: PartialUserUpdate<StreamChatGenerics>[]): Promise<APIResponse & {
616
616
  users: {
617
- [key: string]: UserResponse<UserType>;
617
+ [key: string]: UserResponse<StreamChatGenerics>;
618
618
  };
619
619
  }>;
620
620
  deleteUser(userID: string, params?: {
@@ -622,33 +622,33 @@ export declare class StreamChat<AttachmentType extends UR = UR, ChannelType exte
622
622
  hard_delete?: boolean;
623
623
  mark_messages_deleted?: boolean;
624
624
  }): Promise<APIResponse & {
625
- user: UserResponse<UserType>;
625
+ user: UserResponse<StreamChatGenerics>;
626
626
  }>;
627
627
  reactivateUser(userID: string, options?: {
628
628
  created_by_id?: string;
629
629
  name?: string;
630
630
  restore_messages?: boolean;
631
631
  }): Promise<APIResponse & {
632
- user: UserResponse<UserType>;
632
+ user: UserResponse<StreamChatGenerics>;
633
633
  }>;
634
634
  deactivateUser(userID: string, options?: {
635
635
  created_by_id?: string;
636
636
  mark_messages_deleted?: boolean;
637
637
  }): Promise<APIResponse & {
638
- user: UserResponse<UserType>;
638
+ user: UserResponse<StreamChatGenerics>;
639
639
  }>;
640
640
  exportUser(userID: string, options?: Record<string, string>): Promise<APIResponse & {
641
- messages: MessageResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>[];
642
- reactions: ReactionResponse<ReactionType, UserType>[];
643
- user: UserResponse<UserType>;
641
+ messages: MessageResponse<StreamChatGenerics>[];
642
+ reactions: ReactionResponse<StreamChatGenerics>[];
643
+ user: UserResponse<StreamChatGenerics>;
644
644
  }>;
645
645
  /** banUser - bans a user from all channels
646
646
  *
647
647
  * @param {string} targetUserID
648
- * @param {BanUserOptions<UserType>} [options]
648
+ * @param {BanUserOptions<StreamChatGenerics>} [options]
649
649
  * @returns {Promise<APIResponse>}
650
650
  */
651
- banUser(targetUserID: string, options?: BanUserOptions<UserType>): Promise<APIResponse>;
651
+ banUser(targetUserID: string, options?: BanUserOptions<StreamChatGenerics>): Promise<APIResponse>;
652
652
  /** unbanUser - revoke global ban for a user
653
653
  *
654
654
  * @param {string} targetUserID
@@ -659,10 +659,10 @@ export declare class StreamChat<AttachmentType extends UR = UR, ChannelType exte
659
659
  /** shadowBan - shadow bans a user from all channels
660
660
  *
661
661
  * @param {string} targetUserID
662
- * @param {BanUserOptions<UserType>} [options]
662
+ * @param {BanUserOptions<StreamChatGenerics>} [options]
663
663
  * @returns {Promise<APIResponse>}
664
664
  */
665
- shadowBan(targetUserID: string, options?: BanUserOptions<UserType>): Promise<APIResponse>;
665
+ shadowBan(targetUserID: string, options?: BanUserOptions<StreamChatGenerics>): Promise<APIResponse>;
666
666
  /** removeShadowBan - revoke global shadow ban for a user
667
667
  *
668
668
  * @param {string} targetUserID
@@ -674,10 +674,10 @@ export declare class StreamChat<AttachmentType extends UR = UR, ChannelType exte
674
674
  *
675
675
  * @param {string} targetID
676
676
  * @param {string} [userID] Only used with serverside auth
677
- * @param {MuteUserOptions<UserType>} [options]
678
- * @returns {Promise<MuteUserResponse<ChannelType, CommandType, UserType>>}
677
+ * @param {MuteUserOptions<StreamChatGenerics>} [options]
678
+ * @returns {Promise<MuteUserResponse<StreamChatGenerics>>}
679
679
  */
680
- muteUser(targetID: string, userID?: string, options?: MuteUserOptions<UserType>): Promise<MuteUserResponse<ChannelType, CommandType, UserType>>;
680
+ muteUser(targetID: string, userID?: string, options?: MuteUserOptions<StreamChatGenerics>): Promise<MuteUserResponse<StreamChatGenerics>>;
681
681
  /** unmuteUser - unmutes a user
682
682
  *
683
683
  * @param {string} targetID
@@ -699,7 +699,7 @@ export declare class StreamChat<AttachmentType extends UR = UR, ChannelType exte
699
699
  */
700
700
  flagMessage(targetMessageID: string, options?: {
701
701
  user_id?: string;
702
- }): Promise<FlagMessageResponse<UserType>>;
702
+ }): Promise<FlagMessageResponse<StreamChatGenerics>>;
703
703
  /**
704
704
  * flagUser - flag a user
705
705
  * @param {string} targetID
@@ -708,7 +708,7 @@ export declare class StreamChat<AttachmentType extends UR = UR, ChannelType exte
708
708
  */
709
709
  flagUser(targetID: string, options?: {
710
710
  user_id?: string;
711
- }): Promise<FlagUserResponse<UserType>>;
711
+ }): Promise<FlagUserResponse<StreamChatGenerics>>;
712
712
  /**
713
713
  * unflagMessage - unflag a message
714
714
  * @param {string} targetMessageID
@@ -717,7 +717,7 @@ export declare class StreamChat<AttachmentType extends UR = UR, ChannelType exte
717
717
  */
718
718
  unflagMessage(targetMessageID: string, options?: {
719
719
  user_id?: string;
720
- }): Promise<FlagMessageResponse<UserType>>;
720
+ }): Promise<FlagMessageResponse<StreamChatGenerics>>;
721
721
  /**
722
722
  * unflagUser - unflag a user
723
723
  * @param {string} targetID
@@ -726,7 +726,21 @@ export declare class StreamChat<AttachmentType extends UR = UR, ChannelType exte
726
726
  */
727
727
  unflagUser(targetID: string, options?: {
728
728
  user_id?: string;
729
- }): Promise<FlagUserResponse<UserType>>;
729
+ }): Promise<FlagUserResponse<StreamChatGenerics>>;
730
+ /**
731
+ * _queryFlags - Query flags.
732
+ *
733
+ * Note: Do not use this.
734
+ * It is present for internal usage only.
735
+ * This function can, and will, break and/or be removed at any point in time.
736
+ *
737
+ * @private
738
+ * @param {FlagsFilters} filterConditions MongoDB style filter conditions
739
+ * @param {FlagsPaginationOptions} options Option object, {limit: 10, offset:0}
740
+ *
741
+ * @return {Promise<FlagsResponse<StreamChatGenerics>>} Flags Response
742
+ */
743
+ _queryFlags(filterConditions?: FlagsFilters, options?: FlagsPaginationOptions): Promise<FlagsResponse<StreamChatGenerics>>;
730
744
  /**
731
745
  * _queryFlagReports - Query flag reports.
732
746
  *
@@ -738,9 +752,9 @@ export declare class StreamChat<AttachmentType extends UR = UR, ChannelType exte
738
752
  * @param {FlagReportsFilters} filterConditions MongoDB style filter conditions
739
753
  * @param {FlagReportsPaginationOptions} options Option object, {limit: 10, offset:0}
740
754
  *
741
- * @return {Promise<FlagReportsResponse<ChannelType, CommandType, UserType>>} Flag Reports Response
755
+ * @return {Promise<FlagReportsResponse<StreamChatGenerics>>} Flag Reports Response
742
756
  */
743
- _queryFlagReports(filterConditions?: FlagReportsFilters, options?: FlagReportsPaginationOptions): Promise<FlagReportsResponse<ChannelType, CommandType, UserType, UR, UR, UR>>;
757
+ _queryFlagReports(filterConditions?: FlagReportsFilters, options?: FlagReportsPaginationOptions): Promise<FlagReportsResponse<StreamChatGenerics>>;
744
758
  /**
745
759
  * _reviewFlagReport - review flag report
746
760
  *
@@ -755,7 +769,7 @@ export declare class StreamChat<AttachmentType extends UR = UR, ChannelType exte
755
769
  * @param {string} [options.review_details] custom information about review result
756
770
  * @returns {Promise<ReviewFlagReportResponse>>}
757
771
  */
758
- _reviewFlagReport(id: string, reviewResult: string, options?: ReviewFlagReportOptions): Promise<ReviewFlagReportResponse<UserType, LiteralStringForUnion, UR, UR, UR, UR>>;
772
+ _reviewFlagReport(id: string, reviewResult: string, options?: ReviewFlagReportOptions): Promise<ReviewFlagReportResponse<StreamChatGenerics>>;
759
773
  /**
760
774
  * _unblockMessage - unblocks message blocked by automod
761
775
  *
@@ -775,41 +789,41 @@ export declare class StreamChat<AttachmentType extends UR = UR, ChannelType exte
775
789
  * @deprecated use markChannelsRead instead
776
790
  *
777
791
  * markAllRead - marks all channels for this user as read
778
- * @param {MarkAllReadOptions<UserType>} [data]
792
+ * @param {MarkAllReadOptions<StreamChatGenerics>} [data]
779
793
  *
780
794
  * @return {Promise<APIResponse>}
781
795
  */
782
- markAllRead: (data?: MarkChannelsReadOptions<UserType>) => Promise<void>;
796
+ markAllRead: (data?: MarkChannelsReadOptions<StreamChatGenerics>) => Promise<void>;
783
797
  /**
784
798
  * markChannelsRead - marks channels read -
785
799
  * it accepts a map of cid:messageid pairs, if messageid is empty, the whole channel will be marked as read
786
800
  *
787
- * @param {MarkChannelsReadOptions <UserType>} [data]
801
+ * @param {MarkChannelsReadOptions <StreamChatGenerics>} [data]
788
802
  *
789
803
  * @return {Promise<APIResponse>}
790
804
  */
791
- markChannelsRead(data?: MarkChannelsReadOptions<UserType>): Promise<void>;
792
- createCommand(data: CreateCommandOptions<CommandType>): Promise<CreateCommandResponse<CommandType>>;
793
- getCommand(name: string): Promise<GetCommandResponse<CommandType>>;
794
- updateCommand(name: string, data: UpdateCommandOptions<CommandType>): Promise<UpdateCommandResponse<CommandType>>;
795
- deleteCommand(name: string): Promise<DeleteCommandResponse<CommandType>>;
796
- listCommands(): Promise<ListCommandsResponse<CommandType>>;
797
- createChannelType(data: CreateChannelOptions<CommandType>): Promise<CreateChannelResponse<CommandType>>;
798
- getChannelType(channelType: string): Promise<GetChannelTypeResponse<CommandType>>;
799
- updateChannelType(channelType: string, data: UpdateChannelOptions<CommandType>): Promise<UpdateChannelResponse<CommandType>>;
805
+ markChannelsRead(data?: MarkChannelsReadOptions<StreamChatGenerics>): Promise<void>;
806
+ createCommand(data: CreateCommandOptions<StreamChatGenerics>): Promise<CreateCommandResponse<StreamChatGenerics>>;
807
+ getCommand(name: string): Promise<GetCommandResponse<StreamChatGenerics>>;
808
+ updateCommand(name: string, data: UpdateCommandOptions<StreamChatGenerics>): Promise<UpdateCommandResponse<StreamChatGenerics>>;
809
+ deleteCommand(name: string): Promise<DeleteCommandResponse<StreamChatGenerics>>;
810
+ listCommands(): Promise<ListCommandsResponse<StreamChatGenerics>>;
811
+ createChannelType(data: CreateChannelOptions<StreamChatGenerics>): Promise<CreateChannelResponse<StreamChatGenerics>>;
812
+ getChannelType(channelType: string): Promise<GetChannelTypeResponse<StreamChatGenerics>>;
813
+ updateChannelType(channelType: string, data: UpdateChannelOptions<StreamChatGenerics>): Promise<UpdateChannelResponse<StreamChatGenerics>>;
800
814
  deleteChannelType(channelType: string): Promise<APIResponse>;
801
- listChannelTypes(): Promise<ListChannelResponse<CommandType>>;
815
+ listChannelTypes(): Promise<ListChannelResponse<StreamChatGenerics>>;
802
816
  /**
803
817
  * translateMessage - adds the translation to the message
804
818
  *
805
819
  * @param {string} messageId
806
820
  * @param {string} language
807
821
  *
808
- * @return {APIResponse & MessageResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>} Response that includes the message
822
+ * @return {MessageResponse<StreamChatGenerics>} Response that includes the message
809
823
  */
810
- translateMessage(messageId: string, language: string): Promise<APIResponse & MessageType & {
824
+ translateMessage(messageId: string, language: string): Promise<APIResponse & StreamChatGenerics["messageType"] & {
811
825
  id: string;
812
- attachments?: import("./types").Attachment<AttachmentType>[] | undefined;
826
+ attachments?: import("./types").Attachment<StreamChatGenerics>[] | undefined;
813
827
  html?: string | undefined;
814
828
  mml?: string | undefined;
815
829
  parent_id?: string | undefined;
@@ -819,18 +833,11 @@ export declare class StreamChat<AttachmentType extends UR = UR, ChannelType exte
819
833
  quoted_message_id?: string | undefined;
820
834
  show_in_channel?: boolean | undefined;
821
835
  text?: string | undefined;
822
- user?: UserResponse<UserType> | null | undefined;
836
+ user?: UserResponse<StreamChatGenerics> | null | undefined;
823
837
  user_id?: string | undefined;
824
838
  } & {
825
- args?: string | undefined; /**
826
- * connectUser - Set the current user and open a WebSocket connection
827
- *
828
- * @param {OwnUserResponse<ChannelType, CommandType, UserType> | UserResponse<UserType>} user Data about this user. IE {name: "john"}
829
- * @param {TokenOrProvider} userTokenOrProvider Token or provider
830
- *
831
- * @return {ConnectAPIResponse<ChannelType, CommandType, UserType>} Returns a promise that resolves when the connection is setup
832
- */
833
- channel?: import("./types").ChannelResponse<ChannelType, CommandType, UserType> | undefined;
839
+ args?: string | undefined;
840
+ channel?: import("./types").ChannelResponse<StreamChatGenerics> | undefined;
834
841
  cid?: string | undefined;
835
842
  command?: string | undefined;
836
843
  command_info?: {
@@ -841,12 +848,12 @@ export declare class StreamChat<AttachmentType extends UR = UR, ChannelType exte
841
848
  i18n?: (import("./types").RequireAtLeastOne<Record<"_text" | "so_text" | "hr_text" | "th_text" | "tr_text" | "no_text" | "af_text" | "am_text" | "ar_text" | "az_text" | "bg_text" | "bn_text" | "bs_text" | "cs_text" | "da_text" | "de_text" | "el_text" | "en_text" | "es_text" | "es-MX_text" | "et_text" | "fa_text" | "fa-AF_text" | "fi_text" | "fr_text" | "fr-CA_text" | "ha_text" | "he_text" | "hi_text" | "hu_text" | "id_text" | "it_text" | "ja_text" | "ka_text" | "ko_text" | "lv_text" | "ms_text" | "nl_text" | "pl_text" | "ps_text" | "pt_text" | "ro_text" | "ru_text" | "sk_text" | "sl_text" | "sq_text" | "sr_text" | "sv_text" | "sw_text" | "ta_text" | "tl_text" | "uk_text" | "ur_text" | "vi_text" | "zh_text" | "zh-TW_text", string>> & {
842
849
  language: import("./types").TranslationLanguages;
843
850
  }) | undefined;
844
- latest_reactions?: ReactionResponse<ReactionType, UserType>[] | undefined;
845
- mentioned_users?: UserResponse<UserType>[] | undefined;
846
- own_reactions?: ReactionResponse<ReactionType, UserType>[] | null | undefined;
851
+ latest_reactions?: ReactionResponse<StreamChatGenerics>[] | undefined;
852
+ mentioned_users?: UserResponse<StreamChatGenerics>[] | undefined;
853
+ own_reactions?: ReactionResponse<StreamChatGenerics>[] | null | undefined;
847
854
  pin_expires?: string | null | undefined;
848
855
  pinned_at?: string | null | undefined;
849
- pinned_by?: UserResponse<UserType> | null | undefined;
856
+ pinned_by?: UserResponse<StreamChatGenerics> | null | undefined;
850
857
  reaction_counts?: {
851
858
  [key: string]: number;
852
859
  } | null | undefined;
@@ -857,11 +864,11 @@ export declare class StreamChat<AttachmentType extends UR = UR, ChannelType exte
857
864
  shadowed?: boolean | undefined;
858
865
  silent?: boolean | undefined;
859
866
  status?: string | undefined;
860
- thread_participants?: UserResponse<UserType>[] | undefined;
867
+ thread_participants?: UserResponse<StreamChatGenerics>[] | undefined;
861
868
  type?: import("./types").MessageLabel | undefined;
862
869
  updated_at?: string | undefined;
863
870
  } & {
864
- quoted_message?: import("./types").MessageResponseBase<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType> | undefined;
871
+ quoted_message?: import("./types").MessageResponseBase<StreamChatGenerics> | undefined;
865
872
  }>;
866
873
  /**
867
874
  * _normalizeExpiration - transforms expiration value into ISO string
@@ -887,7 +894,7 @@ export declare class StreamChat<AttachmentType extends UR = UR, ChannelType exte
887
894
  id: string;
888
895
  }, timeoutOrExpirationDate?: null | number | string | Date, pinnedBy?: string | {
889
896
  id: string;
890
- }, pinnedAt?: number | string | Date): Promise<UpdateMessageAPIResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>>;
897
+ }, pinnedAt?: number | string | Date): Promise<UpdateMessageAPIResponse<StreamChatGenerics>>;
891
898
  /**
892
899
  * unpinMessage - unpins the message that was previously pinned
893
900
  * @param {string | { id: string }} messageOrMessageId message object or message id
@@ -897,44 +904,44 @@ export declare class StreamChat<AttachmentType extends UR = UR, ChannelType exte
897
904
  id: string;
898
905
  }, userId?: string | {
899
906
  id: string;
900
- }): Promise<UpdateMessageAPIResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>>;
907
+ }): Promise<UpdateMessageAPIResponse<StreamChatGenerics>>;
901
908
  /**
902
909
  * updateMessage - Update the given message
903
910
  *
904
- * @param {Omit<MessageResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>, 'mentioned_users'> & { mentioned_users?: string[] }} message object, id needs to be specified
911
+ * @param {Omit<MessageResponse<StreamChatGenerics>, 'mentioned_users'> & { mentioned_users?: string[] }} message object, id needs to be specified
905
912
  * @param {string | { id: string }} [userId]
906
913
  * @param {boolean} [options.skip_enrich_url] Do not try to enrich the URLs within message
907
914
  *
908
- * @return {APIResponse & { message: MessageResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType> }} Response that includes the message
915
+ * @return {{ message: MessageResponse<StreamChatGenerics> }} Response that includes the message
909
916
  */
910
- updateMessage(message: UpdatedMessage<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>, userId?: string | {
917
+ updateMessage(message: UpdatedMessage<StreamChatGenerics>, userId?: string | {
911
918
  id: string;
912
919
  }, options?: {
913
920
  skip_enrich_url?: boolean;
914
- }): Promise<UpdateMessageAPIResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>>;
921
+ }): Promise<UpdateMessageAPIResponse<StreamChatGenerics>>;
915
922
  /**
916
923
  * partialUpdateMessage - Update the given message id while retaining additional properties
917
924
  *
918
925
  * @param {string} id the message id
919
926
  *
920
- * @param {PartialUpdateMessage<MessageType>} partialMessageObject which should contain id and any of "set" or "unset" params;
927
+ * @param {PartialUpdateMessage<StreamChatGenerics>} partialMessageObject which should contain id and any of "set" or "unset" params;
921
928
  * example: {id: "user1", set:{text: "hi"}, unset:["color"]}
922
929
  * @param {string | { id: string }} [userId]
923
930
  *
924
931
  * @param {boolean} [options.skip_enrich_url] Do not try to enrich the URLs within message
925
932
  *
926
- * @return {APIResponse & { message: MessageResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType> }} Response that includes the updated message
933
+ * @return {{ message: MessageResponse<StreamChatGenerics> }} Response that includes the updated message
927
934
  */
928
- partialUpdateMessage(id: string, partialMessageObject: PartialMessageUpdate<MessageType>, userId?: string | {
935
+ partialUpdateMessage(id: string, partialMessageObject: PartialMessageUpdate<StreamChatGenerics>, userId?: string | {
929
936
  id: string;
930
937
  }, options?: {
931
938
  skip_enrich_url?: boolean;
932
- }): Promise<UpdateMessageAPIResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>>;
939
+ }): Promise<UpdateMessageAPIResponse<StreamChatGenerics>>;
933
940
  deleteMessage(messageID: string, hardDelete?: boolean): Promise<APIResponse & {
934
- message: MessageResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>;
941
+ message: MessageResponse<StreamChatGenerics>;
935
942
  }>;
936
943
  getMessage(messageID: string): Promise<APIResponse & {
937
- message: MessageResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>;
944
+ message: MessageResponse<StreamChatGenerics>;
938
945
  }>;
939
946
  getUserAgent(): string;
940
947
  setUserAgent(userAgent: string): void;
@@ -1006,7 +1013,7 @@ export declare class StreamChat<AttachmentType extends UR = UR, ChannelType exte
1006
1013
  * @param {string} last_sync_at last time the user was online and in sync. RFC3339 ie. "2020-05-06T15:05:01.207Z"
1007
1014
  */
1008
1015
  sync(channel_cids: string[], last_sync_at: string): Promise<APIResponse & {
1009
- events: Event<AttachmentType, ChannelType, CommandType, EventType, MessageType, ReactionType, UserType>[];
1016
+ events: Event<StreamChatGenerics>[];
1010
1017
  }>;
1011
1018
  /**
1012
1019
  * sendUserCustomEvent - Send a custom event to a user