@myronsi/messenger-api 2.1.0-alpha.31 → 2.1.0-alpha.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/openapi.yaml +271 -10
- package/dist/schema.d.ts +441 -10
- package/dist/ws-docs.json +22 -1
- package/dist/ws-events.d.ts +46 -3
- package/dist/ws-events.schema.json +194 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
Contract changes only. The backend changelog is `CHANGELOG.md` in the repository root. Rules: `docs/api-compatibility.md`.
|
|
4
4
|
|
|
5
|
+
## 2.1.0-alpha.32
|
|
6
|
+
|
|
7
|
+
- `Attachment` gains `placeholder` (ThumbHash), `processing` (`MediaProcessing`: `queued`, `running`, `done`,
|
|
8
|
+
`failed`), `source_url`, `animation_url`, `panel_url` and `message_url`. `thumbnail_url` is a 480 px WebP for new
|
|
9
|
+
uploads and the cover of an audio file; `tags` (with the new `album`) is set for audio files, not only profile music.
|
|
10
|
+
- `GET /attachments/{attachment_id}/content` gains the variants `source`, `panel`, `message`, `animation`, `inline`,
|
|
11
|
+
`avatar_64`, `avatar_128` and `avatar_256`, and `pt`: it works without a bearer token when `pt` is a playback token.
|
|
12
|
+
Without `variant`, an optimized video or audio file answers with the optimized copy.
|
|
13
|
+
- `POST /attachments/{attachment_id}/playback` returns `PlaybackUrl`, a five-minute URL for media elements.
|
|
14
|
+
- Resumable uploads: `POST /upload-sessions`, `GET`/`DELETE /upload-sessions/{upload_id}`,
|
|
15
|
+
`PUT /upload-sessions/{upload_id}/chunks` and `POST /upload-sessions/{upload_id}/complete`.
|
|
16
|
+
- `GET /users/{user_id}/avatar` gains `size`; `GET /emoji/items/{emoji_id}/image` gains `variant=inline`.
|
|
17
|
+
- WebSocket: `attachment_updated` carries an attachment whose optimized copy is ready or failed.
|
|
18
|
+
|
|
5
19
|
## 2.1.0-alpha.31
|
|
6
20
|
|
|
7
21
|
- Custom emoji: `CustomEmoji`, `EmojiPack` and the `emoji` tag with `GET`/`POST /emoji/packs`, `GET`/`PATCH`/`DELETE
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* Generated from api/openapi.yaml 2.1.0-alpha.
|
|
2
|
-
export declare const API_VERSION: "2.1.0-alpha.
|
|
1
|
+
/* Generated from api/openapi.yaml 2.1.0-alpha.32. Do not edit. */
|
|
2
|
+
export declare const API_VERSION: "2.1.0-alpha.32";
|
|
3
3
|
export type { paths, components, operations } from "./schema.js";
|
|
4
4
|
export * from "./ws-events.js";
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const API_VERSION = "2.1.0-alpha.
|
|
1
|
+
export const API_VERSION = "2.1.0-alpha.32";
|
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.
|
|
4
|
+
version: 2.1.0-alpha.32
|
|
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
|
|
@@ -1115,6 +1115,12 @@ paths:
|
|
|
1115
1115
|
in: query
|
|
1116
1116
|
description: Revision of the current avatar, as given in `avatar_url`.
|
|
1117
1117
|
schema: { type: string, maxLength: 64 }
|
|
1118
|
+
- name: size
|
|
1119
|
+
in: query
|
|
1120
|
+
description: |
|
|
1121
|
+
The size the client shows the avatar at, in device pixels. The answer is the smallest stored WebP of
|
|
1122
|
+
64, 128 or 256 px that is at least that large, or the original when there is none.
|
|
1123
|
+
schema: { type: integer, minimum: 1, maximum: 4096 }
|
|
1118
1124
|
responses:
|
|
1119
1125
|
"426": { $ref: "#/components/responses/ClientOutdated" }
|
|
1120
1126
|
"400": { $ref: "#/components/responses/BadRequest" }
|
|
@@ -1249,16 +1255,35 @@ paths:
|
|
|
1249
1255
|
storage. Images, audio and video are sent `inline`; everything else as a download
|
|
1250
1256
|
(`Content-Disposition: attachment`, `application/octet-stream`), always with
|
|
1251
1257
|
`X-Content-Type-Options: nosniff`.
|
|
1258
|
+
|
|
1259
|
+
Without a bearer token the request needs `pt`, a playback token from
|
|
1260
|
+
`POST /attachments/{attachment_id}/playback`, so a `<video>` or `<audio>` element can stream the file with
|
|
1261
|
+
range requests.
|
|
1262
|
+
|
|
1263
|
+
Without `variant`, a video or audio file the server optimized (it then has a `source_url`) is answered
|
|
1264
|
+
with the optimized copy (H.264/AAC MP4 or AAC M4A); `variant=source` returns the file as uploaded.
|
|
1265
|
+
security:
|
|
1266
|
+
- bearerAuth: []
|
|
1267
|
+
- {}
|
|
1252
1268
|
parameters:
|
|
1253
1269
|
- name: variant
|
|
1254
1270
|
in: query
|
|
1255
1271
|
description: |
|
|
1256
|
-
`thumbnail`: a
|
|
1257
|
-
`display`:
|
|
1258
|
-
the
|
|
1272
|
+
`thumbnail`: a WebP of at most 480 px (older uploads: a JPEG of at most 320 px); `thumbnail_url`.
|
|
1273
|
+
`display`: at most 1600 px for viewing a large still image (`display_url`); the original otherwise.
|
|
1274
|
+
`source`: the file as uploaded (`source_url`).
|
|
1275
|
+
`panel`, `message`: a sticker as a still 128 px or a 320 px WebP (`panel_url`, `message_url`).
|
|
1276
|
+
`animation`: a GIF as a muted, looping MP4 (`animation_url`).
|
|
1277
|
+
`inline`: a custom emoji at 64 px.
|
|
1278
|
+
`avatar_64`, `avatar_128`, `avatar_256`: a group avatar at that size.
|
|
1279
|
+
A variant the attachment does not have answers with the default content.
|
|
1259
1280
|
schema:
|
|
1260
1281
|
type: string
|
|
1261
|
-
enum: [thumbnail, display]
|
|
1282
|
+
enum: [thumbnail, display, source, panel, message, animation, inline, avatar_64, avatar_128, avatar_256]
|
|
1283
|
+
- name: pt
|
|
1284
|
+
in: query
|
|
1285
|
+
description: Playback token (`PlaybackUrl.url` carries it); only for requests without a bearer token.
|
|
1286
|
+
schema: { type: string, maxLength: 256 }
|
|
1262
1287
|
responses:
|
|
1263
1288
|
"426": { $ref: "#/components/responses/ClientOutdated" }
|
|
1264
1289
|
"400": { $ref: "#/components/responses/BadRequest" }
|
|
@@ -1281,6 +1306,159 @@ paths:
|
|
|
1281
1306
|
"401": { $ref: "#/components/responses/Unauthorized" }
|
|
1282
1307
|
"403": { $ref: "#/components/responses/Forbidden" }
|
|
1283
1308
|
"404": { $ref: "#/components/responses/NotFound" }
|
|
1309
|
+
/attachments/{attachment_id}/playback:
|
|
1310
|
+
parameters:
|
|
1311
|
+
- $ref: "#/components/parameters/ClientVersion"
|
|
1312
|
+
- $ref: "#/components/parameters/ClientApiVersion"
|
|
1313
|
+
- $ref: "#/components/parameters/AttachmentId"
|
|
1314
|
+
post:
|
|
1315
|
+
tags: [attachments]
|
|
1316
|
+
operationId: createAttachmentPlayback
|
|
1317
|
+
summary: A short-lived URL to stream an attachment
|
|
1318
|
+
description: |
|
|
1319
|
+
Same access as `GET /attachments/{attachment_id}/content`. The answer is a URL that works without a bearer
|
|
1320
|
+
token for five minutes and only for this attachment, so media elements can stream it with range requests.
|
|
1321
|
+
Ask again when it expires (a `401` from the URL); the client keeps the playback position.
|
|
1322
|
+
parameters:
|
|
1323
|
+
- name: variant
|
|
1324
|
+
in: query
|
|
1325
|
+
schema:
|
|
1326
|
+
type: string
|
|
1327
|
+
enum: [source, animation]
|
|
1328
|
+
responses:
|
|
1329
|
+
"426": { $ref: "#/components/responses/ClientOutdated" }
|
|
1330
|
+
"400": { $ref: "#/components/responses/BadRequest" }
|
|
1331
|
+
"200":
|
|
1332
|
+
description: Playback URL
|
|
1333
|
+
content:
|
|
1334
|
+
application/json:
|
|
1335
|
+
schema: { $ref: "#/components/schemas/PlaybackUrl" }
|
|
1336
|
+
"401": { $ref: "#/components/responses/Unauthorized" }
|
|
1337
|
+
"404": { $ref: "#/components/responses/NotFound" }
|
|
1338
|
+
/upload-sessions:
|
|
1339
|
+
parameters:
|
|
1340
|
+
- $ref: "#/components/parameters/ClientVersion"
|
|
1341
|
+
- $ref: "#/components/parameters/ClientApiVersion"
|
|
1342
|
+
post:
|
|
1343
|
+
tags: [attachments]
|
|
1344
|
+
operationId: createUploadSession
|
|
1345
|
+
summary: Start a resumable upload
|
|
1346
|
+
description: |
|
|
1347
|
+
For large files: the client sends the file in chunks of `chunk_size` bytes with
|
|
1348
|
+
`PUT /upload-sessions/{upload_id}/chunks`, can ask how much arrived with `GET`, and finishes with
|
|
1349
|
+
`POST /upload-sessions/{upload_id}/complete`, which checks the file like `POST /attachments`. Sessions
|
|
1350
|
+
without progress for 24 hours are deleted. At most 5 open sessions per user.
|
|
1351
|
+
requestBody:
|
|
1352
|
+
required: true
|
|
1353
|
+
content:
|
|
1354
|
+
application/json:
|
|
1355
|
+
schema: { $ref: "#/components/schemas/CreateUploadSessionRequest" }
|
|
1356
|
+
responses:
|
|
1357
|
+
"426": { $ref: "#/components/responses/ClientOutdated" }
|
|
1358
|
+
"201":
|
|
1359
|
+
description: Session
|
|
1360
|
+
content:
|
|
1361
|
+
application/json:
|
|
1362
|
+
schema: { $ref: "#/components/schemas/UploadSession" }
|
|
1363
|
+
"400": { $ref: "#/components/responses/BadRequest" }
|
|
1364
|
+
"401": { $ref: "#/components/responses/Unauthorized" }
|
|
1365
|
+
"413": { $ref: "#/components/responses/PayloadTooLarge" }
|
|
1366
|
+
"429": { $ref: "#/components/responses/TooManyRequests" }
|
|
1367
|
+
/upload-sessions/{upload_id}:
|
|
1368
|
+
parameters:
|
|
1369
|
+
- $ref: "#/components/parameters/ClientVersion"
|
|
1370
|
+
- $ref: "#/components/parameters/ClientApiVersion"
|
|
1371
|
+
- $ref: "#/components/parameters/UploadId"
|
|
1372
|
+
get:
|
|
1373
|
+
tags: [attachments]
|
|
1374
|
+
operationId: getUploadSession
|
|
1375
|
+
summary: How much of a resumable upload arrived
|
|
1376
|
+
responses:
|
|
1377
|
+
"426": { $ref: "#/components/responses/ClientOutdated" }
|
|
1378
|
+
"400": { $ref: "#/components/responses/BadRequest" }
|
|
1379
|
+
"200":
|
|
1380
|
+
description: Session
|
|
1381
|
+
content:
|
|
1382
|
+
application/json:
|
|
1383
|
+
schema: { $ref: "#/components/schemas/UploadSession" }
|
|
1384
|
+
"401": { $ref: "#/components/responses/Unauthorized" }
|
|
1385
|
+
"404": { $ref: "#/components/responses/NotFound" }
|
|
1386
|
+
delete:
|
|
1387
|
+
tags: [attachments]
|
|
1388
|
+
operationId: deleteUploadSession
|
|
1389
|
+
summary: Cancel a resumable upload
|
|
1390
|
+
responses:
|
|
1391
|
+
"426": { $ref: "#/components/responses/ClientOutdated" }
|
|
1392
|
+
"400": { $ref: "#/components/responses/BadRequest" }
|
|
1393
|
+
"204": { description: Cancelled }
|
|
1394
|
+
"401": { $ref: "#/components/responses/Unauthorized" }
|
|
1395
|
+
"404": { $ref: "#/components/responses/NotFound" }
|
|
1396
|
+
/upload-sessions/{upload_id}/chunks:
|
|
1397
|
+
parameters:
|
|
1398
|
+
- $ref: "#/components/parameters/ClientVersion"
|
|
1399
|
+
- $ref: "#/components/parameters/ClientApiVersion"
|
|
1400
|
+
- $ref: "#/components/parameters/UploadId"
|
|
1401
|
+
put:
|
|
1402
|
+
tags: [attachments]
|
|
1403
|
+
operationId: putUploadChunk
|
|
1404
|
+
summary: Send the next chunk of a resumable upload
|
|
1405
|
+
description: |
|
|
1406
|
+
`offset` must equal `received`; every chunk but the last is exactly `chunk_size` bytes. A chunk sent again
|
|
1407
|
+
after a lost answer gets `409` with the session, whose `received` tells where to continue.
|
|
1408
|
+
parameters:
|
|
1409
|
+
- name: offset
|
|
1410
|
+
in: query
|
|
1411
|
+
required: true
|
|
1412
|
+
schema: { type: integer, format: int64, minimum: 0 }
|
|
1413
|
+
requestBody:
|
|
1414
|
+
required: true
|
|
1415
|
+
content:
|
|
1416
|
+
application/octet-stream:
|
|
1417
|
+
schema: { type: string, format: binary }
|
|
1418
|
+
responses:
|
|
1419
|
+
"426": { $ref: "#/components/responses/ClientOutdated" }
|
|
1420
|
+
"400": { $ref: "#/components/responses/BadRequest" }
|
|
1421
|
+
"200":
|
|
1422
|
+
description: Session after the chunk
|
|
1423
|
+
content:
|
|
1424
|
+
application/json:
|
|
1425
|
+
schema: { $ref: "#/components/schemas/UploadSession" }
|
|
1426
|
+
"401": { $ref: "#/components/responses/Unauthorized" }
|
|
1427
|
+
"404": { $ref: "#/components/responses/NotFound" }
|
|
1428
|
+
"409":
|
|
1429
|
+
description: "`offset` is not where the upload stands"
|
|
1430
|
+
content:
|
|
1431
|
+
application/json:
|
|
1432
|
+
schema: { $ref: "#/components/schemas/UploadSession" }
|
|
1433
|
+
"413": { $ref: "#/components/responses/PayloadTooLarge" }
|
|
1434
|
+
/upload-sessions/{upload_id}/complete:
|
|
1435
|
+
parameters:
|
|
1436
|
+
- $ref: "#/components/parameters/ClientVersion"
|
|
1437
|
+
- $ref: "#/components/parameters/ClientApiVersion"
|
|
1438
|
+
- $ref: "#/components/parameters/UploadId"
|
|
1439
|
+
post:
|
|
1440
|
+
tags: [attachments]
|
|
1441
|
+
operationId: completeUploadSession
|
|
1442
|
+
summary: Finish a resumable upload
|
|
1443
|
+
description: Checks and stores the file like `POST /attachments` and deletes the session.
|
|
1444
|
+
responses:
|
|
1445
|
+
"426": { $ref: "#/components/responses/ClientOutdated" }
|
|
1446
|
+
"201":
|
|
1447
|
+
description: Uploaded
|
|
1448
|
+
content:
|
|
1449
|
+
application/json:
|
|
1450
|
+
schema: { $ref: "#/components/schemas/Attachment" }
|
|
1451
|
+
"400": { $ref: "#/components/responses/BadRequest" }
|
|
1452
|
+
"401": { $ref: "#/components/responses/Unauthorized" }
|
|
1453
|
+
"404": { $ref: "#/components/responses/NotFound" }
|
|
1454
|
+
"409":
|
|
1455
|
+
description: Not all chunks arrived yet
|
|
1456
|
+
content:
|
|
1457
|
+
application/json:
|
|
1458
|
+
schema: { $ref: "#/components/schemas/UploadSession" }
|
|
1459
|
+
"413": { $ref: "#/components/responses/PayloadTooLarge" }
|
|
1460
|
+
"415": { $ref: "#/components/responses/UnsupportedMediaType" }
|
|
1461
|
+
"429": { $ref: "#/components/responses/TooManyRequests" }
|
|
1284
1462
|
|
|
1285
1463
|
# --------------------------------------------------------------- chats
|
|
1286
1464
|
/chats:
|
|
@@ -2878,8 +3056,15 @@ paths:
|
|
|
2878
3056
|
operationId: getCustomEmojiImage
|
|
2879
3057
|
summary: The image of a custom emoji
|
|
2880
3058
|
description: |
|
|
2881
|
-
Any signed-in user; a
|
|
2882
|
-
is deleted: clients then show the token's `:shortcode:` text.
|
|
3059
|
+
Any signed-in user; a WebP (still or animated) of 128 x 128 px, or for older emoji a PNG or a GIF. Cached
|
|
3060
|
+
as immutable. `404` once the emoji or its pack is deleted: clients then show the token's `:shortcode:` text.
|
|
3061
|
+
parameters:
|
|
3062
|
+
- name: variant
|
|
3063
|
+
in: query
|
|
3064
|
+
description: "`inline`: the emoji at 64 px for text; the 128 px image when the emoji has none."
|
|
3065
|
+
schema:
|
|
3066
|
+
type: string
|
|
3067
|
+
enum: [inline]
|
|
2883
3068
|
responses:
|
|
2884
3069
|
"426": { $ref: "#/components/responses/ClientOutdated" }
|
|
2885
3070
|
"400": { $ref: "#/components/responses/BadRequest" }
|
|
@@ -4951,6 +5136,11 @@ components:
|
|
|
4951
5136
|
in: path
|
|
4952
5137
|
required: true
|
|
4953
5138
|
schema: { $ref: "#/components/schemas/AttachmentRef" }
|
|
5139
|
+
UploadId:
|
|
5140
|
+
name: upload_id
|
|
5141
|
+
in: path
|
|
5142
|
+
required: true
|
|
5143
|
+
schema: { type: string, format: uuid }
|
|
4954
5144
|
StickerPackId:
|
|
4955
5145
|
name: pack_id
|
|
4956
5146
|
in: path
|
|
@@ -5898,17 +6088,49 @@ components:
|
|
|
5898
6088
|
readOnly: true
|
|
5899
6089
|
width: { type: [integer, "null"], minimum: 1 }
|
|
5900
6090
|
height: { type: [integer, "null"], minimum: 1 }
|
|
5901
|
-
thumbnail_url:
|
|
6091
|
+
thumbnail_url:
|
|
6092
|
+
type: [string, "null"]
|
|
6093
|
+
readOnly: true
|
|
6094
|
+
description: A WebP of at most 480 px (older uploads a JPEG of at most 320 px); for audio the embedded cover.
|
|
5902
6095
|
display_url:
|
|
5903
6096
|
type: [string, "null"]
|
|
5904
6097
|
readOnly: true
|
|
5905
|
-
description:
|
|
6098
|
+
description: At most 1600 px to show in an image viewer instead of the original; `null` for small images and GIFs, which are shown as they are.
|
|
6099
|
+
placeholder:
|
|
6100
|
+
type: [string, "null"]
|
|
6101
|
+
maxLength: 64
|
|
6102
|
+
readOnly: true
|
|
6103
|
+
description: A ThumbHash (base64) of the image or video poster, to draw a blurred preview before the thumbnail arrives.
|
|
6104
|
+
processing:
|
|
6105
|
+
readOnly: true
|
|
6106
|
+
description: |
|
|
6107
|
+
Whether the server is still making an optimized copy of a video, GIF or audio file. Clients play `url`
|
|
6108
|
+
meanwhile and swap to the new copy on `attachment_updated`. `null` when there is nothing to do.
|
|
6109
|
+
oneOf:
|
|
6110
|
+
- $ref: "#/components/schemas/MediaProcessing"
|
|
6111
|
+
- type: "null"
|
|
6112
|
+
source_url:
|
|
6113
|
+
type: [string, "null"]
|
|
6114
|
+
readOnly: true
|
|
6115
|
+
description: The file as uploaded, when `url` serves an optimized copy; `null` otherwise.
|
|
6116
|
+
animation_url:
|
|
6117
|
+
type: [string, "null"]
|
|
6118
|
+
readOnly: true
|
|
6119
|
+
description: A GIF as a muted, looping MP4, much smaller than the GIF; `null` until made or for other files.
|
|
6120
|
+
panel_url:
|
|
6121
|
+
type: [string, "null"]
|
|
6122
|
+
readOnly: true
|
|
6123
|
+
description: Stickers only; a still 128 px WebP for pickers and lists.
|
|
6124
|
+
message_url:
|
|
6125
|
+
type: [string, "null"]
|
|
6126
|
+
readOnly: true
|
|
6127
|
+
description: Stickers only; a 320 px WebP for messages.
|
|
5906
6128
|
duration_ms: { type: [integer, "null"], minimum: 0 }
|
|
5907
6129
|
waveform:
|
|
5908
6130
|
type: [array, "null"]
|
|
5909
6131
|
items: { type: integer, minimum: 0, maximum: 255 }
|
|
5910
6132
|
tags:
|
|
5911
|
-
description:
|
|
6133
|
+
description: Audio files (not voice messages) and `profile_music` uploads; what the file says about itself.
|
|
5912
6134
|
$ref: "#/components/schemas/AudioTags"
|
|
5913
6135
|
drawing:
|
|
5914
6136
|
description: |
|
|
@@ -5922,6 +6144,45 @@ components:
|
|
|
5922
6144
|
properties:
|
|
5923
6145
|
title: { type: [string, "null"], maxLength: 100 }
|
|
5924
6146
|
artist: { type: [string, "null"], maxLength: 100 }
|
|
6147
|
+
album: { type: [string, "null"], maxLength: 100 }
|
|
6148
|
+
MediaProcessing:
|
|
6149
|
+
type: string
|
|
6150
|
+
enum: [queued, running, done, failed]
|
|
6151
|
+
PlaybackUrl:
|
|
6152
|
+
type: object
|
|
6153
|
+
required: [url, expires_at]
|
|
6154
|
+
properties:
|
|
6155
|
+
url:
|
|
6156
|
+
type: string
|
|
6157
|
+
description: Same-origin path with the playback token; set it as `src` of a media element.
|
|
6158
|
+
expires_at: { type: string, format: date-time }
|
|
6159
|
+
CreateUploadSessionRequest:
|
|
6160
|
+
type: object
|
|
6161
|
+
required: [purpose, filename, size]
|
|
6162
|
+
additionalProperties: false
|
|
6163
|
+
properties:
|
|
6164
|
+
purpose: { $ref: "#/components/schemas/UploadPurpose" }
|
|
6165
|
+
kind:
|
|
6166
|
+
type: string
|
|
6167
|
+
enum: [image, audio, video, file]
|
|
6168
|
+
filename: { type: string, minLength: 1, maxLength: 255 }
|
|
6169
|
+
size:
|
|
6170
|
+
type: integer
|
|
6171
|
+
format: int64
|
|
6172
|
+
minimum: 1
|
|
6173
|
+
description: Bytes of the whole file; at most the upload limit of its kind.
|
|
6174
|
+
UploadSession:
|
|
6175
|
+
type: object
|
|
6176
|
+
required: [id, size, chunk_size, received, expires_at]
|
|
6177
|
+
properties:
|
|
6178
|
+
id: { type: string, format: uuid }
|
|
6179
|
+
size: { type: integer, format: int64 }
|
|
6180
|
+
chunk_size: { type: integer, description: Bytes per chunk (8 MiB). }
|
|
6181
|
+
received: { type: integer, format: int64, description: Bytes stored so far; the next `offset`. }
|
|
6182
|
+
expires_at:
|
|
6183
|
+
type: string
|
|
6184
|
+
format: date-time
|
|
6185
|
+
description: When the session is deleted unless more chunks arrive.
|
|
5925
6186
|
Drawing:
|
|
5926
6187
|
type: object
|
|
5927
6188
|
description: |
|
package/dist/schema.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* Generated from api/openapi.yaml 2.1.0-alpha.
|
|
1
|
+
/* Generated from api/openapi.yaml 2.1.0-alpha.32. Do not edit. */
|
|
2
2
|
export interface paths {
|
|
3
3
|
"/meta": {
|
|
4
4
|
parameters: {
|
|
@@ -1076,6 +1076,13 @@ export interface paths {
|
|
|
1076
1076
|
* storage. Images, audio and video are sent `inline`; everything else as a download
|
|
1077
1077
|
* (`Content-Disposition: attachment`, `application/octet-stream`), always with
|
|
1078
1078
|
* `X-Content-Type-Options: nosniff`.
|
|
1079
|
+
*
|
|
1080
|
+
* Without a bearer token the request needs `pt`, a playback token from
|
|
1081
|
+
* `POST /attachments/{attachment_id}/playback`, so a `<video>` or `<audio>` element can stream the file with
|
|
1082
|
+
* range requests.
|
|
1083
|
+
*
|
|
1084
|
+
* Without `variant`, a video or audio file the server optimized (it then has a `source_url`) is answered
|
|
1085
|
+
* with the optimized copy (H.264/AAC MP4 or AAC M4A); `variant=source` returns the file as uploaded.
|
|
1079
1086
|
*/
|
|
1080
1087
|
get: operations["getAttachmentContent"];
|
|
1081
1088
|
put?: never;
|
|
@@ -1086,6 +1093,143 @@ export interface paths {
|
|
|
1086
1093
|
patch?: never;
|
|
1087
1094
|
trace?: never;
|
|
1088
1095
|
};
|
|
1096
|
+
"/attachments/{attachment_id}/playback": {
|
|
1097
|
+
parameters: {
|
|
1098
|
+
query?: never;
|
|
1099
|
+
header?: {
|
|
1100
|
+
/** @description Version of the client app, for logs and the per-client metric. */
|
|
1101
|
+
"X-Client-Version"?: components["parameters"]["ClientVersion"];
|
|
1102
|
+
/** @description Contract version the client was built with (`API_VERSION` of `@myronsi/messenger-api`). A different MAJOR or a version below `min_client_api_version` is answered with `426`; a malformed value with `400` (`invalid_client_version`). */
|
|
1103
|
+
"X-Client-Api-Version"?: components["parameters"]["ClientApiVersion"];
|
|
1104
|
+
};
|
|
1105
|
+
path: {
|
|
1106
|
+
attachment_id: components["parameters"]["AttachmentId"];
|
|
1107
|
+
};
|
|
1108
|
+
cookie?: never;
|
|
1109
|
+
};
|
|
1110
|
+
get?: never;
|
|
1111
|
+
put?: never;
|
|
1112
|
+
/**
|
|
1113
|
+
* A short-lived URL to stream an attachment
|
|
1114
|
+
* @description Same access as `GET /attachments/{attachment_id}/content`. The answer is a URL that works without a bearer
|
|
1115
|
+
* token for five minutes and only for this attachment, so media elements can stream it with range requests.
|
|
1116
|
+
* Ask again when it expires (a `401` from the URL); the client keeps the playback position.
|
|
1117
|
+
*/
|
|
1118
|
+
post: operations["createAttachmentPlayback"];
|
|
1119
|
+
delete?: never;
|
|
1120
|
+
options?: never;
|
|
1121
|
+
head?: never;
|
|
1122
|
+
patch?: never;
|
|
1123
|
+
trace?: never;
|
|
1124
|
+
};
|
|
1125
|
+
"/upload-sessions": {
|
|
1126
|
+
parameters: {
|
|
1127
|
+
query?: never;
|
|
1128
|
+
header?: {
|
|
1129
|
+
/** @description Version of the client app, for logs and the per-client metric. */
|
|
1130
|
+
"X-Client-Version"?: components["parameters"]["ClientVersion"];
|
|
1131
|
+
/** @description Contract version the client was built with (`API_VERSION` of `@myronsi/messenger-api`). A different MAJOR or a version below `min_client_api_version` is answered with `426`; a malformed value with `400` (`invalid_client_version`). */
|
|
1132
|
+
"X-Client-Api-Version"?: components["parameters"]["ClientApiVersion"];
|
|
1133
|
+
};
|
|
1134
|
+
path?: never;
|
|
1135
|
+
cookie?: never;
|
|
1136
|
+
};
|
|
1137
|
+
get?: never;
|
|
1138
|
+
put?: never;
|
|
1139
|
+
/**
|
|
1140
|
+
* Start a resumable upload
|
|
1141
|
+
* @description For large files: the client sends the file in chunks of `chunk_size` bytes with
|
|
1142
|
+
* `PUT /upload-sessions/{upload_id}/chunks`, can ask how much arrived with `GET`, and finishes with
|
|
1143
|
+
* `POST /upload-sessions/{upload_id}/complete`, which checks the file like `POST /attachments`. Sessions
|
|
1144
|
+
* without progress for 24 hours are deleted. At most 5 open sessions per user.
|
|
1145
|
+
*/
|
|
1146
|
+
post: operations["createUploadSession"];
|
|
1147
|
+
delete?: never;
|
|
1148
|
+
options?: never;
|
|
1149
|
+
head?: never;
|
|
1150
|
+
patch?: never;
|
|
1151
|
+
trace?: never;
|
|
1152
|
+
};
|
|
1153
|
+
"/upload-sessions/{upload_id}": {
|
|
1154
|
+
parameters: {
|
|
1155
|
+
query?: never;
|
|
1156
|
+
header?: {
|
|
1157
|
+
/** @description Version of the client app, for logs and the per-client metric. */
|
|
1158
|
+
"X-Client-Version"?: components["parameters"]["ClientVersion"];
|
|
1159
|
+
/** @description Contract version the client was built with (`API_VERSION` of `@myronsi/messenger-api`). A different MAJOR or a version below `min_client_api_version` is answered with `426`; a malformed value with `400` (`invalid_client_version`). */
|
|
1160
|
+
"X-Client-Api-Version"?: components["parameters"]["ClientApiVersion"];
|
|
1161
|
+
};
|
|
1162
|
+
path: {
|
|
1163
|
+
upload_id: components["parameters"]["UploadId"];
|
|
1164
|
+
};
|
|
1165
|
+
cookie?: never;
|
|
1166
|
+
};
|
|
1167
|
+
/** How much of a resumable upload arrived */
|
|
1168
|
+
get: operations["getUploadSession"];
|
|
1169
|
+
put?: never;
|
|
1170
|
+
post?: never;
|
|
1171
|
+
/** Cancel a resumable upload */
|
|
1172
|
+
delete: operations["deleteUploadSession"];
|
|
1173
|
+
options?: never;
|
|
1174
|
+
head?: never;
|
|
1175
|
+
patch?: never;
|
|
1176
|
+
trace?: never;
|
|
1177
|
+
};
|
|
1178
|
+
"/upload-sessions/{upload_id}/chunks": {
|
|
1179
|
+
parameters: {
|
|
1180
|
+
query?: never;
|
|
1181
|
+
header?: {
|
|
1182
|
+
/** @description Version of the client app, for logs and the per-client metric. */
|
|
1183
|
+
"X-Client-Version"?: components["parameters"]["ClientVersion"];
|
|
1184
|
+
/** @description Contract version the client was built with (`API_VERSION` of `@myronsi/messenger-api`). A different MAJOR or a version below `min_client_api_version` is answered with `426`; a malformed value with `400` (`invalid_client_version`). */
|
|
1185
|
+
"X-Client-Api-Version"?: components["parameters"]["ClientApiVersion"];
|
|
1186
|
+
};
|
|
1187
|
+
path: {
|
|
1188
|
+
upload_id: components["parameters"]["UploadId"];
|
|
1189
|
+
};
|
|
1190
|
+
cookie?: never;
|
|
1191
|
+
};
|
|
1192
|
+
get?: never;
|
|
1193
|
+
/**
|
|
1194
|
+
* Send the next chunk of a resumable upload
|
|
1195
|
+
* @description `offset` must equal `received`; every chunk but the last is exactly `chunk_size` bytes. A chunk sent again
|
|
1196
|
+
* after a lost answer gets `409` with the session, whose `received` tells where to continue.
|
|
1197
|
+
*/
|
|
1198
|
+
put: operations["putUploadChunk"];
|
|
1199
|
+
post?: never;
|
|
1200
|
+
delete?: never;
|
|
1201
|
+
options?: never;
|
|
1202
|
+
head?: never;
|
|
1203
|
+
patch?: never;
|
|
1204
|
+
trace?: never;
|
|
1205
|
+
};
|
|
1206
|
+
"/upload-sessions/{upload_id}/complete": {
|
|
1207
|
+
parameters: {
|
|
1208
|
+
query?: never;
|
|
1209
|
+
header?: {
|
|
1210
|
+
/** @description Version of the client app, for logs and the per-client metric. */
|
|
1211
|
+
"X-Client-Version"?: components["parameters"]["ClientVersion"];
|
|
1212
|
+
/** @description Contract version the client was built with (`API_VERSION` of `@myronsi/messenger-api`). A different MAJOR or a version below `min_client_api_version` is answered with `426`; a malformed value with `400` (`invalid_client_version`). */
|
|
1213
|
+
"X-Client-Api-Version"?: components["parameters"]["ClientApiVersion"];
|
|
1214
|
+
};
|
|
1215
|
+
path: {
|
|
1216
|
+
upload_id: components["parameters"]["UploadId"];
|
|
1217
|
+
};
|
|
1218
|
+
cookie?: never;
|
|
1219
|
+
};
|
|
1220
|
+
get?: never;
|
|
1221
|
+
put?: never;
|
|
1222
|
+
/**
|
|
1223
|
+
* Finish a resumable upload
|
|
1224
|
+
* @description Checks and stores the file like `POST /attachments` and deletes the session.
|
|
1225
|
+
*/
|
|
1226
|
+
post: operations["completeUploadSession"];
|
|
1227
|
+
delete?: never;
|
|
1228
|
+
options?: never;
|
|
1229
|
+
head?: never;
|
|
1230
|
+
patch?: never;
|
|
1231
|
+
trace?: never;
|
|
1232
|
+
};
|
|
1089
1233
|
"/chats": {
|
|
1090
1234
|
parameters: {
|
|
1091
1235
|
query?: never;
|
|
@@ -2394,8 +2538,8 @@ export interface paths {
|
|
|
2394
2538
|
};
|
|
2395
2539
|
/**
|
|
2396
2540
|
* The image of a custom emoji
|
|
2397
|
-
* @description Any signed-in user; a
|
|
2398
|
-
* is deleted: clients then show the token's `:shortcode:` text.
|
|
2541
|
+
* @description Any signed-in user; a WebP (still or animated) of 128 x 128 px, or for older emoji a PNG or a GIF. Cached
|
|
2542
|
+
* as immutable. `404` once the emoji or its pack is deleted: clients then show the token's `:shortcode:` text.
|
|
2399
2543
|
*/
|
|
2400
2544
|
get: operations["getCustomEmojiImage"];
|
|
2401
2545
|
put?: never;
|
|
@@ -4051,12 +4195,28 @@ export interface components {
|
|
|
4051
4195
|
readonly url: string;
|
|
4052
4196
|
width?: number | null;
|
|
4053
4197
|
height?: number | null;
|
|
4198
|
+
/** @description A WebP of at most 480 px (older uploads a JPEG of at most 320 px); for audio the embedded cover. */
|
|
4054
4199
|
readonly thumbnail_url?: string | null;
|
|
4055
|
-
/** @description
|
|
4200
|
+
/** @description At most 1600 px to show in an image viewer instead of the original; `null` for small images and GIFs, which are shown as they are. */
|
|
4056
4201
|
readonly display_url?: string | null;
|
|
4202
|
+
/** @description A ThumbHash (base64) of the image or video poster, to draw a blurred preview before the thumbnail arrives. */
|
|
4203
|
+
readonly placeholder?: string | null;
|
|
4204
|
+
/**
|
|
4205
|
+
* @description Whether the server is still making an optimized copy of a video, GIF or audio file. Clients play `url`
|
|
4206
|
+
* meanwhile and swap to the new copy on `attachment_updated`. `null` when there is nothing to do.
|
|
4207
|
+
*/
|
|
4208
|
+
readonly processing?: components["schemas"]["MediaProcessing"] | null;
|
|
4209
|
+
/** @description The file as uploaded, when `url` serves an optimized copy; `null` otherwise. */
|
|
4210
|
+
readonly source_url?: string | null;
|
|
4211
|
+
/** @description A GIF as a muted, looping MP4, much smaller than the GIF; `null` until made or for other files. */
|
|
4212
|
+
readonly animation_url?: string | null;
|
|
4213
|
+
/** @description Stickers only; a still 128 px WebP for pickers and lists. */
|
|
4214
|
+
readonly panel_url?: string | null;
|
|
4215
|
+
/** @description Stickers only; a 320 px WebP for messages. */
|
|
4216
|
+
readonly message_url?: string | null;
|
|
4057
4217
|
duration_ms?: number | null;
|
|
4058
4218
|
waveform?: number[] | null;
|
|
4059
|
-
/** @description
|
|
4219
|
+
/** @description Audio files (not voice messages) and `profile_music` uploads; what the file says about itself. */
|
|
4060
4220
|
tags?: components["schemas"]["AudioTags"];
|
|
4061
4221
|
/**
|
|
4062
4222
|
* @description What the sender drew on this image of this message. Clients show the image with the drawing on top
|
|
@@ -4068,6 +4228,44 @@ export interface components {
|
|
|
4068
4228
|
AudioTags: {
|
|
4069
4229
|
title: string | null;
|
|
4070
4230
|
artist: string | null;
|
|
4231
|
+
album?: string | null;
|
|
4232
|
+
};
|
|
4233
|
+
/** @enum {string} */
|
|
4234
|
+
MediaProcessing: "queued" | "running" | "done" | "failed";
|
|
4235
|
+
PlaybackUrl: {
|
|
4236
|
+
/** @description Same-origin path with the playback token; set it as `src` of a media element. */
|
|
4237
|
+
url: string;
|
|
4238
|
+
/** Format: date-time */
|
|
4239
|
+
expires_at: string;
|
|
4240
|
+
};
|
|
4241
|
+
CreateUploadSessionRequest: {
|
|
4242
|
+
purpose: components["schemas"]["UploadPurpose"];
|
|
4243
|
+
/** @enum {string} */
|
|
4244
|
+
kind?: "image" | "audio" | "video" | "file";
|
|
4245
|
+
filename: string;
|
|
4246
|
+
/**
|
|
4247
|
+
* Format: int64
|
|
4248
|
+
* @description Bytes of the whole file; at most the upload limit of its kind.
|
|
4249
|
+
*/
|
|
4250
|
+
size: number;
|
|
4251
|
+
};
|
|
4252
|
+
UploadSession: {
|
|
4253
|
+
/** Format: uuid */
|
|
4254
|
+
id: string;
|
|
4255
|
+
/** Format: int64 */
|
|
4256
|
+
size: number;
|
|
4257
|
+
/** @description Bytes per chunk (8 MiB). */
|
|
4258
|
+
chunk_size: number;
|
|
4259
|
+
/**
|
|
4260
|
+
* Format: int64
|
|
4261
|
+
* @description Bytes stored so far; the next `offset`.
|
|
4262
|
+
*/
|
|
4263
|
+
received: number;
|
|
4264
|
+
/**
|
|
4265
|
+
* Format: date-time
|
|
4266
|
+
* @description When the session is deleted unless more chunks arrive.
|
|
4267
|
+
*/
|
|
4268
|
+
expires_at: string;
|
|
4071
4269
|
};
|
|
4072
4270
|
/**
|
|
4073
4271
|
* @description Strokes and text labels on an image. Coordinates, widths and sizes are fractions of the image as it is
|
|
@@ -4943,6 +5141,7 @@ export interface components {
|
|
|
4943
5141
|
UserId: components["schemas"]["Id"];
|
|
4944
5142
|
RequestId: components["schemas"]["Id"];
|
|
4945
5143
|
AttachmentId: components["schemas"]["AttachmentRef"];
|
|
5144
|
+
UploadId: string;
|
|
4946
5145
|
StickerPackId: components["schemas"]["Id"];
|
|
4947
5146
|
StickerId: components["schemas"]["Id"];
|
|
4948
5147
|
EmojiPackId: components["schemas"]["Id"];
|
|
@@ -6468,6 +6667,11 @@ export interface operations {
|
|
|
6468
6667
|
version?: components["schemas"]["Id"];
|
|
6469
6668
|
/** @description Revision of the current avatar, as given in `avatar_url`. */
|
|
6470
6669
|
rev?: string;
|
|
6670
|
+
/**
|
|
6671
|
+
* @description The size the client shows the avatar at, in device pixels. The answer is the smallest stored WebP of
|
|
6672
|
+
* 64, 128 or 256 px that is at least that large, or the original when there is none.
|
|
6673
|
+
*/
|
|
6674
|
+
size?: number;
|
|
6471
6675
|
};
|
|
6472
6676
|
header?: {
|
|
6473
6677
|
/** @description Version of the client app, for logs and the per-client metric. */
|
|
@@ -6664,11 +6868,18 @@ export interface operations {
|
|
|
6664
6868
|
parameters: {
|
|
6665
6869
|
query?: {
|
|
6666
6870
|
/**
|
|
6667
|
-
* @description `thumbnail`: a
|
|
6668
|
-
* `display`:
|
|
6669
|
-
* the
|
|
6871
|
+
* @description `thumbnail`: a WebP of at most 480 px (older uploads: a JPEG of at most 320 px); `thumbnail_url`.
|
|
6872
|
+
* `display`: at most 1600 px for viewing a large still image (`display_url`); the original otherwise.
|
|
6873
|
+
* `source`: the file as uploaded (`source_url`).
|
|
6874
|
+
* `panel`, `message`: a sticker as a still 128 px or a 320 px WebP (`panel_url`, `message_url`).
|
|
6875
|
+
* `animation`: a GIF as a muted, looping MP4 (`animation_url`).
|
|
6876
|
+
* `inline`: a custom emoji at 64 px.
|
|
6877
|
+
* `avatar_64`, `avatar_128`, `avatar_256`: a group avatar at that size.
|
|
6878
|
+
* A variant the attachment does not have answers with the default content.
|
|
6670
6879
|
*/
|
|
6671
|
-
variant?: "thumbnail" | "display";
|
|
6880
|
+
variant?: "thumbnail" | "display" | "source" | "panel" | "message" | "animation" | "inline" | "avatar_64" | "avatar_128" | "avatar_256";
|
|
6881
|
+
/** @description Playback token (`PlaybackUrl.url` carries it); only for requests without a bearer token. */
|
|
6882
|
+
pt?: string;
|
|
6672
6883
|
};
|
|
6673
6884
|
header?: {
|
|
6674
6885
|
/** @description Version of the client app, for logs and the per-client metric. */
|
|
@@ -6729,6 +6940,223 @@ export interface operations {
|
|
|
6729
6940
|
426: components["responses"]["ClientOutdated"];
|
|
6730
6941
|
};
|
|
6731
6942
|
};
|
|
6943
|
+
createAttachmentPlayback: {
|
|
6944
|
+
parameters: {
|
|
6945
|
+
query?: {
|
|
6946
|
+
variant?: "source" | "animation";
|
|
6947
|
+
};
|
|
6948
|
+
header?: {
|
|
6949
|
+
/** @description Version of the client app, for logs and the per-client metric. */
|
|
6950
|
+
"X-Client-Version"?: components["parameters"]["ClientVersion"];
|
|
6951
|
+
/** @description Contract version the client was built with (`API_VERSION` of `@myronsi/messenger-api`). A different MAJOR or a version below `min_client_api_version` is answered with `426`; a malformed value with `400` (`invalid_client_version`). */
|
|
6952
|
+
"X-Client-Api-Version"?: components["parameters"]["ClientApiVersion"];
|
|
6953
|
+
};
|
|
6954
|
+
path: {
|
|
6955
|
+
attachment_id: components["parameters"]["AttachmentId"];
|
|
6956
|
+
};
|
|
6957
|
+
cookie?: never;
|
|
6958
|
+
};
|
|
6959
|
+
requestBody?: never;
|
|
6960
|
+
responses: {
|
|
6961
|
+
/** @description Playback URL */
|
|
6962
|
+
200: {
|
|
6963
|
+
headers: {
|
|
6964
|
+
[name: string]: unknown;
|
|
6965
|
+
};
|
|
6966
|
+
content: {
|
|
6967
|
+
"application/json": components["schemas"]["PlaybackUrl"];
|
|
6968
|
+
};
|
|
6969
|
+
};
|
|
6970
|
+
400: components["responses"]["BadRequest"];
|
|
6971
|
+
401: components["responses"]["Unauthorized"];
|
|
6972
|
+
404: components["responses"]["NotFound"];
|
|
6973
|
+
426: components["responses"]["ClientOutdated"];
|
|
6974
|
+
};
|
|
6975
|
+
};
|
|
6976
|
+
createUploadSession: {
|
|
6977
|
+
parameters: {
|
|
6978
|
+
query?: never;
|
|
6979
|
+
header?: {
|
|
6980
|
+
/** @description Version of the client app, for logs and the per-client metric. */
|
|
6981
|
+
"X-Client-Version"?: components["parameters"]["ClientVersion"];
|
|
6982
|
+
/** @description Contract version the client was built with (`API_VERSION` of `@myronsi/messenger-api`). A different MAJOR or a version below `min_client_api_version` is answered with `426`; a malformed value with `400` (`invalid_client_version`). */
|
|
6983
|
+
"X-Client-Api-Version"?: components["parameters"]["ClientApiVersion"];
|
|
6984
|
+
};
|
|
6985
|
+
path?: never;
|
|
6986
|
+
cookie?: never;
|
|
6987
|
+
};
|
|
6988
|
+
requestBody: {
|
|
6989
|
+
content: {
|
|
6990
|
+
"application/json": components["schemas"]["CreateUploadSessionRequest"];
|
|
6991
|
+
};
|
|
6992
|
+
};
|
|
6993
|
+
responses: {
|
|
6994
|
+
/** @description Session */
|
|
6995
|
+
201: {
|
|
6996
|
+
headers: {
|
|
6997
|
+
[name: string]: unknown;
|
|
6998
|
+
};
|
|
6999
|
+
content: {
|
|
7000
|
+
"application/json": components["schemas"]["UploadSession"];
|
|
7001
|
+
};
|
|
7002
|
+
};
|
|
7003
|
+
400: components["responses"]["BadRequest"];
|
|
7004
|
+
401: components["responses"]["Unauthorized"];
|
|
7005
|
+
413: components["responses"]["PayloadTooLarge"];
|
|
7006
|
+
426: components["responses"]["ClientOutdated"];
|
|
7007
|
+
429: components["responses"]["TooManyRequests"];
|
|
7008
|
+
};
|
|
7009
|
+
};
|
|
7010
|
+
getUploadSession: {
|
|
7011
|
+
parameters: {
|
|
7012
|
+
query?: never;
|
|
7013
|
+
header?: {
|
|
7014
|
+
/** @description Version of the client app, for logs and the per-client metric. */
|
|
7015
|
+
"X-Client-Version"?: components["parameters"]["ClientVersion"];
|
|
7016
|
+
/** @description Contract version the client was built with (`API_VERSION` of `@myronsi/messenger-api`). A different MAJOR or a version below `min_client_api_version` is answered with `426`; a malformed value with `400` (`invalid_client_version`). */
|
|
7017
|
+
"X-Client-Api-Version"?: components["parameters"]["ClientApiVersion"];
|
|
7018
|
+
};
|
|
7019
|
+
path: {
|
|
7020
|
+
upload_id: components["parameters"]["UploadId"];
|
|
7021
|
+
};
|
|
7022
|
+
cookie?: never;
|
|
7023
|
+
};
|
|
7024
|
+
requestBody?: never;
|
|
7025
|
+
responses: {
|
|
7026
|
+
/** @description Session */
|
|
7027
|
+
200: {
|
|
7028
|
+
headers: {
|
|
7029
|
+
[name: string]: unknown;
|
|
7030
|
+
};
|
|
7031
|
+
content: {
|
|
7032
|
+
"application/json": components["schemas"]["UploadSession"];
|
|
7033
|
+
};
|
|
7034
|
+
};
|
|
7035
|
+
400: components["responses"]["BadRequest"];
|
|
7036
|
+
401: components["responses"]["Unauthorized"];
|
|
7037
|
+
404: components["responses"]["NotFound"];
|
|
7038
|
+
426: components["responses"]["ClientOutdated"];
|
|
7039
|
+
};
|
|
7040
|
+
};
|
|
7041
|
+
deleteUploadSession: {
|
|
7042
|
+
parameters: {
|
|
7043
|
+
query?: never;
|
|
7044
|
+
header?: {
|
|
7045
|
+
/** @description Version of the client app, for logs and the per-client metric. */
|
|
7046
|
+
"X-Client-Version"?: components["parameters"]["ClientVersion"];
|
|
7047
|
+
/** @description Contract version the client was built with (`API_VERSION` of `@myronsi/messenger-api`). A different MAJOR or a version below `min_client_api_version` is answered with `426`; a malformed value with `400` (`invalid_client_version`). */
|
|
7048
|
+
"X-Client-Api-Version"?: components["parameters"]["ClientApiVersion"];
|
|
7049
|
+
};
|
|
7050
|
+
path: {
|
|
7051
|
+
upload_id: components["parameters"]["UploadId"];
|
|
7052
|
+
};
|
|
7053
|
+
cookie?: never;
|
|
7054
|
+
};
|
|
7055
|
+
requestBody?: never;
|
|
7056
|
+
responses: {
|
|
7057
|
+
/** @description Cancelled */
|
|
7058
|
+
204: {
|
|
7059
|
+
headers: {
|
|
7060
|
+
[name: string]: unknown;
|
|
7061
|
+
};
|
|
7062
|
+
content?: never;
|
|
7063
|
+
};
|
|
7064
|
+
400: components["responses"]["BadRequest"];
|
|
7065
|
+
401: components["responses"]["Unauthorized"];
|
|
7066
|
+
404: components["responses"]["NotFound"];
|
|
7067
|
+
426: components["responses"]["ClientOutdated"];
|
|
7068
|
+
};
|
|
7069
|
+
};
|
|
7070
|
+
putUploadChunk: {
|
|
7071
|
+
parameters: {
|
|
7072
|
+
query: {
|
|
7073
|
+
offset: number;
|
|
7074
|
+
};
|
|
7075
|
+
header?: {
|
|
7076
|
+
/** @description Version of the client app, for logs and the per-client metric. */
|
|
7077
|
+
"X-Client-Version"?: components["parameters"]["ClientVersion"];
|
|
7078
|
+
/** @description Contract version the client was built with (`API_VERSION` of `@myronsi/messenger-api`). A different MAJOR or a version below `min_client_api_version` is answered with `426`; a malformed value with `400` (`invalid_client_version`). */
|
|
7079
|
+
"X-Client-Api-Version"?: components["parameters"]["ClientApiVersion"];
|
|
7080
|
+
};
|
|
7081
|
+
path: {
|
|
7082
|
+
upload_id: components["parameters"]["UploadId"];
|
|
7083
|
+
};
|
|
7084
|
+
cookie?: never;
|
|
7085
|
+
};
|
|
7086
|
+
requestBody: {
|
|
7087
|
+
content: {
|
|
7088
|
+
"application/octet-stream": string;
|
|
7089
|
+
};
|
|
7090
|
+
};
|
|
7091
|
+
responses: {
|
|
7092
|
+
/** @description Session after the chunk */
|
|
7093
|
+
200: {
|
|
7094
|
+
headers: {
|
|
7095
|
+
[name: string]: unknown;
|
|
7096
|
+
};
|
|
7097
|
+
content: {
|
|
7098
|
+
"application/json": components["schemas"]["UploadSession"];
|
|
7099
|
+
};
|
|
7100
|
+
};
|
|
7101
|
+
400: components["responses"]["BadRequest"];
|
|
7102
|
+
401: components["responses"]["Unauthorized"];
|
|
7103
|
+
404: components["responses"]["NotFound"];
|
|
7104
|
+
/** @description `offset` is not where the upload stands */
|
|
7105
|
+
409: {
|
|
7106
|
+
headers: {
|
|
7107
|
+
[name: string]: unknown;
|
|
7108
|
+
};
|
|
7109
|
+
content: {
|
|
7110
|
+
"application/json": components["schemas"]["UploadSession"];
|
|
7111
|
+
};
|
|
7112
|
+
};
|
|
7113
|
+
413: components["responses"]["PayloadTooLarge"];
|
|
7114
|
+
426: components["responses"]["ClientOutdated"];
|
|
7115
|
+
};
|
|
7116
|
+
};
|
|
7117
|
+
completeUploadSession: {
|
|
7118
|
+
parameters: {
|
|
7119
|
+
query?: never;
|
|
7120
|
+
header?: {
|
|
7121
|
+
/** @description Version of the client app, for logs and the per-client metric. */
|
|
7122
|
+
"X-Client-Version"?: components["parameters"]["ClientVersion"];
|
|
7123
|
+
/** @description Contract version the client was built with (`API_VERSION` of `@myronsi/messenger-api`). A different MAJOR or a version below `min_client_api_version` is answered with `426`; a malformed value with `400` (`invalid_client_version`). */
|
|
7124
|
+
"X-Client-Api-Version"?: components["parameters"]["ClientApiVersion"];
|
|
7125
|
+
};
|
|
7126
|
+
path: {
|
|
7127
|
+
upload_id: components["parameters"]["UploadId"];
|
|
7128
|
+
};
|
|
7129
|
+
cookie?: never;
|
|
7130
|
+
};
|
|
7131
|
+
requestBody?: never;
|
|
7132
|
+
responses: {
|
|
7133
|
+
/** @description Uploaded */
|
|
7134
|
+
201: {
|
|
7135
|
+
headers: {
|
|
7136
|
+
[name: string]: unknown;
|
|
7137
|
+
};
|
|
7138
|
+
content: {
|
|
7139
|
+
"application/json": components["schemas"]["Attachment"];
|
|
7140
|
+
};
|
|
7141
|
+
};
|
|
7142
|
+
400: components["responses"]["BadRequest"];
|
|
7143
|
+
401: components["responses"]["Unauthorized"];
|
|
7144
|
+
404: components["responses"]["NotFound"];
|
|
7145
|
+
/** @description Not all chunks arrived yet */
|
|
7146
|
+
409: {
|
|
7147
|
+
headers: {
|
|
7148
|
+
[name: string]: unknown;
|
|
7149
|
+
};
|
|
7150
|
+
content: {
|
|
7151
|
+
"application/json": components["schemas"]["UploadSession"];
|
|
7152
|
+
};
|
|
7153
|
+
};
|
|
7154
|
+
413: components["responses"]["PayloadTooLarge"];
|
|
7155
|
+
415: components["responses"]["UnsupportedMediaType"];
|
|
7156
|
+
426: components["responses"]["ClientOutdated"];
|
|
7157
|
+
429: components["responses"]["TooManyRequests"];
|
|
7158
|
+
};
|
|
7159
|
+
};
|
|
6732
7160
|
listChats: {
|
|
6733
7161
|
parameters: {
|
|
6734
7162
|
query?: {
|
|
@@ -9046,7 +9474,10 @@ export interface operations {
|
|
|
9046
9474
|
};
|
|
9047
9475
|
getCustomEmojiImage: {
|
|
9048
9476
|
parameters: {
|
|
9049
|
-
query?:
|
|
9477
|
+
query?: {
|
|
9478
|
+
/** @description `inline`: the emoji at 64 px for text; the 128 px image when the emoji has none. */
|
|
9479
|
+
variant?: "inline";
|
|
9480
|
+
};
|
|
9050
9481
|
header?: {
|
|
9051
9482
|
/** @description Version of the client app, for logs and the per-client metric. */
|
|
9052
9483
|
"X-Client-Version"?: components["parameters"]["ClientVersion"];
|
package/dist/ws-docs.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"markdown": "# WebSocket protocol (API contract v2)\r\n\r\nThe JSON Schemas in `websocket/client/` (client → server) and `websocket/server/` (server → client) are the source of truth. Every event has an example in `websocket/examples/`, validated against its schema by `npm run check`. TypeScript types are generated into `dist/ws-events.d.ts` (`ClientEvent`, `ServerEvent`).\r\n\r\n## Connecting\r\n\r\n1. `POST /api/v2/ws/ticket` (authenticated) returns `{ \"ticket\": \"…\", \"expires_in\": 30 }`. The ticket is single-use and short-lived, so no access token ends up in a URL or a log.\r\n2. Open **one connection per browser tab**: `wss://<host>/api/v2/ws?ticket=<ticket>&api_version=<contract version>`. The connection carries the events of all chats of the user. `api_version` is optional and takes the place of the `X-Client-Api-Version` header, which browsers cannot send on a WebSocket.\r\n3. The first server event is `hello` with `api_version` and `min_client_api_version`. A client that reconnects after a deploy compares them with the contract version it was built for and shows an upgrade notice instead of failing at random.\r\n4. When the ticket is invalid or expired the server closes the connection with code `4401`. A client whose `api_version` is no longer served is closed with `4426` after `hello`.\r\n\r\n## Close codes\r\n\r\n| Code | Meaning | Client |\r\n| --- | --- | --- |\r\n| `1012` | `reconnect`: the server is restarting, or it lost its pub/sub connection and events may be missing | reconnect with backoff, then load what was missed (`after` cursor) |\r\n| `1013` | the client did not keep up with its events, or sent more than 64 events that are not handled yet | reconnect, then catch up |\r\n| `4401` | invalid ticket, or the session ended (logout, revoked, password changed) | get a new ticket; if that fails, sign in again |\r\n| `4426` | the client's contract version is no longer served | show the upgrade notice |\r\n| `4429` | the user opened more than 10 connections on this server; the oldest one is closed | do not reconnect this tab automatically |\r\n\r\n## Envelope\r\n\r\nServer → client:\r\n\r\n```json\r\n{ \"type\": \"message\", \"event_id\": \"7217400317439950849\", \"chat_id\": \"42\", \"data\": { \"message\": { \"…\": \"…\" } } }\r\n```\r\n\r\nClient → server:\r\n\r\n```json\r\n{ \"type\": \"message\", \"client_temp_id\": \"c-1\", \"chat_id\": \"42\", \"data\": { \"type\": \"text\", \"content\": \"Hello!\" } }\r\n```\r\n\r\n- All IDs are strings (Snowflake IDs do not fit into a JavaScript number).\r\n- `event_id` is unique and increases per server; it is only for deduplication and logs.\r\n- `chat_id` is always `null` in `hello`, `presence` and `approval_request_created`, which do not belong to a chat. `ack` and `error` repeat the `chat_id` of the client event they answer, and it is `null` for connection-level errors.\r\n- Unknown event `type`s must be ignored by clients, so new event types are not a breaking change.\r\n- A user who is removed from a chat (or whose chat is deleted) receives `chat_deleted` and no further events of that chat.\r\n\r\n## Acknowledgements\r\n\r\nEvery client event except `typing` (which is not acknowledged and carries no `client_temp_id`) has a `client_temp_id` (1–64 characters, unique per client). The server answers with exactly one of:\r\n\r\n- `ack` — `client_temp_id`, and for `message` the stored `message_id` and `created_at`. Sending the same `client_temp_id` again returns the same `ack` (idempotent), which makes retries after a reconnect safe.\r\n- `error` — `client_temp_id` and `data.code`/`data.message`. `code` is one of the stable codes of `ErrorCode` in `openapi.yaml` (the same codes as the REST `application/problem+json` errors).\r\n\r\nThe sender also receives the broadcast `message` event with the stored message (its `client_temp_id` is included, so the client can replace its pending copy).\r\n\r\n## Client → server events\r\n\r\n| Type | Purpose |\r\n| --- | --- |\r\n| `message` | Send a message (`type` `text`, `file` or `voice`; files are referenced by `attachment_id`, never by URL) |\r\n| `resend` | Deliver a stored but undelivered message again |\r\n| `edit` | Edit your own text message |\r\n| `delete` | Delete a message for yourself (`scope: me`) or everyone |\r\n| `read` | Mark messages as read up to `message_id` |\r\n| `reaction_add`, `reaction_remove` | Add or remove a reaction |\r\n| `typing` | Typing, recording a voice message, choosing a sticker or sending a photo, video or file (`action`, not acknowledged). Repeat `is_typing: true` every 3 s while it lasts, send `false` when it ends |\r\n\r\n## Server → client events\r\n\r\n| Type | Meaning |\r\n| --- | --- |\r\n| `hello` | First event: `api_version`, `min_client_api_version`, `user_id` |\r\n| `ack`, `error` | Result of a client event, references `client_temp_id` |\r\n| `message`, `edit`, `delete` | Message created, edited or deleted |\r\n| `reaction_add`, `reaction_remove` | Reactions changed |\r\n| `read` | A user read up to `message_id` |\r\n| `typing` | A user is typing, recording a voice message, choosing a sticker or sending a photo, video or file (`action`); hide it after 6 s without a repeat |\r\n| `chat_created`, `chat_deleted`, `chat_list_update` | Chat list changes |\n| `history_cleared` | Messages up to `before_message_id` were cleared for you (`scope: me`) or everyone |\r\n| `group_created`, `group_updated` | Group changes (members, roles, name, avatar) |\r\n| `approval_request_created` | New request in the inbox |\r\n| `presence` | A user came online or went offline |\n| `user_updated` | A user you share a chat with changed their profile (`profile_version`) |\n| `call_updated` | A call of the chat changed (state, participants, epoch); carries the whole call, keep the highest `version` |\n| `call_keys` | Sealed call sender keys for this session only (`docs/calls-e2ee.md`) |\r\n\r\n## Compatibility\r\n\r\nAdding an event type or an optional field is a MINOR change; removing or renaming an event or field, or making a field required, is MAJOR (see `docs/api-compatibility.md`). Clients must ignore unknown events and unknown fields.\r\n",
|
|
2
|
+
"markdown": "# WebSocket protocol (API contract v2)\r\n\r\nThe JSON Schemas in `websocket/client/` (client → server) and `websocket/server/` (server → client) are the source of truth. Every event has an example in `websocket/examples/`, validated against its schema by `npm run check`. TypeScript types are generated into `dist/ws-events.d.ts` (`ClientEvent`, `ServerEvent`).\r\n\r\n## Connecting\r\n\r\n1. `POST /api/v2/ws/ticket` (authenticated) returns `{ \"ticket\": \"…\", \"expires_in\": 30 }`. The ticket is single-use and short-lived, so no access token ends up in a URL or a log.\r\n2. Open **one connection per browser tab**: `wss://<host>/api/v2/ws?ticket=<ticket>&api_version=<contract version>`. The connection carries the events of all chats of the user. `api_version` is optional and takes the place of the `X-Client-Api-Version` header, which browsers cannot send on a WebSocket.\r\n3. The first server event is `hello` with `api_version` and `min_client_api_version`. A client that reconnects after a deploy compares them with the contract version it was built for and shows an upgrade notice instead of failing at random.\r\n4. When the ticket is invalid or expired the server closes the connection with code `4401`. A client whose `api_version` is no longer served is closed with `4426` after `hello`.\r\n\r\n## Close codes\r\n\r\n| Code | Meaning | Client |\r\n| --- | --- | --- |\r\n| `1012` | `reconnect`: the server is restarting, or it lost its pub/sub connection and events may be missing | reconnect with backoff, then load what was missed (`after` cursor) |\r\n| `1013` | the client did not keep up with its events, or sent more than 64 events that are not handled yet | reconnect, then catch up |\r\n| `4401` | invalid ticket, or the session ended (logout, revoked, password changed) | get a new ticket; if that fails, sign in again |\r\n| `4426` | the client's contract version is no longer served | show the upgrade notice |\r\n| `4429` | the user opened more than 10 connections on this server; the oldest one is closed | do not reconnect this tab automatically |\r\n\r\n## Envelope\r\n\r\nServer → client:\r\n\r\n```json\r\n{ \"type\": \"message\", \"event_id\": \"7217400317439950849\", \"chat_id\": \"42\", \"data\": { \"message\": { \"…\": \"…\" } } }\r\n```\r\n\r\nClient → server:\r\n\r\n```json\r\n{ \"type\": \"message\", \"client_temp_id\": \"c-1\", \"chat_id\": \"42\", \"data\": { \"type\": \"text\", \"content\": \"Hello!\" } }\r\n```\r\n\r\n- All IDs are strings (Snowflake IDs do not fit into a JavaScript number).\r\n- `event_id` is unique and increases per server; it is only for deduplication and logs.\r\n- `chat_id` is always `null` in `hello`, `presence` and `approval_request_created`, which do not belong to a chat. `ack` and `error` repeat the `chat_id` of the client event they answer, and it is `null` for connection-level errors.\r\n- Unknown event `type`s must be ignored by clients, so new event types are not a breaking change.\r\n- A user who is removed from a chat (or whose chat is deleted) receives `chat_deleted` and no further events of that chat.\r\n\r\n## Acknowledgements\r\n\r\nEvery client event except `typing` (which is not acknowledged and carries no `client_temp_id`) has a `client_temp_id` (1–64 characters, unique per client). The server answers with exactly one of:\r\n\r\n- `ack` — `client_temp_id`, and for `message` the stored `message_id` and `created_at`. Sending the same `client_temp_id` again returns the same `ack` (idempotent), which makes retries after a reconnect safe.\r\n- `error` — `client_temp_id` and `data.code`/`data.message`. `code` is one of the stable codes of `ErrorCode` in `openapi.yaml` (the same codes as the REST `application/problem+json` errors).\r\n\r\nThe sender also receives the broadcast `message` event with the stored message (its `client_temp_id` is included, so the client can replace its pending copy).\r\n\r\n## Client → server events\r\n\r\n| Type | Purpose |\r\n| --- | --- |\r\n| `message` | Send a message (`type` `text`, `file` or `voice`; files are referenced by `attachment_id`, never by URL) |\r\n| `resend` | Deliver a stored but undelivered message again |\r\n| `edit` | Edit your own text message |\r\n| `delete` | Delete a message for yourself (`scope: me`) or everyone |\r\n| `read` | Mark messages as read up to `message_id` |\r\n| `reaction_add`, `reaction_remove` | Add or remove a reaction |\r\n| `typing` | Typing, recording a voice message, choosing a sticker or sending a photo, video or file (`action`, not acknowledged). Repeat `is_typing: true` every 3 s while it lasts, send `false` when it ends |\r\n\r\n## Server → client events\r\n\r\n| Type | Meaning |\r\n| --- | --- |\r\n| `hello` | First event: `api_version`, `min_client_api_version`, `user_id` |\r\n| `ack`, `error` | Result of a client event, references `client_temp_id` |\r\n| `message`, `edit`, `delete` | Message created, edited or deleted |\r\n| `reaction_add`, `reaction_remove` | Reactions changed |\r\n| `read` | A user read up to `message_id` |\r\n| `typing` | A user is typing, recording a voice message, choosing a sticker or sending a photo, video or file (`action`); hide it after 6 s without a repeat |\r\n| `chat_created`, `chat_deleted`, `chat_list_update` | Chat list changes |\n| `history_cleared` | Messages up to `before_message_id` were cleared for you (`scope: me`) or everyone |\r\n| `group_created`, `group_updated` | Group changes (members, roles, name, avatar) |\r\n| `approval_request_created` | New request in the inbox |\r\n| `presence` | A user came online or went offline |\n| `user_updated` | A user you share a chat with changed their profile (`profile_version`) |\n| `attachment_updated` | An optimized copy of an attachment you can see is ready (or failed): replace it in your messages |\n| `call_updated` | A call of the chat changed (state, participants, epoch); carries the whole call, keep the highest `version` |\n| `call_keys` | Sealed call sender keys for this session only (`docs/calls-e2ee.md`) |\r\n\r\n## Compatibility\r\n\r\nAdding an event type or an optional field is a MINOR change; removing or renaming an event or field, or making a field required, is MAJOR (see `docs/api-compatibility.md`). Clients must ignore unknown events and unknown fields.\r\n",
|
|
3
3
|
"examples": {
|
|
4
4
|
"client/delete.json": {
|
|
5
5
|
"type": "delete",
|
|
@@ -110,6 +110,27 @@
|
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
112
|
},
|
|
113
|
+
"server/attachment_updated.json": {
|
|
114
|
+
"type": "attachment_updated",
|
|
115
|
+
"event_id": "0",
|
|
116
|
+
"chat_id": null,
|
|
117
|
+
"data": {
|
|
118
|
+
"attachment": {
|
|
119
|
+
"id": "5f0c8a64-2f2b-4c7e-9d0e-6b1f3a2c4d5e",
|
|
120
|
+
"kind": "video",
|
|
121
|
+
"filename": "clip.mp4",
|
|
122
|
+
"content_type": "video/mp4",
|
|
123
|
+
"size": 6815744,
|
|
124
|
+
"url": "/api/v2/attachments/5f0c8a64-2f2b-4c7e-9d0e-6b1f3a2c4d5e/content",
|
|
125
|
+
"width": 720,
|
|
126
|
+
"height": 1280,
|
|
127
|
+
"duration_ms": 42000,
|
|
128
|
+
"thumbnail_url": "/api/v2/attachments/5f0c8a64-2f2b-4c7e-9d0e-6b1f3a2c4d5e/content?variant=thumbnail",
|
|
129
|
+
"processing": "done",
|
|
130
|
+
"source_url": "/api/v2/attachments/5f0c8a64-2f2b-4c7e-9d0e-6b1f3a2c4d5e/content?variant=source"
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
},
|
|
113
134
|
"server/call_keys.json": {
|
|
114
135
|
"type": "call_keys",
|
|
115
136
|
"event_id": "7217400317439950111",
|
package/dist/ws-events.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* Generated from api/openapi.yaml 2.1.0-alpha.
|
|
1
|
+
/* Generated from api/openapi.yaml 2.1.0-alpha.32. Do not edit. */
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Any WebSocket event, in either direction.
|
|
@@ -34,6 +34,7 @@ export type AttachmentRef = string;
|
|
|
34
34
|
export type ServerEvent =
|
|
35
35
|
| ServerAckEvent
|
|
36
36
|
| ServerApprovalRequestCreatedEvent
|
|
37
|
+
| ServerAttachmentUpdatedEvent
|
|
37
38
|
| ServerCallKeysEvent
|
|
38
39
|
| ServerCallUpdatedEvent
|
|
39
40
|
| ServerChatCreatedEvent
|
|
@@ -60,6 +61,7 @@ export type Timestamp = string;
|
|
|
60
61
|
export type ApprovalRequestType = "direct_message" | "group_invite";
|
|
61
62
|
export type ApprovalRequestStatus = "pending" | "approved" | "rejected";
|
|
62
63
|
export type AttachmentKind = "image" | "audio" | "voice" | "video" | "file";
|
|
64
|
+
export type MediaProcessing = "queued" | "running" | "done" | "failed";
|
|
63
65
|
/**
|
|
64
66
|
* `media` an uploaded image, GIF or short video (`attachment`), `preset` one of the clients' built-in
|
|
65
67
|
* gradients (`preset`), `color` one color or a gradient of two (`colors`).
|
|
@@ -381,22 +383,52 @@ export interface Attachment {
|
|
|
381
383
|
url: string;
|
|
382
384
|
width?: number | null;
|
|
383
385
|
height?: number | null;
|
|
386
|
+
/**
|
|
387
|
+
* A WebP of at most 480 px (older uploads a JPEG of at most 320 px); for audio the embedded cover.
|
|
388
|
+
*/
|
|
384
389
|
thumbnail_url?: string | null;
|
|
385
390
|
/**
|
|
386
|
-
*
|
|
391
|
+
* At most 1600 px to show in an image viewer instead of the original; `null` for small images and GIFs, which are shown as they are.
|
|
387
392
|
*/
|
|
388
393
|
display_url?: string | null;
|
|
394
|
+
/**
|
|
395
|
+
* A ThumbHash (base64) of the image or video poster, to draw a blurred preview before the thumbnail arrives.
|
|
396
|
+
*/
|
|
397
|
+
placeholder?: string | null;
|
|
398
|
+
/**
|
|
399
|
+
* Whether the server is still making an optimized copy of a video, GIF or audio file. Clients play `url`
|
|
400
|
+
* meanwhile and swap to the new copy on `attachment_updated`. `null` when there is nothing to do.
|
|
401
|
+
*
|
|
402
|
+
*/
|
|
403
|
+
processing?: MediaProcessing | null;
|
|
404
|
+
/**
|
|
405
|
+
* The file as uploaded, when `url` serves an optimized copy; `null` otherwise.
|
|
406
|
+
*/
|
|
407
|
+
source_url?: string | null;
|
|
408
|
+
/**
|
|
409
|
+
* A GIF as a muted, looping MP4, much smaller than the GIF; `null` until made or for other files.
|
|
410
|
+
*/
|
|
411
|
+
animation_url?: string | null;
|
|
412
|
+
/**
|
|
413
|
+
* Stickers only; a still 128 px WebP for pickers and lists.
|
|
414
|
+
*/
|
|
415
|
+
panel_url?: string | null;
|
|
416
|
+
/**
|
|
417
|
+
* Stickers only; a 320 px WebP for messages.
|
|
418
|
+
*/
|
|
419
|
+
message_url?: string | null;
|
|
389
420
|
duration_ms?: number | null;
|
|
390
421
|
waveform?: number[] | null;
|
|
391
422
|
tags?: AudioTags;
|
|
392
423
|
drawing?: Drawing;
|
|
393
424
|
}
|
|
394
425
|
/**
|
|
395
|
-
*
|
|
426
|
+
* Audio files (not voice messages) and `profile_music` uploads; what the file says about itself.
|
|
396
427
|
*/
|
|
397
428
|
export interface AudioTags {
|
|
398
429
|
title: string | null;
|
|
399
430
|
artist: string | null;
|
|
431
|
+
album?: string | null;
|
|
400
432
|
}
|
|
401
433
|
/**
|
|
402
434
|
* What the sender drew on this image of this message. Clients show the image with the drawing on top
|
|
@@ -458,6 +490,17 @@ export interface ProfileBackground {
|
|
|
458
490
|
*/
|
|
459
491
|
colors?: [BackgroundColor] | [BackgroundColor, BackgroundColor];
|
|
460
492
|
}
|
|
493
|
+
/**
|
|
494
|
+
* The server finished (or gave up) making an optimized copy of an attachment you can see: a video or audio file now served as H.264/AAC, or a GIF with an animation_url. Replace the attachment in every message that holds it; a playing media element keeps its position.
|
|
495
|
+
*/
|
|
496
|
+
export interface ServerAttachmentUpdatedEvent {
|
|
497
|
+
type: "attachment_updated";
|
|
498
|
+
event_id: Id;
|
|
499
|
+
chat_id: null;
|
|
500
|
+
data: {
|
|
501
|
+
attachment: Attachment;
|
|
502
|
+
};
|
|
503
|
+
}
|
|
461
504
|
/**
|
|
462
505
|
* Sealed sender keys for this session (see docs/calls-e2ee.md). Sent only to the recipient session.
|
|
463
506
|
*/
|
|
@@ -1667,7 +1667,8 @@
|
|
|
1667
1667
|
"string",
|
|
1668
1668
|
"null"
|
|
1669
1669
|
],
|
|
1670
|
-
"readOnly": true
|
|
1670
|
+
"readOnly": true,
|
|
1671
|
+
"description": "A WebP of at most 480 px (older uploads a JPEG of at most 320 px); for audio the embedded cover."
|
|
1671
1672
|
},
|
|
1672
1673
|
"display_url": {
|
|
1673
1674
|
"type": [
|
|
@@ -1675,7 +1676,60 @@
|
|
|
1675
1676
|
"null"
|
|
1676
1677
|
],
|
|
1677
1678
|
"readOnly": true,
|
|
1678
|
-
"description": "
|
|
1679
|
+
"description": "At most 1600 px to show in an image viewer instead of the original; `null` for small images and GIFs, which are shown as they are."
|
|
1680
|
+
},
|
|
1681
|
+
"placeholder": {
|
|
1682
|
+
"type": [
|
|
1683
|
+
"string",
|
|
1684
|
+
"null"
|
|
1685
|
+
],
|
|
1686
|
+
"maxLength": 64,
|
|
1687
|
+
"readOnly": true,
|
|
1688
|
+
"description": "A ThumbHash (base64) of the image or video poster, to draw a blurred preview before the thumbnail arrives."
|
|
1689
|
+
},
|
|
1690
|
+
"processing": {
|
|
1691
|
+
"readOnly": true,
|
|
1692
|
+
"description": "Whether the server is still making an optimized copy of a video, GIF or audio file. Clients play `url`\nmeanwhile and swap to the new copy on `attachment_updated`. `null` when there is nothing to do.\n",
|
|
1693
|
+
"oneOf": [
|
|
1694
|
+
{
|
|
1695
|
+
"$ref": "#/$defs/MediaProcessing"
|
|
1696
|
+
},
|
|
1697
|
+
{
|
|
1698
|
+
"type": "null"
|
|
1699
|
+
}
|
|
1700
|
+
]
|
|
1701
|
+
},
|
|
1702
|
+
"source_url": {
|
|
1703
|
+
"type": [
|
|
1704
|
+
"string",
|
|
1705
|
+
"null"
|
|
1706
|
+
],
|
|
1707
|
+
"readOnly": true,
|
|
1708
|
+
"description": "The file as uploaded, when `url` serves an optimized copy; `null` otherwise."
|
|
1709
|
+
},
|
|
1710
|
+
"animation_url": {
|
|
1711
|
+
"type": [
|
|
1712
|
+
"string",
|
|
1713
|
+
"null"
|
|
1714
|
+
],
|
|
1715
|
+
"readOnly": true,
|
|
1716
|
+
"description": "A GIF as a muted, looping MP4, much smaller than the GIF; `null` until made or for other files."
|
|
1717
|
+
},
|
|
1718
|
+
"panel_url": {
|
|
1719
|
+
"type": [
|
|
1720
|
+
"string",
|
|
1721
|
+
"null"
|
|
1722
|
+
],
|
|
1723
|
+
"readOnly": true,
|
|
1724
|
+
"description": "Stickers only; a still 128 px WebP for pickers and lists."
|
|
1725
|
+
},
|
|
1726
|
+
"message_url": {
|
|
1727
|
+
"type": [
|
|
1728
|
+
"string",
|
|
1729
|
+
"null"
|
|
1730
|
+
],
|
|
1731
|
+
"readOnly": true,
|
|
1732
|
+
"description": "Stickers only; a 320 px WebP for messages."
|
|
1679
1733
|
},
|
|
1680
1734
|
"duration_ms": {
|
|
1681
1735
|
"type": [
|
|
@@ -1696,7 +1750,7 @@
|
|
|
1696
1750
|
}
|
|
1697
1751
|
},
|
|
1698
1752
|
"tags": {
|
|
1699
|
-
"description": "
|
|
1753
|
+
"description": "Audio files (not voice messages) and `profile_music` uploads; what the file says about itself.",
|
|
1700
1754
|
"$ref": "#/$defs/AudioTags"
|
|
1701
1755
|
},
|
|
1702
1756
|
"drawing": {
|
|
@@ -1725,6 +1779,107 @@
|
|
|
1725
1779
|
"null"
|
|
1726
1780
|
],
|
|
1727
1781
|
"maxLength": 100
|
|
1782
|
+
},
|
|
1783
|
+
"album": {
|
|
1784
|
+
"type": [
|
|
1785
|
+
"string",
|
|
1786
|
+
"null"
|
|
1787
|
+
],
|
|
1788
|
+
"maxLength": 100
|
|
1789
|
+
}
|
|
1790
|
+
}
|
|
1791
|
+
},
|
|
1792
|
+
"MediaProcessing": {
|
|
1793
|
+
"type": "string",
|
|
1794
|
+
"enum": [
|
|
1795
|
+
"queued",
|
|
1796
|
+
"running",
|
|
1797
|
+
"done",
|
|
1798
|
+
"failed"
|
|
1799
|
+
]
|
|
1800
|
+
},
|
|
1801
|
+
"PlaybackUrl": {
|
|
1802
|
+
"type": "object",
|
|
1803
|
+
"required": [
|
|
1804
|
+
"url",
|
|
1805
|
+
"expires_at"
|
|
1806
|
+
],
|
|
1807
|
+
"properties": {
|
|
1808
|
+
"url": {
|
|
1809
|
+
"type": "string",
|
|
1810
|
+
"description": "Same-origin path with the playback token; set it as `src` of a media element."
|
|
1811
|
+
},
|
|
1812
|
+
"expires_at": {
|
|
1813
|
+
"type": "string",
|
|
1814
|
+
"format": "date-time"
|
|
1815
|
+
}
|
|
1816
|
+
}
|
|
1817
|
+
},
|
|
1818
|
+
"CreateUploadSessionRequest": {
|
|
1819
|
+
"type": "object",
|
|
1820
|
+
"required": [
|
|
1821
|
+
"purpose",
|
|
1822
|
+
"filename",
|
|
1823
|
+
"size"
|
|
1824
|
+
],
|
|
1825
|
+
"additionalProperties": false,
|
|
1826
|
+
"properties": {
|
|
1827
|
+
"purpose": {
|
|
1828
|
+
"$ref": "#/$defs/UploadPurpose"
|
|
1829
|
+
},
|
|
1830
|
+
"kind": {
|
|
1831
|
+
"type": "string",
|
|
1832
|
+
"enum": [
|
|
1833
|
+
"image",
|
|
1834
|
+
"audio",
|
|
1835
|
+
"video",
|
|
1836
|
+
"file"
|
|
1837
|
+
]
|
|
1838
|
+
},
|
|
1839
|
+
"filename": {
|
|
1840
|
+
"type": "string",
|
|
1841
|
+
"minLength": 1,
|
|
1842
|
+
"maxLength": 255
|
|
1843
|
+
},
|
|
1844
|
+
"size": {
|
|
1845
|
+
"type": "integer",
|
|
1846
|
+
"format": "int64",
|
|
1847
|
+
"minimum": 1,
|
|
1848
|
+
"description": "Bytes of the whole file; at most the upload limit of its kind."
|
|
1849
|
+
}
|
|
1850
|
+
}
|
|
1851
|
+
},
|
|
1852
|
+
"UploadSession": {
|
|
1853
|
+
"type": "object",
|
|
1854
|
+
"required": [
|
|
1855
|
+
"id",
|
|
1856
|
+
"size",
|
|
1857
|
+
"chunk_size",
|
|
1858
|
+
"received",
|
|
1859
|
+
"expires_at"
|
|
1860
|
+
],
|
|
1861
|
+
"properties": {
|
|
1862
|
+
"id": {
|
|
1863
|
+
"type": "string",
|
|
1864
|
+
"format": "uuid"
|
|
1865
|
+
},
|
|
1866
|
+
"size": {
|
|
1867
|
+
"type": "integer",
|
|
1868
|
+
"format": "int64"
|
|
1869
|
+
},
|
|
1870
|
+
"chunk_size": {
|
|
1871
|
+
"type": "integer",
|
|
1872
|
+
"description": "Bytes per chunk (8 MiB)."
|
|
1873
|
+
},
|
|
1874
|
+
"received": {
|
|
1875
|
+
"type": "integer",
|
|
1876
|
+
"format": "int64",
|
|
1877
|
+
"description": "Bytes stored so far; the next `offset`."
|
|
1878
|
+
},
|
|
1879
|
+
"expires_at": {
|
|
1880
|
+
"type": "string",
|
|
1881
|
+
"format": "date-time",
|
|
1882
|
+
"description": "When the session is deleted unless more chunks arrive."
|
|
1728
1883
|
}
|
|
1729
1884
|
}
|
|
1730
1885
|
},
|
|
@@ -5107,6 +5262,39 @@
|
|
|
5107
5262
|
"data"
|
|
5108
5263
|
]
|
|
5109
5264
|
},
|
|
5265
|
+
"ServerAttachmentUpdatedEvent": {
|
|
5266
|
+
"title": "ServerAttachmentUpdatedEvent",
|
|
5267
|
+
"description": "The server finished (or gave up) making an optimized copy of an attachment you can see: a video or audio file now served as H.264/AAC, or a GIF with an animation_url. Replace the attachment in every message that holds it; a playing media element keeps its position.",
|
|
5268
|
+
"type": "object",
|
|
5269
|
+
"properties": {
|
|
5270
|
+
"type": {
|
|
5271
|
+
"const": "attachment_updated"
|
|
5272
|
+
},
|
|
5273
|
+
"event_id": {
|
|
5274
|
+
"$ref": "#/$defs/Id"
|
|
5275
|
+
},
|
|
5276
|
+
"chat_id": {
|
|
5277
|
+
"type": "null"
|
|
5278
|
+
},
|
|
5279
|
+
"data": {
|
|
5280
|
+
"type": "object",
|
|
5281
|
+
"properties": {
|
|
5282
|
+
"attachment": {
|
|
5283
|
+
"$ref": "#/$defs/Attachment"
|
|
5284
|
+
}
|
|
5285
|
+
},
|
|
5286
|
+
"required": [
|
|
5287
|
+
"attachment"
|
|
5288
|
+
]
|
|
5289
|
+
}
|
|
5290
|
+
},
|
|
5291
|
+
"required": [
|
|
5292
|
+
"type",
|
|
5293
|
+
"event_id",
|
|
5294
|
+
"chat_id",
|
|
5295
|
+
"data"
|
|
5296
|
+
]
|
|
5297
|
+
},
|
|
5110
5298
|
"ServerCallKeysEvent": {
|
|
5111
5299
|
"title": "ServerCallKeysEvent",
|
|
5112
5300
|
"description": "Sealed sender keys for this session (see docs/calls-e2ee.md). Sent only to the recipient session.",
|
|
@@ -6016,6 +6204,9 @@
|
|
|
6016
6204
|
{
|
|
6017
6205
|
"$ref": "#/$defs/ServerApprovalRequestCreatedEvent"
|
|
6018
6206
|
},
|
|
6207
|
+
{
|
|
6208
|
+
"$ref": "#/$defs/ServerAttachmentUpdatedEvent"
|
|
6209
|
+
},
|
|
6019
6210
|
{
|
|
6020
6211
|
"$ref": "#/$defs/ServerCallKeysEvent"
|
|
6021
6212
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@myronsi/messenger-api",
|
|
3
|
-
"version": "2.1.0-alpha.
|
|
3
|
+
"version": "2.1.0-alpha.32",
|
|
4
4
|
"description": "API contract of the Messenger backend: OpenAPI document, WebSocket event schemas and generated TypeScript types",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|