@myronsi/messenger-api 2.1.0-alpha.34.next.123 → 2.1.0-alpha.35

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,18 @@
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.35
6
+
7
+ - `PrivacySettings` gains the required `voice_video_messages` (`VoiceVideoPolicy`: `everyone`, `contacts`) and
8
+ `forward_link` (`ForwardLinkPolicy`: `everyone`, `contacts`, `nobody`); `UpdatePrivacySettingsRequest` accepts both.
9
+ `PUT /me/privacy/exceptions/{setting_key}/{effect}` accepts both keys, and `PrivacySettings.exceptions` lists them.
10
+ - A voice message, or a file message with a video, sent, resent or forwarded into a direct chat whose peer does not
11
+ accept it is refused with `403` `forbidden` and the field `voice_video_messages`. The WebSocket `error` event gains
12
+ the optional `field`.
13
+ - `User.can_send_voice_video`, only on `Chat.peer` of a direct chat. When the peer changes `voice_video_messages` or its
14
+ exceptions, a `chat_list_update` brings the new value.
15
+ - `ForwardedFrom.sender_id` is `null` for viewers that the original sender's `forward_link` excludes.
16
+
5
17
  ## 2.1.0-alpha.34
6
18
 
7
19
  - Requests folder: `Chat` gains the required `is_request`, `true` when a stranger opened the direct chat and the caller
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- /* Generated from api/openapi.yaml 2.1.0-alpha.34. Do not edit. */
2
- export declare const API_VERSION: "2.1.0-alpha.34";
1
+ /* Generated from api/openapi.yaml 2.1.0-alpha.35. Do not edit. */
2
+ export declare const API_VERSION: "2.1.0-alpha.35";
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.34";
1
+ export const API_VERSION = "2.1.0-alpha.35";
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.34
4
+ version: 2.1.0-alpha.35
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
@@ -726,7 +726,7 @@ paths:
726
726
  required: true
727
727
  schema:
728
728
  type: string
729
- enum: [avatar_visibility, profile_visibility, presence_visibility, last_seen_visibility, birthday_visibility, group_invites, direct_messages, search_visibility, calls_from]
729
+ enum: [avatar_visibility, profile_visibility, presence_visibility, last_seen_visibility, birthday_visibility, group_invites, direct_messages, search_visibility, calls_from, voice_video_messages, forward_link]
730
730
  - name: effect
731
731
  in: path
732
732
  required: true
@@ -1817,6 +1817,9 @@ paths:
1817
1817
  description: |
1818
1818
  Same as the WebSocket `message` event, for clients without a connection. Sending the
1819
1819
  same `client_temp_id` again returns the existing message instead of creating a copy.
1820
+ A voice message, or a file message with a video, in a direct chat whose peer does not accept them from
1821
+ the sender (`voice_video_messages`) is refused with `403` (`forbidden`, field `voice_video_messages`)
1822
+ and kept as an unsent message.
1820
1823
  requestBody:
1821
1824
  required: true
1822
1825
  content:
@@ -2007,6 +2010,9 @@ paths:
2007
2010
  tags: [messages]
2008
2011
  operationId: forwardMessage
2009
2012
  summary: Forward a message to other chats
2013
+ description: |
2014
+ A voice message or a video forwarded into a direct chat whose peer does not accept them from the caller
2015
+ is refused with `403` (`forbidden`, field `voice_video_messages`), and nothing is forwarded.
2010
2016
  requestBody:
2011
2017
  required: true
2012
2018
  content:
@@ -2043,7 +2049,8 @@ paths:
2043
2049
  description: |
2044
2050
  Copies up to 20 messages of the chat, oldest first, into every target chat, at most 20 copies in all. Every
2045
2051
  copy counts against the sender's message rate. Every message and target is checked before anything is
2046
- written, so a refused one forwards nothing.
2052
+ written, so a refused one forwards nothing. Voice messages and videos follow the target peer's
2053
+ `voice_video_messages` (`403`, field `voice_video_messages`).
2047
2054
  requestBody:
2048
2055
  required: true
2049
2056
  content:
@@ -5849,6 +5856,14 @@ components:
5849
5856
  SearchVisibility:
5850
5857
  type: string
5851
5858
  enum: [everyone, nobody]
5859
+ VoiceVideoPolicy:
5860
+ type: string
5861
+ description: Who may send the user voice messages and videos in a direct chat. Groups are not affected.
5862
+ enum: [everyone, contacts]
5863
+ ForwardLinkPolicy:
5864
+ type: string
5865
+ description: Who sees the link to the user's account (`ForwardedFrom.sender_id`) on copies of their forwarded messages.
5866
+ enum: [everyone, contacts, nobody]
5852
5867
  PrivacyExceptions:
5853
5868
  type: object
5854
5869
  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.
@@ -5877,6 +5892,8 @@ components:
5877
5892
  - calls_enabled
5878
5893
  - calls_from
5879
5894
  - typing_indicators_enabled
5895
+ - voice_video_messages
5896
+ - forward_link
5880
5897
  - exceptions
5881
5898
  properties:
5882
5899
  avatar_visibility: { $ref: "#/components/schemas/Visibility" }
@@ -5907,6 +5924,16 @@ components:
5907
5924
  typing_indicators_enabled:
5908
5925
  type: boolean
5909
5926
  description: Whether other members see that this user is typing or recording a voice message. The user still sees theirs.
5927
+ voice_video_messages:
5928
+ description: |
5929
+ Who may send this user voice messages, and file messages with a video, in a direct chat. Others get
5930
+ `403` (`forbidden`, field `voice_video_messages`); their `Chat.peer.can_send_voice_video` is `false`.
5931
+ allOf: [{ $ref: "#/components/schemas/VoiceVideoPolicy" }]
5932
+ forward_link:
5933
+ description: |
5934
+ Who sees `ForwardedFrom.sender_id` when this user's messages are forwarded. Others get `null`; the name
5935
+ stays.
5936
+ allOf: [{ $ref: "#/components/schemas/ForwardLinkPolicy" }]
5910
5937
  exceptions: { $ref: "#/components/schemas/PrivacyExceptions" }
5911
5938
  UpdatePrivacySettingsRequest:
5912
5939
  type: object
@@ -5927,6 +5954,8 @@ components:
5927
5954
  description: "`false` sets `calls_from` to `nobody`; `true` sets it to `everyone` when it was `nobody`. Ignored when `calls_from` is sent."
5928
5955
  calls_from: { $ref: "#/components/schemas/CallPolicy" }
5929
5956
  typing_indicators_enabled: { type: boolean }
5957
+ voice_video_messages: { $ref: "#/components/schemas/VoiceVideoPolicy" }
5958
+ forward_link: { $ref: "#/components/schemas/ForwardLinkPolicy" }
5930
5959
  PrivacyExceptionsRequest:
5931
5960
  type: object
5932
5961
  required: [user_ids]
@@ -5983,6 +6012,11 @@ components:
5983
6012
  - $ref: "#/components/schemas/Timestamp"
5984
6013
  - type: "null"
5985
6014
  is_deleted: { type: boolean }
6015
+ can_send_voice_video:
6016
+ type: boolean
6017
+ description: |
6018
+ Only on `Chat.peer` of a direct chat: whether the requesting user may send this user voice messages and
6019
+ videos (their `voice_video_messages` setting and exceptions). Absent everywhere else.
5986
6020
  Me:
5987
6021
  allOf:
5988
6022
  - $ref: "#/components/schemas/User"
@@ -6560,6 +6594,9 @@ components:
6560
6594
  properties:
6561
6595
  message_id: { $ref: "#/components/schemas/Id" }
6562
6596
  sender_id:
6597
+ description: |
6598
+ The original sender; `null` when their account is gone or their `forward_link` setting hides it from the
6599
+ requesting user. Clients then show `sender_name` as plain text, not as a link to a profile.
6563
6600
  oneOf:
6564
6601
  - $ref: "#/components/schemas/Id"
6565
6602
  - type: "null"
package/dist/schema.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- /* Generated from api/openapi.yaml 2.1.0-alpha.34. Do not edit. */
1
+ /* Generated from api/openapi.yaml 2.1.0-alpha.35. Do not edit. */
2
2
  export interface paths {
3
3
  "/meta": {
4
4
  parameters: {
@@ -563,7 +563,7 @@ export interface paths {
563
563
  "X-Client-Api-Version"?: components["parameters"]["ClientApiVersion"];
564
564
  };
565
565
  path: {
566
- setting_key: "avatar_visibility" | "profile_visibility" | "presence_visibility" | "last_seen_visibility" | "birthday_visibility" | "group_invites" | "direct_messages" | "search_visibility" | "calls_from";
566
+ setting_key: "avatar_visibility" | "profile_visibility" | "presence_visibility" | "last_seen_visibility" | "birthday_visibility" | "group_invites" | "direct_messages" | "search_visibility" | "calls_from" | "voice_video_messages" | "forward_link";
567
567
  effect: "allow" | "deny";
568
568
  };
569
569
  cookie?: never;
@@ -1531,6 +1531,9 @@ export interface paths {
1531
1531
  * Send a message over HTTP
1532
1532
  * @description Same as the WebSocket `message` event, for clients without a connection. Sending the
1533
1533
  * same `client_temp_id` again returns the existing message instead of creating a copy.
1534
+ * A voice message, or a file message with a video, in a direct chat whose peer does not accept them from
1535
+ * the sender (`voice_video_messages`) is refused with `403` (`forbidden`, field `voice_video_messages`)
1536
+ * and kept as an unsent message.
1534
1537
  */
1535
1538
  post: operations["sendMessage"];
1536
1539
  delete?: never;
@@ -1693,7 +1696,11 @@ export interface paths {
1693
1696
  };
1694
1697
  get?: never;
1695
1698
  put?: never;
1696
- /** Forward a message to other chats */
1699
+ /**
1700
+ * Forward a message to other chats
1701
+ * @description A voice message or a video forwarded into a direct chat whose peer does not accept them from the caller
1702
+ * is refused with `403` (`forbidden`, field `voice_video_messages`), and nothing is forwarded.
1703
+ */
1697
1704
  post: operations["forwardMessage"];
1698
1705
  delete?: never;
1699
1706
  options?: never;
@@ -1721,7 +1728,8 @@ export interface paths {
1721
1728
  * Forward several messages of a chat to other chats
1722
1729
  * @description Copies up to 20 messages of the chat, oldest first, into every target chat, at most 20 copies in all. Every
1723
1730
  * copy counts against the sender's message rate. Every message and target is checked before anything is
1724
- * written, so a refused one forwards nothing.
1731
+ * written, so a refused one forwards nothing. Voice messages and videos follow the target peer's
1732
+ * `voice_video_messages` (`403`, field `voice_video_messages`).
1725
1733
  */
1726
1734
  post: operations["forwardMessages"];
1727
1735
  delete?: never;
@@ -4088,6 +4096,16 @@ export interface components {
4088
4096
  CallPolicy: "everyone" | "contacts" | "nobody";
4089
4097
  /** @enum {string} */
4090
4098
  SearchVisibility: "everyone" | "nobody";
4099
+ /**
4100
+ * @description Who may send the user voice messages and videos in a direct chat. Groups are not affected.
4101
+ * @enum {string}
4102
+ */
4103
+ VoiceVideoPolicy: "everyone" | "contacts";
4104
+ /**
4105
+ * @description Who sees the link to the user's account (`ForwardedFrom.sender_id`) on copies of their forwarded messages.
4106
+ * @enum {string}
4107
+ */
4108
+ ForwardLinkPolicy: "everyone" | "contacts" | "nobody";
4091
4109
  /** @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. */
4092
4110
  PrivacyExceptions: {
4093
4111
  [key: string]: {
@@ -4121,6 +4139,16 @@ export interface components {
4121
4139
  calls_from: components["schemas"]["CallPolicy"];
4122
4140
  /** @description Whether other members see that this user is typing or recording a voice message. The user still sees theirs. */
4123
4141
  typing_indicators_enabled: boolean;
4142
+ /**
4143
+ * @description Who may send this user voice messages, and file messages with a video, in a direct chat. Others get
4144
+ * `403` (`forbidden`, field `voice_video_messages`); their `Chat.peer.can_send_voice_video` is `false`.
4145
+ */
4146
+ voice_video_messages: components["schemas"]["VoiceVideoPolicy"];
4147
+ /**
4148
+ * @description Who sees `ForwardedFrom.sender_id` when this user's messages are forwarded. Others get `null`; the name
4149
+ * stays.
4150
+ */
4151
+ forward_link: components["schemas"]["ForwardLinkPolicy"];
4124
4152
  exceptions: components["schemas"]["PrivacyExceptions"];
4125
4153
  };
4126
4154
  UpdatePrivacySettingsRequest: {
@@ -4140,6 +4168,8 @@ export interface components {
4140
4168
  calls_enabled?: boolean;
4141
4169
  calls_from?: components["schemas"]["CallPolicy"];
4142
4170
  typing_indicators_enabled?: boolean;
4171
+ voice_video_messages?: components["schemas"]["VoiceVideoPolicy"];
4172
+ forward_link?: components["schemas"]["ForwardLinkPolicy"];
4143
4173
  };
4144
4174
  PrivacyExceptionsRequest: {
4145
4175
  user_ids: components["schemas"]["Id"][];
@@ -4170,6 +4200,11 @@ export interface components {
4170
4200
  is_online: boolean;
4171
4201
  last_seen: components["schemas"]["Timestamp"] | null;
4172
4202
  is_deleted: boolean;
4203
+ /**
4204
+ * @description Only on `Chat.peer` of a direct chat: whether the requesting user may send this user voice messages and
4205
+ * videos (their `voice_video_messages` setting and exceptions). Absent everywhere else.
4206
+ */
4207
+ can_send_voice_video?: boolean;
4173
4208
  };
4174
4209
  Me: components["schemas"]["User"] & {
4175
4210
  created_at: components["schemas"]["Timestamp"];
@@ -4532,6 +4567,10 @@ export interface components {
4532
4567
  };
4533
4568
  ForwardedFrom: {
4534
4569
  message_id: components["schemas"]["Id"];
4570
+ /**
4571
+ * @description The original sender; `null` when their account is gone or their `forward_link` setting hides it from the
4572
+ * requesting user. Clients then show `sender_name` as plain text, not as a link to a profile.
4573
+ */
4535
4574
  sender_id: components["schemas"]["Id"] | null;
4536
4575
  sender_name: string;
4537
4576
  };
@@ -6250,7 +6289,7 @@ export interface operations {
6250
6289
  "X-Client-Api-Version"?: components["parameters"]["ClientApiVersion"];
6251
6290
  };
6252
6291
  path: {
6253
- setting_key: "avatar_visibility" | "profile_visibility" | "presence_visibility" | "last_seen_visibility" | "birthday_visibility" | "group_invites" | "direct_messages" | "search_visibility" | "calls_from";
6292
+ setting_key: "avatar_visibility" | "profile_visibility" | "presence_visibility" | "last_seen_visibility" | "birthday_visibility" | "group_invites" | "direct_messages" | "search_visibility" | "calls_from" | "voice_video_messages" | "forward_link";
6254
6293
  effect: "allow" | "deny";
6255
6294
  };
6256
6295
  cookie?: never;
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| `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",
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`, and `data.field` when one setting or field caused it (for example `voice_video_messages`). `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",
@@ -1,4 +1,4 @@
1
- /* Generated from api/openapi.yaml 2.1.0-alpha.34. Do not edit. */
1
+ /* Generated from api/openapi.yaml 2.1.0-alpha.35. Do not edit. */
2
2
 
3
3
  /**
4
4
  * Any WebSocket event, in either direction.
@@ -348,6 +348,12 @@ export interface User {
348
348
  is_online: boolean;
349
349
  last_seen: Timestamp | null;
350
350
  is_deleted: boolean;
351
+ /**
352
+ * Only on `Chat.peer` of a direct chat: whether the requesting user may send this user voice messages and
353
+ * videos (their `voice_video_messages` setting and exceptions). Absent everywhere else.
354
+ *
355
+ */
356
+ can_send_voice_video?: boolean;
351
357
  }
352
358
  export interface Birthday {
353
359
  day: number;
@@ -718,6 +724,11 @@ export interface ReplyPreview {
718
724
  }
719
725
  export interface ForwardedFrom {
720
726
  message_id: Id;
727
+ /**
728
+ * The original sender; `null` when their account is gone or their `forward_link` setting hides it from the
729
+ * requesting user. Clients then show `sender_name` as plain text, not as a link to a profile.
730
+ *
731
+ */
721
732
  sender_id: Id | null;
722
733
  sender_name: string;
723
734
  }
@@ -833,6 +844,10 @@ export interface ServerErrorEvent {
833
844
  data: {
834
845
  code: ErrorCode;
835
846
  message?: string;
847
+ /**
848
+ * The setting or field that caused the error, for example `voice_video_messages` for a voice message or video the recipient does not accept.
849
+ */
850
+ field?: string;
836
851
  };
837
852
  client_temp_id?: ClientTempId;
838
853
  }
@@ -1039,6 +1039,23 @@
1039
1039
  "nobody"
1040
1040
  ]
1041
1041
  },
1042
+ "VoiceVideoPolicy": {
1043
+ "type": "string",
1044
+ "description": "Who may send the user voice messages and videos in a direct chat. Groups are not affected.",
1045
+ "enum": [
1046
+ "everyone",
1047
+ "contacts"
1048
+ ]
1049
+ },
1050
+ "ForwardLinkPolicy": {
1051
+ "type": "string",
1052
+ "description": "Who sees the link to the user's account (`ForwardedFrom.sender_id`) on copies of their forwarded messages.",
1053
+ "enum": [
1054
+ "everyone",
1055
+ "contacts",
1056
+ "nobody"
1057
+ ]
1058
+ },
1042
1059
  "PrivacyExceptions": {
1043
1060
  "type": "object",
1044
1061
  "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.",
@@ -1079,6 +1096,8 @@
1079
1096
  "calls_enabled",
1080
1097
  "calls_from",
1081
1098
  "typing_indicators_enabled",
1099
+ "voice_video_messages",
1100
+ "forward_link",
1082
1101
  "exceptions"
1083
1102
  ],
1084
1103
  "properties": {
@@ -1141,6 +1160,22 @@
1141
1160
  "type": "boolean",
1142
1161
  "description": "Whether other members see that this user is typing or recording a voice message. The user still sees theirs."
1143
1162
  },
1163
+ "voice_video_messages": {
1164
+ "description": "Who may send this user voice messages, and file messages with a video, in a direct chat. Others get\n`403` (`forbidden`, field `voice_video_messages`); their `Chat.peer.can_send_voice_video` is `false`.\n",
1165
+ "allOf": [
1166
+ {
1167
+ "$ref": "#/$defs/VoiceVideoPolicy"
1168
+ }
1169
+ ]
1170
+ },
1171
+ "forward_link": {
1172
+ "description": "Who sees `ForwardedFrom.sender_id` when this user's messages are forwarded. Others get `null`; the name\nstays.\n",
1173
+ "allOf": [
1174
+ {
1175
+ "$ref": "#/$defs/ForwardLinkPolicy"
1176
+ }
1177
+ ]
1178
+ },
1144
1179
  "exceptions": {
1145
1180
  "$ref": "#/$defs/PrivacyExceptions"
1146
1181
  }
@@ -1187,6 +1222,12 @@
1187
1222
  },
1188
1223
  "typing_indicators_enabled": {
1189
1224
  "type": "boolean"
1225
+ },
1226
+ "voice_video_messages": {
1227
+ "$ref": "#/$defs/VoiceVideoPolicy"
1228
+ },
1229
+ "forward_link": {
1230
+ "$ref": "#/$defs/ForwardLinkPolicy"
1190
1231
  }
1191
1232
  }
1192
1233
  },
@@ -1314,6 +1355,10 @@
1314
1355
  },
1315
1356
  "is_deleted": {
1316
1357
  "type": "boolean"
1358
+ },
1359
+ "can_send_voice_video": {
1360
+ "type": "boolean",
1361
+ "description": "Only on `Chat.peer` of a direct chat: whether the requesting user may send this user voice messages and\nvideos (their `voice_video_messages` setting and exceptions). Absent everywhere else.\n"
1317
1362
  }
1318
1363
  }
1319
1364
  },
@@ -2545,6 +2590,7 @@
2545
2590
  "$ref": "#/$defs/Id"
2546
2591
  },
2547
2592
  "sender_id": {
2593
+ "description": "The original sender; `null` when their account is gone or their `forward_link` setting hides it from the\nrequesting user. Clients then show `sender_name` as plain text, not as a link to a profile.\n",
2548
2594
  "oneOf": [
2549
2595
  {
2550
2596
  "$ref": "#/$defs/Id"
@@ -5594,6 +5640,10 @@
5594
5640
  },
5595
5641
  "message": {
5596
5642
  "type": "string"
5643
+ },
5644
+ "field": {
5645
+ "type": "string",
5646
+ "description": "The setting or field that caused the error, for example `voice_video_messages` for a voice message or video the recipient does not accept."
5597
5647
  }
5598
5648
  },
5599
5649
  "required": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myronsi/messenger-api",
3
- "version": "2.1.0-alpha.34.next.123",
3
+ "version": "2.1.0-alpha.35",
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": {