@myronsi/messenger-api 2.1.0-alpha.5.next.70 → 2.1.0-alpha.9

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,32 @@
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.9
6
+
7
+ - Privacy exceptions apply to every value of avatar, profile and presence visibility, not only to `*_except`:
8
+ an `allow` exception always shows the item to that user and a `deny` exception always hides it. Group invites
9
+ already worked this way.
10
+ - `direct_messages` and `search_visibility` take exception lists too (`PUT /me/privacy/exceptions/{setting_key}/{effect}`
11
+ and `exceptions` of `PrivacySettings`): `allow` lets the user start a direct chat without approval or find you in
12
+ search, `deny` never does.
13
+
14
+ ## 2.1.0-alpha.8
15
+
16
+ - Adds `POST /chats/{chat_id}/messages/forward` (up to 20 messages to up to 20 chats, at most 20 copies, oldest
17
+ first) and `POST /chats/{chat_id}/messages/delete` (up to 100 messages, `scope` me or everyone). Both check
18
+ every message first and change nothing when one is refused.
19
+
20
+ ## 2.1.0-alpha.7
21
+
22
+ - Adds `DELETE /me/avatars/{avatar_id}`: removes one of your avatars from the history and answers the updated
23
+ `Me`. Deleting the current avatar makes the newest remaining one current again, or the default when none is left.
24
+
25
+ ## 2.1.0-alpha.6
26
+
27
+ - `Message` adds optional `reply_preview` (`ReplyPreview`: id, type, sender, the first 100 characters of the
28
+ text, attachment, is_deleted) on history pages and `message` events, so a reply shows what it answers even
29
+ when that message is not loaded. It is absent when the answered message is gone or hidden for the recipient.
30
+
5
31
  ## 2.1.0-alpha.5
6
32
 
7
33
  - A user's `avatar_url` adds `?rev={revision}`, which changes with every new avatar. `GET /users/{user_id}/avatar`
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- /* Generated from api/openapi.yaml 2.1.0-alpha.5. Do not edit. */
2
- export declare const API_VERSION: "2.1.0-alpha.5";
1
+ /* Generated from api/openapi.yaml 2.1.0-alpha.9. Do not edit. */
2
+ export declare const API_VERSION: "2.1.0-alpha.9";
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.5";
1
+ export const API_VERSION = "2.1.0-alpha.9";
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.5
4
+ version: 2.1.0-alpha.9
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
@@ -444,6 +444,33 @@ paths:
444
444
  "400": { $ref: "#/components/responses/BadRequest" }
445
445
  "401": { $ref: "#/components/responses/Unauthorized" }
446
446
  "404": { $ref: "#/components/responses/NotFound" }
447
+ /me/avatars/{avatar_id}:
448
+ parameters:
449
+ - $ref: "#/components/parameters/ClientVersion"
450
+ - $ref: "#/components/parameters/ClientApiVersion"
451
+ - name: avatar_id
452
+ in: path
453
+ required: true
454
+ description: "`id` of an `AvatarVersion` of the caller."
455
+ schema: { $ref: "#/components/schemas/Id" }
456
+ delete:
457
+ tags: [me]
458
+ operationId: deleteMyAvatar
459
+ summary: Delete one of your avatars
460
+ description: |
461
+ Removes the avatar from your history. When it is the current one, the newest remaining avatar becomes
462
+ current again; without one you get the default avatar. The image is deleted from storage once nothing
463
+ uses it any more.
464
+ responses:
465
+ "426": { $ref: "#/components/responses/ClientOutdated" }
466
+ "200":
467
+ description: Updated user
468
+ content:
469
+ application/json:
470
+ schema: { $ref: "#/components/schemas/Me" }
471
+ "400": { $ref: "#/components/responses/BadRequest" }
472
+ "401": { $ref: "#/components/responses/Unauthorized" }
473
+ "404": { $ref: "#/components/responses/NotFound" }
447
474
  /me/password:
448
475
  parameters:
449
476
  - $ref: "#/components/parameters/ClientVersion"
@@ -670,7 +697,7 @@ paths:
670
697
  required: true
671
698
  schema:
672
699
  type: string
673
- enum: [avatar_visibility, profile_visibility, presence_visibility, group_invites]
700
+ enum: [avatar_visibility, profile_visibility, presence_visibility, group_invites, direct_messages, search_visibility]
674
701
  - name: effect
675
702
  in: path
676
703
  required: true
@@ -1362,6 +1389,69 @@ paths:
1362
1389
  "404": { $ref: "#/components/responses/NotFound" }
1363
1390
  "422": { $ref: "#/components/responses/ValidationFailed" }
1364
1391
  "429": { $ref: "#/components/responses/TooManyRequests" }
1392
+ /chats/{chat_id}/messages/forward:
1393
+ parameters:
1394
+ - $ref: "#/components/parameters/ClientVersion"
1395
+ - $ref: "#/components/parameters/ClientApiVersion"
1396
+ - $ref: "#/components/parameters/ChatId"
1397
+ post:
1398
+ tags: [messages]
1399
+ operationId: forwardMessages
1400
+ summary: Forward several messages of a chat to other chats
1401
+ description: |
1402
+ Copies up to 20 messages of the chat, oldest first, into every target chat, at most 20 copies in all. Every
1403
+ copy counts against the sender's message rate. Every message and target is checked before anything is
1404
+ written, so a refused one forwards nothing.
1405
+ requestBody:
1406
+ required: true
1407
+ content:
1408
+ application/json:
1409
+ schema: { $ref: "#/components/schemas/ForwardMessagesRequest" }
1410
+ responses:
1411
+ "426": { $ref: "#/components/responses/ClientOutdated" }
1412
+ "400": { $ref: "#/components/responses/BadRequest" }
1413
+ "201":
1414
+ description: The new messages, per target chat oldest first
1415
+ content:
1416
+ application/json:
1417
+ schema:
1418
+ type: object
1419
+ required: [items]
1420
+ properties:
1421
+ items:
1422
+ type: array
1423
+ items: { $ref: "#/components/schemas/Message" }
1424
+ "401": { $ref: "#/components/responses/Unauthorized" }
1425
+ "403": { $ref: "#/components/responses/Forbidden" }
1426
+ "404": { $ref: "#/components/responses/NotFound" }
1427
+ "422": { $ref: "#/components/responses/ValidationFailed" }
1428
+ "429": { $ref: "#/components/responses/TooManyRequests" }
1429
+ /chats/{chat_id}/messages/delete:
1430
+ parameters:
1431
+ - $ref: "#/components/parameters/ClientVersion"
1432
+ - $ref: "#/components/parameters/ClientApiVersion"
1433
+ - $ref: "#/components/parameters/ChatId"
1434
+ post:
1435
+ tags: [messages]
1436
+ operationId: deleteMessages
1437
+ summary: Delete several messages of a chat
1438
+ description: |
1439
+ Deletes up to 100 messages of the chat with the rules of `DELETE /messages/{message_id}`. Every message
1440
+ is checked first: when one may not be deleted, none is.
1441
+ requestBody:
1442
+ required: true
1443
+ content:
1444
+ application/json:
1445
+ schema: { $ref: "#/components/schemas/DeleteMessagesRequest" }
1446
+ responses:
1447
+ "426": { $ref: "#/components/responses/ClientOutdated" }
1448
+ "400": { $ref: "#/components/responses/BadRequest" }
1449
+ "204":
1450
+ description: Deleted
1451
+ "401": { $ref: "#/components/responses/Unauthorized" }
1452
+ "403": { $ref: "#/components/responses/Forbidden" }
1453
+ "404": { $ref: "#/components/responses/NotFound" }
1454
+ "422": { $ref: "#/components/responses/ValidationFailed" }
1365
1455
 
1366
1456
  # -------------------------------------------------------------- search
1367
1457
  /search/messages:
@@ -2446,7 +2536,7 @@ components:
2446
2536
  description: A code of the authenticator app, or an unused recovery code.
2447
2537
  Visibility:
2448
2538
  type: string
2449
- description: Who may see the item. `*_except` scopes use the exception lists.
2539
+ description: Who may see the item. The exception lists apply to every value; `*_except` behave like `everyone` and `nobody`.
2450
2540
  enum: [everyone, contacts, everyone_except, nobody_except, nobody]
2451
2541
  DirectMessagePolicy:
2452
2542
  type: string
@@ -2459,7 +2549,7 @@ components:
2459
2549
  enum: [everyone, nobody]
2460
2550
  PrivacyExceptions:
2461
2551
  type: object
2462
- description: User IDs per setting; `allow` applies to `nobody_except`, `deny` to `everyone_except`.
2552
+ description: User IDs per setting. An exception wins over the setting whatever its value; `allow` always lets the user in, `deny` always keeps them out.
2463
2553
  additionalProperties:
2464
2554
  type: object
2465
2555
  required: [allow, deny]
@@ -2641,6 +2731,29 @@ components:
2641
2731
  - $ref: "#/components/schemas/Id"
2642
2732
  - type: "null"
2643
2733
  sender_name: { type: string }
2734
+ ReplyPreview:
2735
+ type: object
2736
+ description: |
2737
+ What a reply shows of the message it answers, so a client can draw the quote without loading that
2738
+ message. Set on messages of history pages and `message` events when the recipient can see the answered
2739
+ message; absent when it is gone or hidden for them, and on chat-list previews and search results.
2740
+ required: [id, type, sender, content, attachment, is_deleted]
2741
+ properties:
2742
+ id: { $ref: "#/components/schemas/Id" }
2743
+ type: { $ref: "#/components/schemas/MessageType" }
2744
+ sender:
2745
+ oneOf:
2746
+ - $ref: "#/components/schemas/User"
2747
+ - type: "null"
2748
+ content:
2749
+ type: [string, "null"]
2750
+ maxLength: 100
2751
+ description: The first 100 characters of the text or caption; `null` when deleted or empty.
2752
+ attachment:
2753
+ oneOf:
2754
+ - $ref: "#/components/schemas/Attachment"
2755
+ - type: "null"
2756
+ is_deleted: { type: boolean }
2644
2757
  Message:
2645
2758
  type: object
2646
2759
  required:
@@ -2678,6 +2791,8 @@ components:
2678
2791
  oneOf:
2679
2792
  - $ref: "#/components/schemas/Id"
2680
2793
  - type: "null"
2794
+ reply_preview:
2795
+ $ref: "#/components/schemas/ReplyPreview"
2681
2796
  forwarded_from:
2682
2797
  oneOf:
2683
2798
  - $ref: "#/components/schemas/ForwardedFrom"
@@ -2785,6 +2900,35 @@ components:
2785
2900
  maxItems: 20
2786
2901
  uniqueItems: true
2787
2902
  items: { $ref: "#/components/schemas/Id" }
2903
+ ForwardMessagesRequest:
2904
+ type: object
2905
+ required: [message_ids, chat_ids]
2906
+ properties:
2907
+ message_ids:
2908
+ type: array
2909
+ minItems: 1
2910
+ maxItems: 20
2911
+ uniqueItems: true
2912
+ items: { $ref: "#/components/schemas/Id" }
2913
+ chat_ids:
2914
+ type: array
2915
+ minItems: 1
2916
+ maxItems: 20
2917
+ uniqueItems: true
2918
+ items: { $ref: "#/components/schemas/Id" }
2919
+ DeleteMessagesRequest:
2920
+ type: object
2921
+ required: [message_ids, scope]
2922
+ properties:
2923
+ message_ids:
2924
+ type: array
2925
+ minItems: 1
2926
+ maxItems: 100
2927
+ uniqueItems: true
2928
+ items: { $ref: "#/components/schemas/Id" }
2929
+ scope:
2930
+ type: string
2931
+ enum: [me, everyone]
2788
2932
  MarkReadRequest:
2789
2933
  type: object
2790
2934
  required: [message_id]
package/dist/schema.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- /* Generated from api/openapi.yaml 2.1.0-alpha.5. Do not edit. */
1
+ /* Generated from api/openapi.yaml 2.1.0-alpha.9. Do not edit. */
2
2
  export interface paths {
3
3
  "/meta": {
4
4
  parameters: {
@@ -328,6 +328,36 @@ export interface paths {
328
328
  patch?: never;
329
329
  trace?: never;
330
330
  };
331
+ "/me/avatars/{avatar_id}": {
332
+ parameters: {
333
+ query?: never;
334
+ header?: {
335
+ /** @description Version of the client app, for logs and the per-client metric. */
336
+ "X-Client-Version"?: components["parameters"]["ClientVersion"];
337
+ /** @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`). */
338
+ "X-Client-Api-Version"?: components["parameters"]["ClientApiVersion"];
339
+ };
340
+ path: {
341
+ /** @description `id` of an `AvatarVersion` of the caller. */
342
+ avatar_id: components["schemas"]["Id"];
343
+ };
344
+ cookie?: never;
345
+ };
346
+ get?: never;
347
+ put?: never;
348
+ post?: never;
349
+ /**
350
+ * Delete one of your avatars
351
+ * @description Removes the avatar from your history. When it is the current one, the newest remaining avatar becomes
352
+ * current again; without one you get the default avatar. The image is deleted from storage once nothing
353
+ * uses it any more.
354
+ */
355
+ delete: operations["deleteMyAvatar"];
356
+ options?: never;
357
+ head?: never;
358
+ patch?: never;
359
+ trace?: never;
360
+ };
331
361
  "/me/password": {
332
362
  parameters: {
333
363
  query?: never;
@@ -531,7 +561,7 @@ export interface paths {
531
561
  "X-Client-Api-Version"?: components["parameters"]["ClientApiVersion"];
532
562
  };
533
563
  path: {
534
- setting_key: "avatar_visibility" | "profile_visibility" | "presence_visibility" | "group_invites";
564
+ setting_key: "avatar_visibility" | "profile_visibility" | "presence_visibility" | "group_invites" | "direct_messages" | "search_visibility";
535
565
  effect: "allow" | "deny";
536
566
  };
537
567
  cookie?: never;
@@ -1062,6 +1092,63 @@ export interface paths {
1062
1092
  patch?: never;
1063
1093
  trace?: never;
1064
1094
  };
1095
+ "/chats/{chat_id}/messages/forward": {
1096
+ parameters: {
1097
+ query?: never;
1098
+ header?: {
1099
+ /** @description Version of the client app, for logs and the per-client metric. */
1100
+ "X-Client-Version"?: components["parameters"]["ClientVersion"];
1101
+ /** @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`). */
1102
+ "X-Client-Api-Version"?: components["parameters"]["ClientApiVersion"];
1103
+ };
1104
+ path: {
1105
+ chat_id: components["parameters"]["ChatId"];
1106
+ };
1107
+ cookie?: never;
1108
+ };
1109
+ get?: never;
1110
+ put?: never;
1111
+ /**
1112
+ * Forward several messages of a chat to other chats
1113
+ * @description Copies up to 20 messages of the chat, oldest first, into every target chat, at most 20 copies in all. Every
1114
+ * copy counts against the sender's message rate. Every message and target is checked before anything is
1115
+ * written, so a refused one forwards nothing.
1116
+ */
1117
+ post: operations["forwardMessages"];
1118
+ delete?: never;
1119
+ options?: never;
1120
+ head?: never;
1121
+ patch?: never;
1122
+ trace?: never;
1123
+ };
1124
+ "/chats/{chat_id}/messages/delete": {
1125
+ parameters: {
1126
+ query?: never;
1127
+ header?: {
1128
+ /** @description Version of the client app, for logs and the per-client metric. */
1129
+ "X-Client-Version"?: components["parameters"]["ClientVersion"];
1130
+ /** @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`). */
1131
+ "X-Client-Api-Version"?: components["parameters"]["ClientApiVersion"];
1132
+ };
1133
+ path: {
1134
+ chat_id: components["parameters"]["ChatId"];
1135
+ };
1136
+ cookie?: never;
1137
+ };
1138
+ get?: never;
1139
+ put?: never;
1140
+ /**
1141
+ * Delete several messages of a chat
1142
+ * @description Deletes up to 100 messages of the chat with the rules of `DELETE /messages/{message_id}`. Every message
1143
+ * is checked first: when one may not be deleted, none is.
1144
+ */
1145
+ post: operations["deleteMessages"];
1146
+ delete?: never;
1147
+ options?: never;
1148
+ head?: never;
1149
+ patch?: never;
1150
+ trace?: never;
1151
+ };
1065
1152
  "/search/messages": {
1066
1153
  parameters: {
1067
1154
  query?: never;
@@ -1712,7 +1799,7 @@ export interface components {
1712
1799
  code: string;
1713
1800
  };
1714
1801
  /**
1715
- * @description Who may see the item. `*_except` scopes use the exception lists.
1802
+ * @description Who may see the item. The exception lists apply to every value; `*_except` behave like `everyone` and `nobody`.
1716
1803
  * @enum {string}
1717
1804
  */
1718
1805
  Visibility: "everyone" | "contacts" | "everyone_except" | "nobody_except" | "nobody";
@@ -1722,7 +1809,7 @@ export interface components {
1722
1809
  GroupInvitePolicy: "everyone" | "contacts" | "everyone_except" | "nobody_except" | "nobody" | "wait_approval";
1723
1810
  /** @enum {string} */
1724
1811
  SearchVisibility: "everyone" | "nobody";
1725
- /** @description User IDs per setting; `allow` applies to `nobody_except`, `deny` to `everyone_except`. */
1812
+ /** @description User IDs per setting. An exception wins over the setting whatever its value; `allow` always lets the user in, `deny` always keeps them out. */
1726
1813
  PrivacyExceptions: {
1727
1814
  [key: string]: {
1728
1815
  allow: components["schemas"]["Id"][];
@@ -1828,6 +1915,20 @@ export interface components {
1828
1915
  sender_id: components["schemas"]["Id"] | null;
1829
1916
  sender_name: string;
1830
1917
  };
1918
+ /**
1919
+ * @description What a reply shows of the message it answers, so a client can draw the quote without loading that
1920
+ * message. Set on messages of history pages and `message` events when the recipient can see the answered
1921
+ * message; absent when it is gone or hidden for them, and on chat-list previews and search results.
1922
+ */
1923
+ ReplyPreview: {
1924
+ id: components["schemas"]["Id"];
1925
+ type: components["schemas"]["MessageType"];
1926
+ sender: components["schemas"]["User"] | null;
1927
+ /** @description The first 100 characters of the text or caption; `null` when deleted or empty. */
1928
+ content: string | null;
1929
+ attachment: components["schemas"]["Attachment"] | null;
1930
+ is_deleted: boolean;
1931
+ };
1831
1932
  Message: {
1832
1933
  id: components["schemas"]["Id"];
1833
1934
  chat_id: components["schemas"]["Id"];
@@ -1838,6 +1939,7 @@ export interface components {
1838
1939
  content: string | null;
1839
1940
  attachment: components["schemas"]["Attachment"] | null;
1840
1941
  reply_to: components["schemas"]["Id"] | null;
1942
+ reply_preview?: components["schemas"]["ReplyPreview"];
1841
1943
  forwarded_from: components["schemas"]["ForwardedFrom"] | null;
1842
1944
  reactions: components["schemas"]["Reaction"][];
1843
1945
  read_by: components["schemas"]["ReadReceipt"][];
@@ -1887,6 +1989,15 @@ export interface components {
1887
1989
  ForwardMessageRequest: {
1888
1990
  chat_ids: components["schemas"]["Id"][];
1889
1991
  };
1992
+ ForwardMessagesRequest: {
1993
+ message_ids: components["schemas"]["Id"][];
1994
+ chat_ids: components["schemas"]["Id"][];
1995
+ };
1996
+ DeleteMessagesRequest: {
1997
+ message_ids: components["schemas"]["Id"][];
1998
+ /** @enum {string} */
1999
+ scope: "me" | "everyone";
2000
+ };
1890
2001
  MarkReadRequest: {
1891
2002
  /** @description Everything up to and including this message is read. */
1892
2003
  message_id: components["schemas"]["Id"];
@@ -2626,6 +2737,38 @@ export interface operations {
2626
2737
  426: components["responses"]["ClientOutdated"];
2627
2738
  };
2628
2739
  };
2740
+ deleteMyAvatar: {
2741
+ parameters: {
2742
+ query?: never;
2743
+ header?: {
2744
+ /** @description Version of the client app, for logs and the per-client metric. */
2745
+ "X-Client-Version"?: components["parameters"]["ClientVersion"];
2746
+ /** @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`). */
2747
+ "X-Client-Api-Version"?: components["parameters"]["ClientApiVersion"];
2748
+ };
2749
+ path: {
2750
+ /** @description `id` of an `AvatarVersion` of the caller. */
2751
+ avatar_id: components["schemas"]["Id"];
2752
+ };
2753
+ cookie?: never;
2754
+ };
2755
+ requestBody?: never;
2756
+ responses: {
2757
+ /** @description Updated user */
2758
+ 200: {
2759
+ headers: {
2760
+ [name: string]: unknown;
2761
+ };
2762
+ content: {
2763
+ "application/json": components["schemas"]["Me"];
2764
+ };
2765
+ };
2766
+ 400: components["responses"]["BadRequest"];
2767
+ 401: components["responses"]["Unauthorized"];
2768
+ 404: components["responses"]["NotFound"];
2769
+ 426: components["responses"]["ClientOutdated"];
2770
+ };
2771
+ };
2629
2772
  changePassword: {
2630
2773
  parameters: {
2631
2774
  query?: never;
@@ -2977,7 +3120,7 @@ export interface operations {
2977
3120
  "X-Client-Api-Version"?: components["parameters"]["ClientApiVersion"];
2978
3121
  };
2979
3122
  path: {
2980
- setting_key: "avatar_visibility" | "profile_visibility" | "presence_visibility" | "group_invites";
3123
+ setting_key: "avatar_visibility" | "profile_visibility" | "presence_visibility" | "group_invites" | "direct_messages" | "search_visibility";
2981
3124
  effect: "allow" | "deny";
2982
3125
  };
2983
3126
  cookie?: never;
@@ -3974,6 +4117,81 @@ export interface operations {
3974
4117
  429: components["responses"]["TooManyRequests"];
3975
4118
  };
3976
4119
  };
4120
+ forwardMessages: {
4121
+ parameters: {
4122
+ query?: never;
4123
+ header?: {
4124
+ /** @description Version of the client app, for logs and the per-client metric. */
4125
+ "X-Client-Version"?: components["parameters"]["ClientVersion"];
4126
+ /** @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`). */
4127
+ "X-Client-Api-Version"?: components["parameters"]["ClientApiVersion"];
4128
+ };
4129
+ path: {
4130
+ chat_id: components["parameters"]["ChatId"];
4131
+ };
4132
+ cookie?: never;
4133
+ };
4134
+ requestBody: {
4135
+ content: {
4136
+ "application/json": components["schemas"]["ForwardMessagesRequest"];
4137
+ };
4138
+ };
4139
+ responses: {
4140
+ /** @description The new messages, per target chat oldest first */
4141
+ 201: {
4142
+ headers: {
4143
+ [name: string]: unknown;
4144
+ };
4145
+ content: {
4146
+ "application/json": {
4147
+ items: components["schemas"]["Message"][];
4148
+ };
4149
+ };
4150
+ };
4151
+ 400: components["responses"]["BadRequest"];
4152
+ 401: components["responses"]["Unauthorized"];
4153
+ 403: components["responses"]["Forbidden"];
4154
+ 404: components["responses"]["NotFound"];
4155
+ 422: components["responses"]["ValidationFailed"];
4156
+ 426: components["responses"]["ClientOutdated"];
4157
+ 429: components["responses"]["TooManyRequests"];
4158
+ };
4159
+ };
4160
+ deleteMessages: {
4161
+ parameters: {
4162
+ query?: never;
4163
+ header?: {
4164
+ /** @description Version of the client app, for logs and the per-client metric. */
4165
+ "X-Client-Version"?: components["parameters"]["ClientVersion"];
4166
+ /** @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`). */
4167
+ "X-Client-Api-Version"?: components["parameters"]["ClientApiVersion"];
4168
+ };
4169
+ path: {
4170
+ chat_id: components["parameters"]["ChatId"];
4171
+ };
4172
+ cookie?: never;
4173
+ };
4174
+ requestBody: {
4175
+ content: {
4176
+ "application/json": components["schemas"]["DeleteMessagesRequest"];
4177
+ };
4178
+ };
4179
+ responses: {
4180
+ /** @description Deleted */
4181
+ 204: {
4182
+ headers: {
4183
+ [name: string]: unknown;
4184
+ };
4185
+ content?: never;
4186
+ };
4187
+ 400: components["responses"]["BadRequest"];
4188
+ 401: components["responses"]["Unauthorized"];
4189
+ 403: components["responses"]["Forbidden"];
4190
+ 404: components["responses"]["NotFound"];
4191
+ 422: components["responses"]["ValidationFailed"];
4192
+ 426: components["responses"]["ClientOutdated"];
4193
+ };
4194
+ };
3977
4195
  searchAllMessages: {
3978
4196
  parameters: {
3979
4197
  query: {
@@ -1,4 +1,4 @@
1
- /* Generated from api/openapi.yaml 2.1.0-alpha.5. Do not edit. */
1
+ /* Generated from api/openapi.yaml 2.1.0-alpha.9. Do not edit. */
2
2
 
3
3
  /**
4
4
  * Any WebSocket event, in either direction.
@@ -307,6 +307,7 @@ export interface Message {
307
307
  content: string | null;
308
308
  attachment: Attachment | null;
309
309
  reply_to: Id | null;
310
+ reply_preview?: ReplyPreview;
310
311
  forwarded_from: ForwardedFrom | null;
311
312
  reactions: Reaction[];
312
313
  read_by: ReadReceipt[];
@@ -337,6 +338,23 @@ export interface Attachment {
337
338
  duration_ms?: number | null;
338
339
  waveform?: number[] | null;
339
340
  }
341
+ /**
342
+ * What a reply shows of the message it answers, so a client can draw the quote without loading that
343
+ * message. Set on messages of history pages and `message` events when the recipient can see the answered
344
+ * message; absent when it is gone or hidden for them, and on chat-list previews and search results.
345
+ *
346
+ */
347
+ export interface ReplyPreview {
348
+ id: Id;
349
+ type: MessageType;
350
+ sender: User | null;
351
+ /**
352
+ * The first 100 characters of the text or caption; `null` when deleted or empty.
353
+ */
354
+ content: string | null;
355
+ attachment: Attachment | null;
356
+ is_deleted: boolean;
357
+ }
340
358
  export interface ForwardedFrom {
341
359
  message_id: Id;
342
360
  sender_id: Id | null;
@@ -803,7 +803,7 @@
803
803
  },
804
804
  "Visibility": {
805
805
  "type": "string",
806
- "description": "Who may see the item. `*_except` scopes use the exception lists.",
806
+ "description": "Who may see the item. The exception lists apply to every value; `*_except` behave like `everyone` and `nobody`.",
807
807
  "enum": [
808
808
  "everyone",
809
809
  "contacts",
@@ -840,7 +840,7 @@
840
840
  },
841
841
  "PrivacyExceptions": {
842
842
  "type": "object",
843
- "description": "User IDs per setting; `allow` applies to `nobody_except`, `deny` to `everyone_except`.",
843
+ "description": "User IDs per setting. An exception wins over the setting whatever its value; `allow` always lets the user in, `deny` always keeps them out.",
844
844
  "additionalProperties": {
845
845
  "type": "object",
846
846
  "required": [
@@ -1276,6 +1276,57 @@
1276
1276
  }
1277
1277
  }
1278
1278
  },
1279
+ "ReplyPreview": {
1280
+ "type": "object",
1281
+ "description": "What a reply shows of the message it answers, so a client can draw the quote without loading that\nmessage. Set on messages of history pages and `message` events when the recipient can see the answered\nmessage; absent when it is gone or hidden for them, and on chat-list previews and search results.\n",
1282
+ "required": [
1283
+ "id",
1284
+ "type",
1285
+ "sender",
1286
+ "content",
1287
+ "attachment",
1288
+ "is_deleted"
1289
+ ],
1290
+ "properties": {
1291
+ "id": {
1292
+ "$ref": "#/$defs/Id"
1293
+ },
1294
+ "type": {
1295
+ "$ref": "#/$defs/MessageType"
1296
+ },
1297
+ "sender": {
1298
+ "oneOf": [
1299
+ {
1300
+ "$ref": "#/$defs/User"
1301
+ },
1302
+ {
1303
+ "type": "null"
1304
+ }
1305
+ ]
1306
+ },
1307
+ "content": {
1308
+ "type": [
1309
+ "string",
1310
+ "null"
1311
+ ],
1312
+ "maxLength": 100,
1313
+ "description": "The first 100 characters of the text or caption; `null` when deleted or empty."
1314
+ },
1315
+ "attachment": {
1316
+ "oneOf": [
1317
+ {
1318
+ "$ref": "#/$defs/Attachment"
1319
+ },
1320
+ {
1321
+ "type": "null"
1322
+ }
1323
+ ]
1324
+ },
1325
+ "is_deleted": {
1326
+ "type": "boolean"
1327
+ }
1328
+ }
1329
+ },
1279
1330
  "Message": {
1280
1331
  "type": "object",
1281
1332
  "required": [
@@ -1342,6 +1393,9 @@
1342
1393
  }
1343
1394
  ]
1344
1395
  },
1396
+ "reply_preview": {
1397
+ "$ref": "#/$defs/ReplyPreview"
1398
+ },
1345
1399
  "forwarded_from": {
1346
1400
  "oneOf": [
1347
1401
  {
@@ -1573,6 +1627,58 @@
1573
1627
  }
1574
1628
  }
1575
1629
  },
1630
+ "ForwardMessagesRequest": {
1631
+ "type": "object",
1632
+ "required": [
1633
+ "message_ids",
1634
+ "chat_ids"
1635
+ ],
1636
+ "properties": {
1637
+ "message_ids": {
1638
+ "type": "array",
1639
+ "minItems": 1,
1640
+ "maxItems": 20,
1641
+ "uniqueItems": true,
1642
+ "items": {
1643
+ "$ref": "#/$defs/Id"
1644
+ }
1645
+ },
1646
+ "chat_ids": {
1647
+ "type": "array",
1648
+ "minItems": 1,
1649
+ "maxItems": 20,
1650
+ "uniqueItems": true,
1651
+ "items": {
1652
+ "$ref": "#/$defs/Id"
1653
+ }
1654
+ }
1655
+ }
1656
+ },
1657
+ "DeleteMessagesRequest": {
1658
+ "type": "object",
1659
+ "required": [
1660
+ "message_ids",
1661
+ "scope"
1662
+ ],
1663
+ "properties": {
1664
+ "message_ids": {
1665
+ "type": "array",
1666
+ "minItems": 1,
1667
+ "maxItems": 100,
1668
+ "uniqueItems": true,
1669
+ "items": {
1670
+ "$ref": "#/$defs/Id"
1671
+ }
1672
+ },
1673
+ "scope": {
1674
+ "type": "string",
1675
+ "enum": [
1676
+ "me",
1677
+ "everyone"
1678
+ ]
1679
+ }
1680
+ }
1681
+ },
1576
1682
  "MarkReadRequest": {
1577
1683
  "type": "object",
1578
1684
  "required": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myronsi/messenger-api",
3
- "version": "2.1.0-alpha.5.next.70",
3
+ "version": "2.1.0-alpha.9",
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": {