@myronsi/messenger-api 2.1.0-alpha.3.next.67 → 2.1.0-alpha.30
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/CHANGELOG.md +310 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/openapi.yaml +4435 -417
- package/dist/schema.d.ts +8086 -1893
- package/dist/ws-docs.json +182 -12
- package/dist/ws-events.d.ts +502 -30
- package/dist/ws-events.schema.json +3400 -543
- package/package.json +1 -1
package/dist/ws-events.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* Generated from api/openapi.yaml 2.1.0-alpha.
|
|
1
|
+
/* Generated from api/openapi.yaml 2.1.0-alpha.30. Do not edit. */
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Any WebSocket event, in either direction.
|
|
@@ -34,6 +34,8 @@ export type AttachmentRef = string;
|
|
|
34
34
|
export type ServerEvent =
|
|
35
35
|
| ServerAckEvent
|
|
36
36
|
| ServerApprovalRequestCreatedEvent
|
|
37
|
+
| ServerCallKeysEvent
|
|
38
|
+
| ServerCallUpdatedEvent
|
|
37
39
|
| ServerChatCreatedEvent
|
|
38
40
|
| ServerChatDeletedEvent
|
|
39
41
|
| ServerChatListUpdateEvent
|
|
@@ -43,21 +45,62 @@ export type ServerEvent =
|
|
|
43
45
|
| ServerGroupCreatedEvent
|
|
44
46
|
| ServerGroupUpdatedEvent
|
|
45
47
|
| ServerHelloEvent
|
|
48
|
+
| ServerHistoryClearedEvent
|
|
46
49
|
| ServerMessageEvent
|
|
47
50
|
| ServerPresenceEvent
|
|
48
51
|
| ServerReactionAddEvent
|
|
49
52
|
| ServerReactionRemoveEvent
|
|
50
53
|
| ServerReadEvent
|
|
54
|
+
| ServerRecoveryRequestEvent
|
|
55
|
+
| ServerSecurityAlertEvent
|
|
51
56
|
| ServerSecurityNoticeEvent
|
|
52
|
-
| ServerTypingEvent
|
|
57
|
+
| ServerTypingEvent
|
|
58
|
+
| ServerUserUpdatedEvent;
|
|
53
59
|
export type Timestamp = string;
|
|
54
60
|
export type ApprovalRequestType = "direct_message" | "group_invite";
|
|
55
61
|
export type ApprovalRequestStatus = "pending" | "approved" | "rejected";
|
|
62
|
+
export type AttachmentKind = "image" | "audio" | "voice" | "video" | "file";
|
|
63
|
+
/**
|
|
64
|
+
* `media` an uploaded image, GIF or short video (`attachment`), `preset` one of the clients' built-in
|
|
65
|
+
* gradients (`preset`), `color` one color or a gradient of two (`colors`).
|
|
66
|
+
*
|
|
67
|
+
*/
|
|
68
|
+
export type ProfileBackgroundKind = "media" | "preset" | "color";
|
|
69
|
+
/**
|
|
70
|
+
* Name of a built-in gradient. Clients show their default background for a name they do not know.
|
|
71
|
+
*/
|
|
72
|
+
export type BackgroundPreset = string;
|
|
73
|
+
export type BackgroundColor = string;
|
|
56
74
|
export type Username = string;
|
|
75
|
+
/**
|
|
76
|
+
* `ringing` until someone answers, `active` while people are in it, `ended` afterwards.
|
|
77
|
+
*/
|
|
78
|
+
export type CallState = "ringing" | "active" | "ended";
|
|
79
|
+
/**
|
|
80
|
+
* Why the call ended: `completed` (people talked), `missed` (nobody answered in time), `declined` (the peer of a
|
|
81
|
+
* direct call declined), `cancelled` (the caller hung up before an answer), `failed` (the media service lost
|
|
82
|
+
* the call).
|
|
83
|
+
*
|
|
84
|
+
*/
|
|
85
|
+
export type CallEndReason = "completed" | "missed" | "declined" | "cancelled" | "failed";
|
|
86
|
+
/**
|
|
87
|
+
* `left` and `declined` can become `joined` again in a group call.
|
|
88
|
+
*/
|
|
89
|
+
export type CallParticipantState = "ringing" | "joined" | "declined" | "missed" | "left";
|
|
90
|
+
/**
|
|
91
|
+
* P-256 public key as an uncompressed point (65 bytes, first byte `0x04`), base64url without padding.
|
|
92
|
+
*
|
|
93
|
+
*/
|
|
94
|
+
export type CallIdentityKey = string;
|
|
57
95
|
export type ChatType = "direct" | "group";
|
|
58
|
-
export type MessageType = "text" | "file" | "voice" | "system";
|
|
59
|
-
export type
|
|
60
|
-
export type
|
|
96
|
+
export type MessageType = "text" | "file" | "voice" | "system" | "sticker";
|
|
97
|
+
export type StickerPackSlug = string;
|
|
98
|
+
export type SystemEventKind =
|
|
99
|
+
"group_created" | "member_added" | "member_joined" | "member_removed" | "member_left" | "call";
|
|
100
|
+
/**
|
|
101
|
+
* A moderator may delete other members' messages; owners and admins also manage the group.
|
|
102
|
+
*/
|
|
103
|
+
export type GroupRole = "owner" | "admin" | "moderator" | "member";
|
|
61
104
|
/**
|
|
62
105
|
* Stable machine-readable error code. New codes can appear in MINOR versions; unknown
|
|
63
106
|
* codes must be treated like `internal_error`.
|
|
@@ -82,6 +125,16 @@ export type ErrorCode =
|
|
|
82
125
|
| "invalid_client_version"
|
|
83
126
|
| "blocked_by_user"
|
|
84
127
|
| "approval_required"
|
|
128
|
+
| "user_verification_required"
|
|
129
|
+
| "session_too_new"
|
|
130
|
+
| "calls_unavailable"
|
|
131
|
+
| "calls_not_allowed"
|
|
132
|
+
| "call_identity_required"
|
|
133
|
+
| "call_full"
|
|
134
|
+
| "call_ended"
|
|
135
|
+
| "already_in_call"
|
|
136
|
+
| "stale_epoch"
|
|
137
|
+
| "limit_reached"
|
|
85
138
|
| "internal_error";
|
|
86
139
|
|
|
87
140
|
/**
|
|
@@ -97,7 +150,7 @@ export interface ClientDeleteEvent {
|
|
|
97
150
|
};
|
|
98
151
|
}
|
|
99
152
|
/**
|
|
100
|
-
* Edit your own text message.
|
|
153
|
+
* Edit your own text message or the caption of your file. An empty content removes a file's caption.
|
|
101
154
|
*/
|
|
102
155
|
export interface ClientEditEvent {
|
|
103
156
|
type: "edit";
|
|
@@ -181,13 +234,18 @@ export interface ClientResendEvent {
|
|
|
181
234
|
};
|
|
182
235
|
}
|
|
183
236
|
/**
|
|
184
|
-
* Tell the chat that you are (not) typing. Not acknowledged, so it carries no `client_temp_id`.
|
|
237
|
+
* Tell the chat that you are (not) typing, recording a voice message, choosing a sticker or sending a photo, video or file. Not acknowledged, so it carries no `client_temp_id`. Send `is_typing: true` again every few seconds while it lasts and `false` when it ends; receivers hide it when it is not repeated. Dropped when your `typing_indicators_enabled` privacy setting is off.
|
|
185
238
|
*/
|
|
186
239
|
export interface ClientTypingEvent {
|
|
187
240
|
type: "typing";
|
|
188
241
|
chat_id: Id;
|
|
189
242
|
data: {
|
|
190
243
|
is_typing: boolean;
|
|
244
|
+
/**
|
|
245
|
+
* What you are doing. Without it, `typing`.
|
|
246
|
+
*/
|
|
247
|
+
action?:
|
|
248
|
+
"typing" | "recording_voice" | "choosing_sticker" | "uploading_photo" | "uploading_video" | "uploading_file";
|
|
191
249
|
};
|
|
192
250
|
}
|
|
193
251
|
/**
|
|
@@ -246,6 +304,28 @@ export interface ApprovalRequest {
|
|
|
246
304
|
*/
|
|
247
305
|
export interface User {
|
|
248
306
|
id: Id;
|
|
307
|
+
/**
|
|
308
|
+
* Grows whenever the username, display name, bio, avatar, pronouns, birthday, profile music or profile
|
|
309
|
+
* background changes (not with presence). Clients keep a stored profile until a higher version arrives.
|
|
310
|
+
*
|
|
311
|
+
*/
|
|
312
|
+
profile_version: number;
|
|
313
|
+
/**
|
|
314
|
+
* Free text such as "she/her". Visible like the bio (`profile_visibility`).
|
|
315
|
+
*/
|
|
316
|
+
pronouns: string | null;
|
|
317
|
+
/**
|
|
318
|
+
* Visible by `birthday_visibility`; `null` when not set or hidden.
|
|
319
|
+
*/
|
|
320
|
+
birthday: Birthday | null;
|
|
321
|
+
/**
|
|
322
|
+
* A short song on the profile, visible like the bio. Clients never play it on their own.
|
|
323
|
+
*/
|
|
324
|
+
music: ProfileMusic | null;
|
|
325
|
+
/**
|
|
326
|
+
* The banner and page background of the profile, visible like the bio.
|
|
327
|
+
*/
|
|
328
|
+
background: ProfileBackground | null;
|
|
249
329
|
username: Username;
|
|
250
330
|
display_name: string;
|
|
251
331
|
/**
|
|
@@ -253,7 +333,7 @@ export interface User {
|
|
|
253
333
|
*/
|
|
254
334
|
contact_name?: string | null;
|
|
255
335
|
/**
|
|
256
|
-
* Path of the avatar, always same-origin (`/api/v2/users/{id}/avatar`).
|
|
336
|
+
* Path of the avatar, always same-origin (`/api/v2/users/{id}/avatar?rev={revision}`).
|
|
257
337
|
*/
|
|
258
338
|
avatar_url: string | null;
|
|
259
339
|
bio: string | null;
|
|
@@ -261,6 +341,206 @@ export interface User {
|
|
|
261
341
|
last_seen: Timestamp | null;
|
|
262
342
|
is_deleted: boolean;
|
|
263
343
|
}
|
|
344
|
+
export interface Birthday {
|
|
345
|
+
day: number;
|
|
346
|
+
month: number;
|
|
347
|
+
/**
|
|
348
|
+
* Optional; `null` when the user keeps the year to themselves.
|
|
349
|
+
*/
|
|
350
|
+
year: number | null;
|
|
351
|
+
}
|
|
352
|
+
export interface ProfileMusic {
|
|
353
|
+
/**
|
|
354
|
+
* The clip (at most 30 s). `thumbnail_url` is the cover when the file had one.
|
|
355
|
+
*/
|
|
356
|
+
attachment: Attachment;
|
|
357
|
+
title: string | null;
|
|
358
|
+
artist: string | null;
|
|
359
|
+
}
|
|
360
|
+
export interface Attachment {
|
|
361
|
+
id: AttachmentRef;
|
|
362
|
+
kind: AttachmentKind;
|
|
363
|
+
filename: string;
|
|
364
|
+
/**
|
|
365
|
+
* Detected by the server
|
|
366
|
+
*/
|
|
367
|
+
content_type: string;
|
|
368
|
+
/**
|
|
369
|
+
* Bytes
|
|
370
|
+
*/
|
|
371
|
+
size: number;
|
|
372
|
+
/**
|
|
373
|
+
* Same-origin path (`/api/v2/attachments/{id}/content`) set by the server.
|
|
374
|
+
*/
|
|
375
|
+
url: string;
|
|
376
|
+
width?: number | null;
|
|
377
|
+
height?: number | null;
|
|
378
|
+
thumbnail_url?: string | null;
|
|
379
|
+
/**
|
|
380
|
+
* A JPEG of at most 1600 px to show in an image viewer instead of the original; `null` for small images and GIFs, which are shown as they are.
|
|
381
|
+
*/
|
|
382
|
+
display_url?: string | null;
|
|
383
|
+
duration_ms?: number | null;
|
|
384
|
+
waveform?: number[] | null;
|
|
385
|
+
tags?: AudioTags;
|
|
386
|
+
drawing?: Drawing;
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* Only in the answer to a `profile_music` upload; what the file says about itself.
|
|
390
|
+
*/
|
|
391
|
+
export interface AudioTags {
|
|
392
|
+
title: string | null;
|
|
393
|
+
artist: string | null;
|
|
394
|
+
}
|
|
395
|
+
/**
|
|
396
|
+
* What the sender drew on this image of this message. Clients show the image with the drawing on top
|
|
397
|
+
* and never without it. Absent when the image has no drawing. The same image can carry another drawing
|
|
398
|
+
* in another message.
|
|
399
|
+
*
|
|
400
|
+
*/
|
|
401
|
+
export interface Drawing {
|
|
402
|
+
version: number;
|
|
403
|
+
/**
|
|
404
|
+
* @minItems 1
|
|
405
|
+
* @maxItems 200
|
|
406
|
+
*/
|
|
407
|
+
items: [DrawingItem, ...DrawingItem[]];
|
|
408
|
+
}
|
|
409
|
+
export interface DrawingItem {
|
|
410
|
+
type: "stroke" | "text";
|
|
411
|
+
color: string;
|
|
412
|
+
/**
|
|
413
|
+
* Stroke only. Line width as a fraction of the image width.
|
|
414
|
+
*/
|
|
415
|
+
width?: number;
|
|
416
|
+
/**
|
|
417
|
+
* Stroke only. Flat list of x, y pairs. A drawing has at most 10000 numbers in all its strokes.
|
|
418
|
+
*
|
|
419
|
+
* @minItems 2
|
|
420
|
+
* @maxItems 10000
|
|
421
|
+
*/
|
|
422
|
+
points?: [number, number, ...number[]];
|
|
423
|
+
/**
|
|
424
|
+
* Text only. Left edge of the label.
|
|
425
|
+
*/
|
|
426
|
+
x?: number;
|
|
427
|
+
/**
|
|
428
|
+
* Text only. Top edge of the label.
|
|
429
|
+
*/
|
|
430
|
+
y?: number;
|
|
431
|
+
/**
|
|
432
|
+
* Text only. Font height as a fraction of the image height.
|
|
433
|
+
*/
|
|
434
|
+
size?: number;
|
|
435
|
+
/**
|
|
436
|
+
* Text only.
|
|
437
|
+
*/
|
|
438
|
+
text?: string;
|
|
439
|
+
}
|
|
440
|
+
export interface ProfileBackground {
|
|
441
|
+
kind: ProfileBackgroundKind;
|
|
442
|
+
/**
|
|
443
|
+
* Set for `media`. An image, an animated GIF or a muted video of at most 15 s; `thumbnail_url` is a still
|
|
444
|
+
* frame to show while it loads and when the viewer prefers reduced motion.
|
|
445
|
+
*
|
|
446
|
+
*/
|
|
447
|
+
attachment?: Attachment;
|
|
448
|
+
preset?: BackgroundPreset;
|
|
449
|
+
/**
|
|
450
|
+
* @minItems 1
|
|
451
|
+
* @maxItems 2
|
|
452
|
+
*/
|
|
453
|
+
colors?: [BackgroundColor] | [BackgroundColor, BackgroundColor];
|
|
454
|
+
}
|
|
455
|
+
/**
|
|
456
|
+
* Sealed sender keys for this session (see docs/calls-e2ee.md). Sent only to the recipient session.
|
|
457
|
+
*/
|
|
458
|
+
export interface ServerCallKeysEvent {
|
|
459
|
+
type: "call_keys";
|
|
460
|
+
event_id: Id;
|
|
461
|
+
chat_id: Id;
|
|
462
|
+
data: CallKeyEnvelopeList;
|
|
463
|
+
}
|
|
464
|
+
export interface CallKeyEnvelopeList {
|
|
465
|
+
call_id: Id;
|
|
466
|
+
epoch: number;
|
|
467
|
+
items: CallKeyEnvelope[];
|
|
468
|
+
}
|
|
469
|
+
/**
|
|
470
|
+
* An HPKE Auth-mode envelope carrying one sender key (see `docs/calls-e2ee.md`).
|
|
471
|
+
*/
|
|
472
|
+
export interface CallKeyEnvelope {
|
|
473
|
+
epoch: number;
|
|
474
|
+
sender_user_id: Id;
|
|
475
|
+
sender_session_id: string;
|
|
476
|
+
recipient_session_id: string;
|
|
477
|
+
/**
|
|
478
|
+
* HPKE encapsulated key, base64url without padding.
|
|
479
|
+
*/
|
|
480
|
+
enc: string;
|
|
481
|
+
/**
|
|
482
|
+
* Sealed sender key, base64url without padding.
|
|
483
|
+
*/
|
|
484
|
+
ciphertext: string;
|
|
485
|
+
}
|
|
486
|
+
/**
|
|
487
|
+
* A call of the chat started, rang, changed participants or epoch, or ended. Carries the whole call; keep the one with the highest `version`. Sent to every member of the chat.
|
|
488
|
+
*/
|
|
489
|
+
export interface ServerCallUpdatedEvent {
|
|
490
|
+
type: "call_updated";
|
|
491
|
+
event_id: Id;
|
|
492
|
+
chat_id: Id;
|
|
493
|
+
data: {
|
|
494
|
+
call: Call;
|
|
495
|
+
};
|
|
496
|
+
}
|
|
497
|
+
export interface Call {
|
|
498
|
+
id: Id;
|
|
499
|
+
chat_id: Id;
|
|
500
|
+
kind: "direct" | "group";
|
|
501
|
+
state: CallState;
|
|
502
|
+
end_reason: CallEndReason | null;
|
|
503
|
+
initiator_id: Id;
|
|
504
|
+
created_at: Timestamp;
|
|
505
|
+
/**
|
|
506
|
+
* First answer; `null` while nobody answered.
|
|
507
|
+
*/
|
|
508
|
+
started_at: Timestamp | null;
|
|
509
|
+
ended_at: Timestamp | null;
|
|
510
|
+
/**
|
|
511
|
+
* When ringing invitations of this call turn into `missed`.
|
|
512
|
+
*/
|
|
513
|
+
ring_expires_at: string;
|
|
514
|
+
/**
|
|
515
|
+
* Key epoch; increases whenever the set of joined sessions or their identity keys change.
|
|
516
|
+
*/
|
|
517
|
+
epoch: number;
|
|
518
|
+
/**
|
|
519
|
+
* Increases with every change of the call; ignore events with a lower version than one already seen.
|
|
520
|
+
*/
|
|
521
|
+
version: number;
|
|
522
|
+
max_participants: number;
|
|
523
|
+
/**
|
|
524
|
+
* Everyone invited or joined, the initiator first.
|
|
525
|
+
*/
|
|
526
|
+
participants: CallParticipant[];
|
|
527
|
+
}
|
|
528
|
+
export interface CallParticipant {
|
|
529
|
+
user_id: Id;
|
|
530
|
+
state: CallParticipantState;
|
|
531
|
+
/**
|
|
532
|
+
* The session that joined; `null` unless `state` is `joined`.
|
|
533
|
+
*/
|
|
534
|
+
session_id: string | null;
|
|
535
|
+
/**
|
|
536
|
+
* Call identity of the joined session; `null` unless `state` is `joined`.
|
|
537
|
+
*/
|
|
538
|
+
identity_key: CallIdentityKey | null;
|
|
539
|
+
/**
|
|
540
|
+
* When the participant last joined; `null` if never.
|
|
541
|
+
*/
|
|
542
|
+
joined_at: Timestamp | null;
|
|
543
|
+
}
|
|
264
544
|
/**
|
|
265
545
|
* A chat was created with you.
|
|
266
546
|
*/
|
|
@@ -281,11 +561,30 @@ export interface Chat {
|
|
|
281
561
|
name: string;
|
|
282
562
|
avatar_url: string | null;
|
|
283
563
|
/**
|
|
284
|
-
* The other user of a direct chat; `null` for groups.
|
|
564
|
+
* The other user of a direct chat (the caller in their "Saved Messages" chat); `null` for groups.
|
|
285
565
|
*/
|
|
286
566
|
peer: User | null;
|
|
287
567
|
is_pinned: boolean;
|
|
568
|
+
/**
|
|
569
|
+
* Order of a pinned chat among the caller's pinned chats, lowest first; `null` when not pinned.
|
|
570
|
+
*/
|
|
571
|
+
pin_position: number | null;
|
|
572
|
+
/**
|
|
573
|
+
* Whether the caller archived the chat (only for the caller).
|
|
574
|
+
*/
|
|
575
|
+
is_archived: boolean;
|
|
288
576
|
unread_count: number;
|
|
577
|
+
/**
|
|
578
|
+
* The oldest message the caller has not read (the same messages `unread_count` counts: not their own,
|
|
579
|
+
* not system messages, not deleted); `null` when nothing is unread. Clients open the chat around it and
|
|
580
|
+
* show the "new messages" divider above it.
|
|
581
|
+
*
|
|
582
|
+
*/
|
|
583
|
+
first_unread_message_id: Id | null;
|
|
584
|
+
/**
|
|
585
|
+
* The caller's read marker (`POST /chats/{chat_id}/read`); `null` before their first read.
|
|
586
|
+
*/
|
|
587
|
+
last_read_message_id: Id | null;
|
|
289
588
|
last_message: Message | null;
|
|
290
589
|
/**
|
|
291
590
|
* Only for groups.
|
|
@@ -302,46 +601,92 @@ export interface Message {
|
|
|
302
601
|
*/
|
|
303
602
|
sender: User | null;
|
|
304
603
|
/**
|
|
305
|
-
* Text, or the
|
|
604
|
+
* Text, the caption of a file, or the emoji of a sticker; `null` when deleted.
|
|
306
605
|
*/
|
|
307
606
|
content: string | null;
|
|
308
607
|
attachment: Attachment | null;
|
|
309
608
|
reply_to: Id | null;
|
|
609
|
+
reply_preview?: ReplyPreview;
|
|
310
610
|
forwarded_from: ForwardedFrom | null;
|
|
611
|
+
sticker?: Sticker;
|
|
612
|
+
/**
|
|
613
|
+
* Ordered images and videos of an album. The first item is also returned as attachment for older clients.
|
|
614
|
+
*
|
|
615
|
+
* @minItems 2
|
|
616
|
+
* @maxItems 10
|
|
617
|
+
*/
|
|
618
|
+
attachments?:
|
|
619
|
+
| [Attachment, Attachment]
|
|
620
|
+
| [Attachment, Attachment, Attachment]
|
|
621
|
+
| [Attachment, Attachment, Attachment, Attachment]
|
|
622
|
+
| [Attachment, Attachment, Attachment, Attachment, Attachment]
|
|
623
|
+
| [Attachment, Attachment, Attachment, Attachment, Attachment, Attachment]
|
|
624
|
+
| [Attachment, Attachment, Attachment, Attachment, Attachment, Attachment, Attachment]
|
|
625
|
+
| [Attachment, Attachment, Attachment, Attachment, Attachment, Attachment, Attachment, Attachment]
|
|
626
|
+
| [Attachment, Attachment, Attachment, Attachment, Attachment, Attachment, Attachment, Attachment, Attachment]
|
|
627
|
+
| [
|
|
628
|
+
Attachment,
|
|
629
|
+
Attachment,
|
|
630
|
+
Attachment,
|
|
631
|
+
Attachment,
|
|
632
|
+
Attachment,
|
|
633
|
+
Attachment,
|
|
634
|
+
Attachment,
|
|
635
|
+
Attachment,
|
|
636
|
+
Attachment,
|
|
637
|
+
Attachment
|
|
638
|
+
];
|
|
311
639
|
reactions: Reaction[];
|
|
312
640
|
read_by: ReadReceipt[];
|
|
313
641
|
created_at: Timestamp;
|
|
314
642
|
edited_at: Timestamp | null;
|
|
315
643
|
is_deleted: boolean;
|
|
644
|
+
system_event?: SystemEvent;
|
|
316
645
|
client_temp_id?: ClientTempId;
|
|
317
646
|
}
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
*/
|
|
329
|
-
size: number;
|
|
647
|
+
/**
|
|
648
|
+
* What a reply shows of the message it answers, so a client can draw the quote without loading that
|
|
649
|
+
* message. Set on messages of history pages and `message` events when the recipient can see the answered
|
|
650
|
+
* message; absent when it is gone or hidden for them, and on chat-list previews and search results.
|
|
651
|
+
*
|
|
652
|
+
*/
|
|
653
|
+
export interface ReplyPreview {
|
|
654
|
+
id: Id;
|
|
655
|
+
type: MessageType;
|
|
656
|
+
sender: User | null;
|
|
330
657
|
/**
|
|
331
|
-
*
|
|
658
|
+
* The first 100 characters of the text or caption; `null` when deleted or empty.
|
|
332
659
|
*/
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
thumbnail_url?: string | null;
|
|
337
|
-
duration_ms?: number | null;
|
|
338
|
-
waveform?: number[] | null;
|
|
660
|
+
content: string | null;
|
|
661
|
+
attachment: Attachment | null;
|
|
662
|
+
is_deleted: boolean;
|
|
339
663
|
}
|
|
340
664
|
export interface ForwardedFrom {
|
|
341
665
|
message_id: Id;
|
|
342
666
|
sender_id: Id | null;
|
|
343
667
|
sender_name: string;
|
|
344
668
|
}
|
|
669
|
+
/**
|
|
670
|
+
* The sticker of a `sticker` message; absent for other types and when deleted. `attachment` carries the
|
|
671
|
+
* same image, so older clients show a sticker as a picture.
|
|
672
|
+
*
|
|
673
|
+
*/
|
|
674
|
+
export interface Sticker {
|
|
675
|
+
id: Id;
|
|
676
|
+
pack_id: Id;
|
|
677
|
+
/**
|
|
678
|
+
* The share link of the sticker's pack when a user made it; missing for built-in packs. A client that
|
|
679
|
+
* shows the pack of a sticker someone sent opens it with `GET /stickers/links/{slug}`.
|
|
680
|
+
*
|
|
681
|
+
*/
|
|
682
|
+
pack_slug?: StickerPackSlug;
|
|
683
|
+
/**
|
|
684
|
+
* The emoji the sticker stands for, for previews, notifications and search.
|
|
685
|
+
*/
|
|
686
|
+
emoji: string;
|
|
687
|
+
is_animated: boolean;
|
|
688
|
+
image: Attachment;
|
|
689
|
+
}
|
|
345
690
|
export interface Reaction {
|
|
346
691
|
emoji: string;
|
|
347
692
|
user_id: Id;
|
|
@@ -350,6 +695,33 @@ export interface ReadReceipt {
|
|
|
350
695
|
user_id: Id;
|
|
351
696
|
read_at: Timestamp;
|
|
352
697
|
}
|
|
698
|
+
/**
|
|
699
|
+
* What a `system` message records; set on system messages only, whose `content` is then `null`. The names
|
|
700
|
+
* are the display names at the time of the event. `target` fields are set for `member_added` and
|
|
701
|
+
* `member_removed`. `call` is set for `call` messages: one per call, posted when the call ends, `actor` is the
|
|
702
|
+
* initiator.
|
|
703
|
+
*
|
|
704
|
+
*/
|
|
705
|
+
export interface SystemEvent {
|
|
706
|
+
kind: SystemEventKind;
|
|
707
|
+
actor_id: Id | null;
|
|
708
|
+
actor_name: string;
|
|
709
|
+
target_id?: Id;
|
|
710
|
+
target_name?: string;
|
|
711
|
+
call?: CallSummary;
|
|
712
|
+
}
|
|
713
|
+
/**
|
|
714
|
+
* The call a `call` system message records.
|
|
715
|
+
*/
|
|
716
|
+
export interface CallSummary {
|
|
717
|
+
call_id: Id;
|
|
718
|
+
kind: "direct" | "group";
|
|
719
|
+
outcome: CallEndReason;
|
|
720
|
+
/**
|
|
721
|
+
* From the first answer to the end; `null` if nobody answered.
|
|
722
|
+
*/
|
|
723
|
+
duration_seconds: number | null;
|
|
724
|
+
}
|
|
353
725
|
/**
|
|
354
726
|
* A chat was deleted, or you were removed from it.
|
|
355
727
|
*/
|
|
@@ -422,6 +794,10 @@ export interface Group {
|
|
|
422
794
|
name: string;
|
|
423
795
|
description: string | null;
|
|
424
796
|
avatar_url: string | null;
|
|
797
|
+
/**
|
|
798
|
+
* The banner and page background of the group profile; set by the owner and admins.
|
|
799
|
+
*/
|
|
800
|
+
background: ProfileBackground | null;
|
|
425
801
|
owner_id: Id;
|
|
426
802
|
my_role: GroupRole;
|
|
427
803
|
members: GroupMember[];
|
|
@@ -456,6 +832,19 @@ export interface ServerHelloEvent {
|
|
|
456
832
|
user_id: Id;
|
|
457
833
|
};
|
|
458
834
|
}
|
|
835
|
+
/**
|
|
836
|
+
* Messages of the chat up to before_message_id were cleared, for you (scope me) or for every member (scope everyone). Drop them from what you show.
|
|
837
|
+
*/
|
|
838
|
+
export interface ServerHistoryClearedEvent {
|
|
839
|
+
type: "history_cleared";
|
|
840
|
+
event_id: Id;
|
|
841
|
+
chat_id: Id;
|
|
842
|
+
data: {
|
|
843
|
+
before_message_id: Id;
|
|
844
|
+
scope: "me" | "everyone";
|
|
845
|
+
actor_id: Id;
|
|
846
|
+
};
|
|
847
|
+
}
|
|
459
848
|
/**
|
|
460
849
|
* A new message in a chat.
|
|
461
850
|
*/
|
|
@@ -517,6 +906,72 @@ export interface ServerReadEvent {
|
|
|
517
906
|
read_at: Timestamp;
|
|
518
907
|
};
|
|
519
908
|
}
|
|
909
|
+
export interface ServerRecoveryRequestEvent {
|
|
910
|
+
type: "recovery_request";
|
|
911
|
+
event_id: string;
|
|
912
|
+
chat_id: null;
|
|
913
|
+
data: {
|
|
914
|
+
/**
|
|
915
|
+
* Approval handle for POST /auth/recovery-requests/{requestId}/approve and /deny. It is not the requester's capability.
|
|
916
|
+
*/
|
|
917
|
+
request_id: string;
|
|
918
|
+
user_agent: string;
|
|
919
|
+
location: Location | null;
|
|
920
|
+
/**
|
|
921
|
+
* @minItems 3
|
|
922
|
+
* @maxItems 3
|
|
923
|
+
*/
|
|
924
|
+
choices: [number, number, number];
|
|
925
|
+
expires_at: string;
|
|
926
|
+
};
|
|
927
|
+
}
|
|
928
|
+
/**
|
|
929
|
+
* Approximate location of a client address, looked up in an offline GeoIP database (IP geolocation by
|
|
930
|
+
* DB-IP, https://db-ip.com, CC BY 4.0). The address itself is never exposed. Each field is `null` when the
|
|
931
|
+
* database does not know it; clients localise the country name from `country_code`.
|
|
932
|
+
*
|
|
933
|
+
*/
|
|
934
|
+
export interface Location {
|
|
935
|
+
/**
|
|
936
|
+
* City name in English
|
|
937
|
+
*/
|
|
938
|
+
city: string | null;
|
|
939
|
+
/**
|
|
940
|
+
* ISO 3166-1 alpha-2 country code
|
|
941
|
+
*/
|
|
942
|
+
country_code: string | null;
|
|
943
|
+
/**
|
|
944
|
+
* Country name in English
|
|
945
|
+
*/
|
|
946
|
+
country: string | null;
|
|
947
|
+
}
|
|
948
|
+
export interface ServerSecurityAlertEvent {
|
|
949
|
+
type: "security_alert";
|
|
950
|
+
event_id: Id;
|
|
951
|
+
chat_id: null;
|
|
952
|
+
data: {
|
|
953
|
+
type:
|
|
954
|
+
| "password_changed"
|
|
955
|
+
| "recovery_key_changed"
|
|
956
|
+
| "2fa_enabled"
|
|
957
|
+
| "2fa_disabled"
|
|
958
|
+
| "passkey_added"
|
|
959
|
+
| "passkey_removed"
|
|
960
|
+
| "recovery_email_changed"
|
|
961
|
+
| "recovery_email_removed"
|
|
962
|
+
| "passkey_counter_warning"
|
|
963
|
+
| "login"
|
|
964
|
+
| "login_2fa"
|
|
965
|
+
| "passkey_login"
|
|
966
|
+
| "qr_login_approved";
|
|
967
|
+
user_agent?: string;
|
|
968
|
+
created_at?: string;
|
|
969
|
+
/**
|
|
970
|
+
* The session that made the change, when a signed-in session made it. Clients skip alerts for their own session.
|
|
971
|
+
*/
|
|
972
|
+
session_id?: string;
|
|
973
|
+
};
|
|
974
|
+
}
|
|
520
975
|
export interface ServerSecurityNoticeEvent {
|
|
521
976
|
type: "security_notice";
|
|
522
977
|
event_id: Id;
|
|
@@ -526,7 +981,7 @@ export interface ServerSecurityNoticeEvent {
|
|
|
526
981
|
};
|
|
527
982
|
}
|
|
528
983
|
/**
|
|
529
|
-
* A user started or stopped typing.
|
|
984
|
+
* A user started or stopped typing, recording a voice message, choosing a sticker or sending a photo, video or file. Hide it after about 6 seconds without a repeat: the sender may disconnect before it sends `false`.
|
|
530
985
|
*/
|
|
531
986
|
export interface ServerTypingEvent {
|
|
532
987
|
type: "typing";
|
|
@@ -535,5 +990,22 @@ export interface ServerTypingEvent {
|
|
|
535
990
|
data: {
|
|
536
991
|
user_id: Id;
|
|
537
992
|
is_typing: boolean;
|
|
993
|
+
/**
|
|
994
|
+
* What the user is doing. New values may be added: show an unknown one like `typing`.
|
|
995
|
+
*/
|
|
996
|
+
action:
|
|
997
|
+
"typing" | "recording_voice" | "choosing_sticker" | "uploading_photo" | "uploading_video" | "uploading_file";
|
|
998
|
+
};
|
|
999
|
+
}
|
|
1000
|
+
/**
|
|
1001
|
+
* A user you share a chat with changed their username, display name, bio, avatar, pronouns, birthday, profile music or profile background. Fetch GET /users/{user_id} again when profile_version is higher than the one you keep.
|
|
1002
|
+
*/
|
|
1003
|
+
export interface ServerUserUpdatedEvent {
|
|
1004
|
+
type: "user_updated";
|
|
1005
|
+
event_id: Id;
|
|
1006
|
+
chat_id: null;
|
|
1007
|
+
data: {
|
|
1008
|
+
user_id: Id;
|
|
1009
|
+
profile_version: number;
|
|
538
1010
|
};
|
|
539
1011
|
}
|