@myronsi/messenger-api 2.1.0-alpha.45.next.154 → 2.1.0-alpha.47

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.
@@ -222,6 +222,8 @@
222
222
  "stale_epoch",
223
223
  "limit_reached",
224
224
  "account_restricted",
225
+ "poll_closed",
226
+ "quiz_answered",
225
227
  "internal_error"
226
228
  ]
227
229
  },
@@ -2001,7 +2003,7 @@
2001
2003
  },
2002
2004
  "UploadPurpose": {
2003
2005
  "type": "string",
2004
- "description": "`sticker`: a PNG, JPEG or still WebP of at most 5 MB. The server fits it into 512 x 512 px with a transparent\nborder and stores a WebP (`413` when that is still over 512 KB). Only its uploader can load it until it is\nadded to a pack.\n\n`profile_music`: an audio file of at most 20 MB. The server keeps at most 30 s of it (from `start_ms` to\n`end_ms`, or the first 30 s), stored as AAC, reads the title and artist into `tags` and the embedded cover\ninto `thumbnail_url`. Use it with `PUT /me/music`.\n\n`profile_background`: an image (10 MB), an animated GIF (15 MB) or a video of at most 15 s (15 MB). Use it\nwith `PUT /me/background` or `PUT /groups/{chat_id}/background`.\n\n`emoji`: a PNG, JPEG, still WebP or GIF of at most 8 MB. The server scales it into 128 x 128 px (a GIF frame\nby frame) and refuses it with `413` when the result is still over 256 KB. Use it with\n`POST /emoji/packs/{pack_id}/emoji`.\n",
2006
+ "description": "`sticker`: a PNG, JPEG or still WebP of at most 5 MB. The server fits it into 512 x 512 px with a transparent\nborder and stores a WebP (`413` when that is still over 512 KB). Only its uploader can load it until it is\nadded to a pack.\n\nA sticker can also be made from a video (`kind: video`: MP4, WebM or MOV) or an animated GIF of at most 15 MB.\nThe server keeps at most 3 s of it (from `start_ms` to `end_ms`, or the first 3 s), crops it to the square\n`crop_x`, `crop_y`, `crop_size` when given (otherwise it fits the clip into the square with a transparent\nborder), drops the sound and stores a looping animated WebP of at most 512 x 512 px (`413` when it is still\nover 1 MB at the lowest quality). The sticker then has `is_animated: true`.\n\n`profile_music`: an audio file of at most 20 MB. The server keeps at most 30 s of it (from `start_ms` to\n`end_ms`, or the first 30 s), stored as AAC, reads the title and artist into `tags` and the embedded cover\ninto `thumbnail_url`. Use it with `PUT /me/music`.\n\n`profile_background`: an image (10 MB), an animated GIF (15 MB) or a video of at most 15 s (15 MB). Use it\nwith `PUT /me/background` or `PUT /groups/{chat_id}/background`.\n\n`emoji`: a PNG, JPEG, still WebP or GIF of at most 8 MB. The server scales it into 128 x 128 px (a GIF frame\nby frame) and refuses it with `413` when the result is still over 256 KB. Use it with\n`POST /emoji/packs/{pack_id}/emoji`.\n",
2005
2007
  "enum": [
2006
2008
  "message",
2007
2009
  "avatar",
@@ -2046,12 +2048,30 @@
2046
2048
  "start_ms": {
2047
2049
  "type": "integer",
2048
2050
  "minimum": 0,
2049
- "description": "`profile_music` only: where the kept part starts."
2051
+ "description": "`profile_music`, and `sticker` from a video or GIF: where the kept part starts."
2050
2052
  },
2051
2053
  "end_ms": {
2052
2054
  "type": "integer",
2053
2055
  "minimum": 1,
2054
- "description": "`profile_music` only: where the kept part ends, at most 30 s after `start_ms`."
2056
+ "description": "`profile_music`: where the kept part ends, at most 30 s after `start_ms`. `sticker` from a video or GIF: at\nmost 3 s after `start_ms`.\n"
2057
+ },
2058
+ "crop_x": {
2059
+ "type": "number",
2060
+ "minimum": 0,
2061
+ "maximum": 1,
2062
+ "description": "`sticker` from a video or GIF: left edge of the square crop, as a fraction of the width."
2063
+ },
2064
+ "crop_y": {
2065
+ "type": "number",
2066
+ "minimum": 0,
2067
+ "maximum": 1,
2068
+ "description": "`sticker` from a video or GIF: top edge of the square crop, as a fraction of the height."
2069
+ },
2070
+ "crop_size": {
2071
+ "type": "number",
2072
+ "exclusiveMinimum": 0,
2073
+ "maximum": 1,
2074
+ "description": "`sticker` from a video or GIF: side of the square crop, as a fraction of the shorter side. Send all three\ncrop fields or none; the square must lie inside the frame.\n"
2055
2075
  }
2056
2076
  }
2057
2077
  },
@@ -2506,17 +2526,21 @@
2506
2526
  },
2507
2527
  "MessageType": {
2508
2528
  "type": "string",
2529
+ "description": "`poll`, `contact` and `location` carry their data in `Message.poll`, `Message.contact` and\n`Message.location`. For older clients their `content` holds a short plain-text summary: `📊 <question>`,\n`👤 @<username>`, or `📍 <place name> <OpenStreetMap link>`.\n",
2509
2530
  "enum": [
2510
2531
  "text",
2511
2532
  "file",
2512
2533
  "voice",
2513
2534
  "system",
2514
- "sticker"
2535
+ "sticker",
2536
+ "poll",
2537
+ "contact",
2538
+ "location"
2515
2539
  ]
2516
2540
  },
2517
2541
  "Sticker": {
2518
2542
  "type": "object",
2519
- "description": "One sticker of a pack. `image` is a WebP or PNG of at most 512 x 512 px with transparency, animated when\n`is_animated` is true; any signed-in user can load it. Clients show it without a bubble.\n",
2543
+ "description": "One sticker of a pack. `image` is a WebP or PNG of at most 512 x 512 px with transparency, animated when\n`is_animated` is true (also stickers made from a video or GIF); any signed-in user can load it. The `panel`\nvariant of an animated sticker is a still first frame. Clients show it without a bubble.\n",
2520
2544
  "required": [
2521
2545
  "id",
2522
2546
  "pack_id",
@@ -3063,7 +3087,7 @@
3063
3087
  "type",
3064
3088
  "chat_id"
3065
3089
  ],
3066
- "description": "`message_updated` carries the message as the caller sees it now (`message`). `message_deleted` names the\nmessage and its `scope`. `pins_changed`: load the pins of the chat again. `history_cleared`: drop the\nmessages up to and including `before_message_id` (`scope` says for whom). `chat_hidden`: the caller\ndeleted the chat for themselves up to `before_message_id`.\n",
3090
+ "description": "`message_updated` carries the message as the caller sees it now (`message`). `message_deleted` names the\nmessage and its `scope`. `pins_changed`: load the pins of the chat again. `history_cleared`: drop the\nmessages up to and including `before_message_id` (`scope` says for whom). `chat_hidden`: the caller\ndeleted the chat for themselves up to `before_message_id`.\n`history_imported`: an imported history was added, removed or a sender confirmed; load the chat again.\n",
3067
3091
  "properties": {
3068
3092
  "type": {
3069
3093
  "type": "string",
@@ -3072,7 +3096,8 @@
3072
3096
  "message_deleted",
3073
3097
  "pins_changed",
3074
3098
  "history_cleared",
3075
- "chat_hidden"
3099
+ "chat_hidden",
3100
+ "history_imported"
3076
3101
  ]
3077
3102
  },
3078
3103
  "chat_id": {
@@ -3160,7 +3185,7 @@
3160
3185
  "null"
3161
3186
  ],
3162
3187
  "maxLength": 4096,
3163
- "description": "Text, the caption of a file, or the emoji of a sticker; `null` when deleted."
3188
+ "description": "Text, the caption of a file, the emoji of a sticker, or the plain-text summary of a poll, contact or\nlocation (see `MessageType`); `null` when deleted.\n"
3164
3189
  },
3165
3190
  "attachment": {
3166
3191
  "oneOf": [
@@ -3221,7 +3246,12 @@
3221
3246
  }
3222
3247
  },
3223
3248
  "created_at": {
3224
- "$ref": "#/$defs/Timestamp"
3249
+ "description": "When the message was sent; for an imported message, when it was sent in the other messenger.",
3250
+ "allOf": [
3251
+ {
3252
+ "$ref": "#/$defs/Timestamp"
3253
+ }
3254
+ ]
3225
3255
  },
3226
3256
  "edited_at": {
3227
3257
  "oneOf": [
@@ -3236,6 +3266,9 @@
3236
3266
  "is_deleted": {
3237
3267
  "type": "boolean"
3238
3268
  },
3269
+ "import": {
3270
+ "$ref": "#/$defs/MessageImport"
3271
+ },
3239
3272
  "removed_by_moderation": {
3240
3273
  "type": "boolean",
3241
3274
  "description": "`true` when moderation removed the message; it is then also `is_deleted`. Clients show \"Removed by\nmoderation\" instead of the deleted placeholder. Absent otherwise.\n"
@@ -3265,180 +3298,247 @@
3265
3298
  "mentions_all": {
3266
3299
  "type": "boolean",
3267
3300
  "description": "`true` when an owner or admin wrote `@all`; it mentions every member. Absent otherwise."
3301
+ },
3302
+ "poll": {
3303
+ "description": "The poll of a `poll` message as the requesting user sees it; absent for other types, when deleted and in chat-list previews.",
3304
+ "$ref": "#/$defs/Poll"
3305
+ },
3306
+ "contact": {
3307
+ "description": "The shared user of a `contact` message; absent for other types, when deleted and in chat-list previews.",
3308
+ "$ref": "#/$defs/ContactCard"
3309
+ },
3310
+ "location": {
3311
+ "description": "The place of a `location` message; absent for other types and when deleted.",
3312
+ "$ref": "#/$defs/MessageLocation"
3268
3313
  }
3269
3314
  }
3270
3315
  },
3271
- "LinkPreview": {
3316
+ "PollCreate": {
3272
3317
  "type": "object",
3318
+ "description": "A new poll. Option texts are trimmed and must differ (ignoring case). `quiz` makes it a quiz: one correct\noption, one answer per voter that cannot be changed; it cannot be combined with `multiple_answers`.\n`close_at` closes the poll automatically, 5 minutes to 30 days from now.\n",
3273
3319
  "required": [
3274
- "url",
3275
- "title",
3276
- "description",
3277
- "site_name",
3278
- "image"
3320
+ "question",
3321
+ "options"
3279
3322
  ],
3323
+ "additionalProperties": false,
3280
3324
  "properties": {
3281
- "url": {
3325
+ "question": {
3282
3326
  "type": "string",
3283
- "description": "The page after redirects"
3284
- },
3285
- "title": {
3286
- "type": [
3287
- "string",
3288
- "null"
3289
- ],
3327
+ "minLength": 1,
3290
3328
  "maxLength": 300
3291
3329
  },
3292
- "description": {
3293
- "type": [
3294
- "string",
3295
- "null"
3296
- ],
3297
- "maxLength": 500
3330
+ "options": {
3331
+ "type": "array",
3332
+ "minItems": 2,
3333
+ "maxItems": 10,
3334
+ "items": {
3335
+ "type": "string",
3336
+ "minLength": 1,
3337
+ "maxLength": 100
3338
+ }
3298
3339
  },
3299
- "site_name": {
3300
- "type": [
3301
- "string",
3302
- "null"
3303
- ],
3304
- "maxLength": 100
3340
+ "multiple_answers": {
3341
+ "type": "boolean",
3342
+ "default": false
3305
3343
  },
3306
- "image": {
3307
- "oneOf": [
3308
- {
3309
- "$ref": "#/$defs/LinkPreviewImage"
3310
- },
3311
- {
3312
- "type": "null"
3313
- }
3314
- ]
3344
+ "anonymous": {
3345
+ "type": "boolean",
3346
+ "default": true,
3347
+ "description": "`false` lets everyone who sees the results list who voted for what. Anonymous votes are still stored\nwith the voter, so each member votes once and can change the vote, but no one else sees them.\n"
3348
+ },
3349
+ "quiz": {
3350
+ "$ref": "#/$defs/PollQuizCreate"
3351
+ },
3352
+ "close_at": {
3353
+ "$ref": "#/$defs/Timestamp"
3315
3354
  }
3316
3355
  }
3317
3356
  },
3318
- "LinkPreviewImage": {
3357
+ "PollQuizCreate": {
3319
3358
  "type": "object",
3320
3359
  "required": [
3321
- "url",
3322
- "width",
3323
- "height"
3360
+ "correct_option"
3324
3361
  ],
3362
+ "additionalProperties": false,
3325
3363
  "properties": {
3326
- "url": {
3327
- "type": "string",
3328
- "description": "`GET /link-preview/image` with the signed address of the page's image"
3329
- },
3330
- "width": {
3331
- "type": [
3332
- "integer",
3333
- "null"
3334
- ],
3335
- "minimum": 1
3364
+ "correct_option": {
3365
+ "type": "integer",
3366
+ "minimum": 0,
3367
+ "maximum": 9,
3368
+ "description": "Index into `options`"
3336
3369
  },
3337
- "height": {
3338
- "type": [
3339
- "integer",
3340
- "null"
3341
- ],
3342
- "minimum": 1
3370
+ "explanation": {
3371
+ "type": "string",
3372
+ "minLength": 1,
3373
+ "maxLength": 200
3343
3374
  }
3344
3375
  }
3345
3376
  },
3346
- "SystemEventKind": {
3347
- "type": "string",
3348
- "enum": [
3349
- "group_created",
3350
- "member_added",
3351
- "member_joined",
3352
- "member_removed",
3353
- "member_left",
3354
- "call",
3355
- "message_pinned",
3356
- "message_unpinned"
3357
- ]
3358
- },
3359
- "SystemEvent": {
3377
+ "Poll": {
3360
3378
  "type": "object",
3361
- "description": "What a `system` message records; set on system messages only, whose `content` is then `null`. The names\nare the display names at the time of the event. `target` fields are set for `member_added` and\n`member_removed`. `call` is set for `call` messages: one per call, posted when the call ends, `actor` is the\ninitiator. `message_id` and `snippet` are set for `message_pinned` and `message_unpinned`.\n",
3379
+ "description": "A poll as the requesting user sees it. Results (`voter_count`, `total_voters`, `is_correct`, `explanation`)\nare `null` or absent until that user voted, unless they created the poll or it is closed. A poll is closed\nwhen `closed_at` is set; clients also treat it as closed once `close_at` has passed.\n",
3362
3380
  "required": [
3363
- "kind",
3364
- "actor_id",
3365
- "actor_name"
3381
+ "question",
3382
+ "options",
3383
+ "multiple_answers",
3384
+ "anonymous",
3385
+ "quiz",
3386
+ "explanation",
3387
+ "close_at",
3388
+ "closed_at",
3389
+ "total_voters",
3390
+ "my_votes",
3391
+ "can_close",
3392
+ "version"
3366
3393
  ],
3367
3394
  "properties": {
3368
- "kind": {
3369
- "$ref": "#/$defs/SystemEventKind"
3395
+ "question": {
3396
+ "type": "string"
3370
3397
  },
3371
- "actor_id": {
3398
+ "options": {
3399
+ "type": "array",
3400
+ "items": {
3401
+ "$ref": "#/$defs/PollOption"
3402
+ }
3403
+ },
3404
+ "multiple_answers": {
3405
+ "type": "boolean"
3406
+ },
3407
+ "anonymous": {
3408
+ "type": "boolean"
3409
+ },
3410
+ "quiz": {
3411
+ "type": "boolean"
3412
+ },
3413
+ "explanation": {
3414
+ "type": [
3415
+ "string",
3416
+ "null"
3417
+ ],
3418
+ "description": "The explanation of a quiz once the user sees the results."
3419
+ },
3420
+ "close_at": {
3372
3421
  "oneOf": [
3373
3422
  {
3374
- "$ref": "#/$defs/Id"
3423
+ "$ref": "#/$defs/Timestamp"
3375
3424
  },
3376
3425
  {
3377
3426
  "type": "null"
3378
3427
  }
3379
3428
  ]
3380
3429
  },
3381
- "actor_name": {
3382
- "type": "string"
3430
+ "closed_at": {
3431
+ "oneOf": [
3432
+ {
3433
+ "$ref": "#/$defs/Timestamp"
3434
+ },
3435
+ {
3436
+ "type": "null"
3437
+ }
3438
+ ]
3383
3439
  },
3384
- "target_id": {
3385
- "$ref": "#/$defs/Id"
3440
+ "total_voters": {
3441
+ "type": [
3442
+ "integer",
3443
+ "null"
3444
+ ],
3445
+ "minimum": 0,
3446
+ "description": "People who voted, each counted once even with several answers."
3386
3447
  },
3387
- "target_name": {
3388
- "type": "string"
3448
+ "my_votes": {
3449
+ "type": "array",
3450
+ "description": "Indexes of the options the user voted for; empty when they have not voted.",
3451
+ "items": {
3452
+ "type": "integer",
3453
+ "minimum": 0,
3454
+ "maximum": 9
3455
+ }
3389
3456
  },
3390
- "call": {
3391
- "$ref": "#/$defs/CallSummary"
3457
+ "can_close": {
3458
+ "type": "boolean",
3459
+ "description": "The user may close the poll now."
3392
3460
  },
3393
- "message_id": {
3394
- "description": "The pinned or unpinned message.",
3395
- "allOf": [
3396
- {
3397
- "$ref": "#/$defs/Id"
3398
- }
3399
- ]
3461
+ "version": {
3462
+ "type": "integer",
3463
+ "minimum": 0,
3464
+ "description": "Grows with every vote and when the poll closes; keep the poll with the highest version."
3465
+ }
3466
+ }
3467
+ },
3468
+ "PollOption": {
3469
+ "type": "object",
3470
+ "required": [
3471
+ "text",
3472
+ "voter_count"
3473
+ ],
3474
+ "properties": {
3475
+ "text": {
3476
+ "type": "string"
3400
3477
  },
3401
- "snippet": {
3402
- "type": "string",
3403
- "maxLength": 64,
3404
- "description": "Start of the pinned message's text at the time of the event (at most 60 characters plus `…`); empty for a\nmessage without text, which clients name by its `message_type`.\n"
3478
+ "voter_count": {
3479
+ "type": [
3480
+ "integer",
3481
+ "null"
3482
+ ],
3483
+ "minimum": 0
3405
3484
  },
3406
- "message_type": {
3407
- "$ref": "#/$defs/MessageType"
3485
+ "is_correct": {
3486
+ "type": "boolean",
3487
+ "description": "Set on every option of a quiz once the user sees the results; absent otherwise."
3408
3488
  }
3409
3489
  }
3410
3490
  },
3411
- "MessagePage": {
3491
+ "PollVoteRequest": {
3412
3492
  "type": "object",
3413
3493
  "required": [
3414
- "items",
3415
- "next_cursor",
3416
- "prev_cursor"
3494
+ "options"
3417
3495
  ],
3496
+ "additionalProperties": false,
3418
3497
  "properties": {
3419
- "items": {
3498
+ "options": {
3420
3499
  "type": "array",
3421
- "description": "Oldest to newest",
3500
+ "maxItems": 10,
3501
+ "uniqueItems": true,
3422
3502
  "items": {
3423
- "$ref": "#/$defs/Message"
3503
+ "type": "integer",
3504
+ "minimum": 0,
3505
+ "maximum": 9
3424
3506
  }
3425
- },
3426
- "next_cursor": {
3427
- "description": "Continues in the direction of the request: pass it as `before` (older) for the\ndefault, `before` and `around` requests, or as `after` (newer) for `after` requests.\n",
3428
- "oneOf": [
3507
+ }
3508
+ }
3509
+ },
3510
+ "ContactCreate": {
3511
+ "type": "object",
3512
+ "required": [
3513
+ "user_id"
3514
+ ],
3515
+ "additionalProperties": false,
3516
+ "properties": {
3517
+ "user_id": {
3518
+ "description": "A user whose profile the sender may open (`403` otherwise), the sender included; not a deleted account.\n",
3519
+ "allOf": [
3429
3520
  {
3430
3521
  "$ref": "#/$defs/Id"
3431
- },
3432
- {
3433
- "type": "null"
3434
3522
  }
3435
3523
  ]
3524
+ }
3525
+ }
3526
+ },
3527
+ "ContactCard": {
3528
+ "type": "object",
3529
+ "required": [
3530
+ "user_id",
3531
+ "user"
3532
+ ],
3533
+ "properties": {
3534
+ "user_id": {
3535
+ "$ref": "#/$defs/Id"
3436
3536
  },
3437
- "prev_cursor": {
3438
- "description": "The opposite direction (`after` for the default request, `before` for an `after` request).",
3537
+ "user": {
3538
+ "description": "The shared user as the requesting user may see them now, not as they were when the card was sent; `null`\nwhen the account is gone.\n",
3439
3539
  "oneOf": [
3440
3540
  {
3441
- "$ref": "#/$defs/Id"
3541
+ "$ref": "#/$defs/User"
3442
3542
  },
3443
3543
  {
3444
3544
  "type": "null"
@@ -3447,157 +3547,965 @@
3447
3547
  }
3448
3548
  }
3449
3549
  },
3450
- "SearchHit": {
3550
+ "LocationCreate": {
3451
3551
  "type": "object",
3452
3552
  "required": [
3453
- "message"
3553
+ "latitude",
3554
+ "longitude"
3454
3555
  ],
3556
+ "additionalProperties": false,
3455
3557
  "properties": {
3456
- "message": {
3457
- "$ref": "#/$defs/Message"
3558
+ "latitude": {
3559
+ "type": "number",
3560
+ "format": "double",
3561
+ "minimum": -90,
3562
+ "maximum": 90
3458
3563
  },
3459
- "highlight": {
3460
- "type": [
3461
- "string",
3462
- "null"
3463
- ],
3464
- "description": "Plain-text excerpt of the matching text or file name; never HTML. The matched words are\nwrapped in U+E000 (start) and U+E001 (end), characters of the Unicode private use area,\nso a client can mark them without parsing markup. `null` when the message matched without\nan excerpt.\n"
3465
- }
3466
- }
3467
- },
3468
- "UnsentMessage": {
3469
- "type": "object",
3564
+ "longitude": {
3565
+ "type": "number",
3566
+ "format": "double",
3567
+ "minimum": -180,
3568
+ "maximum": 180
3569
+ },
3570
+ "accuracy_m": {
3571
+ "type": "integer",
3572
+ "minimum": 0,
3573
+ "maximum": 10000,
3574
+ "description": "Accuracy of a measured position in metres; omit for a point picked on the map."
3575
+ },
3576
+ "title": {
3577
+ "type": "string",
3578
+ "minLength": 1,
3579
+ "maxLength": 100,
3580
+ "description": "A name for the place, typed by the sender."
3581
+ }
3582
+ }
3583
+ },
3584
+ "MessageLocation": {
3585
+ "type": "object",
3586
+ "description": "Coordinates are rounded to 6 decimals (about 10 cm).",
3587
+ "required": [
3588
+ "latitude",
3589
+ "longitude",
3590
+ "accuracy_m",
3591
+ "title",
3592
+ "map"
3593
+ ],
3594
+ "properties": {
3595
+ "latitude": {
3596
+ "type": "number",
3597
+ "format": "double",
3598
+ "minimum": -90,
3599
+ "maximum": 90
3600
+ },
3601
+ "longitude": {
3602
+ "type": "number",
3603
+ "format": "double",
3604
+ "minimum": -180,
3605
+ "maximum": 180
3606
+ },
3607
+ "accuracy_m": {
3608
+ "type": [
3609
+ "integer",
3610
+ "null"
3611
+ ],
3612
+ "minimum": 0
3613
+ },
3614
+ "title": {
3615
+ "type": [
3616
+ "string",
3617
+ "null"
3618
+ ],
3619
+ "maxLength": 100
3620
+ },
3621
+ "map": {
3622
+ "$ref": "#/$defs/MapImage"
3623
+ }
3624
+ }
3625
+ },
3626
+ "MapImage": {
3627
+ "type": "object",
3628
+ "required": [
3629
+ "url",
3630
+ "width",
3631
+ "height"
3632
+ ],
3633
+ "properties": {
3634
+ "url": {
3635
+ "type": "string",
3636
+ "description": "`GET /maps/static` with the signed point; load it like other API images"
3637
+ },
3638
+ "width": {
3639
+ "type": "integer",
3640
+ "minimum": 1
3641
+ },
3642
+ "height": {
3643
+ "type": "integer",
3644
+ "minimum": 1
3645
+ }
3646
+ }
3647
+ },
3648
+ "LinkPreview": {
3649
+ "type": "object",
3650
+ "required": [
3651
+ "url",
3652
+ "title",
3653
+ "description",
3654
+ "site_name",
3655
+ "image"
3656
+ ],
3657
+ "properties": {
3658
+ "url": {
3659
+ "type": "string",
3660
+ "description": "The page after redirects"
3661
+ },
3662
+ "title": {
3663
+ "type": [
3664
+ "string",
3665
+ "null"
3666
+ ],
3667
+ "maxLength": 300
3668
+ },
3669
+ "description": {
3670
+ "type": [
3671
+ "string",
3672
+ "null"
3673
+ ],
3674
+ "maxLength": 500
3675
+ },
3676
+ "site_name": {
3677
+ "type": [
3678
+ "string",
3679
+ "null"
3680
+ ],
3681
+ "maxLength": 100
3682
+ },
3683
+ "image": {
3684
+ "oneOf": [
3685
+ {
3686
+ "$ref": "#/$defs/LinkPreviewImage"
3687
+ },
3688
+ {
3689
+ "type": "null"
3690
+ }
3691
+ ]
3692
+ }
3693
+ }
3694
+ },
3695
+ "LinkPreviewImage": {
3696
+ "type": "object",
3697
+ "required": [
3698
+ "url",
3699
+ "width",
3700
+ "height"
3701
+ ],
3702
+ "properties": {
3703
+ "url": {
3704
+ "type": "string",
3705
+ "description": "`GET /link-preview/image` with the signed address of the page's image"
3706
+ },
3707
+ "width": {
3708
+ "type": [
3709
+ "integer",
3710
+ "null"
3711
+ ],
3712
+ "minimum": 1
3713
+ },
3714
+ "height": {
3715
+ "type": [
3716
+ "integer",
3717
+ "null"
3718
+ ],
3719
+ "minimum": 1
3720
+ }
3721
+ }
3722
+ },
3723
+ "SystemEventKind": {
3724
+ "type": "string",
3725
+ "enum": [
3726
+ "group_created",
3727
+ "member_added",
3728
+ "member_joined",
3729
+ "member_removed",
3730
+ "member_left",
3731
+ "call",
3732
+ "message_pinned",
3733
+ "message_unpinned",
3734
+ "history_imported",
3735
+ "history_import_ended",
3736
+ "imported_note",
3737
+ "group_renamed",
3738
+ "group_avatar_changed",
3739
+ "owner_transferred"
3740
+ ]
3741
+ },
3742
+ "SystemEvent": {
3743
+ "type": "object",
3744
+ "description": "What a `system` message records; set on system messages only, whose `content` is then `null`. The names\nare the display names at the time of the event. `target` fields are set for `member_added`,\n`member_removed` and `owner_transferred` (the new owner; `actor` is the previous one). `call` is set for\n`call` messages: one per call, posted when the call ends, `actor` is the initiator. `message_id` and\n`snippet` are set for `message_pinned` and `message_unpinned`. `old_name` and `new_name` are set for\n`group_renamed`, `avatar_removed` for `group_avatar_changed`.\n`history_imported` opens and `history_import_ended` closes an imported history; both carry `import`, and\n`actor` is the importer. `imported_note` is a line of the export that is not a message; its text is `text`.\n",
3745
+ "required": [
3746
+ "kind",
3747
+ "actor_id",
3748
+ "actor_name"
3749
+ ],
3750
+ "properties": {
3751
+ "kind": {
3752
+ "$ref": "#/$defs/SystemEventKind"
3753
+ },
3754
+ "actor_id": {
3755
+ "oneOf": [
3756
+ {
3757
+ "$ref": "#/$defs/Id"
3758
+ },
3759
+ {
3760
+ "type": "null"
3761
+ }
3762
+ ]
3763
+ },
3764
+ "actor_name": {
3765
+ "type": "string"
3766
+ },
3767
+ "target_id": {
3768
+ "$ref": "#/$defs/Id"
3769
+ },
3770
+ "target_name": {
3771
+ "type": "string"
3772
+ },
3773
+ "call": {
3774
+ "$ref": "#/$defs/CallSummary"
3775
+ },
3776
+ "message_id": {
3777
+ "description": "The pinned or unpinned message.",
3778
+ "allOf": [
3779
+ {
3780
+ "$ref": "#/$defs/Id"
3781
+ }
3782
+ ]
3783
+ },
3784
+ "snippet": {
3785
+ "type": "string",
3786
+ "maxLength": 64,
3787
+ "description": "Start of the pinned message's text at the time of the event (at most 60 characters plus `…`): the question\nof a poll, the place name of a location. Empty for a message without text and for a contact, which clients\nname by its `message_type`.\n"
3788
+ },
3789
+ "message_type": {
3790
+ "$ref": "#/$defs/MessageType"
3791
+ },
3792
+ "old_name": {
3793
+ "type": "string",
3794
+ "maxLength": 64
3795
+ },
3796
+ "new_name": {
3797
+ "type": "string",
3798
+ "maxLength": 64
3799
+ },
3800
+ "avatar_removed": {
3801
+ "type": "boolean",
3802
+ "description": "`true` when the group photo was removed, `false` when a new one was set."
3803
+ },
3804
+ "import": {
3805
+ "$ref": "#/$defs/ImportSummary"
3806
+ },
3807
+ "text": {
3808
+ "type": "string",
3809
+ "maxLength": 4096,
3810
+ "description": "The line of the export, for `imported_note`."
3811
+ }
3812
+ }
3813
+ },
3814
+ "MessagePage": {
3815
+ "type": "object",
3816
+ "required": [
3817
+ "items",
3818
+ "next_cursor",
3819
+ "prev_cursor"
3820
+ ],
3821
+ "properties": {
3822
+ "items": {
3823
+ "type": "array",
3824
+ "description": "Oldest to newest",
3825
+ "items": {
3826
+ "$ref": "#/$defs/Message"
3827
+ }
3828
+ },
3829
+ "next_cursor": {
3830
+ "description": "Continues in the direction of the request: pass it as `before` (older) for the\ndefault, `before` and `around` requests, or as `after` (newer) for `after` requests.\n",
3831
+ "oneOf": [
3832
+ {
3833
+ "$ref": "#/$defs/Id"
3834
+ },
3835
+ {
3836
+ "type": "null"
3837
+ }
3838
+ ]
3839
+ },
3840
+ "prev_cursor": {
3841
+ "description": "The opposite direction (`after` for the default request, `before` for an `after` request).",
3842
+ "oneOf": [
3843
+ {
3844
+ "$ref": "#/$defs/Id"
3845
+ },
3846
+ {
3847
+ "type": "null"
3848
+ }
3849
+ ]
3850
+ }
3851
+ }
3852
+ },
3853
+ "SearchHit": {
3854
+ "type": "object",
3855
+ "required": [
3856
+ "message"
3857
+ ],
3858
+ "properties": {
3859
+ "message": {
3860
+ "$ref": "#/$defs/Message"
3861
+ },
3862
+ "highlight": {
3863
+ "type": [
3864
+ "string",
3865
+ "null"
3866
+ ],
3867
+ "description": "Plain-text excerpt of the matching text or file name; never HTML. The matched words are\nwrapped in U+E000 (start) and U+E001 (end), characters of the Unicode private use area,\nso a client can mark them without parsing markup. `null` when the message matched without\nan excerpt.\n"
3868
+ }
3869
+ }
3870
+ },
3871
+ "UnsentMessage": {
3872
+ "type": "object",
3470
3873
  "description": "A send the server rejected for a reason that may pass later. Resend it with the same `client_temp_id`.",
3471
3874
  "required": [
3472
- "chat_id",
3473
- "client_temp_id",
3474
- "type",
3475
- "content",
3476
- "reply_to",
3477
- "attachments",
3478
- "error_code",
3479
- "created_at"
3875
+ "chat_id",
3876
+ "client_temp_id",
3877
+ "type",
3878
+ "content",
3879
+ "reply_to",
3880
+ "attachments",
3881
+ "error_code",
3882
+ "created_at"
3883
+ ],
3884
+ "properties": {
3885
+ "chat_id": {
3886
+ "$ref": "#/$defs/Id"
3887
+ },
3888
+ "client_temp_id": {
3889
+ "$ref": "#/$defs/ClientTempId"
3890
+ },
3891
+ "type": {
3892
+ "type": "string",
3893
+ "enum": [
3894
+ "text",
3895
+ "file",
3896
+ "voice",
3897
+ "sticker",
3898
+ "poll",
3899
+ "contact",
3900
+ "location"
3901
+ ]
3902
+ },
3903
+ "content": {
3904
+ "type": [
3905
+ "string",
3906
+ "null"
3907
+ ]
3908
+ },
3909
+ "reply_to": {
3910
+ "oneOf": [
3911
+ {
3912
+ "$ref": "#/$defs/Id"
3913
+ },
3914
+ {
3915
+ "type": "null"
3916
+ }
3917
+ ]
3918
+ },
3919
+ "attachments": {
3920
+ "type": "array",
3921
+ "description": "Uploaded files of the send that still exist, in the order they were sent.",
3922
+ "items": {
3923
+ "$ref": "#/$defs/Attachment"
3924
+ }
3925
+ },
3926
+ "sticker": {
3927
+ "$ref": "#/$defs/Sticker"
3928
+ },
3929
+ "poll": {
3930
+ "description": "The poll of an unsent `poll` message, as it was sent.",
3931
+ "$ref": "#/$defs/PollCreate"
3932
+ },
3933
+ "contact": {
3934
+ "description": "The contact of an unsent `contact` message, as it was sent.",
3935
+ "$ref": "#/$defs/ContactCreate"
3936
+ },
3937
+ "location": {
3938
+ "description": "The place of an unsent `location` message, as it was sent.",
3939
+ "$ref": "#/$defs/LocationCreate"
3940
+ },
3941
+ "error_code": {
3942
+ "$ref": "#/$defs/ErrorCode"
3943
+ },
3944
+ "created_at": {
3945
+ "$ref": "#/$defs/Timestamp"
3946
+ }
3947
+ }
3948
+ },
3949
+ "MessageSearchPage": {
3950
+ "type": "object",
3951
+ "required": [
3952
+ "items",
3953
+ "next_cursor"
3954
+ ],
3955
+ "properties": {
3956
+ "items": {
3957
+ "type": "array",
3958
+ "items": {
3959
+ "$ref": "#/$defs/SearchHit"
3960
+ }
3961
+ },
3962
+ "next_cursor": {
3963
+ "$ref": "#/$defs/Cursor"
3964
+ }
3965
+ }
3966
+ },
3967
+ "SendMessageRequest": {
3968
+ "type": "object",
3969
+ "required": [
3970
+ "client_temp_id",
3971
+ "type"
3972
+ ],
3973
+ "properties": {
3974
+ "client_temp_id": {
3975
+ "$ref": "#/$defs/ClientTempId"
3976
+ },
3977
+ "type": {
3978
+ "type": "string",
3979
+ "enum": [
3980
+ "text",
3981
+ "file",
3982
+ "voice",
3983
+ "sticker",
3984
+ "poll",
3985
+ "contact",
3986
+ "location"
3987
+ ]
3988
+ },
3989
+ "content": {
3990
+ "type": [
3991
+ "string",
3992
+ "null"
3993
+ ],
3994
+ "maxLength": 4096
3995
+ },
3996
+ "poll": {
3997
+ "description": "The poll of a `poll` message. Poll, contact and location messages have no content, attachment, sticker or\ndrawings; the server writes a plain-text summary into `content` for older clients. Send them with this\noperation; the WebSocket `message` event does not take them.\n",
3998
+ "$ref": "#/$defs/PollCreate"
3999
+ },
4000
+ "contact": {
4001
+ "description": "The shared user of a `contact` message.",
4002
+ "$ref": "#/$defs/ContactCreate"
4003
+ },
4004
+ "location": {
4005
+ "description": "The place of a `location` message.",
4006
+ "$ref": "#/$defs/LocationCreate"
4007
+ },
4008
+ "sticker_id": {
4009
+ "description": "The sticker of a `sticker` message, from any pack that is not deleted. Sticker messages have no content,\nattachment or drawings; the server sets `content` to the sticker's emoji. Send stickers with this\noperation; the WebSocket `message` event does not take them.\n",
4010
+ "$ref": "#/$defs/Id"
4011
+ },
4012
+ "attachment_id": {
4013
+ "description": "Single upload ID for a file or voice message. Omit for albums.",
4014
+ "oneOf": [
4015
+ {
4016
+ "$ref": "#/$defs/AttachmentRef"
4017
+ },
4018
+ {
4019
+ "type": "null"
4020
+ }
4021
+ ]
4022
+ },
4023
+ "attachment_ids": {
4024
+ "type": "array",
4025
+ "description": "Ordered IDs of two to ten image or video uploads for one file message.",
4026
+ "minItems": 2,
4027
+ "maxItems": 10,
4028
+ "uniqueItems": true,
4029
+ "items": {
4030
+ "$ref": "#/$defs/AttachmentRef"
4031
+ }
4032
+ },
4033
+ "reply_to": {
4034
+ "oneOf": [
4035
+ {
4036
+ "$ref": "#/$defs/Id"
4037
+ },
4038
+ {
4039
+ "type": "null"
4040
+ }
4041
+ ]
4042
+ },
4043
+ "drawings": {
4044
+ "type": "array",
4045
+ "description": "Drawings on images of a `file` message, at most one per image. Each `attachment_id` must be one of the\nmessage's attachments. An image with a drawing may also be an image of the message in `reply_to`\ninstead of the sender's own upload: that is how a member draws on an image someone sent.\n",
4046
+ "maxItems": 10,
4047
+ "items": {
4048
+ "$ref": "#/$defs/AttachmentDrawing"
4049
+ }
4050
+ }
4051
+ },
4052
+ "allOf": [
4053
+ {
4054
+ "if": {
4055
+ "properties": {
4056
+ "type": {
4057
+ "const": "poll"
4058
+ }
4059
+ }
4060
+ },
4061
+ "then": {
4062
+ "required": [
4063
+ "poll"
4064
+ ],
4065
+ "properties": {
4066
+ "poll": {
4067
+ "$ref": "#/$defs/PollCreate"
4068
+ }
4069
+ }
4070
+ },
4071
+ "else": {
4072
+ "properties": {
4073
+ "poll": {
4074
+ "not": {}
4075
+ }
4076
+ }
4077
+ }
4078
+ },
4079
+ {
4080
+ "if": {
4081
+ "properties": {
4082
+ "type": {
4083
+ "const": "contact"
4084
+ }
4085
+ }
4086
+ },
4087
+ "then": {
4088
+ "required": [
4089
+ "contact"
4090
+ ],
4091
+ "properties": {
4092
+ "contact": {
4093
+ "$ref": "#/$defs/ContactCreate"
4094
+ }
4095
+ }
4096
+ },
4097
+ "else": {
4098
+ "properties": {
4099
+ "contact": {
4100
+ "not": {}
4101
+ }
4102
+ }
4103
+ }
4104
+ },
4105
+ {
4106
+ "if": {
4107
+ "properties": {
4108
+ "type": {
4109
+ "const": "location"
4110
+ }
4111
+ }
4112
+ },
4113
+ "then": {
4114
+ "required": [
4115
+ "location"
4116
+ ],
4117
+ "properties": {
4118
+ "location": {
4119
+ "$ref": "#/$defs/LocationCreate"
4120
+ }
4121
+ }
4122
+ },
4123
+ "else": {
4124
+ "properties": {
4125
+ "location": {
4126
+ "not": {}
4127
+ }
4128
+ }
4129
+ }
4130
+ }
4131
+ ],
4132
+ "if": {
4133
+ "properties": {
4134
+ "type": {
4135
+ "enum": [
4136
+ "file",
4137
+ "voice"
4138
+ ]
4139
+ }
4140
+ }
4141
+ },
4142
+ "then": {
4143
+ "properties": {
4144
+ "sticker_id": {
4145
+ "not": {}
4146
+ }
4147
+ },
4148
+ "oneOf": [
4149
+ {
4150
+ "required": [
4151
+ "attachment_id"
4152
+ ],
4153
+ "properties": {
4154
+ "attachment_id": {
4155
+ "$ref": "#/$defs/AttachmentRef"
4156
+ },
4157
+ "attachment_ids": {
4158
+ "not": {}
4159
+ }
4160
+ }
4161
+ },
4162
+ {
4163
+ "required": [
4164
+ "attachment_ids"
4165
+ ],
4166
+ "properties": {
4167
+ "type": {
4168
+ "const": "file"
4169
+ },
4170
+ "attachment_id": {
4171
+ "not": {}
4172
+ },
4173
+ "attachment_ids": {
4174
+ "type": "array"
4175
+ }
4176
+ }
4177
+ }
4178
+ ]
4179
+ },
4180
+ "else": {
4181
+ "if": {
4182
+ "properties": {
4183
+ "type": {
4184
+ "enum": [
4185
+ "sticker",
4186
+ "poll",
4187
+ "contact",
4188
+ "location"
4189
+ ]
4190
+ }
4191
+ }
4192
+ },
4193
+ "then": {
4194
+ "properties": {
4195
+ "content": {
4196
+ "not": {}
4197
+ },
4198
+ "attachment_id": {
4199
+ "not": {}
4200
+ },
4201
+ "attachment_ids": {
4202
+ "not": {}
4203
+ },
4204
+ "drawings": {
4205
+ "not": {}
4206
+ }
4207
+ },
4208
+ "if": {
4209
+ "properties": {
4210
+ "type": {
4211
+ "const": "sticker"
4212
+ }
4213
+ }
4214
+ },
4215
+ "then": {
4216
+ "required": [
4217
+ "sticker_id"
4218
+ ],
4219
+ "properties": {
4220
+ "sticker_id": {
4221
+ "$ref": "#/$defs/Id"
4222
+ }
4223
+ }
4224
+ },
4225
+ "else": {
4226
+ "properties": {
4227
+ "sticker_id": {
4228
+ "not": {}
4229
+ }
4230
+ }
4231
+ }
4232
+ },
4233
+ "else": {
4234
+ "required": [
4235
+ "content"
4236
+ ],
4237
+ "properties": {
4238
+ "content": {
4239
+ "type": "string",
4240
+ "minLength": 1,
4241
+ "maxLength": 4096
4242
+ },
4243
+ "attachment_id": {
4244
+ "not": {}
4245
+ },
4246
+ "attachment_ids": {
4247
+ "not": {}
4248
+ },
4249
+ "drawings": {
4250
+ "not": {}
4251
+ },
4252
+ "sticker_id": {
4253
+ "not": {}
4254
+ }
4255
+ }
4256
+ }
4257
+ }
4258
+ },
4259
+ "EditMessageRequest": {
4260
+ "type": "object",
4261
+ "required": [
4262
+ "content"
3480
4263
  ],
3481
4264
  "properties": {
3482
- "chat_id": {
3483
- "$ref": "#/$defs/Id"
4265
+ "content": {
4266
+ "type": "string",
4267
+ "maxLength": 4096,
4268
+ "description": "New text, or the new caption of a file. Empty removes a file's caption; a text message rejects it."
4269
+ }
4270
+ }
4271
+ },
4272
+ "ForwardMessageRequest": {
4273
+ "type": "object",
4274
+ "required": [
4275
+ "chat_ids"
4276
+ ],
4277
+ "properties": {
4278
+ "chat_ids": {
4279
+ "type": "array",
4280
+ "minItems": 1,
4281
+ "maxItems": 20,
4282
+ "uniqueItems": true,
4283
+ "items": {
4284
+ "$ref": "#/$defs/Id"
4285
+ }
4286
+ }
4287
+ }
4288
+ },
4289
+ "ForwardMessagesRequest": {
4290
+ "type": "object",
4291
+ "required": [
4292
+ "message_ids",
4293
+ "chat_ids"
4294
+ ],
4295
+ "properties": {
4296
+ "message_ids": {
4297
+ "type": "array",
4298
+ "minItems": 1,
4299
+ "maxItems": 20,
4300
+ "uniqueItems": true,
4301
+ "items": {
4302
+ "$ref": "#/$defs/Id"
4303
+ }
3484
4304
  },
3485
- "client_temp_id": {
3486
- "$ref": "#/$defs/ClientTempId"
4305
+ "chat_ids": {
4306
+ "type": "array",
4307
+ "minItems": 1,
4308
+ "maxItems": 20,
4309
+ "uniqueItems": true,
4310
+ "items": {
4311
+ "$ref": "#/$defs/Id"
4312
+ }
4313
+ }
4314
+ }
4315
+ },
4316
+ "DeleteMessagesRequest": {
4317
+ "type": "object",
4318
+ "required": [
4319
+ "message_ids",
4320
+ "scope"
4321
+ ],
4322
+ "properties": {
4323
+ "message_ids": {
4324
+ "type": "array",
4325
+ "minItems": 1,
4326
+ "maxItems": 100,
4327
+ "uniqueItems": true,
4328
+ "items": {
4329
+ "$ref": "#/$defs/Id"
4330
+ }
3487
4331
  },
3488
- "type": {
4332
+ "scope": {
3489
4333
  "type": "string",
3490
4334
  "enum": [
3491
- "text",
3492
- "file",
3493
- "voice",
3494
- "sticker"
3495
- ]
3496
- },
3497
- "content": {
3498
- "type": [
3499
- "string",
3500
- "null"
4335
+ "me",
4336
+ "everyone"
3501
4337
  ]
4338
+ }
4339
+ }
4340
+ },
4341
+ "MarkReadRequest": {
4342
+ "type": "object",
4343
+ "required": [
4344
+ "message_id"
4345
+ ],
4346
+ "properties": {
4347
+ "message_id": {
4348
+ "description": "Everything up to and including this message is read.",
4349
+ "$ref": "#/$defs/Id"
4350
+ }
4351
+ }
4352
+ },
4353
+ "ChatType": {
4354
+ "type": "string",
4355
+ "enum": [
4356
+ "direct",
4357
+ "group"
4358
+ ]
4359
+ },
4360
+ "GroupRole": {
4361
+ "type": "string",
4362
+ "description": "A moderator may delete other members' messages; owners and admins also manage the group.",
4363
+ "enum": [
4364
+ "owner",
4365
+ "admin",
4366
+ "moderator",
4367
+ "member"
4368
+ ]
4369
+ },
4370
+ "GroupRoleEvent": {
4371
+ "type": "object",
4372
+ "description": "A member got a new role; `owner` means the actor transferred ownership to them.",
4373
+ "required": [
4374
+ "id",
4375
+ "actor",
4376
+ "target",
4377
+ "role",
4378
+ "created_at"
4379
+ ],
4380
+ "properties": {
4381
+ "id": {
4382
+ "$ref": "#/$defs/Id"
3502
4383
  },
3503
- "reply_to": {
4384
+ "actor": {
4385
+ "description": "`null` when the account is gone.",
3504
4386
  "oneOf": [
3505
4387
  {
3506
- "$ref": "#/$defs/Id"
4388
+ "$ref": "#/$defs/User"
3507
4389
  },
3508
4390
  {
3509
4391
  "type": "null"
3510
4392
  }
3511
4393
  ]
3512
4394
  },
3513
- "attachments": {
3514
- "type": "array",
3515
- "description": "Uploaded files of the send that still exist, in the order they were sent.",
3516
- "items": {
3517
- "$ref": "#/$defs/Attachment"
3518
- }
3519
- },
3520
- "sticker": {
3521
- "$ref": "#/$defs/Sticker"
4395
+ "target": {
4396
+ "$ref": "#/$defs/User"
3522
4397
  },
3523
- "error_code": {
3524
- "$ref": "#/$defs/ErrorCode"
4398
+ "role": {
4399
+ "$ref": "#/$defs/GroupRole"
3525
4400
  },
3526
4401
  "created_at": {
3527
4402
  "$ref": "#/$defs/Timestamp"
3528
4403
  }
3529
4404
  }
3530
4405
  },
3531
- "MessageSearchPage": {
4406
+ "GroupRoleLog": {
3532
4407
  "type": "object",
3533
4408
  "required": [
3534
- "items",
3535
- "next_cursor"
4409
+ "items"
3536
4410
  ],
3537
4411
  "properties": {
3538
4412
  "items": {
3539
4413
  "type": "array",
4414
+ "description": "Newest first, at most 100",
3540
4415
  "items": {
3541
- "$ref": "#/$defs/SearchHit"
4416
+ "$ref": "#/$defs/GroupRoleEvent"
3542
4417
  }
3543
- },
3544
- "next_cursor": {
3545
- "$ref": "#/$defs/Cursor"
3546
4418
  }
3547
4419
  }
3548
4420
  },
3549
- "SendMessageRequest": {
4421
+ "Chat": {
3550
4422
  "type": "object",
3551
4423
  "required": [
3552
- "client_temp_id",
3553
- "type"
4424
+ "id",
4425
+ "type",
4426
+ "name",
4427
+ "avatar_url",
4428
+ "peer",
4429
+ "is_pinned",
4430
+ "pin_position",
4431
+ "is_archived",
4432
+ "is_request",
4433
+ "unread_count",
4434
+ "unread_mentions_count",
4435
+ "first_unread_message_id",
4436
+ "last_read_message_id",
4437
+ "last_message",
4438
+ "pinned_message_count",
4439
+ "created_at"
3554
4440
  ],
3555
4441
  "properties": {
3556
- "client_temp_id": {
3557
- "$ref": "#/$defs/ClientTempId"
4442
+ "id": {
4443
+ "$ref": "#/$defs/Id"
3558
4444
  },
3559
4445
  "type": {
4446
+ "$ref": "#/$defs/ChatType"
4447
+ },
4448
+ "name": {
3560
4449
  "type": "string",
3561
- "enum": [
3562
- "text",
3563
- "file",
3564
- "voice",
3565
- "sticker"
3566
- ]
4450
+ "description": "Display name of the peer or the group"
3567
4451
  },
3568
- "content": {
4452
+ "avatar_url": {
3569
4453
  "type": [
3570
4454
  "string",
3571
4455
  "null"
3572
- ],
3573
- "maxLength": 4096
4456
+ ]
4457
+ },
4458
+ "peer": {
4459
+ "description": "The other user of a direct chat (the caller in their \"Saved Messages\" chat); `null` for groups.",
4460
+ "oneOf": [
4461
+ {
4462
+ "$ref": "#/$defs/User"
4463
+ },
4464
+ {
4465
+ "type": "null"
4466
+ }
4467
+ ]
4468
+ },
4469
+ "is_pinned": {
4470
+ "type": "boolean"
4471
+ },
4472
+ "pin_position": {
4473
+ "description": "Order of a pinned chat among the caller's pinned chats, lowest first; `null` when not pinned.",
4474
+ "type": [
4475
+ "integer",
4476
+ "null"
4477
+ ]
4478
+ },
4479
+ "is_archived": {
4480
+ "type": "boolean",
4481
+ "description": "Whether the caller archived the chat (only for the caller)."
4482
+ },
4483
+ "is_request": {
4484
+ "type": "boolean",
4485
+ "description": "Whether the chat is in the caller's Requests folder: a stranger opened it, and the caller has not\nreplied, accepted, pinned or archived it yet (only for the caller).\n"
3574
4486
  },
3575
- "sticker_id": {
3576
- "description": "The sticker of a `sticker` message, from any pack that is not deleted. Sticker messages have no content,\nattachment or drawings; the server sets `content` to the sticker's emoji. Send stickers with this\noperation; the WebSocket `message` event does not take them.\n",
3577
- "$ref": "#/$defs/Id"
4487
+ "unread_count": {
4488
+ "type": "integer",
4489
+ "minimum": 0
3578
4490
  },
3579
- "attachment_id": {
3580
- "description": "Single upload ID for a file or voice message. Omit for albums.",
4491
+ "unread_mentions_count": {
4492
+ "type": "integer",
4493
+ "minimum": 0,
4494
+ "description": "Unread messages that mention the caller (`GET /chats/{chat_id}/mentions`). Clients show an `@` badge while\nit is above 0. Always 0 in direct chats.\n"
4495
+ },
4496
+ "first_unread_message_id": {
4497
+ "description": "The oldest message the caller has not read (the same messages `unread_count` counts: not their own,\nnot system messages, not deleted); `null` when nothing is unread. Clients open the chat around it and\nshow the \"new messages\" divider above it.\n",
3581
4498
  "oneOf": [
3582
4499
  {
3583
- "$ref": "#/$defs/AttachmentRef"
4500
+ "$ref": "#/$defs/Id"
3584
4501
  },
3585
4502
  {
3586
4503
  "type": "null"
3587
4504
  }
3588
4505
  ]
3589
4506
  },
3590
- "attachment_ids": {
3591
- "type": "array",
3592
- "description": "Ordered IDs of two to ten image or video uploads for one file message.",
3593
- "minItems": 2,
3594
- "maxItems": 10,
3595
- "uniqueItems": true,
3596
- "items": {
3597
- "$ref": "#/$defs/AttachmentRef"
3598
- }
3599
- },
3600
- "reply_to": {
4507
+ "last_read_message_id": {
4508
+ "description": "The caller's read marker (`POST /chats/{chat_id}/read`); `null` before their first read.",
3601
4509
  "oneOf": [
3602
4510
  {
3603
4511
  "$ref": "#/$defs/Id"
@@ -3607,169 +4515,91 @@
3607
4515
  }
3608
4516
  ]
3609
4517
  },
3610
- "drawings": {
3611
- "type": "array",
3612
- "description": "Drawings on images of a `file` message, at most one per image. Each `attachment_id` must be one of the\nmessage's attachments. An image with a drawing may also be an image of the message in `reply_to`\ninstead of the sender's own upload: that is how a member draws on an image someone sent.\n",
3613
- "maxItems": 10,
3614
- "items": {
3615
- "$ref": "#/$defs/AttachmentDrawing"
3616
- }
3617
- }
3618
- },
3619
- "if": {
3620
- "properties": {
3621
- "type": {
3622
- "enum": [
3623
- "file",
3624
- "voice"
3625
- ]
3626
- }
3627
- }
3628
- },
3629
- "then": {
3630
- "properties": {
3631
- "sticker_id": {
3632
- "not": {}
3633
- }
3634
- },
3635
- "oneOf": [
3636
- {
3637
- "required": [
3638
- "attachment_id"
3639
- ],
3640
- "properties": {
3641
- "attachment_id": {
3642
- "$ref": "#/$defs/AttachmentRef"
3643
- },
3644
- "attachment_ids": {
3645
- "not": {}
3646
- }
3647
- }
3648
- },
3649
- {
3650
- "required": [
3651
- "attachment_ids"
3652
- ],
3653
- "properties": {
3654
- "type": {
3655
- "const": "file"
3656
- },
3657
- "attachment_id": {
3658
- "not": {}
3659
- },
3660
- "attachment_ids": {
3661
- "type": "array"
3662
- }
3663
- }
3664
- }
3665
- ]
3666
- },
3667
- "else": {
3668
- "if": {
3669
- "properties": {
3670
- "type": {
3671
- "const": "sticker"
3672
- }
3673
- }
3674
- },
3675
- "then": {
3676
- "required": [
3677
- "sticker_id"
3678
- ],
3679
- "properties": {
3680
- "sticker_id": {
3681
- "$ref": "#/$defs/Id"
3682
- },
3683
- "content": {
3684
- "not": {}
3685
- },
3686
- "attachment_id": {
3687
- "not": {}
3688
- },
3689
- "attachment_ids": {
3690
- "not": {}
4518
+ "last_message": {
4519
+ "oneOf": [
4520
+ {
4521
+ "$ref": "#/$defs/Message"
3691
4522
  },
3692
- "drawings": {
3693
- "not": {}
4523
+ {
4524
+ "type": "null"
3694
4525
  }
3695
- }
4526
+ ]
3696
4527
  },
3697
- "else": {
3698
- "required": [
3699
- "content"
3700
- ],
3701
- "properties": {
3702
- "content": {
3703
- "type": "string",
3704
- "minLength": 1,
3705
- "maxLength": 4096
3706
- },
3707
- "attachment_id": {
3708
- "not": {}
3709
- },
3710
- "attachment_ids": {
3711
- "not": {}
3712
- },
3713
- "drawings": {
3714
- "not": {}
4528
+ "my_role": {
4529
+ "description": "Only for groups.",
4530
+ "oneOf": [
4531
+ {
4532
+ "$ref": "#/$defs/GroupRole"
3715
4533
  },
3716
- "sticker_id": {
3717
- "not": {}
4534
+ {
4535
+ "type": "null"
3718
4536
  }
3719
- }
4537
+ ]
4538
+ },
4539
+ "pinned_message_count": {
4540
+ "type": "integer",
4541
+ "minimum": 0,
4542
+ "description": "Pinned messages the caller sees (`GET /chats/{chat_id}/pins`); clients show the pinned bar above 0."
4543
+ },
4544
+ "created_at": {
4545
+ "$ref": "#/$defs/Timestamp"
3720
4546
  }
3721
4547
  }
3722
4548
  },
3723
- "EditMessageRequest": {
4549
+ "ChatRequestCount": {
3724
4550
  "type": "object",
3725
4551
  "required": [
3726
- "content"
4552
+ "requests_count"
3727
4553
  ],
3728
4554
  "properties": {
3729
- "content": {
3730
- "type": "string",
3731
- "maxLength": 4096,
3732
- "description": "New text, or the new caption of a file. Empty removes a file's caption; a text message rejects it."
4555
+ "requests_count": {
4556
+ "type": "integer",
4557
+ "minimum": 0
3733
4558
  }
3734
4559
  }
3735
4560
  },
3736
- "ForwardMessageRequest": {
4561
+ "ChatPage": {
3737
4562
  "type": "object",
3738
4563
  "required": [
3739
- "chat_ids"
4564
+ "items",
4565
+ "next_cursor"
3740
4566
  ],
3741
4567
  "properties": {
3742
- "chat_ids": {
4568
+ "items": {
3743
4569
  "type": "array",
3744
- "minItems": 1,
3745
- "maxItems": 20,
3746
- "uniqueItems": true,
3747
4570
  "items": {
3748
- "$ref": "#/$defs/Id"
4571
+ "$ref": "#/$defs/Chat"
3749
4572
  }
4573
+ },
4574
+ "next_cursor": {
4575
+ "$ref": "#/$defs/Cursor"
3750
4576
  }
3751
4577
  }
3752
4578
  },
3753
- "ForwardMessagesRequest": {
4579
+ "ClearHistoryRequest": {
4580
+ "type": "object",
4581
+ "required": [
4582
+ "scope"
4583
+ ],
4584
+ "properties": {
4585
+ "scope": {
4586
+ "type": "string",
4587
+ "enum": [
4588
+ "me",
4589
+ "everyone"
4590
+ ]
4591
+ }
4592
+ }
4593
+ },
4594
+ "PinOrderRequest": {
3754
4595
  "type": "object",
3755
4596
  "required": [
3756
- "message_ids",
3757
4597
  "chat_ids"
3758
4598
  ],
3759
4599
  "properties": {
3760
- "message_ids": {
3761
- "type": "array",
3762
- "minItems": 1,
3763
- "maxItems": 20,
3764
- "uniqueItems": true,
3765
- "items": {
3766
- "$ref": "#/$defs/Id"
3767
- }
3768
- },
3769
4600
  "chat_ids": {
3770
4601
  "type": "array",
3771
- "minItems": 1,
3772
- "maxItems": 20,
4602
+ "maxItems": 10,
3773
4603
  "uniqueItems": true,
3774
4604
  "items": {
3775
4605
  "$ref": "#/$defs/Id"
@@ -3777,97 +4607,229 @@
3777
4607
  }
3778
4608
  }
3779
4609
  },
3780
- "DeleteMessagesRequest": {
4610
+ "PinScope": {
4611
+ "type": "string",
4612
+ "description": "`me`: only for the caller. `everyone`: for every member of the chat.",
4613
+ "enum": [
4614
+ "me",
4615
+ "everyone"
4616
+ ]
4617
+ },
4618
+ "PinMessageRequest": {
3781
4619
  "type": "object",
3782
4620
  "required": [
3783
- "message_ids",
3784
4621
  "scope"
3785
4622
  ],
3786
4623
  "properties": {
3787
- "message_ids": {
3788
- "type": "array",
3789
- "minItems": 1,
3790
- "maxItems": 100,
3791
- "uniqueItems": true,
3792
- "items": {
3793
- "$ref": "#/$defs/Id"
3794
- }
4624
+ "scope": {
4625
+ "$ref": "#/$defs/PinScope"
4626
+ }
4627
+ }
4628
+ },
4629
+ "PinnedMessage": {
4630
+ "type": "object",
4631
+ "required": [
4632
+ "message",
4633
+ "scope",
4634
+ "pinned_by",
4635
+ "pinned_at",
4636
+ "can_unpin_for_everyone"
4637
+ ],
4638
+ "properties": {
4639
+ "message": {
4640
+ "$ref": "#/$defs/Message"
3795
4641
  },
3796
4642
  "scope": {
3797
- "type": "string",
3798
- "enum": [
3799
- "me",
3800
- "everyone"
4643
+ "$ref": "#/$defs/PinScope"
4644
+ },
4645
+ "pinned_by": {
4646
+ "description": "Who pinned it; the caller for `me`.",
4647
+ "allOf": [
4648
+ {
4649
+ "$ref": "#/$defs/Id"
4650
+ }
3801
4651
  ]
4652
+ },
4653
+ "pinned_at": {
4654
+ "$ref": "#/$defs/Timestamp"
4655
+ },
4656
+ "can_unpin_for_everyone": {
4657
+ "type": "boolean",
4658
+ "description": "Whether `DELETE …/pin?scope=everyone` is allowed for the caller; always `false` for `me`."
3802
4659
  }
3803
4660
  }
3804
4661
  },
3805
- "MarkReadRequest": {
4662
+ "PinnedMessagePage": {
3806
4663
  "type": "object",
3807
4664
  "required": [
3808
- "message_id"
4665
+ "items",
4666
+ "next_cursor"
3809
4667
  ],
3810
4668
  "properties": {
3811
- "message_id": {
3812
- "description": "Everything up to and including this message is read.",
3813
- "$ref": "#/$defs/Id"
4669
+ "items": {
4670
+ "type": "array",
4671
+ "description": "Newest pin first",
4672
+ "items": {
4673
+ "$ref": "#/$defs/PinnedMessage"
4674
+ }
4675
+ },
4676
+ "next_cursor": {
4677
+ "$ref": "#/$defs/Cursor"
3814
4678
  }
3815
4679
  }
3816
4680
  },
3817
- "ChatType": {
4681
+ "ImportSource": {
3818
4682
  "type": "string",
3819
4683
  "enum": [
3820
- "direct",
3821
- "group"
4684
+ "telegram",
4685
+ "whatsapp"
3822
4686
  ]
3823
4687
  },
3824
- "GroupRole": {
4688
+ "ChatImportState": {
3825
4689
  "type": "string",
3826
- "description": "A moderator may delete other members' messages; owners and admins also manage the group.",
4690
+ "description": "`running`: messages are being added. `done`: finished. `removing`: being removed.",
3827
4691
  "enum": [
3828
- "owner",
3829
- "admin",
3830
- "moderator",
3831
- "member"
4692
+ "running",
4693
+ "done",
4694
+ "removing"
3832
4695
  ]
3833
4696
  },
3834
- "GroupRoleEvent": {
4697
+ "ImportSenderKey": {
4698
+ "type": "string",
4699
+ "description": "The client's key for one name of the export.",
4700
+ "pattern": "^[A-Za-z0-9_-]{1,64}$"
4701
+ },
4702
+ "ImportSenderState": {
4703
+ "type": "string",
4704
+ "description": "`me`: the importer's own messages. `unassigned`: shown as text. `pending`: suggested for `user_id`, who has\nnot answered. `confirmed`: `user_id` confirmed; the messages show their account. `declined`: the suggested\nmember said no; shown as text.\n",
4705
+ "enum": [
4706
+ "me",
4707
+ "unassigned",
4708
+ "pending",
4709
+ "confirmed",
4710
+ "declined"
4711
+ ]
4712
+ },
4713
+ "ChatImportSender": {
4714
+ "type": "object",
4715
+ "required": [
4716
+ "key",
4717
+ "name",
4718
+ "message_count",
4719
+ "state",
4720
+ "user_id"
4721
+ ],
4722
+ "properties": {
4723
+ "key": {
4724
+ "$ref": "#/$defs/ImportSenderKey"
4725
+ },
4726
+ "name": {
4727
+ "type": "string",
4728
+ "minLength": 1,
4729
+ "maxLength": 128
4730
+ },
4731
+ "message_count": {
4732
+ "type": "integer",
4733
+ "minimum": 0
4734
+ },
4735
+ "state": {
4736
+ "$ref": "#/$defs/ImportSenderState"
4737
+ },
4738
+ "user_id": {
4739
+ "oneOf": [
4740
+ {
4741
+ "$ref": "#/$defs/Id"
4742
+ },
4743
+ {
4744
+ "type": "null"
4745
+ }
4746
+ ]
4747
+ }
4748
+ }
4749
+ },
4750
+ "ChatImport": {
3835
4751
  "type": "object",
3836
- "description": "A member got a new role; `owner` means the actor transferred ownership to them.",
3837
4752
  "required": [
3838
4753
  "id",
3839
- "actor",
3840
- "target",
3841
- "role",
3842
- "created_at"
4754
+ "chat_id",
4755
+ "source",
4756
+ "state",
4757
+ "message_count",
4758
+ "file_count",
4759
+ "first_at",
4760
+ "last_at",
4761
+ "next_index",
4762
+ "imported_by",
4763
+ "created_at",
4764
+ "finished_at",
4765
+ "senders"
3843
4766
  ],
3844
4767
  "properties": {
3845
4768
  "id": {
3846
4769
  "$ref": "#/$defs/Id"
3847
4770
  },
3848
- "actor": {
3849
- "description": "`null` when the account is gone.",
4771
+ "chat_id": {
4772
+ "$ref": "#/$defs/Id"
4773
+ },
4774
+ "source": {
4775
+ "$ref": "#/$defs/ImportSource"
4776
+ },
4777
+ "state": {
4778
+ "$ref": "#/$defs/ChatImportState"
4779
+ },
4780
+ "message_count": {
4781
+ "type": "integer",
4782
+ "minimum": 1,
4783
+ "maximum": 100000
4784
+ },
4785
+ "file_count": {
4786
+ "type": "integer",
4787
+ "minimum": 0,
4788
+ "maximum": 5000
4789
+ },
4790
+ "first_at": {
4791
+ "$ref": "#/$defs/Timestamp"
4792
+ },
4793
+ "last_at": {
4794
+ "$ref": "#/$defs/Timestamp"
4795
+ },
4796
+ "next_index": {
4797
+ "type": "integer",
4798
+ "minimum": 0,
4799
+ "description": "How many messages are stored; the `from_index` of the next batch."
4800
+ },
4801
+ "imported_by": {
3850
4802
  "oneOf": [
3851
4803
  {
3852
- "$ref": "#/$defs/User"
4804
+ "$ref": "#/$defs/Id"
3853
4805
  },
3854
4806
  {
3855
4807
  "type": "null"
3856
4808
  }
3857
4809
  ]
3858
4810
  },
3859
- "target": {
3860
- "$ref": "#/$defs/User"
3861
- },
3862
- "role": {
3863
- "$ref": "#/$defs/GroupRole"
3864
- },
3865
4811
  "created_at": {
3866
4812
  "$ref": "#/$defs/Timestamp"
4813
+ },
4814
+ "finished_at": {
4815
+ "oneOf": [
4816
+ {
4817
+ "$ref": "#/$defs/Timestamp"
4818
+ },
4819
+ {
4820
+ "type": "null"
4821
+ }
4822
+ ]
4823
+ },
4824
+ "senders": {
4825
+ "type": "array",
4826
+ "items": {
4827
+ "$ref": "#/$defs/ChatImportSender"
4828
+ }
3867
4829
  }
3868
4830
  }
3869
4831
  },
3870
- "GroupRoleLog": {
4832
+ "ChatImportList": {
3871
4833
  "type": "object",
3872
4834
  "required": [
3873
4835
  "items"
@@ -3875,270 +4837,277 @@
3875
4837
  "properties": {
3876
4838
  "items": {
3877
4839
  "type": "array",
3878
- "description": "Newest first, at most 100",
3879
4840
  "items": {
3880
- "$ref": "#/$defs/GroupRoleEvent"
4841
+ "$ref": "#/$defs/ChatImport"
3881
4842
  }
3882
4843
  }
3883
4844
  }
3884
4845
  },
3885
- "Chat": {
4846
+ "StartChatImportSender": {
3886
4847
  "type": "object",
3887
4848
  "required": [
3888
- "id",
3889
- "type",
4849
+ "key",
3890
4850
  "name",
3891
- "avatar_url",
3892
- "peer",
3893
- "is_pinned",
3894
- "pin_position",
3895
- "is_archived",
3896
- "is_request",
3897
- "unread_count",
3898
- "unread_mentions_count",
3899
- "first_unread_message_id",
3900
- "last_read_message_id",
3901
- "last_message",
3902
- "pinned_message_count",
3903
- "created_at"
4851
+ "message_count"
3904
4852
  ],
3905
4853
  "properties": {
3906
- "id": {
3907
- "$ref": "#/$defs/Id"
3908
- },
3909
- "type": {
3910
- "$ref": "#/$defs/ChatType"
4854
+ "key": {
4855
+ "$ref": "#/$defs/ImportSenderKey"
3911
4856
  },
3912
4857
  "name": {
3913
4858
  "type": "string",
3914
- "description": "Display name of the peer or the group"
4859
+ "minLength": 1,
4860
+ "maxLength": 128
3915
4861
  },
3916
- "avatar_url": {
3917
- "type": [
3918
- "string",
3919
- "null"
3920
- ]
4862
+ "message_count": {
4863
+ "type": "integer",
4864
+ "minimum": 0
3921
4865
  },
3922
- "peer": {
3923
- "description": "The other user of a direct chat (the caller in their \"Saved Messages\" chat); `null` for groups.",
3924
- "oneOf": [
3925
- {
3926
- "$ref": "#/$defs/User"
3927
- },
4866
+ "me": {
4867
+ "type": "boolean",
4868
+ "description": "The caller's own messages; at most one sender."
4869
+ },
4870
+ "user_id": {
4871
+ "description": "A member of the chat suggested for this name; not with `me`.",
4872
+ "allOf": [
3928
4873
  {
3929
- "type": "null"
4874
+ "$ref": "#/$defs/Id"
3930
4875
  }
3931
4876
  ]
4877
+ }
4878
+ }
4879
+ },
4880
+ "StartChatImportRequest": {
4881
+ "type": "object",
4882
+ "required": [
4883
+ "source",
4884
+ "message_count",
4885
+ "file_count",
4886
+ "first_at",
4887
+ "last_at",
4888
+ "senders"
4889
+ ],
4890
+ "properties": {
4891
+ "source": {
4892
+ "$ref": "#/$defs/ImportSource"
3932
4893
  },
3933
- "is_pinned": {
3934
- "type": "boolean"
3935
- },
3936
- "pin_position": {
3937
- "description": "Order of a pinned chat among the caller's pinned chats, lowest first; `null` when not pinned.",
3938
- "type": [
3939
- "integer",
3940
- "null"
3941
- ]
3942
- },
3943
- "is_archived": {
3944
- "type": "boolean",
3945
- "description": "Whether the caller archived the chat (only for the caller)."
3946
- },
3947
- "is_request": {
3948
- "type": "boolean",
3949
- "description": "Whether the chat is in the caller's Requests folder: a stranger opened it, and the caller has not\nreplied, accepted, pinned or archived it yet (only for the caller).\n"
3950
- },
3951
- "unread_count": {
4894
+ "message_count": {
3952
4895
  "type": "integer",
3953
- "minimum": 0
4896
+ "minimum": 1,
4897
+ "maximum": 100000
3954
4898
  },
3955
- "unread_mentions_count": {
4899
+ "file_count": {
3956
4900
  "type": "integer",
3957
4901
  "minimum": 0,
3958
- "description": "Unread messages that mention the caller (`GET /chats/{chat_id}/mentions`). Clients show an `@` badge while\nit is above 0. Always 0 in direct chats.\n"
4902
+ "maximum": 5000
3959
4903
  },
3960
- "first_unread_message_id": {
3961
- "description": "The oldest message the caller has not read (the same messages `unread_count` counts: not their own,\nnot system messages, not deleted); `null` when nothing is unread. Clients open the chat around it and\nshow the \"new messages\" divider above it.\n",
3962
- "oneOf": [
3963
- {
3964
- "$ref": "#/$defs/Id"
3965
- },
3966
- {
3967
- "type": "null"
3968
- }
3969
- ]
4904
+ "first_at": {
4905
+ "$ref": "#/$defs/Timestamp"
3970
4906
  },
3971
- "last_read_message_id": {
3972
- "description": "The caller's read marker (`POST /chats/{chat_id}/read`); `null` before their first read.",
3973
- "oneOf": [
3974
- {
3975
- "$ref": "#/$defs/Id"
3976
- },
3977
- {
3978
- "type": "null"
3979
- }
3980
- ]
4907
+ "last_at": {
4908
+ "$ref": "#/$defs/Timestamp"
4909
+ },
4910
+ "senders": {
4911
+ "type": "array",
4912
+ "minItems": 1,
4913
+ "maxItems": 200,
4914
+ "items": {
4915
+ "$ref": "#/$defs/StartChatImportSender"
4916
+ }
4917
+ }
4918
+ }
4919
+ },
4920
+ "ImportedMessageType": {
4921
+ "type": "string",
4922
+ "description": "`note`: a line of the export that is not a message (for example that someone joined), shown as a system message.",
4923
+ "enum": [
4924
+ "text",
4925
+ "file",
4926
+ "voice",
4927
+ "note"
4928
+ ]
4929
+ },
4930
+ "ImportedMessage": {
4931
+ "type": "object",
4932
+ "required": [
4933
+ "index",
4934
+ "original_at",
4935
+ "type"
4936
+ ],
4937
+ "properties": {
4938
+ "index": {
4939
+ "type": "integer",
4940
+ "minimum": 0,
4941
+ "description": "Position in the import, counting from 0 without gaps."
3981
4942
  },
3982
- "last_message": {
3983
- "oneOf": [
3984
- {
3985
- "$ref": "#/$defs/Message"
3986
- },
4943
+ "sender_key": {
4944
+ "description": "Required except for `note`.",
4945
+ "allOf": [
3987
4946
  {
3988
- "type": "null"
4947
+ "$ref": "#/$defs/ImportSenderKey"
3989
4948
  }
3990
4949
  ]
3991
4950
  },
3992
- "my_role": {
3993
- "description": "Only for groups.",
3994
- "oneOf": [
3995
- {
3996
- "$ref": "#/$defs/GroupRole"
3997
- },
4951
+ "original_at": {
4952
+ "description": "When the message was sent in the other messenger; between the import's `first_at` and `last_at`.",
4953
+ "allOf": [
3998
4954
  {
3999
- "type": "null"
4955
+ "$ref": "#/$defs/Timestamp"
4000
4956
  }
4001
4957
  ]
4002
4958
  },
4003
- "pinned_message_count": {
4959
+ "type": {
4960
+ "$ref": "#/$defs/ImportedMessageType"
4961
+ },
4962
+ "content": {
4963
+ "type": [
4964
+ "string",
4965
+ "null"
4966
+ ],
4967
+ "maxLength": 4096
4968
+ },
4969
+ "attachment_ids": {
4970
+ "type": "array",
4971
+ "description": "The importer's uploads; two to ten images or videos make an album.",
4972
+ "minItems": 1,
4973
+ "maxItems": 10,
4974
+ "uniqueItems": true,
4975
+ "items": {
4976
+ "$ref": "#/$defs/AttachmentRef"
4977
+ }
4978
+ },
4979
+ "reply_to_index": {
4004
4980
  "type": "integer",
4005
4981
  "minimum": 0,
4006
- "description": "Pinned messages the caller sees (`GET /chats/{chat_id}/pins`); clients show the pinned bar above 0."
4007
- },
4008
- "created_at": {
4009
- "$ref": "#/$defs/Timestamp"
4982
+ "description": "`index` of an earlier message of the import that this one answers."
4010
4983
  }
4011
4984
  }
4012
4985
  },
4013
- "ChatRequestCount": {
4986
+ "AddImportedMessagesRequest": {
4014
4987
  "type": "object",
4015
4988
  "required": [
4016
- "requests_count"
4989
+ "from_index",
4990
+ "messages"
4017
4991
  ],
4018
4992
  "properties": {
4019
- "requests_count": {
4993
+ "from_index": {
4020
4994
  "type": "integer",
4021
4995
  "minimum": 0
4022
- }
4023
- }
4024
- },
4025
- "ChatPage": {
4026
- "type": "object",
4027
- "required": [
4028
- "items",
4029
- "next_cursor"
4030
- ],
4031
- "properties": {
4032
- "items": {
4996
+ },
4997
+ "messages": {
4033
4998
  "type": "array",
4999
+ "minItems": 1,
5000
+ "maxItems": 500,
4034
5001
  "items": {
4035
- "$ref": "#/$defs/Chat"
5002
+ "$ref": "#/$defs/ImportedMessage"
4036
5003
  }
4037
- },
4038
- "next_cursor": {
4039
- "$ref": "#/$defs/Cursor"
4040
5004
  }
4041
5005
  }
4042
5006
  },
4043
- "ClearHistoryRequest": {
5007
+ "ImportProgress": {
4044
5008
  "type": "object",
4045
5009
  "required": [
4046
- "scope"
5010
+ "next_index"
4047
5011
  ],
4048
5012
  "properties": {
4049
- "scope": {
4050
- "type": "string",
4051
- "enum": [
4052
- "me",
4053
- "everyone"
4054
- ]
5013
+ "next_index": {
5014
+ "type": "integer",
5015
+ "minimum": 0
4055
5016
  }
4056
5017
  }
4057
5018
  },
4058
- "PinOrderRequest": {
5019
+ "AssignImportSenderRequest": {
4059
5020
  "type": "object",
4060
5021
  "required": [
4061
- "chat_ids"
5022
+ "user_id"
4062
5023
  ],
4063
5024
  "properties": {
4064
- "chat_ids": {
4065
- "type": "array",
4066
- "maxItems": 10,
4067
- "uniqueItems": true,
4068
- "items": {
4069
- "$ref": "#/$defs/Id"
4070
- }
5025
+ "user_id": {
5026
+ "oneOf": [
5027
+ {
5028
+ "$ref": "#/$defs/Id"
5029
+ },
5030
+ {
5031
+ "type": "null"
5032
+ }
5033
+ ]
4071
5034
  }
4072
5035
  }
4073
5036
  },
4074
- "PinScope": {
4075
- "type": "string",
4076
- "description": "`me`: only for the caller. `everyone`: for every member of the chat.",
4077
- "enum": [
4078
- "me",
4079
- "everyone"
4080
- ]
4081
- },
4082
- "PinMessageRequest": {
5037
+ "DecideImportSenderRequest": {
4083
5038
  "type": "object",
4084
5039
  "required": [
4085
- "scope"
5040
+ "decision"
4086
5041
  ],
4087
5042
  "properties": {
4088
- "scope": {
4089
- "$ref": "#/$defs/PinScope"
5043
+ "decision": {
5044
+ "type": "string",
5045
+ "enum": [
5046
+ "confirm",
5047
+ "decline",
5048
+ "withdraw"
5049
+ ]
4090
5050
  }
4091
5051
  }
4092
5052
  },
4093
- "PinnedMessage": {
5053
+ "MessageImport": {
4094
5054
  "type": "object",
5055
+ "description": "Set on messages that came from an import.",
4095
5056
  "required": [
4096
- "message",
4097
- "scope",
4098
- "pinned_by",
4099
- "pinned_at",
4100
- "can_unpin_for_everyone"
5057
+ "import_id",
5058
+ "source",
5059
+ "original_at"
4101
5060
  ],
4102
5061
  "properties": {
4103
- "message": {
4104
- "$ref": "#/$defs/Message"
4105
- },
4106
- "scope": {
4107
- "$ref": "#/$defs/PinScope"
5062
+ "import_id": {
5063
+ "$ref": "#/$defs/Id"
4108
5064
  },
4109
- "pinned_by": {
4110
- "description": "Who pinned it; the caller for `me`.",
4111
- "allOf": [
4112
- {
4113
- "$ref": "#/$defs/Id"
4114
- }
4115
- ]
5065
+ "source": {
5066
+ "$ref": "#/$defs/ImportSource"
4116
5067
  },
4117
- "pinned_at": {
5068
+ "original_at": {
4118
5069
  "$ref": "#/$defs/Timestamp"
4119
5070
  },
4120
- "can_unpin_for_everyone": {
4121
- "type": "boolean",
4122
- "description": "Whether `DELETE …/pin?scope=everyone` is allowed for the caller; always `false` for `me`."
5071
+ "sender_name": {
5072
+ "type": "string",
5073
+ "description": "The name in the export; absent on system messages."
5074
+ },
5075
+ "sender_state": {
5076
+ "type": "string",
5077
+ "description": "`me`: the importer's own message, `sender` is the importer. `confirmed`: the member confirmed the name,\n`sender` is that member. `unconfirmed`: `sender` is `null`; show `sender_name` as text. Absent on system\nmessages.\n",
5078
+ "enum": [
5079
+ "me",
5080
+ "confirmed",
5081
+ "unconfirmed"
5082
+ ]
4123
5083
  }
4124
5084
  }
4125
5085
  },
4126
- "PinnedMessagePage": {
5086
+ "ImportSummary": {
4127
5087
  "type": "object",
4128
5088
  "required": [
4129
- "items",
4130
- "next_cursor"
5089
+ "import_id",
5090
+ "source",
5091
+ "message_count",
5092
+ "first_at",
5093
+ "last_at"
4131
5094
  ],
4132
5095
  "properties": {
4133
- "items": {
4134
- "type": "array",
4135
- "description": "Newest pin first",
4136
- "items": {
4137
- "$ref": "#/$defs/PinnedMessage"
4138
- }
5096
+ "import_id": {
5097
+ "$ref": "#/$defs/Id"
4139
5098
  },
4140
- "next_cursor": {
4141
- "$ref": "#/$defs/Cursor"
5099
+ "source": {
5100
+ "$ref": "#/$defs/ImportSource"
5101
+ },
5102
+ "message_count": {
5103
+ "type": "integer",
5104
+ "minimum": 1
5105
+ },
5106
+ "first_at": {
5107
+ "$ref": "#/$defs/Timestamp"
5108
+ },
5109
+ "last_at": {
5110
+ "$ref": "#/$defs/Timestamp"
4142
5111
  }
4143
5112
  }
4144
5113
  },
@@ -6857,6 +7826,104 @@
6857
7826
  "data"
6858
7827
  ]
6859
7828
  },
7829
+ "ServerImportSenderUpdateEvent": {
7830
+ "title": "ServerImportSenderUpdateEvent",
7831
+ "description": "A name of an imported history changed. A suggestion (pending) and a decline go only to the importer and the suggested member; that member shows the confirm banner for pending. A confirmation or its withdrawal goes to every member: render the messages of that name again (or load the chat again).",
7832
+ "type": "object",
7833
+ "properties": {
7834
+ "type": {
7835
+ "const": "import_sender_update"
7836
+ },
7837
+ "event_id": {
7838
+ "$ref": "#/$defs/Id"
7839
+ },
7840
+ "chat_id": {
7841
+ "$ref": "#/$defs/Id"
7842
+ },
7843
+ "data": {
7844
+ "type": "object",
7845
+ "properties": {
7846
+ "import_id": {
7847
+ "$ref": "#/$defs/Id"
7848
+ },
7849
+ "sender": {
7850
+ "type": "object",
7851
+ "properties": {
7852
+ "key": {
7853
+ "$ref": "#/$defs/ImportSenderKey"
7854
+ },
7855
+ "name": {
7856
+ "type": "string"
7857
+ },
7858
+ "message_count": {
7859
+ "type": "integer",
7860
+ "minimum": 0
7861
+ },
7862
+ "state": {
7863
+ "$ref": "#/$defs/ImportSenderState"
7864
+ },
7865
+ "user_id": {
7866
+ "$ref": "#/$defs/Id"
7867
+ }
7868
+ },
7869
+ "required": [
7870
+ "key",
7871
+ "name",
7872
+ "message_count",
7873
+ "state"
7874
+ ]
7875
+ }
7876
+ },
7877
+ "required": [
7878
+ "import_id",
7879
+ "sender"
7880
+ ]
7881
+ }
7882
+ },
7883
+ "required": [
7884
+ "type",
7885
+ "event_id",
7886
+ "chat_id",
7887
+ "data"
7888
+ ]
7889
+ },
7890
+ "ServerImportUpdateEvent": {
7891
+ "title": "ServerImportUpdateEvent",
7892
+ "description": "An imported history of the chat started, finished or is being removed; goes to every member. On done and removing, load the chat's history again; GET /chats/{chat_id}/imports lists the imports.",
7893
+ "type": "object",
7894
+ "properties": {
7895
+ "type": {
7896
+ "const": "import_update"
7897
+ },
7898
+ "event_id": {
7899
+ "$ref": "#/$defs/Id"
7900
+ },
7901
+ "chat_id": {
7902
+ "$ref": "#/$defs/Id"
7903
+ },
7904
+ "data": {
7905
+ "type": "object",
7906
+ "properties": {
7907
+ "import_id": {
7908
+ "$ref": "#/$defs/Id"
7909
+ },
7910
+ "state": {
7911
+ "$ref": "#/$defs/ChatImportState"
7912
+ }
7913
+ },
7914
+ "required": [
7915
+ "import_id",
7916
+ "state"
7917
+ ]
7918
+ }
7919
+ },
7920
+ "required": [
7921
+ "type",
7922
+ "event_id",
7923
+ "chat_id",
7924
+ "data"
7925
+ ]
7926
+ },
6860
7927
  "ServerMessageEvent": {
6861
7928
  "title": "ServerMessageEvent",
6862
7929
  "description": "A new message in a chat.",
@@ -6948,6 +8015,43 @@
6948
8015
  "data"
6949
8016
  ]
6950
8017
  },
8018
+ "ServerPollUpdatedEvent": {
8019
+ "title": "ServerPollUpdatedEvent",
8020
+ "description": "Someone voted, changed or took back a vote, or the poll closed. Goes to every member of the chat, each with the poll as they see it (results only after they voted, for the creator, or once closed). Replace Message.poll when version is higher than the one you have.",
8021
+ "type": "object",
8022
+ "properties": {
8023
+ "type": {
8024
+ "const": "poll_updated"
8025
+ },
8026
+ "event_id": {
8027
+ "$ref": "#/$defs/Id"
8028
+ },
8029
+ "chat_id": {
8030
+ "$ref": "#/$defs/Id"
8031
+ },
8032
+ "data": {
8033
+ "type": "object",
8034
+ "properties": {
8035
+ "message_id": {
8036
+ "$ref": "#/$defs/Id"
8037
+ },
8038
+ "poll": {
8039
+ "$ref": "#/$defs/Poll"
8040
+ }
8041
+ },
8042
+ "required": [
8043
+ "message_id",
8044
+ "poll"
8045
+ ]
8046
+ }
8047
+ },
8048
+ "required": [
8049
+ "type",
8050
+ "event_id",
8051
+ "chat_id",
8052
+ "data"
8053
+ ]
8054
+ },
6951
8055
  "ServerPresenceEvent": {
6952
8056
  "title": "ServerPresenceEvent",
6953
8057
  "description": "A user came online or went offline, as far as their privacy settings allow.",
@@ -7468,12 +8572,21 @@
7468
8572
  {
7469
8573
  "$ref": "#/$defs/ServerHistoryClearedEvent"
7470
8574
  },
8575
+ {
8576
+ "$ref": "#/$defs/ServerImportSenderUpdateEvent"
8577
+ },
8578
+ {
8579
+ "$ref": "#/$defs/ServerImportUpdateEvent"
8580
+ },
7471
8581
  {
7472
8582
  "$ref": "#/$defs/ServerMessageEvent"
7473
8583
  },
7474
8584
  {
7475
8585
  "$ref": "#/$defs/ServerPinUpdateEvent"
7476
8586
  },
8587
+ {
8588
+ "$ref": "#/$defs/ServerPollUpdatedEvent"
8589
+ },
7477
8590
  {
7478
8591
  "$ref": "#/$defs/ServerPresenceEvent"
7479
8592
  },