@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.
package/dist/openapi.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  openapi: 3.1.0
2
2
  info:
3
3
  title: Messenger API
4
- version: 2.1.0-alpha.45
4
+ version: 2.1.0-alpha.47
5
5
  summary: REST contract of the Messenger backend (v2).
6
6
  description: |
7
7
  Contract for the Go backend. The WebSocket protocol is described in `websocket/` and
@@ -62,8 +62,12 @@ tags:
62
62
  description: Approval requests (direct messages and group invites)
63
63
  - name: websocket
64
64
  description: Realtime connection (see `websocket.md`)
65
+ - name: imports
66
+ description: Chat histories imported from other messengers
65
67
  - name: calls
66
68
  description: Audio calls (see `docs/calls.md` and `docs/calls-e2ee.md`)
69
+ - name: maps
70
+ description: Map tiles and map images of location messages, served through the server (see `docs/maps.md`)
67
71
  - name: public
68
72
  description: Profile and group cards for people without an account, and link previews (see `docs/sharing.md`)
69
73
 
@@ -2354,6 +2358,302 @@ paths:
2354
2358
  schema: { $ref: "#/components/schemas/PinnedMessagePage" }
2355
2359
  "401": { $ref: "#/components/responses/Unauthorized" }
2356
2360
  "404": { $ref: "#/components/responses/NotFound" }
2361
+ /chats/{chat_id}/messages/{message_id}/poll/votes:
2362
+ parameters:
2363
+ - $ref: "#/components/parameters/ClientVersion"
2364
+ - $ref: "#/components/parameters/ClientApiVersion"
2365
+ - $ref: "#/components/parameters/ChatId"
2366
+ - $ref: "#/components/parameters/MessageId"
2367
+ put:
2368
+ tags: [messages]
2369
+ operationId: votePoll
2370
+ summary: Vote in a poll, change the vote or take it back
2371
+ description: |
2372
+ Replaces the caller's vote with `options` (indexes into `Poll.options`). An empty list takes the vote back.
2373
+ More than one option needs `multiple_answers` (`422`). A quiz takes one option, and its first answer is
2374
+ final (`409` `quiz_answered`). A closed poll answers `409` `poll_closed`. Members only; in a direct chat
2375
+ with a block `403`. Every change sends `poll_updated` to the members of the chat.
2376
+ requestBody:
2377
+ required: true
2378
+ content:
2379
+ application/json:
2380
+ schema: { $ref: "#/components/schemas/PollVoteRequest" }
2381
+ responses:
2382
+ "426": { $ref: "#/components/responses/ClientOutdated" }
2383
+ "400": { $ref: "#/components/responses/BadRequest" }
2384
+ "200":
2385
+ description: The poll as the caller sees it after the vote
2386
+ content:
2387
+ application/json:
2388
+ schema: { $ref: "#/components/schemas/Poll" }
2389
+ "401": { $ref: "#/components/responses/Unauthorized" }
2390
+ "403": { $ref: "#/components/responses/Forbidden" }
2391
+ "404": { $ref: "#/components/responses/NotFound" }
2392
+ "409": { $ref: "#/components/responses/Conflict" }
2393
+ "422": { $ref: "#/components/responses/ValidationFailed" }
2394
+ "429": { $ref: "#/components/responses/TooManyRequests" }
2395
+ /chats/{chat_id}/messages/{message_id}/poll/close:
2396
+ parameters:
2397
+ - $ref: "#/components/parameters/ClientVersion"
2398
+ - $ref: "#/components/parameters/ClientApiVersion"
2399
+ - $ref: "#/components/parameters/ChatId"
2400
+ - $ref: "#/components/parameters/MessageId"
2401
+ post:
2402
+ tags: [messages]
2403
+ operationId: closePoll
2404
+ summary: Close a poll
2405
+ description: |
2406
+ The creator may close the poll; in a group also the owner and admins (`Poll.can_close`, `403` otherwise).
2407
+ Closing a closed poll changes nothing. A closed poll shows its results and the quiz answer to everyone and
2408
+ takes no more votes. Sends `poll_updated`; no system message and no push.
2409
+ responses:
2410
+ "426": { $ref: "#/components/responses/ClientOutdated" }
2411
+ "200":
2412
+ description: The closed poll as the caller sees it
2413
+ content:
2414
+ application/json:
2415
+ schema: { $ref: "#/components/schemas/Poll" }
2416
+ "401": { $ref: "#/components/responses/Unauthorized" }
2417
+ "403": { $ref: "#/components/responses/Forbidden" }
2418
+ "404": { $ref: "#/components/responses/NotFound" }
2419
+ /chats/{chat_id}/messages/{message_id}/poll/voters:
2420
+ parameters:
2421
+ - $ref: "#/components/parameters/ClientVersion"
2422
+ - $ref: "#/components/parameters/ClientApiVersion"
2423
+ - $ref: "#/components/parameters/ChatId"
2424
+ - $ref: "#/components/parameters/MessageId"
2425
+ get:
2426
+ tags: [messages]
2427
+ operationId: listPollVoters
2428
+ summary: Who voted for an option of a public poll
2429
+ description: |
2430
+ Only for polls with `anonymous: false`, and only when the caller sees the results (`PollOption.voter_count` is
2431
+ not `null`); `403` otherwise. Newest vote first. Users appear as the caller may see them.
2432
+ parameters:
2433
+ - name: option
2434
+ in: query
2435
+ required: true
2436
+ schema: { type: integer, minimum: 0, maximum: 9 }
2437
+ - $ref: "#/components/parameters/Limit"
2438
+ - $ref: "#/components/parameters/After"
2439
+ responses:
2440
+ "426": { $ref: "#/components/responses/ClientOutdated" }
2441
+ "400": { $ref: "#/components/responses/BadRequest" }
2442
+ "200":
2443
+ description: Voters of the option
2444
+ content:
2445
+ application/json:
2446
+ schema: { $ref: "#/components/schemas/UserPage" }
2447
+ "401": { $ref: "#/components/responses/Unauthorized" }
2448
+ "403": { $ref: "#/components/responses/Forbidden" }
2449
+ "404": { $ref: "#/components/responses/NotFound" }
2450
+ /chats/{chat_id}/imports:
2451
+ parameters:
2452
+ - $ref: "#/components/parameters/ClientVersion"
2453
+ - $ref: "#/components/parameters/ClientApiVersion"
2454
+ - $ref: "#/components/parameters/ChatId"
2455
+ get:
2456
+ tags: [imports]
2457
+ operationId: listChatImports
2458
+ summary: The imported histories of a chat
2459
+ description: |
2460
+ Imports that are running or done, oldest period first. A sender the importer assigned to a member is
2461
+ `pending` or `declined` only for the importer and that member; everyone else sees it as `unassigned`
2462
+ without `user_id` until the member confirms.
2463
+ responses:
2464
+ "426": { $ref: "#/components/responses/ClientOutdated" }
2465
+ "200":
2466
+ description: The imports
2467
+ content:
2468
+ application/json:
2469
+ schema: { $ref: "#/components/schemas/ChatImportList" }
2470
+ "401": { $ref: "#/components/responses/Unauthorized" }
2471
+ "404": { $ref: "#/components/responses/NotFound" }
2472
+ post:
2473
+ tags: [imports]
2474
+ operationId: startChatImport
2475
+ summary: Start importing a history from another messenger
2476
+ description: |
2477
+ The client parses the export (Telegram Desktop JSON or a WhatsApp chat export) on the device, uploads the
2478
+ files with `POST /attachments`, then sends the messages in order with `PUT /imports/{import_id}/messages`
2479
+ and ends with `POST /imports/{import_id}/finish`.
2480
+
2481
+ In a direct chat either user may import, not in a chat in the Requests folder or with a block (`403`). In a
2482
+ group only an admin or the owner may (`403`). One import per chat runs at a time (`409`). The messages are
2483
+ placed above the oldest message of the chat, in their original order; a second import goes next to the
2484
+ imports whose periods it follows, and an import whose period overlaps an existing one is `409`.
2485
+
2486
+ `senders` lists every name of the export. `me: true` marks the caller's own messages. `user_id` suggests a
2487
+ member of the chat for a name; that member confirms it after the import is finished. Every other name is
2488
+ shown as text.
2489
+ requestBody:
2490
+ required: true
2491
+ content:
2492
+ application/json:
2493
+ schema: { $ref: "#/components/schemas/StartChatImportRequest" }
2494
+ responses:
2495
+ "426": { $ref: "#/components/responses/ClientOutdated" }
2496
+ "400": { $ref: "#/components/responses/BadRequest" }
2497
+ "201":
2498
+ description: The import, running
2499
+ content:
2500
+ application/json:
2501
+ schema: { $ref: "#/components/schemas/ChatImport" }
2502
+ "401": { $ref: "#/components/responses/Unauthorized" }
2503
+ "403": { $ref: "#/components/responses/Forbidden" }
2504
+ "404": { $ref: "#/components/responses/NotFound" }
2505
+ "409": { $ref: "#/components/responses/Conflict" }
2506
+ "422": { $ref: "#/components/responses/ValidationFailed" }
2507
+ /imports/{import_id}:
2508
+ parameters:
2509
+ - $ref: "#/components/parameters/ClientVersion"
2510
+ - $ref: "#/components/parameters/ClientApiVersion"
2511
+ - $ref: "#/components/parameters/ImportId"
2512
+ get:
2513
+ tags: [imports]
2514
+ operationId: getChatImport
2515
+ summary: One import, for resuming it or showing its senders
2516
+ responses:
2517
+ "426": { $ref: "#/components/responses/ClientOutdated" }
2518
+ "200":
2519
+ description: The import
2520
+ content:
2521
+ application/json:
2522
+ schema: { $ref: "#/components/schemas/ChatImport" }
2523
+ "401": { $ref: "#/components/responses/Unauthorized" }
2524
+ "404": { $ref: "#/components/responses/NotFound" }
2525
+ delete:
2526
+ tags: [imports]
2527
+ operationId: removeChatImport
2528
+ summary: Remove an imported history
2529
+ description: |
2530
+ The importer, or the owner of a group, removes every message of the import for everyone. The messages
2531
+ disappear at once (`import_update` with state `removing`); the worker deletes them afterwards.
2532
+ responses:
2533
+ "426": { $ref: "#/components/responses/ClientOutdated" }
2534
+ "202":
2535
+ description: Removing
2536
+ "401": { $ref: "#/components/responses/Unauthorized" }
2537
+ "403": { $ref: "#/components/responses/Forbidden" }
2538
+ "404": { $ref: "#/components/responses/NotFound" }
2539
+ /imports/{import_id}/messages:
2540
+ parameters:
2541
+ - $ref: "#/components/parameters/ClientVersion"
2542
+ - $ref: "#/components/parameters/ClientApiVersion"
2543
+ - $ref: "#/components/parameters/ImportId"
2544
+ put:
2545
+ tags: [imports]
2546
+ operationId: addImportedMessages
2547
+ summary: Add the next batch of messages to a running import
2548
+ description: |
2549
+ Only the importer. `from_index` must be the import's `next_index`; a batch that was stored already answers
2550
+ with the current `next_index`, so a retry after a lost answer is safe. Another `from_index` is `409`.
2551
+ Attachments must be the importer's own uploads. Imported messages send no push and count as read.
2552
+ requestBody:
2553
+ required: true
2554
+ content:
2555
+ application/json:
2556
+ schema: { $ref: "#/components/schemas/AddImportedMessagesRequest" }
2557
+ responses:
2558
+ "426": { $ref: "#/components/responses/ClientOutdated" }
2559
+ "400": { $ref: "#/components/responses/BadRequest" }
2560
+ "200":
2561
+ description: Stored
2562
+ content:
2563
+ application/json:
2564
+ schema: { $ref: "#/components/schemas/ImportProgress" }
2565
+ "401": { $ref: "#/components/responses/Unauthorized" }
2566
+ "403": { $ref: "#/components/responses/Forbidden" }
2567
+ "404": { $ref: "#/components/responses/NotFound" }
2568
+ "409": { $ref: "#/components/responses/Conflict" }
2569
+ "422": { $ref: "#/components/responses/ValidationFailed" }
2570
+ /imports/{import_id}/finish:
2571
+ parameters:
2572
+ - $ref: "#/components/parameters/ClientVersion"
2573
+ - $ref: "#/components/parameters/ClientApiVersion"
2574
+ - $ref: "#/components/parameters/ImportId"
2575
+ post:
2576
+ tags: [imports]
2577
+ operationId: finishChatImport
2578
+ summary: Finish an import once every message is stored
2579
+ description: |
2580
+ Only the importer, once `next_index` equals `message_count` (`422` before). Adds the closing system
2581
+ message, tells every member to load the chat again (`import_update`, sync change `history_imported`) and
2582
+ asks each assigned member to confirm their messages (`import_sender_update`).
2583
+ responses:
2584
+ "426": { $ref: "#/components/responses/ClientOutdated" }
2585
+ "200":
2586
+ description: The finished import
2587
+ content:
2588
+ application/json:
2589
+ schema: { $ref: "#/components/schemas/ChatImport" }
2590
+ "401": { $ref: "#/components/responses/Unauthorized" }
2591
+ "403": { $ref: "#/components/responses/Forbidden" }
2592
+ "404": { $ref: "#/components/responses/NotFound" }
2593
+ "422": { $ref: "#/components/responses/ValidationFailed" }
2594
+ /imports/{import_id}/senders/{sender_key}:
2595
+ parameters:
2596
+ - $ref: "#/components/parameters/ClientVersion"
2597
+ - $ref: "#/components/parameters/ClientApiVersion"
2598
+ - $ref: "#/components/parameters/ImportId"
2599
+ - $ref: "#/components/parameters/ImportSenderKey"
2600
+ put:
2601
+ tags: [imports]
2602
+ operationId: assignImportSender
2603
+ summary: Suggest a member for a name of the export, or take the suggestion back
2604
+ description: |
2605
+ Only the importer. `user_id` must be another member of the chat; `null` makes the name text again. A name
2606
+ that is `me` or `confirmed` cannot be reassigned, and a member who declined or withdrew a name cannot be
2607
+ suggested for it again (`409`).
2608
+ requestBody:
2609
+ required: true
2610
+ content:
2611
+ application/json:
2612
+ schema: { $ref: "#/components/schemas/AssignImportSenderRequest" }
2613
+ responses:
2614
+ "426": { $ref: "#/components/responses/ClientOutdated" }
2615
+ "400": { $ref: "#/components/responses/BadRequest" }
2616
+ "200":
2617
+ description: The sender
2618
+ content:
2619
+ application/json:
2620
+ schema: { $ref: "#/components/schemas/ChatImportSender" }
2621
+ "401": { $ref: "#/components/responses/Unauthorized" }
2622
+ "403": { $ref: "#/components/responses/Forbidden" }
2623
+ "404": { $ref: "#/components/responses/NotFound" }
2624
+ "409": { $ref: "#/components/responses/Conflict" }
2625
+ "422": { $ref: "#/components/responses/ValidationFailed" }
2626
+ /imports/{import_id}/senders/{sender_key}/decision:
2627
+ parameters:
2628
+ - $ref: "#/components/parameters/ClientVersion"
2629
+ - $ref: "#/components/parameters/ClientApiVersion"
2630
+ - $ref: "#/components/parameters/ImportId"
2631
+ - $ref: "#/components/parameters/ImportSenderKey"
2632
+ post:
2633
+ tags: [imports]
2634
+ operationId: decideImportSender
2635
+ summary: Confirm or decline that a name of the export is you, or withdraw a confirmation
2636
+ description: |
2637
+ Only the member the importer suggested, once the import is finished. `confirm` links the messages of the
2638
+ name to the caller's account for everyone; `decline` keeps them as text; `withdraw` turns a confirmed name
2639
+ back into text. After `decline` or `withdraw` the importer cannot suggest the caller for that name again.
2640
+ `404` when the caller is not the suggested member or the name is not in the matching state.
2641
+ requestBody:
2642
+ required: true
2643
+ content:
2644
+ application/json:
2645
+ schema: { $ref: "#/components/schemas/DecideImportSenderRequest" }
2646
+ responses:
2647
+ "426": { $ref: "#/components/responses/ClientOutdated" }
2648
+ "400": { $ref: "#/components/responses/BadRequest" }
2649
+ "200":
2650
+ description: The sender
2651
+ content:
2652
+ application/json:
2653
+ schema: { $ref: "#/components/schemas/ChatImportSender" }
2654
+ "401": { $ref: "#/components/responses/Unauthorized" }
2655
+ "404": { $ref: "#/components/responses/NotFound" }
2656
+ "422": { $ref: "#/components/responses/ValidationFailed" }
2357
2657
  /chats/{chat_id}/messages/forward:
2358
2658
  parameters:
2359
2659
  - $ref: "#/components/parameters/ClientVersion"
@@ -2659,6 +2959,7 @@ paths:
2659
2959
  tags: [groups]
2660
2960
  operationId: updateGroup
2661
2961
  summary: Change name or description
2962
+ description: A new name posts a `group_renamed` system message; the same name posts nothing.
2662
2963
  requestBody:
2663
2964
  required: true
2664
2965
  content:
@@ -2697,7 +2998,9 @@ paths:
2697
2998
  tags: [groups]
2698
2999
  operationId: setGroupAvatar
2699
3000
  summary: Set the group avatar from an uploaded attachment
2700
- description: The attachment must be an image the caller uploaded with purpose `avatar` (`422` otherwise).
3001
+ description: |
3002
+ The attachment must be an image the caller uploaded with purpose `avatar` (`422` otherwise). Posts a
3003
+ `group_avatar_changed` system message.
2701
3004
  requestBody:
2702
3005
  required: true
2703
3006
  content:
@@ -2715,6 +3018,23 @@ paths:
2715
3018
  "403": { $ref: "#/components/responses/Forbidden" }
2716
3019
  "404": { $ref: "#/components/responses/NotFound" }
2717
3020
  "422": { $ref: "#/components/responses/ValidationFailed" }
3021
+ delete:
3022
+ tags: [groups]
3023
+ operationId: deleteGroupAvatar
3024
+ summary: Remove the group avatar
3025
+ description: |
3026
+ Same permission as setting it. Posts a `group_avatar_changed` system message with `avatar_removed: true`;
3027
+ removing an avatar the group does not have changes nothing.
3028
+ responses:
3029
+ "426": { $ref: "#/components/responses/ClientOutdated" }
3030
+ "200":
3031
+ description: Updated group
3032
+ content:
3033
+ application/json:
3034
+ schema: { $ref: "#/components/schemas/Group" }
3035
+ "401": { $ref: "#/components/responses/Unauthorized" }
3036
+ "403": { $ref: "#/components/responses/Forbidden" }
3037
+ "404": { $ref: "#/components/responses/NotFound" }
2718
3038
  /groups/{chat_id}/background:
2719
3039
  parameters:
2720
3040
  - $ref: "#/components/parameters/ClientVersion"
@@ -2859,7 +3179,9 @@ paths:
2859
3179
  tags: [groups]
2860
3180
  operationId: transferGroupOwnership
2861
3181
  summary: Make another member the owner
2862
- description: The previous owner becomes an admin. Transferring to yourself is `422`.
3182
+ description: |
3183
+ The previous owner becomes an admin. Transferring to yourself is `422`. Posts an `owner_transferred` system
3184
+ message.
2863
3185
  requestBody:
2864
3186
  required: true
2865
3187
  content:
@@ -4133,6 +4455,83 @@ paths:
4133
4455
  "404": { $ref: "#/components/responses/NotFound" }
4134
4456
  "429": { $ref: "#/components/responses/TooManyRequests" }
4135
4457
 
4458
+ /maps/tiles/{z}/{x}/{y}:
4459
+ parameters:
4460
+ - $ref: "#/components/parameters/ClientVersion"
4461
+ - $ref: "#/components/parameters/ClientApiVersion"
4462
+ - name: z
4463
+ in: path
4464
+ required: true
4465
+ schema: { type: integer, minimum: 0, maximum: 19 }
4466
+ - name: x
4467
+ in: path
4468
+ required: true
4469
+ description: Tile column, `0` to `2^z - 1`
4470
+ schema: { type: integer, minimum: 0 }
4471
+ - name: y
4472
+ in: path
4473
+ required: true
4474
+ description: Tile row, `0` to `2^z - 1`
4475
+ schema: { type: integer, minimum: 0 }
4476
+ get:
4477
+ tags: [maps]
4478
+ operationId: getMapTile
4479
+ summary: A 256 px map tile, through the server
4480
+ description: |
4481
+ For the map a client shows while picking a place. The server fetches OpenStreetMap tiles and caches them, so
4482
+ the viewer never contacts the tile provider. Clients must show "© OpenStreetMap contributors" on the map,
4483
+ request only the tiles of the visible area and never download tiles ahead (no offline maps). At most 600
4484
+ tiles per minute per user (`429`). `503` when the provider cannot be reached and no copy is cached.
4485
+ responses:
4486
+ "426": { $ref: "#/components/responses/ClientOutdated" }
4487
+ "400": { $ref: "#/components/responses/BadRequest" }
4488
+ "200":
4489
+ description: PNG tile
4490
+ content:
4491
+ image/png:
4492
+ schema: { type: string, format: binary }
4493
+ "401": { $ref: "#/components/responses/Unauthorized" }
4494
+ "429": { $ref: "#/components/responses/TooManyRequests" }
4495
+ "503":
4496
+ description: The tile provider is unavailable
4497
+ /maps/static:
4498
+ parameters:
4499
+ - $ref: "#/components/parameters/ClientVersion"
4500
+ - $ref: "#/components/parameters/ClientApiVersion"
4501
+ get:
4502
+ tags: [maps]
4503
+ operationId: getStaticMap
4504
+ summary: The map image of a location message
4505
+ description: |
4506
+ Use `MessageLocation.map.url` as it is; `sig` proves the server made it. A 640 x 320 JPEG at zoom 16 with a
4507
+ pin in the middle, made from OpenStreetMap tiles. Clients show "© OpenStreetMap contributors" on it. `503`
4508
+ when the image is not made yet and the tile provider cannot be reached.
4509
+ parameters:
4510
+ - name: lat
4511
+ in: query
4512
+ required: true
4513
+ schema: { type: number, format: double, minimum: -90, maximum: 90 }
4514
+ - name: lon
4515
+ in: query
4516
+ required: true
4517
+ schema: { type: number, format: double, minimum: -180, maximum: 180 }
4518
+ - name: sig
4519
+ in: query
4520
+ required: true
4521
+ schema: { type: string, minLength: 1, maxLength: 64 }
4522
+ responses:
4523
+ "426": { $ref: "#/components/responses/ClientOutdated" }
4524
+ "400": { $ref: "#/components/responses/BadRequest" }
4525
+ "200":
4526
+ description: JPEG image
4527
+ content:
4528
+ image/jpeg:
4529
+ schema: { type: string, format: binary }
4530
+ "401": { $ref: "#/components/responses/Unauthorized" }
4531
+ "403": { $ref: "#/components/responses/Forbidden" }
4532
+ "503":
4533
+ description: The tile provider is unavailable
4534
+
4136
4535
  /me/notifications:
4137
4536
  get:
4138
4537
  tags:
@@ -6078,6 +6477,16 @@ components:
6078
6477
  in: path
6079
6478
  required: true
6080
6479
  schema: { $ref: "#/components/schemas/Id" }
6480
+ ImportId:
6481
+ name: import_id
6482
+ in: path
6483
+ required: true
6484
+ schema: { $ref: "#/components/schemas/Id" }
6485
+ ImportSenderKey:
6486
+ name: sender_key
6487
+ in: path
6488
+ required: true
6489
+ schema: { $ref: "#/components/schemas/ImportSenderKey" }
6081
6490
  UserId:
6082
6491
  name: user_id
6083
6492
  in: path
@@ -6433,6 +6842,8 @@ components:
6433
6842
  - stale_epoch
6434
6843
  - limit_reached
6435
6844
  - account_restricted
6845
+ - poll_closed
6846
+ - quiz_answered
6436
6847
  - internal_error
6437
6848
  Problem:
6438
6849
  type: object
@@ -7265,6 +7676,12 @@ components:
7265
7676
  border and stores a WebP (`413` when that is still over 512 KB). Only its uploader can load it until it is
7266
7677
  added to a pack.
7267
7678
 
7679
+ A sticker can also be made from a video (`kind: video`: MP4, WebM or MOV) or an animated GIF of at most 15 MB.
7680
+ The server keeps at most 3 s of it (from `start_ms` to `end_ms`, or the first 3 s), crops it to the square
7681
+ `crop_x`, `crop_y`, `crop_size` when given (otherwise it fits the clip into the square with a transparent
7682
+ border), drops the sound and stores a looping animated WebP of at most 512 x 512 px (`413` when it is still
7683
+ over 1 MB at the lowest quality). The sticker then has `is_animated: true`.
7684
+
7268
7685
  `profile_music`: an audio file of at most 20 MB. The server keeps at most 30 s of it (from `start_ms` to
7269
7686
  `end_ms`, or the first 30 s), stored as AAC, reads the title and artist into `tags` and the embedded cover
7270
7687
  into `thumbnail_url`. Use it with `PUT /me/music`.
@@ -7297,11 +7714,30 @@ components:
7297
7714
  start_ms:
7298
7715
  type: integer
7299
7716
  minimum: 0
7300
- description: "`profile_music` only: where the kept part starts."
7717
+ description: "`profile_music`, and `sticker` from a video or GIF: where the kept part starts."
7301
7718
  end_ms:
7302
7719
  type: integer
7303
7720
  minimum: 1
7304
- description: "`profile_music` only: where the kept part ends, at most 30 s after `start_ms`."
7721
+ description: |
7722
+ `profile_music`: where the kept part ends, at most 30 s after `start_ms`. `sticker` from a video or GIF: at
7723
+ most 3 s after `start_ms`.
7724
+ crop_x:
7725
+ type: number
7726
+ minimum: 0
7727
+ maximum: 1
7728
+ description: "`sticker` from a video or GIF: left edge of the square crop, as a fraction of the width."
7729
+ crop_y:
7730
+ type: number
7731
+ minimum: 0
7732
+ maximum: 1
7733
+ description: "`sticker` from a video or GIF: top edge of the square crop, as a fraction of the height."
7734
+ crop_size:
7735
+ type: number
7736
+ exclusiveMinimum: 0
7737
+ maximum: 1
7738
+ description: |
7739
+ `sticker` from a video or GIF: side of the square crop, as a fraction of the shorter side. Send all three
7740
+ crop fields or none; the square must lie inside the frame.
7305
7741
  Attachment:
7306
7742
  type: object
7307
7743
  required: [id, kind, filename, content_type, size, url]
@@ -7502,12 +7938,17 @@ components:
7502
7938
  # -------------------------------------------------------- messages
7503
7939
  MessageType:
7504
7940
  type: string
7505
- enum: [text, file, voice, system, sticker]
7941
+ description: |
7942
+ `poll`, `contact` and `location` carry their data in `Message.poll`, `Message.contact` and
7943
+ `Message.location`. For older clients their `content` holds a short plain-text summary: `📊 <question>`,
7944
+ `👤 @<username>`, or `📍 <place name> <OpenStreetMap link>`.
7945
+ enum: [text, file, voice, system, sticker, poll, contact, location]
7506
7946
  Sticker:
7507
7947
  type: object
7508
7948
  description: |
7509
7949
  One sticker of a pack. `image` is a WebP or PNG of at most 512 x 512 px with transparency, animated when
7510
- `is_animated` is true; any signed-in user can load it. Clients show it without a bubble.
7950
+ `is_animated` is true (also stickers made from a video or GIF); any signed-in user can load it. The `panel`
7951
+ variant of an animated sticker is a still first frame. Clients show it without a bubble.
7511
7952
  required: [id, pack_id, emoji, is_animated, image]
7512
7953
  properties:
7513
7954
  id: { $ref: "#/components/schemas/Id" }
@@ -7770,10 +8211,11 @@ components:
7770
8211
  message and its `scope`. `pins_changed`: load the pins of the chat again. `history_cleared`: drop the
7771
8212
  messages up to and including `before_message_id` (`scope` says for whom). `chat_hidden`: the caller
7772
8213
  deleted the chat for themselves up to `before_message_id`.
8214
+ `history_imported`: an imported history was added, removed or a sender confirmed; load the chat again.
7773
8215
  properties:
7774
8216
  type:
7775
8217
  type: string
7776
- enum: [message_updated, message_deleted, pins_changed, history_cleared, chat_hidden]
8218
+ enum: [message_updated, message_deleted, pins_changed, history_cleared, chat_hidden, history_imported]
7777
8219
  chat_id: { $ref: "#/components/schemas/Id" }
7778
8220
  message_id: { $ref: "#/components/schemas/Id" }
7779
8221
  scope:
@@ -7820,7 +8262,9 @@ components:
7820
8262
  content:
7821
8263
  type: [string, "null"]
7822
8264
  maxLength: 4096
7823
- description: Text, the caption of a file, or the emoji of a sticker; `null` when deleted.
8265
+ description: |
8266
+ Text, the caption of a file, the emoji of a sticker, or the plain-text summary of a poll, contact or
8267
+ location (see `MessageType`); `null` when deleted.
7824
8268
  attachment:
7825
8269
  oneOf:
7826
8270
  - $ref: "#/components/schemas/Attachment"
@@ -7852,12 +8296,16 @@ components:
7852
8296
  read_by:
7853
8297
  type: array
7854
8298
  items: { $ref: "#/components/schemas/ReadReceipt" }
7855
- created_at: { $ref: "#/components/schemas/Timestamp" }
8299
+ created_at:
8300
+ description: When the message was sent; for an imported message, when it was sent in the other messenger.
8301
+ allOf: [{ $ref: "#/components/schemas/Timestamp" }]
7856
8302
  edited_at:
7857
8303
  oneOf:
7858
8304
  - $ref: "#/components/schemas/Timestamp"
7859
8305
  - type: "null"
7860
8306
  is_deleted: { type: boolean }
8307
+ import:
8308
+ $ref: "#/components/schemas/MessageImport"
7861
8309
  removed_by_moderation:
7862
8310
  type: boolean
7863
8311
  description: |
@@ -7880,6 +8328,167 @@ components:
7880
8328
  mentions_all:
7881
8329
  type: boolean
7882
8330
  description: "`true` when an owner or admin wrote `@all`; it mentions every member. Absent otherwise."
8331
+ poll:
8332
+ description: The poll of a `poll` message as the requesting user sees it; absent for other types, when deleted and in chat-list previews.
8333
+ $ref: "#/components/schemas/Poll"
8334
+ contact:
8335
+ description: The shared user of a `contact` message; absent for other types, when deleted and in chat-list previews.
8336
+ $ref: "#/components/schemas/ContactCard"
8337
+ location:
8338
+ description: The place of a `location` message; absent for other types and when deleted.
8339
+ $ref: "#/components/schemas/MessageLocation"
8340
+ PollCreate:
8341
+ type: object
8342
+ description: |
8343
+ A new poll. Option texts are trimmed and must differ (ignoring case). `quiz` makes it a quiz: one correct
8344
+ option, one answer per voter that cannot be changed; it cannot be combined with `multiple_answers`.
8345
+ `close_at` closes the poll automatically, 5 minutes to 30 days from now.
8346
+ required: [question, options]
8347
+ additionalProperties: false
8348
+ properties:
8349
+ question: { type: string, minLength: 1, maxLength: 300 }
8350
+ options:
8351
+ type: array
8352
+ minItems: 2
8353
+ maxItems: 10
8354
+ items: { type: string, minLength: 1, maxLength: 100 }
8355
+ multiple_answers: { type: boolean, default: false }
8356
+ anonymous:
8357
+ type: boolean
8358
+ default: true
8359
+ description: |
8360
+ `false` lets everyone who sees the results list who voted for what. Anonymous votes are still stored
8361
+ with the voter, so each member votes once and can change the vote, but no one else sees them.
8362
+ quiz: { $ref: "#/components/schemas/PollQuizCreate" }
8363
+ close_at: { $ref: "#/components/schemas/Timestamp" }
8364
+ PollQuizCreate:
8365
+ type: object
8366
+ required: [correct_option]
8367
+ additionalProperties: false
8368
+ properties:
8369
+ correct_option:
8370
+ type: integer
8371
+ minimum: 0
8372
+ maximum: 9
8373
+ description: Index into `options`
8374
+ explanation: { type: string, minLength: 1, maxLength: 200 }
8375
+ Poll:
8376
+ type: object
8377
+ description: |
8378
+ A poll as the requesting user sees it. Results (`voter_count`, `total_voters`, `is_correct`, `explanation`)
8379
+ are `null` or absent until that user voted, unless they created the poll or it is closed. A poll is closed
8380
+ when `closed_at` is set; clients also treat it as closed once `close_at` has passed.
8381
+ required: [question, options, multiple_answers, anonymous, quiz, explanation, close_at, closed_at, total_voters, my_votes, can_close, version]
8382
+ properties:
8383
+ question: { type: string }
8384
+ options:
8385
+ type: array
8386
+ items: { $ref: "#/components/schemas/PollOption" }
8387
+ multiple_answers: { type: boolean }
8388
+ anonymous: { type: boolean }
8389
+ quiz: { type: boolean }
8390
+ explanation:
8391
+ type: [string, "null"]
8392
+ description: The explanation of a quiz once the user sees the results.
8393
+ close_at:
8394
+ oneOf:
8395
+ - $ref: "#/components/schemas/Timestamp"
8396
+ - type: "null"
8397
+ closed_at:
8398
+ oneOf:
8399
+ - $ref: "#/components/schemas/Timestamp"
8400
+ - type: "null"
8401
+ total_voters:
8402
+ type: [integer, "null"]
8403
+ minimum: 0
8404
+ description: People who voted, each counted once even with several answers.
8405
+ my_votes:
8406
+ type: array
8407
+ description: Indexes of the options the user voted for; empty when they have not voted.
8408
+ items: { type: integer, minimum: 0, maximum: 9 }
8409
+ can_close:
8410
+ type: boolean
8411
+ description: The user may close the poll now.
8412
+ version:
8413
+ type: integer
8414
+ minimum: 0
8415
+ description: Grows with every vote and when the poll closes; keep the poll with the highest version.
8416
+ PollOption:
8417
+ type: object
8418
+ required: [text, voter_count]
8419
+ properties:
8420
+ text: { type: string }
8421
+ voter_count: { type: [integer, "null"], minimum: 0 }
8422
+ is_correct:
8423
+ type: boolean
8424
+ description: Set on every option of a quiz once the user sees the results; absent otherwise.
8425
+ PollVoteRequest:
8426
+ type: object
8427
+ required: [options]
8428
+ additionalProperties: false
8429
+ properties:
8430
+ options:
8431
+ type: array
8432
+ maxItems: 10
8433
+ uniqueItems: true
8434
+ items: { type: integer, minimum: 0, maximum: 9 }
8435
+ ContactCreate:
8436
+ type: object
8437
+ required: [user_id]
8438
+ additionalProperties: false
8439
+ properties:
8440
+ user_id:
8441
+ description: |
8442
+ A user whose profile the sender may open (`403` otherwise), the sender included; not a deleted account.
8443
+ allOf: [{ $ref: "#/components/schemas/Id" }]
8444
+ ContactCard:
8445
+ type: object
8446
+ required: [user_id, user]
8447
+ properties:
8448
+ user_id: { $ref: "#/components/schemas/Id" }
8449
+ user:
8450
+ description: |
8451
+ The shared user as the requesting user may see them now, not as they were when the card was sent; `null`
8452
+ when the account is gone.
8453
+ oneOf:
8454
+ - $ref: "#/components/schemas/User"
8455
+ - type: "null"
8456
+ LocationCreate:
8457
+ type: object
8458
+ required: [latitude, longitude]
8459
+ additionalProperties: false
8460
+ properties:
8461
+ latitude: { type: number, format: double, minimum: -90, maximum: 90 }
8462
+ longitude: { type: number, format: double, minimum: -180, maximum: 180 }
8463
+ accuracy_m:
8464
+ type: integer
8465
+ minimum: 0
8466
+ maximum: 10000
8467
+ description: Accuracy of a measured position in metres; omit for a point picked on the map.
8468
+ title:
8469
+ type: string
8470
+ minLength: 1
8471
+ maxLength: 100
8472
+ description: A name for the place, typed by the sender.
8473
+ MessageLocation:
8474
+ type: object
8475
+ description: Coordinates are rounded to 6 decimals (about 10 cm).
8476
+ required: [latitude, longitude, accuracy_m, title, map]
8477
+ properties:
8478
+ latitude: { type: number, format: double, minimum: -90, maximum: 90 }
8479
+ longitude: { type: number, format: double, minimum: -180, maximum: 180 }
8480
+ accuracy_m: { type: [integer, "null"], minimum: 0 }
8481
+ title: { type: [string, "null"], maxLength: 100 }
8482
+ map: { $ref: "#/components/schemas/MapImage" }
8483
+ MapImage:
8484
+ type: object
8485
+ required: [url, width, height]
8486
+ properties:
8487
+ url:
8488
+ type: string
8489
+ description: "`GET /maps/static` with the signed point; load it like other API images"
8490
+ width: { type: integer, minimum: 1 }
8491
+ height: { type: integer, minimum: 1 }
7883
8492
  LinkPreview:
7884
8493
  type: object
7885
8494
  required: [url, title, description, site_name, image]
@@ -7905,14 +8514,18 @@ components:
7905
8514
  height: { type: [integer, "null"], minimum: 1 }
7906
8515
  SystemEventKind:
7907
8516
  type: string
7908
- enum: [group_created, member_added, member_joined, member_removed, member_left, call, message_pinned, message_unpinned]
8517
+ enum: [group_created, member_added, member_joined, member_removed, member_left, call, message_pinned, message_unpinned, history_imported, history_import_ended, imported_note, group_renamed, group_avatar_changed, owner_transferred]
7909
8518
  SystemEvent:
7910
8519
  type: object
7911
8520
  description: |
7912
8521
  What a `system` message records; set on system messages only, whose `content` is then `null`. The names
7913
- are the display names at the time of the event. `target` fields are set for `member_added` and
7914
- `member_removed`. `call` is set for `call` messages: one per call, posted when the call ends, `actor` is the
7915
- initiator. `message_id` and `snippet` are set for `message_pinned` and `message_unpinned`.
8522
+ are the display names at the time of the event. `target` fields are set for `member_added`,
8523
+ `member_removed` and `owner_transferred` (the new owner; `actor` is the previous one). `call` is set for
8524
+ `call` messages: one per call, posted when the call ends, `actor` is the initiator. `message_id` and
8525
+ `snippet` are set for `message_pinned` and `message_unpinned`. `old_name` and `new_name` are set for
8526
+ `group_renamed`, `avatar_removed` for `group_avatar_changed`.
8527
+ `history_imported` opens and `history_import_ended` closes an imported history; both carry `import`, and
8528
+ `actor` is the importer. `imported_note` is a line of the export that is not a message; its text is `text`.
7916
8529
  required: [kind, actor_id, actor_name]
7917
8530
  properties:
7918
8531
  kind: { $ref: "#/components/schemas/SystemEventKind" }
@@ -7931,9 +8544,20 @@ components:
7931
8544
  type: string
7932
8545
  maxLength: 64
7933
8546
  description: |
7934
- Start of the pinned message's text at the time of the event (at most 60 characters plus `…`); empty for a
7935
- message without text, which clients name by its `message_type`.
8547
+ Start of the pinned message's text at the time of the event (at most 60 characters plus `…`): the question
8548
+ of a poll, the place name of a location. Empty for a message without text and for a contact, which clients
8549
+ name by its `message_type`.
7936
8550
  message_type: { $ref: "#/components/schemas/MessageType" }
8551
+ old_name: { type: string, maxLength: 64 }
8552
+ new_name: { type: string, maxLength: 64 }
8553
+ avatar_removed:
8554
+ type: boolean
8555
+ description: "`true` when the group photo was removed, `false` when a new one was set."
8556
+ import: { $ref: "#/components/schemas/ImportSummary" }
8557
+ text:
8558
+ type: string
8559
+ maxLength: 4096
8560
+ description: The line of the export, for `imported_note`.
7937
8561
  MessagePage:
7938
8562
  type: object
7939
8563
  required: [items, next_cursor, prev_cursor]
@@ -7975,7 +8599,7 @@ components:
7975
8599
  client_temp_id: { $ref: "#/components/schemas/ClientTempId" }
7976
8600
  type:
7977
8601
  type: string
7978
- enum: [text, file, voice, sticker]
8602
+ enum: [text, file, voice, sticker, poll, contact, location]
7979
8603
  content: { type: [string, "null"] }
7980
8604
  reply_to:
7981
8605
  oneOf:
@@ -7986,6 +8610,15 @@ components:
7986
8610
  description: Uploaded files of the send that still exist, in the order they were sent.
7987
8611
  items: { $ref: "#/components/schemas/Attachment" }
7988
8612
  sticker: { $ref: "#/components/schemas/Sticker" }
8613
+ poll:
8614
+ description: The poll of an unsent `poll` message, as it was sent.
8615
+ $ref: "#/components/schemas/PollCreate"
8616
+ contact:
8617
+ description: The contact of an unsent `contact` message, as it was sent.
8618
+ $ref: "#/components/schemas/ContactCreate"
8619
+ location:
8620
+ description: The place of an unsent `location` message, as it was sent.
8621
+ $ref: "#/components/schemas/LocationCreate"
7989
8622
  error_code: { $ref: "#/components/schemas/ErrorCode" }
7990
8623
  created_at: { $ref: "#/components/schemas/Timestamp" }
7991
8624
  MessageSearchPage:
@@ -8003,10 +8636,22 @@ components:
8003
8636
  client_temp_id: { $ref: "#/components/schemas/ClientTempId" }
8004
8637
  type:
8005
8638
  type: string
8006
- enum: [text, file, voice, sticker]
8639
+ enum: [text, file, voice, sticker, poll, contact, location]
8007
8640
  content:
8008
8641
  type: [string, "null"]
8009
8642
  maxLength: 4096
8643
+ poll:
8644
+ description: |
8645
+ The poll of a `poll` message. Poll, contact and location messages have no content, attachment, sticker or
8646
+ drawings; the server writes a plain-text summary into `content` for older clients. Send them with this
8647
+ operation; the WebSocket `message` event does not take them.
8648
+ $ref: "#/components/schemas/PollCreate"
8649
+ contact:
8650
+ description: The shared user of a `contact` message.
8651
+ $ref: "#/components/schemas/ContactCreate"
8652
+ location:
8653
+ description: The place of a `location` message.
8654
+ $ref: "#/components/schemas/LocationCreate"
8010
8655
  sticker_id:
8011
8656
  description: |
8012
8657
  The sticker of a `sticker` message, from any pack that is not deleted. Sticker messages have no content,
@@ -8037,6 +8682,37 @@ components:
8037
8682
  instead of the sender's own upload: that is how a member draws on an image someone sent.
8038
8683
  maxItems: 10
8039
8684
  items: { $ref: "#/components/schemas/AttachmentDrawing" }
8685
+ allOf:
8686
+ - if:
8687
+ properties:
8688
+ type: { const: poll }
8689
+ then:
8690
+ required: [poll]
8691
+ properties:
8692
+ poll: { $ref: "#/components/schemas/PollCreate" }
8693
+ else:
8694
+ properties:
8695
+ poll: { not: {} }
8696
+ - if:
8697
+ properties:
8698
+ type: { const: contact }
8699
+ then:
8700
+ required: [contact]
8701
+ properties:
8702
+ contact: { $ref: "#/components/schemas/ContactCreate" }
8703
+ else:
8704
+ properties:
8705
+ contact: { not: {} }
8706
+ - if:
8707
+ properties:
8708
+ type: { const: location }
8709
+ then:
8710
+ required: [location]
8711
+ properties:
8712
+ location: { $ref: "#/components/schemas/LocationCreate" }
8713
+ else:
8714
+ properties:
8715
+ location: { not: {} }
8040
8716
  if:
8041
8717
  properties:
8042
8718
  type: { enum: [file, voice] }
@@ -8056,15 +8732,23 @@ components:
8056
8732
  else:
8057
8733
  if:
8058
8734
  properties:
8059
- type: { const: sticker }
8735
+ type: { enum: [sticker, poll, contact, location] }
8060
8736
  then:
8061
- required: [sticker_id]
8062
8737
  properties:
8063
- sticker_id: { $ref: "#/components/schemas/Id" }
8064
8738
  content: { not: {} }
8065
8739
  attachment_id: { not: {} }
8066
8740
  attachment_ids: { not: {} }
8067
8741
  drawings: { not: {} }
8742
+ if:
8743
+ properties:
8744
+ type: { const: sticker }
8745
+ then:
8746
+ required: [sticker_id]
8747
+ properties:
8748
+ sticker_id: { $ref: "#/components/schemas/Id" }
8749
+ else:
8750
+ properties:
8751
+ sticker_id: { not: {} }
8068
8752
  else:
8069
8753
  required: [content]
8070
8754
  properties:
@@ -8295,6 +8979,188 @@ components:
8295
8979
  description: Newest pin first
8296
8980
  items: { $ref: "#/components/schemas/PinnedMessage" }
8297
8981
  next_cursor: { $ref: "#/components/schemas/Cursor" }
8982
+ ImportSource:
8983
+ type: string
8984
+ enum: [telegram, whatsapp]
8985
+ ChatImportState:
8986
+ type: string
8987
+ description: "`running`: messages are being added. `done`: finished. `removing`: being removed."
8988
+ enum: [running, done, removing]
8989
+ ImportSenderKey:
8990
+ type: string
8991
+ description: The client's key for one name of the export.
8992
+ pattern: "^[A-Za-z0-9_-]{1,64}$"
8993
+ ImportSenderState:
8994
+ type: string
8995
+ description: |
8996
+ `me`: the importer's own messages. `unassigned`: shown as text. `pending`: suggested for `user_id`, who has
8997
+ not answered. `confirmed`: `user_id` confirmed; the messages show their account. `declined`: the suggested
8998
+ member said no; shown as text.
8999
+ enum: [me, unassigned, pending, confirmed, declined]
9000
+ ChatImportSender:
9001
+ type: object
9002
+ required: [key, name, message_count, state, user_id]
9003
+ properties:
9004
+ key: { $ref: "#/components/schemas/ImportSenderKey" }
9005
+ name: { type: string, minLength: 1, maxLength: 128 }
9006
+ message_count: { type: integer, minimum: 0 }
9007
+ state: { $ref: "#/components/schemas/ImportSenderState" }
9008
+ user_id:
9009
+ oneOf:
9010
+ - $ref: "#/components/schemas/Id"
9011
+ - type: "null"
9012
+ ChatImport:
9013
+ type: object
9014
+ required: [id, chat_id, source, state, message_count, file_count, first_at, last_at, next_index, imported_by, created_at, finished_at, senders]
9015
+ properties:
9016
+ id: { $ref: "#/components/schemas/Id" }
9017
+ chat_id: { $ref: "#/components/schemas/Id" }
9018
+ source: { $ref: "#/components/schemas/ImportSource" }
9019
+ state: { $ref: "#/components/schemas/ChatImportState" }
9020
+ message_count: { type: integer, minimum: 1, maximum: 100000 }
9021
+ file_count: { type: integer, minimum: 0, maximum: 5000 }
9022
+ first_at: { $ref: "#/components/schemas/Timestamp" }
9023
+ last_at: { $ref: "#/components/schemas/Timestamp" }
9024
+ next_index:
9025
+ type: integer
9026
+ minimum: 0
9027
+ description: How many messages are stored; the `from_index` of the next batch.
9028
+ imported_by:
9029
+ oneOf:
9030
+ - $ref: "#/components/schemas/Id"
9031
+ - type: "null"
9032
+ created_at: { $ref: "#/components/schemas/Timestamp" }
9033
+ finished_at:
9034
+ oneOf:
9035
+ - $ref: "#/components/schemas/Timestamp"
9036
+ - type: "null"
9037
+ senders:
9038
+ type: array
9039
+ items: { $ref: "#/components/schemas/ChatImportSender" }
9040
+ ChatImportList:
9041
+ type: object
9042
+ required: [items]
9043
+ properties:
9044
+ items:
9045
+ type: array
9046
+ items: { $ref: "#/components/schemas/ChatImport" }
9047
+ StartChatImportSender:
9048
+ type: object
9049
+ required: [key, name, message_count]
9050
+ properties:
9051
+ key: { $ref: "#/components/schemas/ImportSenderKey" }
9052
+ name: { type: string, minLength: 1, maxLength: 128 }
9053
+ message_count: { type: integer, minimum: 0 }
9054
+ me:
9055
+ type: boolean
9056
+ description: The caller's own messages; at most one sender.
9057
+ user_id:
9058
+ description: A member of the chat suggested for this name; not with `me`.
9059
+ allOf: [{ $ref: "#/components/schemas/Id" }]
9060
+ StartChatImportRequest:
9061
+ type: object
9062
+ required: [source, message_count, file_count, first_at, last_at, senders]
9063
+ properties:
9064
+ source: { $ref: "#/components/schemas/ImportSource" }
9065
+ message_count: { type: integer, minimum: 1, maximum: 100000 }
9066
+ file_count: { type: integer, minimum: 0, maximum: 5000 }
9067
+ first_at: { $ref: "#/components/schemas/Timestamp" }
9068
+ last_at: { $ref: "#/components/schemas/Timestamp" }
9069
+ senders:
9070
+ type: array
9071
+ minItems: 1
9072
+ maxItems: 200
9073
+ items: { $ref: "#/components/schemas/StartChatImportSender" }
9074
+ ImportedMessageType:
9075
+ type: string
9076
+ description: "`note`: a line of the export that is not a message (for example that someone joined), shown as a system message."
9077
+ enum: [text, file, voice, note]
9078
+ ImportedMessage:
9079
+ type: object
9080
+ required: [index, original_at, type]
9081
+ properties:
9082
+ index:
9083
+ type: integer
9084
+ minimum: 0
9085
+ description: Position in the import, counting from 0 without gaps.
9086
+ sender_key:
9087
+ description: Required except for `note`.
9088
+ allOf: [{ $ref: "#/components/schemas/ImportSenderKey" }]
9089
+ original_at:
9090
+ description: When the message was sent in the other messenger; between the import's `first_at` and `last_at`.
9091
+ allOf: [{ $ref: "#/components/schemas/Timestamp" }]
9092
+ type: { $ref: "#/components/schemas/ImportedMessageType" }
9093
+ content:
9094
+ type: [string, "null"]
9095
+ maxLength: 4096
9096
+ attachment_ids:
9097
+ type: array
9098
+ description: The importer's uploads; two to ten images or videos make an album.
9099
+ minItems: 1
9100
+ maxItems: 10
9101
+ uniqueItems: true
9102
+ items: { $ref: "#/components/schemas/AttachmentRef" }
9103
+ reply_to_index:
9104
+ type: integer
9105
+ minimum: 0
9106
+ description: "`index` of an earlier message of the import that this one answers."
9107
+ AddImportedMessagesRequest:
9108
+ type: object
9109
+ required: [from_index, messages]
9110
+ properties:
9111
+ from_index: { type: integer, minimum: 0 }
9112
+ messages:
9113
+ type: array
9114
+ minItems: 1
9115
+ maxItems: 500
9116
+ items: { $ref: "#/components/schemas/ImportedMessage" }
9117
+ ImportProgress:
9118
+ type: object
9119
+ required: [next_index]
9120
+ properties:
9121
+ next_index: { type: integer, minimum: 0 }
9122
+ AssignImportSenderRequest:
9123
+ type: object
9124
+ required: [user_id]
9125
+ properties:
9126
+ user_id:
9127
+ oneOf:
9128
+ - $ref: "#/components/schemas/Id"
9129
+ - type: "null"
9130
+ DecideImportSenderRequest:
9131
+ type: object
9132
+ required: [decision]
9133
+ properties:
9134
+ decision:
9135
+ type: string
9136
+ enum: [confirm, decline, withdraw]
9137
+ MessageImport:
9138
+ type: object
9139
+ description: Set on messages that came from an import.
9140
+ required: [import_id, source, original_at]
9141
+ properties:
9142
+ import_id: { $ref: "#/components/schemas/Id" }
9143
+ source: { $ref: "#/components/schemas/ImportSource" }
9144
+ original_at: { $ref: "#/components/schemas/Timestamp" }
9145
+ sender_name:
9146
+ type: string
9147
+ description: The name in the export; absent on system messages.
9148
+ sender_state:
9149
+ type: string
9150
+ description: |
9151
+ `me`: the importer's own message, `sender` is the importer. `confirmed`: the member confirmed the name,
9152
+ `sender` is that member. `unconfirmed`: `sender` is `null`; show `sender_name` as text. Absent on system
9153
+ messages.
9154
+ enum: [me, confirmed, unconfirmed]
9155
+ ImportSummary:
9156
+ type: object
9157
+ required: [import_id, source, message_count, first_at, last_at]
9158
+ properties:
9159
+ import_id: { $ref: "#/components/schemas/Id" }
9160
+ source: { $ref: "#/components/schemas/ImportSource" }
9161
+ message_count: { type: integer, minimum: 1 }
9162
+ first_at: { $ref: "#/components/schemas/Timestamp" }
9163
+ last_at: { $ref: "#/components/schemas/Timestamp" }
8298
9164
  CreateChatRequest:
8299
9165
  type: object
8300
9166
  required: [user_id]