@myronsi/messenger-api 2.1.0-alpha.46.next.165 → 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.46
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
@@ -66,6 +66,8 @@ tags:
66
66
  description: Chat histories imported from other messengers
67
67
  - name: calls
68
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`)
69
71
  - name: public
70
72
  description: Profile and group cards for people without an account, and link previews (see `docs/sharing.md`)
71
73
 
@@ -2356,6 +2358,95 @@ paths:
2356
2358
  schema: { $ref: "#/components/schemas/PinnedMessagePage" }
2357
2359
  "401": { $ref: "#/components/responses/Unauthorized" }
2358
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" }
2359
2450
  /chats/{chat_id}/imports:
2360
2451
  parameters:
2361
2452
  - $ref: "#/components/parameters/ClientVersion"
@@ -2868,6 +2959,7 @@ paths:
2868
2959
  tags: [groups]
2869
2960
  operationId: updateGroup
2870
2961
  summary: Change name or description
2962
+ description: A new name posts a `group_renamed` system message; the same name posts nothing.
2871
2963
  requestBody:
2872
2964
  required: true
2873
2965
  content:
@@ -2906,7 +2998,9 @@ paths:
2906
2998
  tags: [groups]
2907
2999
  operationId: setGroupAvatar
2908
3000
  summary: Set the group avatar from an uploaded attachment
2909
- 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.
2910
3004
  requestBody:
2911
3005
  required: true
2912
3006
  content:
@@ -2924,6 +3018,23 @@ paths:
2924
3018
  "403": { $ref: "#/components/responses/Forbidden" }
2925
3019
  "404": { $ref: "#/components/responses/NotFound" }
2926
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" }
2927
3038
  /groups/{chat_id}/background:
2928
3039
  parameters:
2929
3040
  - $ref: "#/components/parameters/ClientVersion"
@@ -3068,7 +3179,9 @@ paths:
3068
3179
  tags: [groups]
3069
3180
  operationId: transferGroupOwnership
3070
3181
  summary: Make another member the owner
3071
- 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.
3072
3185
  requestBody:
3073
3186
  required: true
3074
3187
  content:
@@ -4342,6 +4455,83 @@ paths:
4342
4455
  "404": { $ref: "#/components/responses/NotFound" }
4343
4456
  "429": { $ref: "#/components/responses/TooManyRequests" }
4344
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
+
4345
4535
  /me/notifications:
4346
4536
  get:
4347
4537
  tags:
@@ -6652,6 +6842,8 @@ components:
6652
6842
  - stale_epoch
6653
6843
  - limit_reached
6654
6844
  - account_restricted
6845
+ - poll_closed
6846
+ - quiz_answered
6655
6847
  - internal_error
6656
6848
  Problem:
6657
6849
  type: object
@@ -7484,6 +7676,12 @@ components:
7484
7676
  border and stores a WebP (`413` when that is still over 512 KB). Only its uploader can load it until it is
7485
7677
  added to a pack.
7486
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
+
7487
7685
  `profile_music`: an audio file of at most 20 MB. The server keeps at most 30 s of it (from `start_ms` to
7488
7686
  `end_ms`, or the first 30 s), stored as AAC, reads the title and artist into `tags` and the embedded cover
7489
7687
  into `thumbnail_url`. Use it with `PUT /me/music`.
@@ -7516,11 +7714,30 @@ components:
7516
7714
  start_ms:
7517
7715
  type: integer
7518
7716
  minimum: 0
7519
- 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."
7520
7718
  end_ms:
7521
7719
  type: integer
7522
7720
  minimum: 1
7523
- 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.
7524
7741
  Attachment:
7525
7742
  type: object
7526
7743
  required: [id, kind, filename, content_type, size, url]
@@ -7721,12 +7938,17 @@ components:
7721
7938
  # -------------------------------------------------------- messages
7722
7939
  MessageType:
7723
7940
  type: string
7724
- 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]
7725
7946
  Sticker:
7726
7947
  type: object
7727
7948
  description: |
7728
7949
  One sticker of a pack. `image` is a WebP or PNG of at most 512 x 512 px with transparency, animated when
7729
- `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.
7730
7952
  required: [id, pack_id, emoji, is_animated, image]
7731
7953
  properties:
7732
7954
  id: { $ref: "#/components/schemas/Id" }
@@ -8040,7 +8262,9 @@ components:
8040
8262
  content:
8041
8263
  type: [string, "null"]
8042
8264
  maxLength: 4096
8043
- 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.
8044
8268
  attachment:
8045
8269
  oneOf:
8046
8270
  - $ref: "#/components/schemas/Attachment"
@@ -8104,6 +8328,167 @@ components:
8104
8328
  mentions_all:
8105
8329
  type: boolean
8106
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 }
8107
8492
  LinkPreview:
8108
8493
  type: object
8109
8494
  required: [url, title, description, site_name, image]
@@ -8129,14 +8514,16 @@ components:
8129
8514
  height: { type: [integer, "null"], minimum: 1 }
8130
8515
  SystemEventKind:
8131
8516
  type: string
8132
- enum: [group_created, member_added, member_joined, member_removed, member_left, call, message_pinned, message_unpinned, history_imported, history_import_ended, imported_note]
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]
8133
8518
  SystemEvent:
8134
8519
  type: object
8135
8520
  description: |
8136
8521
  What a `system` message records; set on system messages only, whose `content` is then `null`. The names
8137
- are the display names at the time of the event. `target` fields are set for `member_added` and
8138
- `member_removed`. `call` is set for `call` messages: one per call, posted when the call ends, `actor` is the
8139
- 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`.
8140
8527
  `history_imported` opens and `history_import_ended` closes an imported history; both carry `import`, and
8141
8528
  `actor` is the importer. `imported_note` is a line of the export that is not a message; its text is `text`.
8142
8529
  required: [kind, actor_id, actor_name]
@@ -8157,9 +8544,15 @@ components:
8157
8544
  type: string
8158
8545
  maxLength: 64
8159
8546
  description: |
8160
- Start of the pinned message's text at the time of the event (at most 60 characters plus `…`); empty for a
8161
- 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`.
8162
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."
8163
8556
  import: { $ref: "#/components/schemas/ImportSummary" }
8164
8557
  text:
8165
8558
  type: string
@@ -8206,7 +8599,7 @@ components:
8206
8599
  client_temp_id: { $ref: "#/components/schemas/ClientTempId" }
8207
8600
  type:
8208
8601
  type: string
8209
- enum: [text, file, voice, sticker]
8602
+ enum: [text, file, voice, sticker, poll, contact, location]
8210
8603
  content: { type: [string, "null"] }
8211
8604
  reply_to:
8212
8605
  oneOf:
@@ -8217,6 +8610,15 @@ components:
8217
8610
  description: Uploaded files of the send that still exist, in the order they were sent.
8218
8611
  items: { $ref: "#/components/schemas/Attachment" }
8219
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"
8220
8622
  error_code: { $ref: "#/components/schemas/ErrorCode" }
8221
8623
  created_at: { $ref: "#/components/schemas/Timestamp" }
8222
8624
  MessageSearchPage:
@@ -8234,10 +8636,22 @@ components:
8234
8636
  client_temp_id: { $ref: "#/components/schemas/ClientTempId" }
8235
8637
  type:
8236
8638
  type: string
8237
- enum: [text, file, voice, sticker]
8639
+ enum: [text, file, voice, sticker, poll, contact, location]
8238
8640
  content:
8239
8641
  type: [string, "null"]
8240
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"
8241
8655
  sticker_id:
8242
8656
  description: |
8243
8657
  The sticker of a `sticker` message, from any pack that is not deleted. Sticker messages have no content,
@@ -8268,6 +8682,37 @@ components:
8268
8682
  instead of the sender's own upload: that is how a member draws on an image someone sent.
8269
8683
  maxItems: 10
8270
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: {} }
8271
8716
  if:
8272
8717
  properties:
8273
8718
  type: { enum: [file, voice] }
@@ -8287,15 +8732,23 @@ components:
8287
8732
  else:
8288
8733
  if:
8289
8734
  properties:
8290
- type: { const: sticker }
8735
+ type: { enum: [sticker, poll, contact, location] }
8291
8736
  then:
8292
- required: [sticker_id]
8293
8737
  properties:
8294
- sticker_id: { $ref: "#/components/schemas/Id" }
8295
8738
  content: { not: {} }
8296
8739
  attachment_id: { not: {} }
8297
8740
  attachment_ids: { not: {} }
8298
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: {} }
8299
8752
  else:
8300
8753
  required: [content]
8301
8754
  properties: