@myronsi/messenger-api 2.1.0-alpha.17.next.91 → 2.1.0-alpha.18

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 CHANGED
@@ -2,6 +2,15 @@
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.18
6
+
7
+ - Drawings on images: `SendMessageRequest.drawings` adds strokes and text labels to images of a `file` message.
8
+ The image file stays unchanged; the drawing is stored with the message.
9
+ - To draw on an image someone else sent, reply to that message with `reply_to`, reuse its image ID in
10
+ `attachment_id` and send a drawing for it.
11
+ - `Attachment.drawing` returns the drawing. Clients show the image with it. Older clients ignore it and show the
12
+ plain image.
13
+
5
14
  ## 2.1.0-alpha.17
6
15
 
7
16
  - Media albums: `SendMessageRequest.attachment_ids` sends two to ten image or video uploads as one `file` message
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- /* Generated from api/openapi.yaml 2.1.0-alpha.17. Do not edit. */
2
- export declare const API_VERSION: "2.1.0-alpha.17";
1
+ /* Generated from api/openapi.yaml 2.1.0-alpha.18. Do not edit. */
2
+ export declare const API_VERSION: "2.1.0-alpha.18";
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.17";
1
+ export const API_VERSION = "2.1.0-alpha.18";
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.17
4
+ version: 2.1.0-alpha.18
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
@@ -4499,6 +4499,87 @@ components:
4499
4499
  waveform:
4500
4500
  type: [array, "null"]
4501
4501
  items: { type: integer, minimum: 0, maximum: 255 }
4502
+ drawing:
4503
+ description: |
4504
+ What the sender drew on this image of this message. Clients show the image with the drawing on top
4505
+ and never without it. Absent when the image has no drawing. The same image can carry another drawing
4506
+ in another message.
4507
+ $ref: "#/components/schemas/Drawing"
4508
+ Drawing:
4509
+ type: object
4510
+ description: |
4511
+ Strokes and text labels on an image. Coordinates, widths and sizes are fractions of the image as it is
4512
+ shown (0 is the left or top edge, 1 the right or bottom edge), so the drawing fits any display size.
4513
+ Items are drawn in order. The server rounds numbers to four decimals.
4514
+ required: [version, items]
4515
+ additionalProperties: false
4516
+ properties:
4517
+ version: { type: integer, minimum: 1, maximum: 1 }
4518
+ items:
4519
+ type: array
4520
+ minItems: 1
4521
+ maxItems: 200
4522
+ items: { $ref: "#/components/schemas/DrawingItem" }
4523
+ DrawingItem:
4524
+ type: object
4525
+ required: [type, color]
4526
+ additionalProperties: false
4527
+ properties:
4528
+ type:
4529
+ type: string
4530
+ enum: [stroke, text]
4531
+ color:
4532
+ type: string
4533
+ pattern: "^#[0-9a-fA-F]{6}$"
4534
+ width:
4535
+ type: number
4536
+ format: double
4537
+ minimum: 0.001
4538
+ maximum: 0.2
4539
+ description: Stroke only. Line width as a fraction of the image width.
4540
+ points:
4541
+ type: array
4542
+ minItems: 2
4543
+ maxItems: 10000
4544
+ description: Stroke only. Flat list of x, y pairs. A drawing has at most 10000 numbers in all its strokes.
4545
+ items: { type: number, format: double, minimum: 0, maximum: 1 }
4546
+ x: { type: number, format: double, minimum: 0, maximum: 1, description: Text only. Left edge of the label. }
4547
+ y: { type: number, format: double, minimum: 0, maximum: 1, description: Text only. Top edge of the label. }
4548
+ size:
4549
+ type: number
4550
+ format: double
4551
+ minimum: 0.01
4552
+ maximum: 0.5
4553
+ description: Text only. Font height as a fraction of the image height.
4554
+ text: { type: string, minLength: 1, maxLength: 200, description: Text only. }
4555
+ if:
4556
+ properties:
4557
+ type: { const: stroke }
4558
+ then:
4559
+ required: [width, points]
4560
+ properties:
4561
+ width: { type: number }
4562
+ points: { type: array }
4563
+ x: { not: {} }
4564
+ y: { not: {} }
4565
+ size: { not: {} }
4566
+ text: { not: {} }
4567
+ else:
4568
+ required: [x, y, size, text]
4569
+ properties:
4570
+ x: { type: number }
4571
+ y: { type: number }
4572
+ size: { type: number }
4573
+ text: { type: string }
4574
+ width: { not: {} }
4575
+ points: { not: {} }
4576
+ AttachmentDrawing:
4577
+ type: object
4578
+ required: [attachment_id, drawing]
4579
+ additionalProperties: false
4580
+ properties:
4581
+ attachment_id: { $ref: "#/components/schemas/AttachmentRef" }
4582
+ drawing: { $ref: "#/components/schemas/Drawing" }
4502
4583
  MediaKind:
4503
4584
  type: string
4504
4585
  enum: [image, audio, visual]
@@ -4727,6 +4808,14 @@ components:
4727
4808
  oneOf:
4728
4809
  - $ref: "#/components/schemas/Id"
4729
4810
  - type: "null"
4811
+ drawings:
4812
+ type: array
4813
+ description: |
4814
+ Drawings on images of a `file` message, at most one per image. Each `attachment_id` must be one of the
4815
+ message's attachments. An image with a drawing may also be an image of the message in `reply_to`
4816
+ instead of the sender's own upload: that is how a member draws on an image someone sent.
4817
+ maxItems: 10
4818
+ items: { $ref: "#/components/schemas/AttachmentDrawing" }
4730
4819
  if:
4731
4820
  properties:
4732
4821
  type: { enum: [file, voice] }
@@ -4747,6 +4836,7 @@ components:
4747
4836
  content: { type: string, minLength: 1, maxLength: 4096 }
4748
4837
  attachment_id: { not: {} }
4749
4838
  attachment_ids: { not: {} }
4839
+ drawings: { not: {} }
4750
4840
  EditMessageRequest:
4751
4841
  type: object
4752
4842
  required: [content]
package/dist/schema.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- /* Generated from api/openapi.yaml 2.1.0-alpha.17. Do not edit. */
1
+ /* Generated from api/openapi.yaml 2.1.0-alpha.18. Do not edit. */
2
2
  export interface paths {
3
3
  "/meta": {
4
4
  parameters: {
@@ -2869,6 +2869,54 @@ export interface components {
2869
2869
  readonly display_url?: string | null;
2870
2870
  duration_ms?: number | null;
2871
2871
  waveform?: number[] | null;
2872
+ /**
2873
+ * @description What the sender drew on this image of this message. Clients show the image with the drawing on top
2874
+ * and never without it. Absent when the image has no drawing. The same image can carry another drawing
2875
+ * in another message.
2876
+ */
2877
+ drawing?: components["schemas"]["Drawing"];
2878
+ };
2879
+ /**
2880
+ * @description Strokes and text labels on an image. Coordinates, widths and sizes are fractions of the image as it is
2881
+ * shown (0 is the left or top edge, 1 the right or bottom edge), so the drawing fits any display size.
2882
+ * Items are drawn in order. The server rounds numbers to four decimals.
2883
+ */
2884
+ Drawing: {
2885
+ version: number;
2886
+ items: components["schemas"]["DrawingItem"][];
2887
+ };
2888
+ DrawingItem: {
2889
+ /** @enum {string} */
2890
+ type: "stroke" | "text";
2891
+ color: string;
2892
+ /**
2893
+ * Format: double
2894
+ * @description Stroke only. Line width as a fraction of the image width.
2895
+ */
2896
+ width?: number;
2897
+ /** @description Stroke only. Flat list of x, y pairs. A drawing has at most 10000 numbers in all its strokes. */
2898
+ points?: number[];
2899
+ /**
2900
+ * Format: double
2901
+ * @description Text only. Left edge of the label.
2902
+ */
2903
+ x?: number;
2904
+ /**
2905
+ * Format: double
2906
+ * @description Text only. Top edge of the label.
2907
+ */
2908
+ y?: number;
2909
+ /**
2910
+ * Format: double
2911
+ * @description Text only. Font height as a fraction of the image height.
2912
+ */
2913
+ size?: number;
2914
+ /** @description Text only. */
2915
+ text?: string;
2916
+ };
2917
+ AttachmentDrawing: {
2918
+ attachment_id: components["schemas"]["AttachmentRef"];
2919
+ drawing: components["schemas"]["Drawing"];
2872
2920
  };
2873
2921
  /** @enum {string} */
2874
2922
  MediaKind: "image" | "audio" | "visual";
@@ -2988,6 +3036,12 @@ export interface components {
2988
3036
  /** @description Ordered IDs of two to ten image or video uploads for one file message. */
2989
3037
  attachment_ids?: components["schemas"]["AttachmentRef"][];
2990
3038
  reply_to?: components["schemas"]["Id"] | null;
3039
+ /**
3040
+ * @description Drawings on images of a `file` message, at most one per image. Each `attachment_id` must be one of the
3041
+ * message's attachments. An image with a drawing may also be an image of the message in `reply_to`
3042
+ * instead of the sender's own upload: that is how a member draws on an image someone sent.
3043
+ */
3044
+ drawings?: components["schemas"]["AttachmentDrawing"][];
2991
3045
  };
2992
3046
  EditMessageRequest: {
2993
3047
  /** @description New text, or the new caption of a file. Empty removes a file's caption; a text message rejects it. */
@@ -1,4 +1,4 @@
1
- /* Generated from api/openapi.yaml 2.1.0-alpha.17. Do not edit. */
1
+ /* Generated from api/openapi.yaml 2.1.0-alpha.18. Do not edit. */
2
2
 
3
3
  /**
4
4
  * Any WebSocket event, in either direction.
@@ -496,6 +496,52 @@ export interface Attachment {
496
496
  display_url?: string | null;
497
497
  duration_ms?: number | null;
498
498
  waveform?: number[] | null;
499
+ drawing?: Drawing;
500
+ }
501
+ /**
502
+ * What the sender drew on this image of this message. Clients show the image with the drawing on top
503
+ * and never without it. Absent when the image has no drawing. The same image can carry another drawing
504
+ * in another message.
505
+ *
506
+ */
507
+ export interface Drawing {
508
+ version: number;
509
+ /**
510
+ * @minItems 1
511
+ * @maxItems 200
512
+ */
513
+ items: [DrawingItem, ...DrawingItem[]];
514
+ }
515
+ export interface DrawingItem {
516
+ type: "stroke" | "text";
517
+ color: string;
518
+ /**
519
+ * Stroke only. Line width as a fraction of the image width.
520
+ */
521
+ width?: number;
522
+ /**
523
+ * Stroke only. Flat list of x, y pairs. A drawing has at most 10000 numbers in all its strokes.
524
+ *
525
+ * @minItems 2
526
+ * @maxItems 10000
527
+ */
528
+ points?: [number, number, ...number[]];
529
+ /**
530
+ * Text only. Left edge of the label.
531
+ */
532
+ x?: number;
533
+ /**
534
+ * Text only. Top edge of the label.
535
+ */
536
+ y?: number;
537
+ /**
538
+ * Text only. Font height as a fraction of the image height.
539
+ */
540
+ size?: number;
541
+ /**
542
+ * Text only.
543
+ */
544
+ text?: string;
499
545
  }
500
546
  /**
501
547
  * What a reply shows of the message it answers, so a client can draw the quote without loading that
@@ -1238,6 +1238,178 @@
1238
1238
  "minimum": 0,
1239
1239
  "maximum": 255
1240
1240
  }
1241
+ },
1242
+ "drawing": {
1243
+ "description": "What the sender drew on this image of this message. Clients show the image with the drawing on top\nand never without it. Absent when the image has no drawing. The same image can carry another drawing\nin another message.\n",
1244
+ "$ref": "#/$defs/Drawing"
1245
+ }
1246
+ }
1247
+ },
1248
+ "Drawing": {
1249
+ "type": "object",
1250
+ "description": "Strokes and text labels on an image. Coordinates, widths and sizes are fractions of the image as it is\nshown (0 is the left or top edge, 1 the right or bottom edge), so the drawing fits any display size.\nItems are drawn in order. The server rounds numbers to four decimals.\n",
1251
+ "required": [
1252
+ "version",
1253
+ "items"
1254
+ ],
1255
+ "additionalProperties": false,
1256
+ "properties": {
1257
+ "version": {
1258
+ "type": "integer",
1259
+ "minimum": 1,
1260
+ "maximum": 1
1261
+ },
1262
+ "items": {
1263
+ "type": "array",
1264
+ "minItems": 1,
1265
+ "maxItems": 200,
1266
+ "items": {
1267
+ "$ref": "#/$defs/DrawingItem"
1268
+ }
1269
+ }
1270
+ }
1271
+ },
1272
+ "DrawingItem": {
1273
+ "type": "object",
1274
+ "required": [
1275
+ "type",
1276
+ "color"
1277
+ ],
1278
+ "additionalProperties": false,
1279
+ "properties": {
1280
+ "type": {
1281
+ "type": "string",
1282
+ "enum": [
1283
+ "stroke",
1284
+ "text"
1285
+ ]
1286
+ },
1287
+ "color": {
1288
+ "type": "string",
1289
+ "pattern": "^#[0-9a-fA-F]{6}$"
1290
+ },
1291
+ "width": {
1292
+ "type": "number",
1293
+ "format": "double",
1294
+ "minimum": 0.001,
1295
+ "maximum": 0.2,
1296
+ "description": "Stroke only. Line width as a fraction of the image width."
1297
+ },
1298
+ "points": {
1299
+ "type": "array",
1300
+ "minItems": 2,
1301
+ "maxItems": 10000,
1302
+ "description": "Stroke only. Flat list of x, y pairs. A drawing has at most 10000 numbers in all its strokes.",
1303
+ "items": {
1304
+ "type": "number",
1305
+ "format": "double",
1306
+ "minimum": 0,
1307
+ "maximum": 1
1308
+ }
1309
+ },
1310
+ "x": {
1311
+ "type": "number",
1312
+ "format": "double",
1313
+ "minimum": 0,
1314
+ "maximum": 1,
1315
+ "description": "Text only. Left edge of the label."
1316
+ },
1317
+ "y": {
1318
+ "type": "number",
1319
+ "format": "double",
1320
+ "minimum": 0,
1321
+ "maximum": 1,
1322
+ "description": "Text only. Top edge of the label."
1323
+ },
1324
+ "size": {
1325
+ "type": "number",
1326
+ "format": "double",
1327
+ "minimum": 0.01,
1328
+ "maximum": 0.5,
1329
+ "description": "Text only. Font height as a fraction of the image height."
1330
+ },
1331
+ "text": {
1332
+ "type": "string",
1333
+ "minLength": 1,
1334
+ "maxLength": 200,
1335
+ "description": "Text only."
1336
+ }
1337
+ },
1338
+ "if": {
1339
+ "properties": {
1340
+ "type": {
1341
+ "const": "stroke"
1342
+ }
1343
+ }
1344
+ },
1345
+ "then": {
1346
+ "required": [
1347
+ "width",
1348
+ "points"
1349
+ ],
1350
+ "properties": {
1351
+ "width": {
1352
+ "type": "number"
1353
+ },
1354
+ "points": {
1355
+ "type": "array"
1356
+ },
1357
+ "x": {
1358
+ "not": {}
1359
+ },
1360
+ "y": {
1361
+ "not": {}
1362
+ },
1363
+ "size": {
1364
+ "not": {}
1365
+ },
1366
+ "text": {
1367
+ "not": {}
1368
+ }
1369
+ }
1370
+ },
1371
+ "else": {
1372
+ "required": [
1373
+ "x",
1374
+ "y",
1375
+ "size",
1376
+ "text"
1377
+ ],
1378
+ "properties": {
1379
+ "x": {
1380
+ "type": "number"
1381
+ },
1382
+ "y": {
1383
+ "type": "number"
1384
+ },
1385
+ "size": {
1386
+ "type": "number"
1387
+ },
1388
+ "text": {
1389
+ "type": "string"
1390
+ },
1391
+ "width": {
1392
+ "not": {}
1393
+ },
1394
+ "points": {
1395
+ "not": {}
1396
+ }
1397
+ }
1398
+ }
1399
+ },
1400
+ "AttachmentDrawing": {
1401
+ "type": "object",
1402
+ "required": [
1403
+ "attachment_id",
1404
+ "drawing"
1405
+ ],
1406
+ "additionalProperties": false,
1407
+ "properties": {
1408
+ "attachment_id": {
1409
+ "$ref": "#/$defs/AttachmentRef"
1410
+ },
1411
+ "drawing": {
1412
+ "$ref": "#/$defs/Drawing"
1241
1413
  }
1242
1414
  }
1243
1415
  },
@@ -1743,6 +1915,14 @@
1743
1915
  "type": "null"
1744
1916
  }
1745
1917
  ]
1918
+ },
1919
+ "drawings": {
1920
+ "type": "array",
1921
+ "description": "Drawings on images of a `file` message, at most one per image. Each `attachment_id` must be one of the\nmessage's attachments. An image with a drawing may also be an image of the message in `reply_to`\ninstead of the sender's own upload: that is how a member draws on an image someone sent.\n",
1922
+ "maxItems": 10,
1923
+ "items": {
1924
+ "$ref": "#/$defs/AttachmentDrawing"
1925
+ }
1746
1926
  }
1747
1927
  },
1748
1928
  "if": {
@@ -1803,6 +1983,9 @@
1803
1983
  },
1804
1984
  "attachment_ids": {
1805
1985
  "not": {}
1986
+ },
1987
+ "drawings": {
1988
+ "not": {}
1806
1989
  }
1807
1990
  }
1808
1991
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myronsi/messenger-api",
3
- "version": "2.1.0-alpha.17.next.91",
3
+ "version": "2.1.0-alpha.18",
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": {