stream-chat 4.4.3 → 5.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.
- package/README.md +4 -13
- package/dist/browser.es.js +1954 -1288
- package/dist/browser.es.js.map +1 -1
- package/dist/browser.full-bundle.min.js +1 -1
- package/dist/browser.full-bundle.min.js.map +1 -1
- package/dist/browser.js +1954 -1288
- package/dist/browser.js.map +1 -1
- package/dist/index.es.js +1954 -1288
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +1954 -1288
- package/dist/index.js.map +1 -1
- package/dist/types/base64.d.ts.map +1 -1
- package/dist/types/channel.d.ts +31 -15
- package/dist/types/channel.d.ts.map +1 -1
- package/dist/types/channel_state.d.ts +2 -2
- package/dist/types/channel_state.d.ts.map +1 -1
- package/dist/types/client.d.ts +52 -43
- package/dist/types/client.d.ts.map +1 -1
- package/dist/types/client_state.d.ts +2 -2
- package/dist/types/client_state.d.ts.map +1 -1
- package/dist/types/connection.d.ts +14 -49
- package/dist/types/connection.d.ts.map +1 -1
- package/dist/types/connection_fallback.d.ts +41 -0
- package/dist/types/connection_fallback.d.ts.map +1 -0
- package/dist/types/errors.d.ts +14 -0
- package/dist/types/errors.d.ts.map +1 -0
- package/dist/types/insights.d.ts +6 -6
- package/dist/types/insights.d.ts.map +1 -1
- package/dist/types/permissions.d.ts.map +1 -1
- package/dist/types/signing.d.ts +3 -3
- package/dist/types/signing.d.ts.map +1 -1
- package/dist/types/token_manager.d.ts +2 -2
- package/dist/types/token_manager.d.ts.map +1 -1
- package/dist/types/types.d.ts +174 -90
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/utils.d.ts +12 -2
- package/dist/types/utils.d.ts.map +1 -1
- package/package.json +25 -31
- package/src/base64.ts +1 -4
- package/src/channel.ts +157 -461
- package/src/channel_state.ts +31 -158
- package/src/client.ts +332 -683
- package/src/client_state.ts +2 -2
- package/src/connection.ts +143 -394
- package/src/connection_fallback.ts +209 -0
- package/src/errors.ts +58 -0
- package/src/insights.ts +15 -23
- package/src/permissions.ts +3 -24
- package/src/signing.ts +6 -17
- package/src/token_manager.ts +6 -18
- package/src/types.ts +391 -513
- package/src/utils.ts +48 -19
package/src/types.ts
CHANGED
|
@@ -24,15 +24,14 @@ export type RequireAtLeastOne<T> = {
|
|
|
24
24
|
[K in keyof T]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<keyof T, K>>>;
|
|
25
25
|
}[keyof T];
|
|
26
26
|
|
|
27
|
-
export type RequireOnlyOne<T, Keys extends keyof T = keyof T> = Pick<
|
|
28
|
-
T,
|
|
29
|
-
Exclude<keyof T, Keys>
|
|
30
|
-
> &
|
|
27
|
+
export type RequireOnlyOne<T, Keys extends keyof T = keyof T> = Pick<T, Exclude<keyof T, Keys>> &
|
|
31
28
|
{
|
|
32
29
|
[K in Keys]-?: Required<Pick<T, K>> & Partial<Record<Exclude<Keys, K>, undefined>>;
|
|
33
30
|
}[Keys];
|
|
34
31
|
|
|
35
|
-
|
|
32
|
+
/* Unknown Record */
|
|
33
|
+
export type UR = Record<string, unknown>;
|
|
34
|
+
export type UnknownType = UR; //alias to avoid breaking change
|
|
36
35
|
|
|
37
36
|
export type Unpacked<T> = T extends (infer U)[]
|
|
38
37
|
? U // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -50,9 +49,7 @@ export type APIResponse = {
|
|
|
50
49
|
duration: string;
|
|
51
50
|
};
|
|
52
51
|
|
|
53
|
-
export type AppSettingsAPIResponse<
|
|
54
|
-
CommandType extends string = LiteralStringForUnion
|
|
55
|
-
> = APIResponse & {
|
|
52
|
+
export type AppSettingsAPIResponse<CommandType extends string = LiteralStringForUnion> = APIResponse & {
|
|
56
53
|
app?: {
|
|
57
54
|
channel_configs: Record<
|
|
58
55
|
string,
|
|
@@ -129,22 +126,15 @@ export type ModerationResult = {
|
|
|
129
126
|
};
|
|
130
127
|
|
|
131
128
|
export type MessageFlagsResponse<
|
|
132
|
-
ChannelType extends
|
|
129
|
+
ChannelType extends UR = UR,
|
|
133
130
|
CommandType extends string = LiteralStringForUnion,
|
|
134
|
-
UserType extends
|
|
135
|
-
AttachmentType =
|
|
136
|
-
MessageType =
|
|
137
|
-
ReactionType =
|
|
131
|
+
UserType extends UR = UR,
|
|
132
|
+
AttachmentType = UR,
|
|
133
|
+
MessageType = UR,
|
|
134
|
+
ReactionType = UR
|
|
138
135
|
> = APIResponse & {
|
|
139
136
|
flags?: Array<{
|
|
140
|
-
message: MessageResponse<
|
|
141
|
-
AttachmentType,
|
|
142
|
-
ChannelType,
|
|
143
|
-
CommandType,
|
|
144
|
-
MessageType,
|
|
145
|
-
ReactionType,
|
|
146
|
-
UserType
|
|
147
|
-
>;
|
|
137
|
+
message: MessageResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>;
|
|
148
138
|
user: UserResponse<UserType>;
|
|
149
139
|
approved_at?: string;
|
|
150
140
|
created_at?: string;
|
|
@@ -157,10 +147,52 @@ export type MessageFlagsResponse<
|
|
|
157
147
|
}>;
|
|
158
148
|
};
|
|
159
149
|
|
|
150
|
+
export type FlagReport<
|
|
151
|
+
ChannelType extends UR = UR,
|
|
152
|
+
CommandType extends string = LiteralStringForUnion,
|
|
153
|
+
UserType extends UR = UR,
|
|
154
|
+
AttachmentType = UR,
|
|
155
|
+
MessageType = UR,
|
|
156
|
+
ReactionType = UR
|
|
157
|
+
> = {
|
|
158
|
+
flags_count: number;
|
|
159
|
+
id: string;
|
|
160
|
+
message: MessageResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>;
|
|
161
|
+
user: UserResponse<UserType>;
|
|
162
|
+
created_at?: string;
|
|
163
|
+
review_details?: Object;
|
|
164
|
+
review_result?: string;
|
|
165
|
+
reviewed_at?: string;
|
|
166
|
+
reviewed_by?: UserResponse<UserType>;
|
|
167
|
+
updated_at?: string;
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
export type FlagReportsResponse<
|
|
171
|
+
ChannelType extends UR = UR,
|
|
172
|
+
CommandType extends string = LiteralStringForUnion,
|
|
173
|
+
UserType extends UR = UR,
|
|
174
|
+
AttachmentType = UR,
|
|
175
|
+
MessageType = UR,
|
|
176
|
+
ReactionType = UR
|
|
177
|
+
> = APIResponse & {
|
|
178
|
+
flag_reports: Array<FlagReport<ChannelType, CommandType, UserType, AttachmentType, MessageType, ReactionType>>;
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
export type ReviewFlagReportResponse<
|
|
182
|
+
ChannelType extends UR = UR,
|
|
183
|
+
CommandType extends string = LiteralStringForUnion,
|
|
184
|
+
UserType extends UR = UR,
|
|
185
|
+
AttachmentType = UR,
|
|
186
|
+
MessageType = UR,
|
|
187
|
+
ReactionType = UR
|
|
188
|
+
> = APIResponse & {
|
|
189
|
+
flag_report: FlagReport<ChannelType, CommandType, UserType, AttachmentType, MessageType, ReactionType>;
|
|
190
|
+
};
|
|
191
|
+
|
|
160
192
|
export type BannedUsersResponse<
|
|
161
|
-
ChannelType extends
|
|
193
|
+
ChannelType extends UR = UR,
|
|
162
194
|
CommandType extends string = LiteralStringForUnion,
|
|
163
|
-
UserType extends
|
|
195
|
+
UserType extends UR = UR
|
|
164
196
|
> = APIResponse & {
|
|
165
197
|
bans?: Array<{
|
|
166
198
|
user: UserResponse<UserType>;
|
|
@@ -179,9 +211,9 @@ export type BlockListResponse = BlockList & {
|
|
|
179
211
|
};
|
|
180
212
|
|
|
181
213
|
export type ChannelResponse<
|
|
182
|
-
ChannelType =
|
|
214
|
+
ChannelType = UR,
|
|
183
215
|
CommandType extends string = LiteralStringForUnion,
|
|
184
|
-
UserType =
|
|
216
|
+
UserType = UR
|
|
185
217
|
> = ChannelType & {
|
|
186
218
|
cid: string;
|
|
187
219
|
disabled: boolean;
|
|
@@ -205,35 +237,22 @@ export type ChannelResponse<
|
|
|
205
237
|
name?: string;
|
|
206
238
|
own_capabilities?: string[];
|
|
207
239
|
team?: string;
|
|
240
|
+
truncated_at?: string;
|
|
208
241
|
updated_at?: string;
|
|
209
242
|
};
|
|
210
243
|
|
|
211
244
|
export type ChannelAPIResponse<
|
|
212
|
-
AttachmentType =
|
|
213
|
-
ChannelType =
|
|
245
|
+
AttachmentType = UR,
|
|
246
|
+
ChannelType = UR,
|
|
214
247
|
CommandType extends string = LiteralStringForUnion,
|
|
215
|
-
MessageType =
|
|
216
|
-
ReactionType =
|
|
217
|
-
UserType =
|
|
248
|
+
MessageType = UR,
|
|
249
|
+
ReactionType = UR,
|
|
250
|
+
UserType = UR
|
|
218
251
|
> = APIResponse & {
|
|
219
252
|
channel: ChannelResponse<ChannelType, CommandType, UserType>;
|
|
220
253
|
members: ChannelMemberResponse<UserType>[];
|
|
221
|
-
messages: MessageResponse<
|
|
222
|
-
|
|
223
|
-
ChannelType,
|
|
224
|
-
CommandType,
|
|
225
|
-
MessageType,
|
|
226
|
-
ReactionType,
|
|
227
|
-
UserType
|
|
228
|
-
>[];
|
|
229
|
-
pinned_messages: MessageResponse<
|
|
230
|
-
AttachmentType,
|
|
231
|
-
ChannelType,
|
|
232
|
-
CommandType,
|
|
233
|
-
MessageType,
|
|
234
|
-
ReactionType,
|
|
235
|
-
UserType
|
|
236
|
-
>[];
|
|
254
|
+
messages: MessageResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>[];
|
|
255
|
+
pinned_messages: MessageResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>[];
|
|
237
256
|
hidden?: boolean;
|
|
238
257
|
membership?: ChannelMembership<UserType> | null;
|
|
239
258
|
read?: ReadResponse<UserType>[];
|
|
@@ -241,11 +260,16 @@ export type ChannelAPIResponse<
|
|
|
241
260
|
watchers?: UserResponse<UserType>[];
|
|
242
261
|
};
|
|
243
262
|
|
|
244
|
-
export type
|
|
263
|
+
export type ChannelUpdateOptions = {
|
|
264
|
+
hide_history?: boolean;
|
|
265
|
+
skip_push?: boolean;
|
|
266
|
+
};
|
|
267
|
+
|
|
268
|
+
export type ChannelMemberAPIResponse<UserType = UR> = APIResponse & {
|
|
245
269
|
members: ChannelMemberResponse<UserType>[];
|
|
246
270
|
};
|
|
247
271
|
|
|
248
|
-
export type ChannelMemberResponse<UserType =
|
|
272
|
+
export type ChannelMemberResponse<UserType = UR> = {
|
|
249
273
|
banned?: boolean;
|
|
250
274
|
channel_role?: Role;
|
|
251
275
|
created_at?: string;
|
|
@@ -277,9 +301,7 @@ export type CheckSQSResponse = APIResponse & {
|
|
|
277
301
|
error?: string;
|
|
278
302
|
};
|
|
279
303
|
|
|
280
|
-
export type CommandResponse<
|
|
281
|
-
CommandType extends string = LiteralStringForUnion
|
|
282
|
-
> = Partial<CreatedAtUpdatedAt> & {
|
|
304
|
+
export type CommandResponse<CommandType extends string = LiteralStringForUnion> = Partial<CreatedAtUpdatedAt> & {
|
|
283
305
|
args?: string;
|
|
284
306
|
description?: string;
|
|
285
307
|
name?: CommandVariants<CommandType>;
|
|
@@ -287,56 +309,44 @@ export type CommandResponse<
|
|
|
287
309
|
};
|
|
288
310
|
|
|
289
311
|
export type ConnectAPIResponse<
|
|
290
|
-
ChannelType extends
|
|
312
|
+
ChannelType extends UR = UR,
|
|
291
313
|
CommandType extends string = LiteralStringForUnion,
|
|
292
|
-
UserType extends
|
|
314
|
+
UserType extends UR = UR
|
|
293
315
|
> = Promise<void | ConnectionOpen<ChannelType, CommandType, UserType>>;
|
|
294
316
|
|
|
295
|
-
export type CreateChannelResponse<
|
|
296
|
-
CommandType extends string = LiteralStringForUnion
|
|
297
|
-
> = APIResponse &
|
|
317
|
+
export type CreateChannelResponse<CommandType extends string = LiteralStringForUnion> = APIResponse &
|
|
298
318
|
Omit<CreateChannelOptions<CommandType>, 'client_id' | 'connection_id'> & {
|
|
299
319
|
created_at: string;
|
|
300
320
|
updated_at: string;
|
|
301
321
|
grants?: Record<string, string[]>;
|
|
302
322
|
};
|
|
303
323
|
|
|
304
|
-
export type CreateCommandResponse<
|
|
305
|
-
CommandType
|
|
306
|
-
|
|
324
|
+
export type CreateCommandResponse<CommandType extends string = LiteralStringForUnion> = APIResponse & {
|
|
325
|
+
command: CreateCommandOptions<CommandType> & CreatedAtUpdatedAt;
|
|
326
|
+
};
|
|
307
327
|
|
|
308
328
|
export type DeleteChannelAPIResponse<
|
|
309
|
-
ChannelType =
|
|
329
|
+
ChannelType = UR,
|
|
310
330
|
CommandType extends string = LiteralStringForUnion,
|
|
311
|
-
UserType =
|
|
331
|
+
UserType = UR
|
|
312
332
|
> = APIResponse & {
|
|
313
333
|
channel: ChannelResponse<ChannelType, CommandType, UserType>;
|
|
314
334
|
};
|
|
315
335
|
|
|
316
|
-
export type DeleteCommandResponse<
|
|
317
|
-
CommandType extends string = LiteralStringForUnion
|
|
318
|
-
> = APIResponse & {
|
|
336
|
+
export type DeleteCommandResponse<CommandType extends string = LiteralStringForUnion> = APIResponse & {
|
|
319
337
|
name?: CommandVariants<CommandType>;
|
|
320
338
|
};
|
|
321
339
|
|
|
322
340
|
export type EventAPIResponse<
|
|
323
|
-
AttachmentType extends
|
|
324
|
-
ChannelType extends
|
|
341
|
+
AttachmentType extends UR = UR,
|
|
342
|
+
ChannelType extends UR = UR,
|
|
325
343
|
CommandType extends string = LiteralStringForUnion,
|
|
326
|
-
EventType extends
|
|
327
|
-
MessageType extends
|
|
328
|
-
ReactionType extends
|
|
329
|
-
UserType extends
|
|
344
|
+
EventType extends UR = UR,
|
|
345
|
+
MessageType extends UR = UR,
|
|
346
|
+
ReactionType extends UR = UR,
|
|
347
|
+
UserType extends UR = UR
|
|
330
348
|
> = APIResponse & {
|
|
331
|
-
event: Event<
|
|
332
|
-
AttachmentType,
|
|
333
|
-
ChannelType,
|
|
334
|
-
CommandType,
|
|
335
|
-
EventType,
|
|
336
|
-
MessageType,
|
|
337
|
-
ReactionType,
|
|
338
|
-
UserType
|
|
339
|
-
>;
|
|
349
|
+
event: Event<AttachmentType, ChannelType, CommandType, EventType, MessageType, ReactionType, UserType>;
|
|
340
350
|
};
|
|
341
351
|
|
|
342
352
|
export type ExportChannelResponse = {
|
|
@@ -350,7 +360,7 @@ export type ExportChannelStatusResponse = {
|
|
|
350
360
|
updated_at?: string;
|
|
351
361
|
};
|
|
352
362
|
|
|
353
|
-
export type FlagMessageResponse<UserType =
|
|
363
|
+
export type FlagMessageResponse<UserType = UR> = APIResponse & {
|
|
354
364
|
flag: {
|
|
355
365
|
created_at: string;
|
|
356
366
|
created_by_automod: boolean;
|
|
@@ -358,13 +368,14 @@ export type FlagMessageResponse<UserType = UnknownType> = APIResponse & {
|
|
|
358
368
|
updated_at: string;
|
|
359
369
|
user: UserResponse<UserType>;
|
|
360
370
|
approved_at?: string;
|
|
371
|
+
details?: Object; // Any JSON
|
|
361
372
|
rejected_at?: string;
|
|
362
373
|
reviewed_at?: string;
|
|
363
374
|
reviewed_by?: string;
|
|
364
375
|
};
|
|
365
376
|
};
|
|
366
377
|
|
|
367
|
-
export type FlagUserResponse<UserType =
|
|
378
|
+
export type FlagUserResponse<UserType = UR> = APIResponse & {
|
|
368
379
|
flag: {
|
|
369
380
|
created_at: string;
|
|
370
381
|
created_by_automod: boolean;
|
|
@@ -372,6 +383,7 @@ export type FlagUserResponse<UserType = UnknownType> = APIResponse & {
|
|
|
372
383
|
updated_at: string;
|
|
373
384
|
user: UserResponse<UserType>;
|
|
374
385
|
approved_at?: string;
|
|
386
|
+
details?: Object; // Any JSON
|
|
375
387
|
rejected_at?: string;
|
|
376
388
|
reviewed_at?: string;
|
|
377
389
|
reviewed_by?: string;
|
|
@@ -379,12 +391,12 @@ export type FlagUserResponse<UserType = UnknownType> = APIResponse & {
|
|
|
379
391
|
};
|
|
380
392
|
|
|
381
393
|
export type FormatMessageResponse<
|
|
382
|
-
AttachmentType =
|
|
383
|
-
ChannelType =
|
|
394
|
+
AttachmentType = UR,
|
|
395
|
+
ChannelType = UR,
|
|
384
396
|
CommandType extends string = LiteralStringForUnion,
|
|
385
|
-
MessageType =
|
|
386
|
-
ReactionType =
|
|
387
|
-
UserType =
|
|
397
|
+
MessageType = UR,
|
|
398
|
+
ReactionType = UR,
|
|
399
|
+
UserType = UR
|
|
388
400
|
> = Omit<
|
|
389
401
|
MessageResponse<AttachmentType, ChannelType, CommandType, {}, ReactionType, UserType>,
|
|
390
402
|
'created_at' | 'pinned_at' | 'updated_at' | 'status'
|
|
@@ -396,9 +408,7 @@ export type FormatMessageResponse<
|
|
|
396
408
|
updated_at: Date;
|
|
397
409
|
};
|
|
398
410
|
|
|
399
|
-
export type GetChannelTypeResponse<
|
|
400
|
-
CommandType extends string = LiteralStringForUnion
|
|
401
|
-
> = APIResponse &
|
|
411
|
+
export type GetChannelTypeResponse<CommandType extends string = LiteralStringForUnion> = APIResponse &
|
|
402
412
|
Omit<CreateChannelOptions<CommandType>, 'client_id' | 'connection_id' | 'commands'> & {
|
|
403
413
|
created_at: string;
|
|
404
414
|
updated_at: string;
|
|
@@ -406,26 +416,19 @@ export type GetChannelTypeResponse<
|
|
|
406
416
|
grants?: Record<string, string[]>;
|
|
407
417
|
};
|
|
408
418
|
|
|
409
|
-
export type GetCommandResponse<
|
|
410
|
-
CommandType
|
|
411
|
-
|
|
419
|
+
export type GetCommandResponse<CommandType extends string = LiteralStringForUnion> = APIResponse &
|
|
420
|
+
CreateCommandOptions<CommandType> &
|
|
421
|
+
CreatedAtUpdatedAt;
|
|
412
422
|
|
|
413
423
|
export type GetMultipleMessagesAPIResponse<
|
|
414
|
-
AttachmentType =
|
|
415
|
-
ChannelType =
|
|
424
|
+
AttachmentType = UR,
|
|
425
|
+
ChannelType = UR,
|
|
416
426
|
CommandType extends string = LiteralStringForUnion,
|
|
417
|
-
MessageType =
|
|
418
|
-
ReactionType =
|
|
419
|
-
UserType =
|
|
427
|
+
MessageType = UR,
|
|
428
|
+
ReactionType = UR,
|
|
429
|
+
UserType = UR
|
|
420
430
|
> = APIResponse & {
|
|
421
|
-
messages: MessageResponse<
|
|
422
|
-
AttachmentType,
|
|
423
|
-
ChannelType,
|
|
424
|
-
CommandType,
|
|
425
|
-
MessageType,
|
|
426
|
-
ReactionType,
|
|
427
|
-
UserType
|
|
428
|
-
>[];
|
|
431
|
+
messages: MessageResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>[];
|
|
429
432
|
};
|
|
430
433
|
|
|
431
434
|
export type GetRateLimitsResponse = APIResponse & {
|
|
@@ -435,40 +438,25 @@ export type GetRateLimitsResponse = APIResponse & {
|
|
|
435
438
|
web?: RateLimitsMap;
|
|
436
439
|
};
|
|
437
440
|
|
|
438
|
-
export type GetReactionsAPIResponse<
|
|
439
|
-
ReactionType = UnknownType,
|
|
440
|
-
UserType = UnknownType
|
|
441
|
-
> = APIResponse & {
|
|
441
|
+
export type GetReactionsAPIResponse<ReactionType = UR, UserType = UR> = APIResponse & {
|
|
442
442
|
reactions: ReactionResponse<ReactionType, UserType>[];
|
|
443
443
|
};
|
|
444
444
|
|
|
445
445
|
export type GetRepliesAPIResponse<
|
|
446
|
-
AttachmentType =
|
|
447
|
-
ChannelType =
|
|
446
|
+
AttachmentType = UR,
|
|
447
|
+
ChannelType = UR,
|
|
448
448
|
CommandType extends string = LiteralStringForUnion,
|
|
449
|
-
MessageType =
|
|
450
|
-
ReactionType =
|
|
451
|
-
UserType =
|
|
449
|
+
MessageType = UR,
|
|
450
|
+
ReactionType = UR,
|
|
451
|
+
UserType = UR
|
|
452
452
|
> = APIResponse & {
|
|
453
|
-
messages: MessageResponse<
|
|
454
|
-
AttachmentType,
|
|
455
|
-
ChannelType,
|
|
456
|
-
CommandType,
|
|
457
|
-
MessageType,
|
|
458
|
-
ReactionType,
|
|
459
|
-
UserType
|
|
460
|
-
>[];
|
|
453
|
+
messages: MessageResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>[];
|
|
461
454
|
};
|
|
462
455
|
|
|
463
|
-
export type ListChannelResponse<
|
|
464
|
-
CommandType extends string = LiteralStringForUnion
|
|
465
|
-
> = APIResponse & {
|
|
456
|
+
export type ListChannelResponse<CommandType extends string = LiteralStringForUnion> = APIResponse & {
|
|
466
457
|
channel_types: Record<
|
|
467
458
|
string,
|
|
468
|
-
Omit<
|
|
469
|
-
CreateChannelOptions<CommandType>,
|
|
470
|
-
'client_id' | 'connection_id' | 'commands'
|
|
471
|
-
> & {
|
|
459
|
+
Omit<CreateChannelOptions<CommandType>, 'client_id' | 'connection_id' | 'commands'> & {
|
|
472
460
|
commands: CommandResponse<CommandType>[];
|
|
473
461
|
created_at: string;
|
|
474
462
|
updated_at: string;
|
|
@@ -481,16 +469,14 @@ export type ListChannelTypesAPIResponse<
|
|
|
481
469
|
CommandType extends string = LiteralStringForUnion
|
|
482
470
|
> = ListChannelResponse<CommandType>;
|
|
483
471
|
|
|
484
|
-
export type ListCommandsResponse<
|
|
485
|
-
CommandType
|
|
486
|
-
> = APIResponse & {
|
|
487
|
-
commands: Array<CreateCommandOptions<CommandType> & CreatedAtUpdatedAt>;
|
|
472
|
+
export type ListCommandsResponse<CommandType extends string = LiteralStringForUnion> = APIResponse & {
|
|
473
|
+
commands: Array<CreateCommandOptions<CommandType> & Partial<CreatedAtUpdatedAt>>;
|
|
488
474
|
};
|
|
489
475
|
|
|
490
476
|
export type MuteChannelAPIResponse<
|
|
491
|
-
ChannelType extends
|
|
477
|
+
ChannelType extends UR = UR,
|
|
492
478
|
CommandType extends string = LiteralStringForUnion,
|
|
493
|
-
UserType extends
|
|
479
|
+
UserType extends UR = UR
|
|
494
480
|
> = APIResponse & {
|
|
495
481
|
channel_mute: ChannelMute<ChannelType, CommandType, UserType>;
|
|
496
482
|
own_user: OwnUserResponse<ChannelType, CommandType, UserType>;
|
|
@@ -499,37 +485,23 @@ export type MuteChannelAPIResponse<
|
|
|
499
485
|
};
|
|
500
486
|
|
|
501
487
|
export type MessageResponse<
|
|
502
|
-
AttachmentType =
|
|
503
|
-
ChannelType =
|
|
488
|
+
AttachmentType = UR,
|
|
489
|
+
ChannelType = UR,
|
|
504
490
|
CommandType extends string = LiteralStringForUnion,
|
|
505
|
-
MessageType =
|
|
506
|
-
ReactionType =
|
|
507
|
-
UserType =
|
|
508
|
-
> = MessageResponseBase<
|
|
509
|
-
AttachmentType,
|
|
510
|
-
ChannelType,
|
|
511
|
-
CommandType,
|
|
512
|
-
MessageType,
|
|
513
|
-
ReactionType,
|
|
514
|
-
UserType
|
|
515
|
-
> & {
|
|
516
|
-
quoted_message?: MessageResponseBase<
|
|
517
|
-
AttachmentType,
|
|
518
|
-
ChannelType,
|
|
519
|
-
CommandType,
|
|
520
|
-
MessageType,
|
|
521
|
-
ReactionType,
|
|
522
|
-
UserType
|
|
523
|
-
>;
|
|
491
|
+
MessageType = UR,
|
|
492
|
+
ReactionType = UR,
|
|
493
|
+
UserType = UR
|
|
494
|
+
> = MessageResponseBase<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType> & {
|
|
495
|
+
quoted_message?: MessageResponseBase<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>;
|
|
524
496
|
};
|
|
525
497
|
|
|
526
498
|
export type MessageResponseBase<
|
|
527
|
-
AttachmentType =
|
|
528
|
-
ChannelType =
|
|
499
|
+
AttachmentType = UR,
|
|
500
|
+
ChannelType = UR,
|
|
529
501
|
CommandType extends string = LiteralStringForUnion,
|
|
530
|
-
MessageType =
|
|
531
|
-
ReactionType =
|
|
532
|
-
UserType =
|
|
502
|
+
MessageType = UR,
|
|
503
|
+
ReactionType = UR,
|
|
504
|
+
UserType = UR
|
|
533
505
|
> = MessageBase<AttachmentType, MessageType, UserType> & {
|
|
534
506
|
args?: string;
|
|
535
507
|
channel?: ChannelResponse<ChannelType, CommandType, UserType>;
|
|
@@ -558,7 +530,7 @@ export type MessageResponseBase<
|
|
|
558
530
|
updated_at?: string;
|
|
559
531
|
};
|
|
560
532
|
|
|
561
|
-
export type MuteResponse<UserType =
|
|
533
|
+
export type MuteResponse<UserType = UR> = {
|
|
562
534
|
user: UserResponse<UserType>;
|
|
563
535
|
created_at?: string;
|
|
564
536
|
expires?: string;
|
|
@@ -567,9 +539,9 @@ export type MuteResponse<UserType = UnknownType> = {
|
|
|
567
539
|
};
|
|
568
540
|
|
|
569
541
|
export type MuteUserResponse<
|
|
570
|
-
ChannelType extends
|
|
542
|
+
ChannelType extends UR = UR,
|
|
571
543
|
CommandType extends string = LiteralStringForUnion,
|
|
572
|
-
UserType extends
|
|
544
|
+
UserType extends UR = UR
|
|
573
545
|
> = APIResponse & {
|
|
574
546
|
mute?: MuteResponse<UserType>;
|
|
575
547
|
mutes?: Array<Mute<UserType>>;
|
|
@@ -577,9 +549,9 @@ export type MuteUserResponse<
|
|
|
577
549
|
};
|
|
578
550
|
|
|
579
551
|
export type OwnUserBase<
|
|
580
|
-
ChannelType extends
|
|
552
|
+
ChannelType extends UR = UR,
|
|
581
553
|
CommandType extends string = LiteralStringForUnion,
|
|
582
|
-
UserType extends
|
|
554
|
+
UserType extends UR = UR
|
|
583
555
|
> = {
|
|
584
556
|
channel_mutes: ChannelMute<ChannelType, CommandType, UserType>[];
|
|
585
557
|
devices: Device<UserType>[];
|
|
@@ -592,15 +564,15 @@ export type OwnUserBase<
|
|
|
592
564
|
};
|
|
593
565
|
|
|
594
566
|
export type OwnUserResponse<
|
|
595
|
-
ChannelType extends
|
|
567
|
+
ChannelType extends UR = UR,
|
|
596
568
|
CommandType extends string = LiteralStringForUnion,
|
|
597
|
-
UserType extends
|
|
569
|
+
UserType extends UR = UR
|
|
598
570
|
> = UserResponse<UserType> & OwnUserBase<ChannelType, CommandType, UserType>;
|
|
599
571
|
|
|
600
572
|
export type PartialUpdateChannelAPIResponse<
|
|
601
|
-
ChannelType =
|
|
573
|
+
ChannelType = UR,
|
|
602
574
|
CommandType extends string = LiteralStringForUnion,
|
|
603
|
-
UserType =
|
|
575
|
+
UserType = UR
|
|
604
576
|
> = APIResponse & {
|
|
605
577
|
channel: ChannelResponse<ChannelType, CommandType, UserType>;
|
|
606
578
|
members: ChannelMemberResponse<UserType>[];
|
|
@@ -615,55 +587,38 @@ export type PermissionsAPIResponse = APIResponse & {
|
|
|
615
587
|
};
|
|
616
588
|
|
|
617
589
|
export type ReactionAPIResponse<
|
|
618
|
-
AttachmentType =
|
|
619
|
-
ChannelType =
|
|
590
|
+
AttachmentType = UR,
|
|
591
|
+
ChannelType = UR,
|
|
620
592
|
CommandType extends string = LiteralStringForUnion,
|
|
621
|
-
MessageType =
|
|
622
|
-
ReactionType =
|
|
623
|
-
UserType =
|
|
593
|
+
MessageType = UR,
|
|
594
|
+
ReactionType = UR,
|
|
595
|
+
UserType = UR
|
|
624
596
|
> = APIResponse & {
|
|
625
|
-
message: MessageResponse<
|
|
626
|
-
AttachmentType,
|
|
627
|
-
ChannelType,
|
|
628
|
-
CommandType,
|
|
629
|
-
MessageType,
|
|
630
|
-
ReactionType,
|
|
631
|
-
UserType
|
|
632
|
-
>;
|
|
597
|
+
message: MessageResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>;
|
|
633
598
|
reaction: ReactionResponse<ReactionType, UserType>;
|
|
634
599
|
};
|
|
635
600
|
|
|
636
|
-
export type ReactionResponse<
|
|
637
|
-
ReactionType = UnknownType,
|
|
638
|
-
UserType = UnknownType
|
|
639
|
-
> = Reaction<ReactionType, UserType> & {
|
|
601
|
+
export type ReactionResponse<ReactionType = UR, UserType = UR> = Reaction<ReactionType, UserType> & {
|
|
640
602
|
created_at: string;
|
|
641
603
|
updated_at: string;
|
|
642
604
|
};
|
|
643
605
|
|
|
644
|
-
export type ReadResponse<UserType =
|
|
606
|
+
export type ReadResponse<UserType = UR> = {
|
|
645
607
|
last_read: string;
|
|
646
608
|
user: UserResponse<UserType>;
|
|
647
609
|
unread_messages?: number;
|
|
648
610
|
};
|
|
649
611
|
|
|
650
612
|
export type SearchAPIResponse<
|
|
651
|
-
AttachmentType =
|
|
652
|
-
ChannelType =
|
|
613
|
+
AttachmentType = UR,
|
|
614
|
+
ChannelType = UR,
|
|
653
615
|
CommandType extends string = LiteralStringForUnion,
|
|
654
|
-
MessageType =
|
|
655
|
-
ReactionType =
|
|
656
|
-
UserType =
|
|
616
|
+
MessageType = UR,
|
|
617
|
+
ReactionType = UR,
|
|
618
|
+
UserType = UR
|
|
657
619
|
> = APIResponse & {
|
|
658
620
|
results: {
|
|
659
|
-
message: MessageResponse<
|
|
660
|
-
AttachmentType,
|
|
661
|
-
ChannelType,
|
|
662
|
-
CommandType,
|
|
663
|
-
MessageType,
|
|
664
|
-
ReactionType,
|
|
665
|
-
UserType
|
|
666
|
-
>;
|
|
621
|
+
message: MessageResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>;
|
|
667
622
|
}[];
|
|
668
623
|
next?: string;
|
|
669
624
|
previous?: string;
|
|
@@ -679,62 +634,48 @@ export type SearchWarning = {
|
|
|
679
634
|
export type SendFileAPIResponse = APIResponse & { file: string };
|
|
680
635
|
|
|
681
636
|
export type SendMessageAPIResponse<
|
|
682
|
-
AttachmentType =
|
|
683
|
-
ChannelType =
|
|
637
|
+
AttachmentType = UR,
|
|
638
|
+
ChannelType = UR,
|
|
684
639
|
CommandType extends string = LiteralStringForUnion,
|
|
685
|
-
MessageType =
|
|
686
|
-
ReactionType =
|
|
687
|
-
UserType =
|
|
640
|
+
MessageType = UR,
|
|
641
|
+
ReactionType = UR,
|
|
642
|
+
UserType = UR
|
|
688
643
|
> = APIResponse & {
|
|
689
|
-
message: MessageResponse<
|
|
690
|
-
AttachmentType,
|
|
691
|
-
ChannelType,
|
|
692
|
-
CommandType,
|
|
693
|
-
MessageType,
|
|
694
|
-
ReactionType,
|
|
695
|
-
UserType
|
|
696
|
-
>;
|
|
644
|
+
message: MessageResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>;
|
|
697
645
|
};
|
|
698
646
|
|
|
699
647
|
export type TruncateChannelAPIResponse<
|
|
700
|
-
ChannelType =
|
|
648
|
+
ChannelType = UR,
|
|
701
649
|
CommandType extends string = LiteralStringForUnion,
|
|
702
|
-
UserType =
|
|
650
|
+
UserType = UR,
|
|
651
|
+
AttachmentType = UR,
|
|
652
|
+
MessageType = UR,
|
|
653
|
+
ReactionType = UR
|
|
703
654
|
> = APIResponse & {
|
|
704
655
|
channel: ChannelResponse<ChannelType, CommandType, UserType>;
|
|
656
|
+
message?: MessageResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>;
|
|
705
657
|
};
|
|
706
658
|
|
|
707
659
|
export type UpdateChannelAPIResponse<
|
|
708
|
-
AttachmentType =
|
|
709
|
-
ChannelType =
|
|
660
|
+
AttachmentType = UR,
|
|
661
|
+
ChannelType = UR,
|
|
710
662
|
CommandType extends string = LiteralStringForUnion,
|
|
711
|
-
MessageType =
|
|
712
|
-
ReactionType =
|
|
713
|
-
UserType =
|
|
663
|
+
MessageType = UR,
|
|
664
|
+
ReactionType = UR,
|
|
665
|
+
UserType = UR
|
|
714
666
|
> = APIResponse & {
|
|
715
667
|
channel: ChannelResponse<ChannelType, CommandType, UserType>;
|
|
716
668
|
members: ChannelMemberResponse<UserType>[];
|
|
717
|
-
message?: MessageResponse<
|
|
718
|
-
AttachmentType,
|
|
719
|
-
ChannelType,
|
|
720
|
-
CommandType,
|
|
721
|
-
MessageType,
|
|
722
|
-
ReactionType,
|
|
723
|
-
UserType
|
|
724
|
-
>;
|
|
669
|
+
message?: MessageResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>;
|
|
725
670
|
};
|
|
726
671
|
|
|
727
|
-
export type UpdateChannelResponse<
|
|
728
|
-
CommandType extends string = LiteralStringForUnion
|
|
729
|
-
> = APIResponse &
|
|
672
|
+
export type UpdateChannelResponse<CommandType extends string = LiteralStringForUnion> = APIResponse &
|
|
730
673
|
Omit<CreateChannelOptions<CommandType>, 'client_id' | 'connection_id'> & {
|
|
731
674
|
created_at: string;
|
|
732
675
|
updated_at: string;
|
|
733
676
|
};
|
|
734
677
|
|
|
735
|
-
export type UpdateCommandResponse<
|
|
736
|
-
CommandType extends string = LiteralStringForUnion
|
|
737
|
-
> = APIResponse & {
|
|
678
|
+
export type UpdateCommandResponse<CommandType extends string = LiteralStringForUnion> = APIResponse & {
|
|
738
679
|
command: UpdateCommandOptions<CommandType> &
|
|
739
680
|
CreatedAtUpdatedAt & {
|
|
740
681
|
name: CommandVariants<CommandType>;
|
|
@@ -742,32 +683,25 @@ export type UpdateCommandResponse<
|
|
|
742
683
|
};
|
|
743
684
|
|
|
744
685
|
export type UpdateMessageAPIResponse<
|
|
745
|
-
AttachmentType =
|
|
746
|
-
ChannelType =
|
|
686
|
+
AttachmentType = UR,
|
|
687
|
+
ChannelType = UR,
|
|
747
688
|
CommandType extends string = LiteralStringForUnion,
|
|
748
|
-
MessageType =
|
|
749
|
-
ReactionType =
|
|
750
|
-
UserType =
|
|
689
|
+
MessageType = UR,
|
|
690
|
+
ReactionType = UR,
|
|
691
|
+
UserType = UR
|
|
751
692
|
> = APIResponse & {
|
|
752
|
-
message: MessageResponse<
|
|
753
|
-
AttachmentType,
|
|
754
|
-
ChannelType,
|
|
755
|
-
CommandType,
|
|
756
|
-
MessageType,
|
|
757
|
-
ReactionType,
|
|
758
|
-
UserType
|
|
759
|
-
>;
|
|
693
|
+
message: MessageResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>;
|
|
760
694
|
};
|
|
761
695
|
|
|
762
|
-
export type UsersAPIResponse<UserType =
|
|
696
|
+
export type UsersAPIResponse<UserType = UR> = APIResponse & {
|
|
763
697
|
users: Array<UserResponse<UserType>>;
|
|
764
698
|
};
|
|
765
699
|
|
|
766
|
-
export type UpdateUsersAPIResponse<UserType =
|
|
700
|
+
export type UpdateUsersAPIResponse<UserType = UR> = APIResponse & {
|
|
767
701
|
users: { [key: string]: UserResponse<UserType> };
|
|
768
702
|
};
|
|
769
703
|
|
|
770
|
-
export type UserResponse<UserType =
|
|
704
|
+
export type UserResponse<UserType = UR> = User<UserType> & {
|
|
771
705
|
banned?: boolean;
|
|
772
706
|
created_at?: string;
|
|
773
707
|
deactivated_at?: string;
|
|
@@ -775,11 +709,17 @@ export type UserResponse<UserType = UnknownType> = User<UserType> & {
|
|
|
775
709
|
language?: TranslationLanguages | '';
|
|
776
710
|
last_active?: string;
|
|
777
711
|
online?: boolean;
|
|
712
|
+
push_notifications?: PushNotificationSettings;
|
|
778
713
|
revoke_tokens_issued_before?: string;
|
|
779
714
|
shadow_banned?: boolean;
|
|
780
715
|
updated_at?: string;
|
|
781
716
|
};
|
|
782
717
|
|
|
718
|
+
export type PushNotificationSettings = {
|
|
719
|
+
disabled?: boolean;
|
|
720
|
+
disabled_until?: string | null;
|
|
721
|
+
};
|
|
722
|
+
|
|
783
723
|
/**
|
|
784
724
|
* Option Types
|
|
785
725
|
*/
|
|
@@ -789,44 +729,38 @@ export type MessageFlagsPaginationOptions = {
|
|
|
789
729
|
offset?: number;
|
|
790
730
|
};
|
|
791
731
|
|
|
792
|
-
export type
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
732
|
+
export type FlagReportsPaginationOptions = {
|
|
733
|
+
limit?: number;
|
|
734
|
+
offset?: number;
|
|
735
|
+
};
|
|
736
|
+
|
|
737
|
+
export type ReviewFlagReportOptions = {
|
|
738
|
+
review_details?: Object;
|
|
739
|
+
user_id?: string;
|
|
740
|
+
};
|
|
796
741
|
|
|
797
|
-
export type
|
|
742
|
+
export type BannedUsersPaginationOptions = Omit<PaginationOptions, 'id_gt' | 'id_gte' | 'id_lt' | 'id_lte'>;
|
|
743
|
+
|
|
744
|
+
export type BanUserOptions<UserType = UR> = UnBanUserOptions & {
|
|
798
745
|
banned_by?: UserResponse<UserType>;
|
|
799
746
|
banned_by_id?: string;
|
|
800
747
|
ip_ban?: boolean;
|
|
801
748
|
reason?: string;
|
|
802
749
|
timeout?: number;
|
|
803
|
-
/**
|
|
804
|
-
* @deprecated please use banned_by
|
|
805
|
-
*/
|
|
806
|
-
user?: UserResponse<UserType>;
|
|
807
|
-
/**
|
|
808
|
-
* @deprecated please use banned_by_id
|
|
809
|
-
*/
|
|
810
|
-
user_id?: string;
|
|
811
750
|
};
|
|
812
751
|
|
|
813
752
|
export type ChannelOptions = {
|
|
814
|
-
last_message_ids?: { [key: string]: string };
|
|
815
753
|
limit?: number;
|
|
754
|
+
member_limit?: number;
|
|
816
755
|
message_limit?: number;
|
|
817
756
|
offset?: number;
|
|
818
757
|
presence?: boolean;
|
|
819
|
-
recovery?: boolean;
|
|
820
758
|
state?: boolean;
|
|
821
759
|
user_id?: string;
|
|
822
760
|
watch?: boolean;
|
|
823
761
|
};
|
|
824
762
|
|
|
825
|
-
export type ChannelQueryOptions<
|
|
826
|
-
ChannelType = UnknownType,
|
|
827
|
-
CommandType extends string = LiteralStringForUnion,
|
|
828
|
-
UserType = UnknownType
|
|
829
|
-
> = {
|
|
763
|
+
export type ChannelQueryOptions<ChannelType = UR, CommandType extends string = LiteralStringForUnion, UserType = UR> = {
|
|
830
764
|
client_id?: string;
|
|
831
765
|
connection_id?: string;
|
|
832
766
|
data?: ChannelResponse<ChannelType, CommandType, UserType>;
|
|
@@ -889,12 +823,12 @@ export type CustomPermissionOptions = {
|
|
|
889
823
|
|
|
890
824
|
// TODO: rename to UpdateChannelOptions in the next major update and use it in channel._update and/or channel.update
|
|
891
825
|
export type InviteOptions<
|
|
892
|
-
AttachmentType =
|
|
893
|
-
ChannelType =
|
|
826
|
+
AttachmentType = UR,
|
|
827
|
+
ChannelType = UR,
|
|
894
828
|
CommandType extends string = LiteralStringForUnion,
|
|
895
|
-
MessageType =
|
|
896
|
-
ReactionType =
|
|
897
|
-
UserType =
|
|
829
|
+
MessageType = UR,
|
|
830
|
+
ReactionType = UR,
|
|
831
|
+
UserType = UR
|
|
898
832
|
> = {
|
|
899
833
|
accept_invite?: boolean;
|
|
900
834
|
add_members?: string[];
|
|
@@ -904,14 +838,7 @@ export type InviteOptions<
|
|
|
904
838
|
data?: Omit<ChannelResponse<ChannelType, CommandType, UserType>, 'id' | 'cid'>;
|
|
905
839
|
demote_moderators?: string[];
|
|
906
840
|
invites?: string[];
|
|
907
|
-
message?: MessageResponse<
|
|
908
|
-
AttachmentType,
|
|
909
|
-
ChannelType,
|
|
910
|
-
CommandType,
|
|
911
|
-
MessageType,
|
|
912
|
-
ReactionType,
|
|
913
|
-
UserType
|
|
914
|
-
>;
|
|
841
|
+
message?: MessageResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>;
|
|
915
842
|
reject_invite?: boolean;
|
|
916
843
|
remove_members?: string[];
|
|
917
844
|
user?: UserResponse<UserType>;
|
|
@@ -919,11 +846,9 @@ export type InviteOptions<
|
|
|
919
846
|
};
|
|
920
847
|
|
|
921
848
|
/** @deprecated use MarkChannelsReadOptions instead */
|
|
922
|
-
export type MarkAllReadOptions<
|
|
923
|
-
UserType = UnknownType
|
|
924
|
-
> = MarkChannelsReadOptions<UserType>;
|
|
849
|
+
export type MarkAllReadOptions<UserType = UR> = MarkChannelsReadOptions<UserType>;
|
|
925
850
|
|
|
926
|
-
export type MarkChannelsReadOptions<UserType =
|
|
851
|
+
export type MarkChannelsReadOptions<UserType = UR> = {
|
|
927
852
|
client_id?: string;
|
|
928
853
|
connection_id?: string;
|
|
929
854
|
read_by_channel?: Record<string, string>;
|
|
@@ -931,7 +856,7 @@ export type MarkChannelsReadOptions<UserType = UnknownType> = {
|
|
|
931
856
|
user_id?: string;
|
|
932
857
|
};
|
|
933
858
|
|
|
934
|
-
export type MarkReadOptions<UserType =
|
|
859
|
+
export type MarkReadOptions<UserType = UR> = {
|
|
935
860
|
client_id?: string;
|
|
936
861
|
connection_id?: string;
|
|
937
862
|
message_id?: string;
|
|
@@ -939,7 +864,7 @@ export type MarkReadOptions<UserType = UnknownType> = {
|
|
|
939
864
|
user_id?: string;
|
|
940
865
|
};
|
|
941
866
|
|
|
942
|
-
export type MuteUserOptions<UserType =
|
|
867
|
+
export type MuteUserOptions<UserType = UR> = {
|
|
943
868
|
client_id?: string;
|
|
944
869
|
connection_id?: string;
|
|
945
870
|
id?: string;
|
|
@@ -969,6 +894,21 @@ export type MessagePaginationOptions = PaginationOptions & {
|
|
|
969
894
|
id_around?: string;
|
|
970
895
|
};
|
|
971
896
|
|
|
897
|
+
export type PinnedMessagePaginationOptions = {
|
|
898
|
+
id_around?: string;
|
|
899
|
+
id_gt?: string;
|
|
900
|
+
id_gte?: string;
|
|
901
|
+
id_lt?: string;
|
|
902
|
+
id_lte?: string;
|
|
903
|
+
limit?: number;
|
|
904
|
+
offset?: number;
|
|
905
|
+
pinned_at_after?: string | Date;
|
|
906
|
+
pinned_at_after_or_equal?: string | Date;
|
|
907
|
+
pinned_at_around?: string | Date;
|
|
908
|
+
pinned_at_before?: string | Date;
|
|
909
|
+
pinned_at_before_or_equal?: string | Date;
|
|
910
|
+
};
|
|
911
|
+
|
|
972
912
|
export type QueryMembersOptions = {
|
|
973
913
|
limit?: number;
|
|
974
914
|
offset?: number;
|
|
@@ -978,7 +918,7 @@ export type QueryMembersOptions = {
|
|
|
978
918
|
user_id_lte?: string;
|
|
979
919
|
};
|
|
980
920
|
|
|
981
|
-
export type SearchOptions<MessageType =
|
|
921
|
+
export type SearchOptions<MessageType = UR> = {
|
|
982
922
|
limit?: number;
|
|
983
923
|
next?: string;
|
|
984
924
|
offset?: number;
|
|
@@ -998,6 +938,8 @@ export type StreamChatOptions = AxiosRequestConfig & {
|
|
|
998
938
|
browser?: boolean;
|
|
999
939
|
device?: BaseDeviceFields;
|
|
1000
940
|
enableInsights?: boolean;
|
|
941
|
+
/** experimental feature, please contact support if you want this feature enabled for you */
|
|
942
|
+
enableWSFallback?: boolean;
|
|
1001
943
|
logger?: Logger;
|
|
1002
944
|
/**
|
|
1003
945
|
* When network is recovered, we re-query the active channels on client. But in single query, you can recover
|
|
@@ -1022,9 +964,10 @@ export type UnBanUserOptions = {
|
|
|
1022
964
|
};
|
|
1023
965
|
|
|
1024
966
|
// TODO: rename to UpdateChannelTypeOptions in the next major update
|
|
1025
|
-
export type UpdateChannelOptions<
|
|
1026
|
-
CommandType
|
|
1027
|
-
|
|
967
|
+
export type UpdateChannelOptions<CommandType extends string = LiteralStringForUnion> = Omit<
|
|
968
|
+
CreateChannelOptions<CommandType>,
|
|
969
|
+
'name'
|
|
970
|
+
> & {
|
|
1028
971
|
created_at?: string;
|
|
1029
972
|
updated_at?: string;
|
|
1030
973
|
};
|
|
@@ -1051,13 +994,13 @@ export type ConnectionChangeEvent = {
|
|
|
1051
994
|
};
|
|
1052
995
|
|
|
1053
996
|
export type Event<
|
|
1054
|
-
AttachmentType extends
|
|
1055
|
-
ChannelType extends
|
|
997
|
+
AttachmentType extends UR = UR,
|
|
998
|
+
ChannelType extends UR = UR,
|
|
1056
999
|
CommandType extends string = LiteralStringForUnion,
|
|
1057
|
-
EventType extends
|
|
1058
|
-
MessageType extends
|
|
1059
|
-
ReactionType extends
|
|
1060
|
-
UserType extends
|
|
1000
|
+
EventType extends UR = UR,
|
|
1001
|
+
MessageType extends UR = UR,
|
|
1002
|
+
ReactionType extends UR = UR,
|
|
1003
|
+
UserType extends UR = UR
|
|
1061
1004
|
> = EventType & {
|
|
1062
1005
|
type: EventTypes;
|
|
1063
1006
|
channel?: ChannelResponse<ChannelType, CommandType, UserType>;
|
|
@@ -1071,14 +1014,7 @@ export type Event<
|
|
|
1071
1014
|
mark_messages_deleted?: boolean;
|
|
1072
1015
|
me?: OwnUserResponse<ChannelType, CommandType, UserType>;
|
|
1073
1016
|
member?: ChannelMemberResponse<UserType>;
|
|
1074
|
-
message?: MessageResponse<
|
|
1075
|
-
AttachmentType,
|
|
1076
|
-
ChannelType,
|
|
1077
|
-
CommandType,
|
|
1078
|
-
MessageType,
|
|
1079
|
-
ReactionType,
|
|
1080
|
-
UserType
|
|
1081
|
-
>;
|
|
1017
|
+
message?: MessageResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>;
|
|
1082
1018
|
online?: boolean;
|
|
1083
1019
|
parent_id?: string;
|
|
1084
1020
|
reaction?: ReactionResponse<ReactionType, UserType>;
|
|
@@ -1092,29 +1028,19 @@ export type Event<
|
|
|
1092
1028
|
watcher_count?: number;
|
|
1093
1029
|
};
|
|
1094
1030
|
|
|
1095
|
-
export type UserCustomEvent<EventType extends
|
|
1031
|
+
export type UserCustomEvent<EventType extends UR = UR> = EventType & {
|
|
1096
1032
|
type: string;
|
|
1097
1033
|
};
|
|
1098
1034
|
|
|
1099
1035
|
export type EventHandler<
|
|
1100
|
-
AttachmentType extends
|
|
1101
|
-
ChannelType extends
|
|
1036
|
+
AttachmentType extends UR = UR,
|
|
1037
|
+
ChannelType extends UR = UR,
|
|
1102
1038
|
CommandType extends string = LiteralStringForUnion,
|
|
1103
|
-
EventType extends
|
|
1104
|
-
MessageType extends
|
|
1105
|
-
ReactionType extends
|
|
1106
|
-
UserType extends
|
|
1107
|
-
> = (
|
|
1108
|
-
event: Event<
|
|
1109
|
-
AttachmentType,
|
|
1110
|
-
ChannelType,
|
|
1111
|
-
CommandType,
|
|
1112
|
-
EventType,
|
|
1113
|
-
MessageType,
|
|
1114
|
-
ReactionType,
|
|
1115
|
-
UserType
|
|
1116
|
-
>,
|
|
1117
|
-
) => void;
|
|
1039
|
+
EventType extends UR = UR,
|
|
1040
|
+
MessageType extends UR = UR,
|
|
1041
|
+
ReactionType extends UR = UR,
|
|
1042
|
+
UserType extends UR = UR
|
|
1043
|
+
> = (event: Event<AttachmentType, ChannelType, CommandType, EventType, MessageType, ReactionType, UserType>) => void;
|
|
1118
1044
|
|
|
1119
1045
|
export type EventTypes =
|
|
1120
1046
|
| 'all'
|
|
@@ -1126,6 +1052,7 @@ export type EventTypes =
|
|
|
1126
1052
|
| 'channel.unmuted'
|
|
1127
1053
|
| 'channel.updated'
|
|
1128
1054
|
| 'channel.visible'
|
|
1055
|
+
| 'transport.changed' // ws vs longpoll
|
|
1129
1056
|
| 'connection.changed'
|
|
1130
1057
|
| 'connection.recovered'
|
|
1131
1058
|
| 'health.check'
|
|
@@ -1176,32 +1103,60 @@ export type MessageFlagsFiltersOptions = {
|
|
|
1176
1103
|
export type MessageFlagsFilters = QueryFilters<
|
|
1177
1104
|
{
|
|
1178
1105
|
channel_cid?:
|
|
1179
|
-
| RequireOnlyOne<
|
|
1180
|
-
Pick<QueryFilter<MessageFlagsFiltersOptions['channel_cid']>, '$eq' | '$in'>
|
|
1181
|
-
>
|
|
1106
|
+
| RequireOnlyOne<Pick<QueryFilter<MessageFlagsFiltersOptions['channel_cid']>, '$eq' | '$in'>>
|
|
1182
1107
|
| PrimitiveFilter<MessageFlagsFiltersOptions['channel_cid']>;
|
|
1183
1108
|
} & {
|
|
1184
1109
|
team?:
|
|
1185
|
-
| RequireOnlyOne<
|
|
1186
|
-
Pick<QueryFilter<MessageFlagsFiltersOptions['team']>, '$eq' | '$in'>
|
|
1187
|
-
>
|
|
1110
|
+
| RequireOnlyOne<Pick<QueryFilter<MessageFlagsFiltersOptions['team']>, '$eq' | '$in'>>
|
|
1188
1111
|
| PrimitiveFilter<MessageFlagsFiltersOptions['team']>;
|
|
1189
1112
|
} & {
|
|
1190
1113
|
user_id?:
|
|
1191
|
-
| RequireOnlyOne<
|
|
1192
|
-
Pick<QueryFilter<MessageFlagsFiltersOptions['user_id']>, '$eq' | '$in'>
|
|
1193
|
-
>
|
|
1114
|
+
| RequireOnlyOne<Pick<QueryFilter<MessageFlagsFiltersOptions['user_id']>, '$eq' | '$in'>>
|
|
1194
1115
|
| PrimitiveFilter<MessageFlagsFiltersOptions['user_id']>;
|
|
1195
1116
|
} & {
|
|
1196
|
-
[Key in keyof Omit<
|
|
1197
|
-
MessageFlagsFiltersOptions,
|
|
1198
|
-
'channel_cid' | 'user_id' | 'is_reviewed'
|
|
1199
|
-
>]:
|
|
1117
|
+
[Key in keyof Omit<MessageFlagsFiltersOptions, 'channel_cid' | 'user_id' | 'is_reviewed'>]:
|
|
1200
1118
|
| RequireOnlyOne<QueryFilter<MessageFlagsFiltersOptions[Key]>>
|
|
1201
1119
|
| PrimitiveFilter<MessageFlagsFiltersOptions[Key]>;
|
|
1202
1120
|
}
|
|
1203
1121
|
>;
|
|
1204
1122
|
|
|
1123
|
+
export type FlagReportsFiltersOptions = {
|
|
1124
|
+
is_reviewed?: boolean;
|
|
1125
|
+
message_id?: string;
|
|
1126
|
+
report_id?: string;
|
|
1127
|
+
review_result?: string;
|
|
1128
|
+
reviewed_by?: string;
|
|
1129
|
+
user_id?: string;
|
|
1130
|
+
};
|
|
1131
|
+
|
|
1132
|
+
export type FlagReportsFilters = QueryFilters<
|
|
1133
|
+
{
|
|
1134
|
+
report_id?:
|
|
1135
|
+
| RequireOnlyOne<Pick<QueryFilter<FlagReportsFiltersOptions['report_id']>, '$eq' | '$in'>>
|
|
1136
|
+
| PrimitiveFilter<FlagReportsFiltersOptions['report_id']>;
|
|
1137
|
+
} & {
|
|
1138
|
+
review_result?:
|
|
1139
|
+
| RequireOnlyOne<Pick<QueryFilter<FlagReportsFiltersOptions['review_result']>, '$eq' | '$in'>>
|
|
1140
|
+
| PrimitiveFilter<FlagReportsFiltersOptions['review_result']>;
|
|
1141
|
+
} & {
|
|
1142
|
+
reviewed_by?:
|
|
1143
|
+
| RequireOnlyOne<Pick<QueryFilter<FlagReportsFiltersOptions['reviewed_by']>, '$eq' | '$in'>>
|
|
1144
|
+
| PrimitiveFilter<FlagReportsFiltersOptions['reviewed_by']>;
|
|
1145
|
+
} & {
|
|
1146
|
+
user_id?:
|
|
1147
|
+
| RequireOnlyOne<Pick<QueryFilter<FlagReportsFiltersOptions['user_id']>, '$eq' | '$in'>>
|
|
1148
|
+
| PrimitiveFilter<FlagReportsFiltersOptions['user_id']>;
|
|
1149
|
+
} & {
|
|
1150
|
+
message_id?:
|
|
1151
|
+
| RequireOnlyOne<Pick<QueryFilter<FlagReportsFiltersOptions['message_id']>, '$eq' | '$in'>>
|
|
1152
|
+
| PrimitiveFilter<FlagReportsFiltersOptions['message_id']>;
|
|
1153
|
+
} & {
|
|
1154
|
+
[Key in keyof Omit<
|
|
1155
|
+
FlagReportsFiltersOptions,
|
|
1156
|
+
'report_id' | 'user_id' | 'message_id' | 'review_result' | 'reviewed_by'
|
|
1157
|
+
>]: RequireOnlyOne<QueryFilter<FlagReportsFiltersOptions[Key]>> | PrimitiveFilter<FlagReportsFiltersOptions[Key]>;
|
|
1158
|
+
}
|
|
1159
|
+
>;
|
|
1205
1160
|
export type BannedUsersFilterOptions = {
|
|
1206
1161
|
banned_by_id?: string;
|
|
1207
1162
|
channel_cid?: string;
|
|
@@ -1213,9 +1168,7 @@ export type BannedUsersFilterOptions = {
|
|
|
1213
1168
|
export type BannedUsersFilters = QueryFilters<
|
|
1214
1169
|
{
|
|
1215
1170
|
channel_cid?:
|
|
1216
|
-
| RequireOnlyOne<
|
|
1217
|
-
Pick<QueryFilter<BannedUsersFilterOptions['channel_cid']>, '$eq' | '$in'>
|
|
1218
|
-
>
|
|
1171
|
+
| RequireOnlyOne<Pick<QueryFilter<BannedUsersFilterOptions['channel_cid']>, '$eq' | '$in'>>
|
|
1219
1172
|
| PrimitiveFilter<BannedUsersFilterOptions['channel_cid']>;
|
|
1220
1173
|
} & {
|
|
1221
1174
|
reason?:
|
|
@@ -1233,9 +1186,9 @@ export type BannedUsersFilters = QueryFilters<
|
|
|
1233
1186
|
>;
|
|
1234
1187
|
|
|
1235
1188
|
export type ChannelFilters<
|
|
1236
|
-
ChannelType =
|
|
1189
|
+
ChannelType = UR,
|
|
1237
1190
|
CommandType extends string = LiteralStringForUnion,
|
|
1238
|
-
UserType =
|
|
1191
|
+
UserType = UR
|
|
1239
1192
|
> = QueryFilters<
|
|
1240
1193
|
ContainsOperator<ChannelType> & {
|
|
1241
1194
|
members?:
|
|
@@ -1251,10 +1204,7 @@ export type ChannelFilters<
|
|
|
1251
1204
|
>
|
|
1252
1205
|
| PrimitiveFilter<ChannelResponse<ChannelType, CommandType, UserType>['name']>;
|
|
1253
1206
|
} & {
|
|
1254
|
-
[Key in keyof Omit<
|
|
1255
|
-
ChannelResponse<{}, CommandType, UserType>,
|
|
1256
|
-
'name' | 'members'
|
|
1257
|
-
>]:
|
|
1207
|
+
[Key in keyof Omit<ChannelResponse<{}, CommandType, UserType>, 'name' | 'members'>]:
|
|
1258
1208
|
| RequireOnlyOne<QueryFilter<ChannelResponse<{}, CommandType, UserType>[Key]>>
|
|
1259
1209
|
| PrimitiveFilter<ChannelResponse<{}, CommandType, UserType>[Key]>;
|
|
1260
1210
|
}
|
|
@@ -1275,12 +1225,12 @@ export type ContainsOperator<CustomType = {}> = {
|
|
|
1275
1225
|
};
|
|
1276
1226
|
|
|
1277
1227
|
export type MessageFilters<
|
|
1278
|
-
AttachmentType =
|
|
1279
|
-
ChannelType =
|
|
1228
|
+
AttachmentType = UR,
|
|
1229
|
+
ChannelType = UR,
|
|
1280
1230
|
CommandType extends string = LiteralStringForUnion,
|
|
1281
|
-
MessageType =
|
|
1282
|
-
ReactionType =
|
|
1283
|
-
UserType =
|
|
1231
|
+
MessageType = UR,
|
|
1232
|
+
ReactionType = UR,
|
|
1233
|
+
UserType = UR
|
|
1284
1234
|
> = QueryFilters<
|
|
1285
1235
|
ContainsOperator<MessageType> & {
|
|
1286
1236
|
text?:
|
|
@@ -1294,78 +1244,29 @@ export type MessageFilters<
|
|
|
1294
1244
|
ReactionType,
|
|
1295
1245
|
UserType
|
|
1296
1246
|
>['text'];
|
|
1297
|
-
$q?: MessageResponse<
|
|
1298
|
-
AttachmentType,
|
|
1299
|
-
ChannelType,
|
|
1300
|
-
CommandType,
|
|
1301
|
-
MessageType,
|
|
1302
|
-
ReactionType,
|
|
1303
|
-
UserType
|
|
1304
|
-
>['text'];
|
|
1247
|
+
$q?: MessageResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>['text'];
|
|
1305
1248
|
} & QueryFilter<
|
|
1306
|
-
MessageResponse<
|
|
1307
|
-
AttachmentType,
|
|
1308
|
-
ChannelType,
|
|
1309
|
-
CommandType,
|
|
1310
|
-
MessageType,
|
|
1311
|
-
ReactionType,
|
|
1312
|
-
UserType
|
|
1313
|
-
>['text']
|
|
1249
|
+
MessageResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>['text']
|
|
1314
1250
|
>
|
|
1315
1251
|
>
|
|
1316
1252
|
| PrimitiveFilter<
|
|
1317
|
-
MessageResponse<
|
|
1318
|
-
AttachmentType,
|
|
1319
|
-
ChannelType,
|
|
1320
|
-
CommandType,
|
|
1321
|
-
MessageType,
|
|
1322
|
-
ReactionType,
|
|
1323
|
-
UserType
|
|
1324
|
-
>['text']
|
|
1253
|
+
MessageResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>['text']
|
|
1325
1254
|
>;
|
|
1326
1255
|
} & {
|
|
1327
1256
|
[Key in keyof Omit<
|
|
1328
|
-
MessageResponse<
|
|
1329
|
-
AttachmentType,
|
|
1330
|
-
ChannelType,
|
|
1331
|
-
CommandType,
|
|
1332
|
-
{},
|
|
1333
|
-
ReactionType,
|
|
1334
|
-
UserType
|
|
1335
|
-
>,
|
|
1257
|
+
MessageResponse<AttachmentType, ChannelType, CommandType, {}, ReactionType, UserType>,
|
|
1336
1258
|
'text'
|
|
1337
1259
|
>]?:
|
|
1338
1260
|
| RequireOnlyOne<
|
|
1339
|
-
QueryFilter<
|
|
1340
|
-
MessageResponse<
|
|
1341
|
-
AttachmentType,
|
|
1342
|
-
ChannelType,
|
|
1343
|
-
CommandType,
|
|
1344
|
-
{},
|
|
1345
|
-
ReactionType,
|
|
1346
|
-
UserType
|
|
1347
|
-
>[Key]
|
|
1348
|
-
>
|
|
1261
|
+
QueryFilter<MessageResponse<AttachmentType, ChannelType, CommandType, {}, ReactionType, UserType>[Key]>
|
|
1349
1262
|
>
|
|
1350
|
-
| PrimitiveFilter<
|
|
1351
|
-
MessageResponse<
|
|
1352
|
-
AttachmentType,
|
|
1353
|
-
ChannelType,
|
|
1354
|
-
CommandType,
|
|
1355
|
-
{},
|
|
1356
|
-
ReactionType,
|
|
1357
|
-
UserType
|
|
1358
|
-
>[Key]
|
|
1359
|
-
>;
|
|
1263
|
+
| PrimitiveFilter<MessageResponse<AttachmentType, ChannelType, CommandType, {}, ReactionType, UserType>[Key]>;
|
|
1360
1264
|
}
|
|
1361
1265
|
>;
|
|
1362
1266
|
|
|
1363
1267
|
export type PrimitiveFilter<ObjectType> = ObjectType | null;
|
|
1364
1268
|
|
|
1365
|
-
export type QueryFilter<ObjectType = string> = NonNullable<ObjectType> extends
|
|
1366
|
-
| string
|
|
1367
|
-
| number
|
|
1368
|
-
| boolean
|
|
1269
|
+
export type QueryFilter<ObjectType = string> = NonNullable<ObjectType> extends string | number | boolean
|
|
1369
1270
|
? {
|
|
1370
1271
|
$eq?: PrimitiveFilter<ObjectType>;
|
|
1371
1272
|
$exists?: boolean;
|
|
@@ -1396,21 +1297,13 @@ export type QueryLogicalOperators<Operators> = {
|
|
|
1396
1297
|
$or?: ArrayTwoOrMore<QueryFilters<Operators>>;
|
|
1397
1298
|
};
|
|
1398
1299
|
|
|
1399
|
-
export type UserFilters<UserType =
|
|
1300
|
+
export type UserFilters<UserType = UR> = QueryFilters<
|
|
1400
1301
|
ContainsOperator<UserType> & {
|
|
1401
1302
|
id?:
|
|
1402
|
-
| RequireOnlyOne<
|
|
1403
|
-
{ $autocomplete?: UserResponse<UserType>['id'] } & QueryFilter<
|
|
1404
|
-
UserResponse<UserType>['id']
|
|
1405
|
-
>
|
|
1406
|
-
>
|
|
1303
|
+
| RequireOnlyOne<{ $autocomplete?: UserResponse<UserType>['id'] } & QueryFilter<UserResponse<UserType>['id']>>
|
|
1407
1304
|
| PrimitiveFilter<UserResponse<UserType>['id']>;
|
|
1408
1305
|
name?:
|
|
1409
|
-
| RequireOnlyOne<
|
|
1410
|
-
{ $autocomplete?: UserResponse<UserType>['name'] } & QueryFilter<
|
|
1411
|
-
UserResponse<UserType>['name']
|
|
1412
|
-
>
|
|
1413
|
-
>
|
|
1306
|
+
| RequireOnlyOne<{ $autocomplete?: UserResponse<UserType>['name'] } & QueryFilter<UserResponse<UserType>['name']>>
|
|
1414
1307
|
| PrimitiveFilter<UserResponse<UserType>['name']>;
|
|
1415
1308
|
teams?:
|
|
1416
1309
|
| RequireOnlyOne<{
|
|
@@ -1420,9 +1313,7 @@ export type UserFilters<UserType = UnknownType> = QueryFilters<
|
|
|
1420
1313
|
| PrimitiveFilter<UserResponse<UserType>['teams']>;
|
|
1421
1314
|
username?:
|
|
1422
1315
|
| RequireOnlyOne<
|
|
1423
|
-
{ $autocomplete?: UserResponse<UserType>['username'] } & QueryFilter<
|
|
1424
|
-
UserResponse<UserType>['username']
|
|
1425
|
-
>
|
|
1316
|
+
{ $autocomplete?: UserResponse<UserType>['username'] } & QueryFilter<UserResponse<UserType>['username']>
|
|
1426
1317
|
>
|
|
1427
1318
|
| PrimitiveFilter<UserResponse<UserType>['username']>;
|
|
1428
1319
|
} & {
|
|
@@ -1440,11 +1331,9 @@ export type BannedUsersSort = BannedUsersSortBase | Array<BannedUsersSortBase>;
|
|
|
1440
1331
|
|
|
1441
1332
|
export type BannedUsersSortBase = { created_at?: AscDesc };
|
|
1442
1333
|
|
|
1443
|
-
export type ChannelSort<ChannelType =
|
|
1444
|
-
| ChannelSortBase<ChannelType>
|
|
1445
|
-
| Array<ChannelSortBase<ChannelType>>;
|
|
1334
|
+
export type ChannelSort<ChannelType = UR> = ChannelSortBase<ChannelType> | Array<ChannelSortBase<ChannelType>>;
|
|
1446
1335
|
|
|
1447
|
-
export type ChannelSortBase<ChannelType =
|
|
1336
|
+
export type ChannelSortBase<ChannelType = UR> = Sort<ChannelType> & {
|
|
1448
1337
|
created_at?: AscDesc;
|
|
1449
1338
|
has_unread?: AscDesc;
|
|
1450
1339
|
last_message_at?: AscDesc;
|
|
@@ -1454,19 +1343,20 @@ export type ChannelSortBase<ChannelType = UnknownType> = Sort<ChannelType> & {
|
|
|
1454
1343
|
updated_at?: AscDesc;
|
|
1455
1344
|
};
|
|
1456
1345
|
|
|
1346
|
+
export type PinnedMessagesSort = PinnedMessagesSortBase | Array<PinnedMessagesSortBase>;
|
|
1347
|
+
export type PinnedMessagesSortBase = { pinned_at?: AscDesc };
|
|
1348
|
+
|
|
1457
1349
|
export type Sort<T> = {
|
|
1458
1350
|
[P in keyof T]?: AscDesc;
|
|
1459
1351
|
};
|
|
1460
1352
|
|
|
1461
|
-
export type UserSort<UserType =
|
|
1462
|
-
| Sort<UserResponse<UserType>>
|
|
1463
|
-
| Array<Sort<UserResponse<UserType>>>;
|
|
1353
|
+
export type UserSort<UserType = UR> = Sort<UserResponse<UserType>> | Array<Sort<UserResponse<UserType>>>;
|
|
1464
1354
|
|
|
1465
|
-
export type MemberSort<UserType =
|
|
1355
|
+
export type MemberSort<UserType = UR> =
|
|
1466
1356
|
| Sort<Pick<UserResponse<UserType>, 'id' | 'created_at' | 'name'>>
|
|
1467
1357
|
| Array<Sort<Pick<UserResponse<UserType>, 'id' | 'created_at' | 'name'>>>;
|
|
1468
1358
|
|
|
1469
|
-
export type SearchMessageSortBase<MessageType =
|
|
1359
|
+
export type SearchMessageSortBase<MessageType = UR> = Sort<MessageType> & {
|
|
1470
1360
|
attachments?: AscDesc;
|
|
1471
1361
|
'attachments.type'?: AscDesc;
|
|
1472
1362
|
created_at?: AscDesc;
|
|
@@ -1482,15 +1372,11 @@ export type SearchMessageSortBase<MessageType = UnknownType> = Sort<MessageType>
|
|
|
1482
1372
|
'user.id'?: AscDesc;
|
|
1483
1373
|
};
|
|
1484
1374
|
|
|
1485
|
-
export type SearchMessageSort<MessageType =
|
|
1375
|
+
export type SearchMessageSort<MessageType = UR> =
|
|
1486
1376
|
| SearchMessageSortBase<MessageType>
|
|
1487
1377
|
| Array<SearchMessageSortBase<MessageType>>;
|
|
1488
1378
|
|
|
1489
|
-
export type QuerySort<
|
|
1490
|
-
ChannelType = UnknownType,
|
|
1491
|
-
UserType = UnknownType,
|
|
1492
|
-
MessageType = UnknownType
|
|
1493
|
-
> =
|
|
1379
|
+
export type QuerySort<ChannelType = UR, UserType = UR, MessageType = UR> =
|
|
1494
1380
|
| BannedUsersSort
|
|
1495
1381
|
| ChannelSort<ChannelType>
|
|
1496
1382
|
| SearchMessageSort<MessageType>
|
|
@@ -1567,7 +1453,7 @@ export type AppSettings = {
|
|
|
1567
1453
|
webhook_url?: string;
|
|
1568
1454
|
};
|
|
1569
1455
|
|
|
1570
|
-
export type Attachment<T =
|
|
1456
|
+
export type Attachment<T = UR> = T & {
|
|
1571
1457
|
actions?: Action[];
|
|
1572
1458
|
asset_url?: string;
|
|
1573
1459
|
author_icon?: string;
|
|
@@ -1606,9 +1492,7 @@ export type BlockList = {
|
|
|
1606
1492
|
words: string[];
|
|
1607
1493
|
};
|
|
1608
1494
|
|
|
1609
|
-
export type ChannelConfig<
|
|
1610
|
-
CommandType extends string = LiteralStringForUnion
|
|
1611
|
-
> = ChannelConfigFields &
|
|
1495
|
+
export type ChannelConfig<CommandType extends string = LiteralStringForUnion> = ChannelConfigFields &
|
|
1612
1496
|
CreatedAtUpdatedAt & {
|
|
1613
1497
|
commands?: CommandVariants<CommandType>[];
|
|
1614
1498
|
};
|
|
@@ -1644,19 +1528,17 @@ export type ChannelConfigFields = {
|
|
|
1644
1528
|
url_enrichment?: boolean;
|
|
1645
1529
|
};
|
|
1646
1530
|
|
|
1647
|
-
export type ChannelConfigWithInfo<
|
|
1648
|
-
CommandType extends string = LiteralStringForUnion
|
|
1649
|
-
> = ChannelConfigFields &
|
|
1531
|
+
export type ChannelConfigWithInfo<CommandType extends string = LiteralStringForUnion> = ChannelConfigFields &
|
|
1650
1532
|
CreatedAtUpdatedAt & {
|
|
1651
1533
|
commands?: CommandResponse<CommandType>[];
|
|
1652
1534
|
};
|
|
1653
1535
|
|
|
1654
|
-
export type ChannelData<ChannelType =
|
|
1536
|
+
export type ChannelData<ChannelType = UR> = ChannelType & {
|
|
1655
1537
|
members?: string[];
|
|
1656
1538
|
name?: string;
|
|
1657
1539
|
};
|
|
1658
1540
|
|
|
1659
|
-
export type ChannelMembership<UserType =
|
|
1541
|
+
export type ChannelMembership<UserType = UR> = {
|
|
1660
1542
|
banned?: boolean;
|
|
1661
1543
|
channel_role?: Role;
|
|
1662
1544
|
created_at?: string;
|
|
@@ -1668,9 +1550,9 @@ export type ChannelMembership<UserType = UnknownType> = {
|
|
|
1668
1550
|
};
|
|
1669
1551
|
|
|
1670
1552
|
export type ChannelMute<
|
|
1671
|
-
ChannelType extends
|
|
1553
|
+
ChannelType extends UR = UR,
|
|
1672
1554
|
CommandType extends string = LiteralStringForUnion,
|
|
1673
|
-
UserType extends
|
|
1555
|
+
UserType extends UR = UR
|
|
1674
1556
|
> = {
|
|
1675
1557
|
user: UserResponse<UserType>;
|
|
1676
1558
|
channel?: ChannelResponse<ChannelType, CommandType, UserType>;
|
|
@@ -1687,7 +1569,7 @@ export type ChannelRole = {
|
|
|
1687
1569
|
same_team?: boolean;
|
|
1688
1570
|
};
|
|
1689
1571
|
|
|
1690
|
-
export type CheckPushInput<UserType =
|
|
1572
|
+
export type CheckPushInput<UserType = UR> = {
|
|
1691
1573
|
apn_template?: string;
|
|
1692
1574
|
client_id?: string;
|
|
1693
1575
|
connection_id?: string;
|
|
@@ -1717,9 +1599,9 @@ export type Configs<CommandType extends string = LiteralStringForUnion> = {
|
|
|
1717
1599
|
};
|
|
1718
1600
|
|
|
1719
1601
|
export type ConnectionOpen<
|
|
1720
|
-
ChannelType extends
|
|
1602
|
+
ChannelType extends UR = UR,
|
|
1721
1603
|
CommandType extends string = LiteralStringForUnion,
|
|
1722
|
-
UserType extends
|
|
1604
|
+
UserType extends UR = UR
|
|
1723
1605
|
> = {
|
|
1724
1606
|
connection_id: string;
|
|
1725
1607
|
cid?: string;
|
|
@@ -1733,7 +1615,7 @@ export type CreatedAtUpdatedAt = {
|
|
|
1733
1615
|
updated_at: string;
|
|
1734
1616
|
};
|
|
1735
1617
|
|
|
1736
|
-
export type Device<UserType =
|
|
1618
|
+
export type Device<UserType = UR> = DeviceFields & {
|
|
1737
1619
|
provider?: string;
|
|
1738
1620
|
user?: UserResponse<UserType>;
|
|
1739
1621
|
user_id?: string;
|
|
@@ -1839,13 +1721,16 @@ export type EndpointName =
|
|
|
1839
1721
|
export type ExportChannelRequest = {
|
|
1840
1722
|
id: string;
|
|
1841
1723
|
type: string;
|
|
1724
|
+
cid?: string;
|
|
1842
1725
|
messages_since?: Date;
|
|
1843
1726
|
messages_until?: Date;
|
|
1844
1727
|
};
|
|
1845
1728
|
|
|
1846
1729
|
export type ExportChannelOptions = {
|
|
1847
1730
|
clear_deleted_message_text?: boolean;
|
|
1731
|
+
export_users?: boolean;
|
|
1848
1732
|
include_truncated_messages?: boolean;
|
|
1733
|
+
version?: string;
|
|
1849
1734
|
};
|
|
1850
1735
|
|
|
1851
1736
|
export type Field = {
|
|
@@ -1875,31 +1760,25 @@ export type HuaweiConfig = {
|
|
|
1875
1760
|
|
|
1876
1761
|
export type LiteralStringForUnion = string & {};
|
|
1877
1762
|
|
|
1878
|
-
export type
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
AttachmentType = UnknownType,
|
|
1886
|
-
MessageType = UnknownType,
|
|
1887
|
-
UserType = UnknownType
|
|
1888
|
-
> = Partial<MessageBase<AttachmentType, MessageType, UserType>> & {
|
|
1763
|
+
export type LogLevel = 'info' | 'error' | 'warn';
|
|
1764
|
+
|
|
1765
|
+
export type Logger = (logLevel: LogLevel, message: string, extraData?: Record<string, unknown>) => void;
|
|
1766
|
+
|
|
1767
|
+
export type Message<AttachmentType = UR, MessageType = UR, UserType = UR> = Partial<
|
|
1768
|
+
MessageBase<AttachmentType, MessageType, UserType>
|
|
1769
|
+
> & {
|
|
1889
1770
|
mentioned_users?: string[];
|
|
1890
1771
|
};
|
|
1891
1772
|
|
|
1892
|
-
export type MessageBase<
|
|
1893
|
-
AttachmentType = UnknownType,
|
|
1894
|
-
MessageType = UnknownType,
|
|
1895
|
-
UserType = UnknownType
|
|
1896
|
-
> = MessageType & {
|
|
1773
|
+
export type MessageBase<AttachmentType = UR, MessageType = UR, UserType = UR> = MessageType & {
|
|
1897
1774
|
id: string;
|
|
1898
1775
|
attachments?: Attachment<AttachmentType>[];
|
|
1899
1776
|
html?: string;
|
|
1900
1777
|
mml?: string;
|
|
1901
1778
|
parent_id?: string;
|
|
1779
|
+
pin_expires?: string;
|
|
1902
1780
|
pinned?: boolean;
|
|
1781
|
+
pinned_at?: string;
|
|
1903
1782
|
quoted_message_id?: string;
|
|
1904
1783
|
show_in_channel?: boolean;
|
|
1905
1784
|
text?: string;
|
|
@@ -1907,38 +1786,32 @@ export type MessageBase<
|
|
|
1907
1786
|
user_id?: string;
|
|
1908
1787
|
};
|
|
1909
1788
|
|
|
1910
|
-
export type MessageLabel =
|
|
1911
|
-
| 'deleted'
|
|
1912
|
-
| 'ephemeral'
|
|
1913
|
-
| 'error'
|
|
1914
|
-
| 'regular'
|
|
1915
|
-
| 'reply'
|
|
1916
|
-
| 'system';
|
|
1789
|
+
export type MessageLabel = 'deleted' | 'ephemeral' | 'error' | 'regular' | 'reply' | 'system';
|
|
1917
1790
|
|
|
1918
|
-
export type Mute<UserType =
|
|
1791
|
+
export type Mute<UserType = UR> = {
|
|
1919
1792
|
created_at: string;
|
|
1920
1793
|
target: UserResponse<UserType>;
|
|
1921
1794
|
updated_at: string;
|
|
1922
1795
|
user: UserResponse<UserType>;
|
|
1923
1796
|
};
|
|
1924
1797
|
|
|
1925
|
-
export type PartialUpdateChannel<ChannelType =
|
|
1798
|
+
export type PartialUpdateChannel<ChannelType = UR> = {
|
|
1926
1799
|
set?: Partial<ChannelResponse<ChannelType>>;
|
|
1927
1800
|
unset?: Array<keyof ChannelResponse<ChannelType>>;
|
|
1928
1801
|
};
|
|
1929
1802
|
|
|
1930
|
-
export type PartialUserUpdate<UserType =
|
|
1803
|
+
export type PartialUserUpdate<UserType = UR> = {
|
|
1931
1804
|
id: string;
|
|
1932
1805
|
set?: Partial<UserResponse<UserType>>;
|
|
1933
1806
|
unset?: Array<keyof UserResponse<UserType>>;
|
|
1934
1807
|
};
|
|
1935
1808
|
|
|
1936
|
-
export type MessageUpdatableFields<MessageType =
|
|
1809
|
+
export type MessageUpdatableFields<MessageType = UR> = Omit<
|
|
1937
1810
|
MessageResponse<MessageType>,
|
|
1938
1811
|
'cid' | 'created_at' | 'updated_at' | 'deleted_at' | 'user' | 'user_id'
|
|
1939
1812
|
>;
|
|
1940
1813
|
|
|
1941
|
-
export type PartialMessageUpdate<MessageType =
|
|
1814
|
+
export type PartialMessageUpdate<MessageType = UR> = {
|
|
1942
1815
|
set?: Partial<MessageUpdatableFields<MessageType>>;
|
|
1943
1816
|
unset?: Array<keyof MessageUpdatableFields<MessageType>>;
|
|
1944
1817
|
};
|
|
@@ -1949,6 +1822,7 @@ export type PermissionAPIObject = {
|
|
|
1949
1822
|
custom?: boolean;
|
|
1950
1823
|
description?: string;
|
|
1951
1824
|
id?: string;
|
|
1825
|
+
level?: string;
|
|
1952
1826
|
name?: string;
|
|
1953
1827
|
owner?: boolean;
|
|
1954
1828
|
same_team?: boolean;
|
|
@@ -1982,10 +1856,7 @@ export type RateLimitsInfo = {
|
|
|
1982
1856
|
|
|
1983
1857
|
export type RateLimitsMap = Record<EndpointName, RateLimitsInfo>;
|
|
1984
1858
|
|
|
1985
|
-
export type Reaction<
|
|
1986
|
-
ReactionType = UnknownType,
|
|
1987
|
-
UserType = UnknownType
|
|
1988
|
-
> = ReactionType & {
|
|
1859
|
+
export type Reaction<ReactionType = UR, UserType = UR> = ReactionType & {
|
|
1989
1860
|
type: string;
|
|
1990
1861
|
message_id?: string;
|
|
1991
1862
|
score?: number;
|
|
@@ -2014,12 +1885,12 @@ export type Resource =
|
|
|
2014
1885
|
| 'UploadAttachment';
|
|
2015
1886
|
|
|
2016
1887
|
export type SearchPayload<
|
|
2017
|
-
AttachmentType =
|
|
2018
|
-
ChannelType =
|
|
1888
|
+
AttachmentType = UR,
|
|
1889
|
+
ChannelType = UR,
|
|
2019
1890
|
CommandType extends string = LiteralStringForUnion,
|
|
2020
|
-
MessageType =
|
|
2021
|
-
ReactionType =
|
|
2022
|
-
UserType =
|
|
1891
|
+
MessageType = UR,
|
|
1892
|
+
ReactionType = UR,
|
|
1893
|
+
UserType = UR
|
|
2023
1894
|
> = Omit<SearchOptions<MessageType>, 'sort'> & {
|
|
2024
1895
|
client_id?: string;
|
|
2025
1896
|
connection_id?: string;
|
|
@@ -2118,26 +1989,33 @@ export type TranslationLanguages =
|
|
|
2118
1989
|
|
|
2119
1990
|
export type TypingStartEvent = Event;
|
|
2120
1991
|
|
|
1992
|
+
export type ReservedMessageFields =
|
|
1993
|
+
| 'command'
|
|
1994
|
+
| 'created_at'
|
|
1995
|
+
| 'html'
|
|
1996
|
+
| 'latest_reactions'
|
|
1997
|
+
| 'own_reactions'
|
|
1998
|
+
| 'quoted_message'
|
|
1999
|
+
| 'reaction_counts'
|
|
2000
|
+
| 'reply_count'
|
|
2001
|
+
| 'type'
|
|
2002
|
+
| 'updated_at'
|
|
2003
|
+
| 'user'
|
|
2004
|
+
| '__html';
|
|
2005
|
+
|
|
2121
2006
|
export type UpdatedMessage<
|
|
2122
|
-
AttachmentType =
|
|
2123
|
-
ChannelType =
|
|
2007
|
+
AttachmentType = UR,
|
|
2008
|
+
ChannelType = UR,
|
|
2124
2009
|
CommandType extends string = LiteralStringForUnion,
|
|
2125
|
-
MessageType =
|
|
2126
|
-
ReactionType =
|
|
2127
|
-
UserType =
|
|
2010
|
+
MessageType = UR,
|
|
2011
|
+
ReactionType = UR,
|
|
2012
|
+
UserType = UR
|
|
2128
2013
|
> = Omit<
|
|
2129
|
-
MessageResponse<
|
|
2130
|
-
AttachmentType,
|
|
2131
|
-
ChannelType,
|
|
2132
|
-
CommandType,
|
|
2133
|
-
MessageType,
|
|
2134
|
-
ReactionType,
|
|
2135
|
-
UserType
|
|
2136
|
-
>,
|
|
2014
|
+
MessageResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>,
|
|
2137
2015
|
'mentioned_users'
|
|
2138
2016
|
> & { mentioned_users?: string[] };
|
|
2139
2017
|
|
|
2140
|
-
export type User<UserType =
|
|
2018
|
+
export type User<UserType = UR> = UserType & {
|
|
2141
2019
|
id: string;
|
|
2142
2020
|
anon?: boolean;
|
|
2143
2021
|
name?: string;
|
|
@@ -2203,14 +2081,7 @@ export type CampaignData = {
|
|
|
2203
2081
|
|
|
2204
2082
|
export type CampaignStatus = {
|
|
2205
2083
|
errors: string[];
|
|
2206
|
-
status:
|
|
2207
|
-
| 'draft'
|
|
2208
|
-
| 'stopped'
|
|
2209
|
-
| 'scheduled'
|
|
2210
|
-
| 'completed'
|
|
2211
|
-
| 'failed'
|
|
2212
|
-
| 'canceled'
|
|
2213
|
-
| 'in_progress';
|
|
2084
|
+
status: 'draft' | 'stopped' | 'scheduled' | 'completed' | 'failed' | 'canceled' | 'in_progress';
|
|
2214
2085
|
completed_at?: string;
|
|
2215
2086
|
failed_at?: string;
|
|
2216
2087
|
progress?: number;
|
|
@@ -2236,5 +2107,12 @@ export type TaskStatus = {
|
|
|
2236
2107
|
description: string;
|
|
2237
2108
|
type: string;
|
|
2238
2109
|
};
|
|
2239
|
-
result?:
|
|
2110
|
+
result?: UR;
|
|
2111
|
+
};
|
|
2112
|
+
|
|
2113
|
+
export type TruncateOptions<AttachmentType, MessageType, UserType> = {
|
|
2114
|
+
hard_delete?: boolean;
|
|
2115
|
+
message?: Message<AttachmentType, MessageType, UserType>;
|
|
2116
|
+
skip_push?: boolean;
|
|
2117
|
+
truncated_at?: Date;
|
|
2240
2118
|
};
|