@myronsi/messenger-api 2.1.0-alpha.26.next.108 → 2.1.0-alpha.27.next.109

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.27
6
+
7
+ - `User` gains the required `profile_version` (grows with username, display name, bio or avatar changes, not with
8
+ presence) and `StickerPack` the required `version` (grows with title or sticker changes).
9
+ - `GET /me`, `GET /users/{user_id}`, `GET /groups/{chat_id}`, `GET /stickers/packs` and `GET /stickers/packs/{pack_id}`
10
+ send an `ETag` with `Cache-Control: private, no-cache` and answer `304` to a matching `If-None-Match`.
11
+ - `/attachments/{attachment_id}/content` is cached as immutable (an attachment never changes).
12
+ - New server WebSocket event `user_updated` (`user_id`, `profile_version`) for users who share a chat with the user.
13
+
5
14
  ## 2.1.0-alpha.26
6
15
 
7
16
  - `DELETE /chats/{chat_id}` takes `scope=me|everyone` (default `everyone`, as before). `me` deletes the direct chat
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- /* Generated from api/openapi.yaml 2.1.0-alpha.26. Do not edit. */
2
- export declare const API_VERSION: "2.1.0-alpha.26";
1
+ /* Generated from api/openapi.yaml 2.1.0-alpha.27. Do not edit. */
2
+ export declare const API_VERSION: "2.1.0-alpha.27";
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.26";
1
+ export const API_VERSION = "2.1.0-alpha.27";
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.26
4
+ version: 2.1.0-alpha.27
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
@@ -329,6 +329,8 @@ paths:
329
329
  operationId: getMe
330
330
  summary: Current user
331
331
  responses:
332
+ "304":
333
+ description: Not modified; the response's `ETag` matches `If-None-Match`.
332
334
  "426": { $ref: "#/components/responses/ClientOutdated" }
333
335
  "400": { $ref: "#/components/responses/BadRequest" }
334
336
  "200":
@@ -795,6 +797,8 @@ paths:
795
797
  or a `deny` exception) is `404` unless the two share a chat. Your own profile is always found. Lookups are
796
798
  rate limited per user.
797
799
  responses:
800
+ "304":
801
+ description: Not modified; the response's `ETag` matches `If-None-Match`.
798
802
  "426": { $ref: "#/components/responses/ClientOutdated" }
799
803
  "400": { $ref: "#/components/responses/BadRequest" }
800
804
  "200":
@@ -1757,6 +1761,8 @@ paths:
1757
1761
  operationId: getGroup
1758
1762
  summary: Group details and members
1759
1763
  responses:
1764
+ "304":
1765
+ description: Not modified; the response's `ETag` matches `If-None-Match`.
1760
1766
  "426": { $ref: "#/components/responses/ClientOutdated" }
1761
1767
  "400": { $ref: "#/components/responses/BadRequest" }
1762
1768
  "200":
@@ -1974,6 +1980,8 @@ paths:
1974
1980
  required: false
1975
1981
  schema: { type: boolean, default: false }
1976
1982
  responses:
1983
+ "304":
1984
+ description: Not modified; the response's `ETag` matches `If-None-Match`.
1977
1985
  "426": { $ref: "#/components/responses/ClientOutdated" }
1978
1986
  "400": { $ref: "#/components/responses/BadRequest" }
1979
1987
  "200":
@@ -2020,6 +2028,8 @@ paths:
2020
2028
  `Sticker.pack_slug` with `GET /stickers/links/{slug}` instead. `is_installed` tells whether it is in the
2021
2029
  user's panel. A hidden pack is found only by its owner.
2022
2030
  responses:
2031
+ "304":
2032
+ description: Not modified; the response's `ETag` matches `If-None-Match`.
2023
2033
  "426": { $ref: "#/components/responses/ClientOutdated" }
2024
2034
  "400": { $ref: "#/components/responses/BadRequest" }
2025
2035
  "200":
@@ -4894,9 +4904,13 @@ components:
4894
4904
  User:
4895
4905
  type: object
4896
4906
  description: A user as visible to the requesting user; hidden fields are `null`.
4897
- required: [id, username, display_name, avatar_url, bio, is_online, last_seen, is_deleted]
4907
+ required: [id, username, display_name, avatar_url, bio, is_online, last_seen, is_deleted, profile_version]
4898
4908
  properties:
4899
4909
  id: { $ref: "#/components/schemas/Id" }
4910
+ profile_version:
4911
+ type: integer
4912
+ minimum: 0
4913
+ description: Grows whenever the username, display name, bio or avatar changes (not with presence). Clients keep a stored profile until a higher version arrives.
4900
4914
  username: { $ref: "#/components/schemas/Username" }
4901
4915
  display_name: { type: string }
4902
4916
  contact_name:
@@ -5115,9 +5129,13 @@ components:
5115
5129
  pattern: "^[A-Za-z0-9]{8,32}$"
5116
5130
  StickerPack:
5117
5131
  type: object
5118
- required: [id, title, is_official, is_installed, is_mine, is_hidden, stickers]
5132
+ required: [id, title, is_official, is_installed, is_mine, is_hidden, stickers, version]
5119
5133
  properties:
5120
5134
  id: { $ref: "#/components/schemas/Id" }
5135
+ version:
5136
+ type: integer
5137
+ minimum: 0
5138
+ description: Grows whenever the title or the stickers of the pack change.
5121
5139
  title: { type: string, minLength: 1, maxLength: 64 }
5122
5140
  is_official:
5123
5141
  type: boolean
package/dist/schema.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- /* Generated from api/openapi.yaml 2.1.0-alpha.26. Do not edit. */
1
+ /* Generated from api/openapi.yaml 2.1.0-alpha.27. Do not edit. */
2
2
  export interface paths {
3
3
  "/meta": {
4
4
  parameters: {
@@ -3243,6 +3243,8 @@ export interface components {
3243
3243
  /** @description A user as visible to the requesting user; hidden fields are `null`. */
3244
3244
  User: {
3245
3245
  id: components["schemas"]["Id"];
3246
+ /** @description Grows whenever the username, display name, bio or avatar changes (not with presence). Clients keep a stored profile until a higher version arrives. */
3247
+ profile_version: number;
3246
3248
  username: components["schemas"]["Username"];
3247
3249
  display_name: string;
3248
3250
  /** @description The requesting user's own name for this user, if set. */
@@ -3382,6 +3384,8 @@ export interface components {
3382
3384
  StickerPackSlug: string;
3383
3385
  StickerPack: {
3384
3386
  id: components["schemas"]["Id"];
3387
+ /** @description Grows whenever the title or the stickers of the pack change. */
3388
+ version: number;
3385
3389
  title: string;
3386
3390
  /** @description A built-in pack of the messenger, not made by a user. */
3387
3391
  is_official: boolean;
@@ -4509,6 +4513,13 @@ export interface operations {
4509
4513
  "application/json": components["schemas"]["Me"];
4510
4514
  };
4511
4515
  };
4516
+ /** @description Not modified; the response's `ETag` matches `If-None-Match`. */
4517
+ 304: {
4518
+ headers: {
4519
+ [name: string]: unknown;
4520
+ };
4521
+ content?: never;
4522
+ };
4512
4523
  400: components["responses"]["BadRequest"];
4513
4524
  401: components["responses"]["Unauthorized"];
4514
4525
  426: components["responses"]["ClientOutdated"];
@@ -5205,6 +5216,13 @@ export interface operations {
5205
5216
  "application/json": components["schemas"]["User"];
5206
5217
  };
5207
5218
  };
5219
+ /** @description Not modified; the response's `ETag` matches `If-None-Match`. */
5220
+ 304: {
5221
+ headers: {
5222
+ [name: string]: unknown;
5223
+ };
5224
+ content?: never;
5225
+ };
5208
5226
  400: components["responses"]["BadRequest"];
5209
5227
  401: components["responses"]["Unauthorized"];
5210
5228
  404: components["responses"]["NotFound"];
@@ -6504,6 +6522,13 @@ export interface operations {
6504
6522
  "application/json": components["schemas"]["Group"];
6505
6523
  };
6506
6524
  };
6525
+ /** @description Not modified; the response's `ETag` matches `If-None-Match`. */
6526
+ 304: {
6527
+ headers: {
6528
+ [name: string]: unknown;
6529
+ };
6530
+ content?: never;
6531
+ };
6507
6532
  400: components["responses"]["BadRequest"];
6508
6533
  401: components["responses"]["Unauthorized"];
6509
6534
  404: components["responses"]["NotFound"];
@@ -6843,6 +6868,13 @@ export interface operations {
6843
6868
  "application/json": components["schemas"]["StickerPackList"];
6844
6869
  };
6845
6870
  };
6871
+ /** @description Not modified; the response's `ETag` matches `If-None-Match`. */
6872
+ 304: {
6873
+ headers: {
6874
+ [name: string]: unknown;
6875
+ };
6876
+ content?: never;
6877
+ };
6846
6878
  400: components["responses"]["BadRequest"];
6847
6879
  401: components["responses"]["Unauthorized"];
6848
6880
  426: components["responses"]["ClientOutdated"];
@@ -6907,6 +6939,13 @@ export interface operations {
6907
6939
  "application/json": components["schemas"]["StickerPack"];
6908
6940
  };
6909
6941
  };
6942
+ /** @description Not modified; the response's `ETag` matches `If-None-Match`. */
6943
+ 304: {
6944
+ headers: {
6945
+ [name: string]: unknown;
6946
+ };
6947
+ content?: never;
6948
+ };
6910
6949
  400: components["responses"]["BadRequest"];
6911
6950
  401: components["responses"]["Unauthorized"];
6912
6951
  404: components["responses"]["NotFound"];
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| `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| `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",
@@ -97,7 +97,8 @@
97
97
  "bio": null,
98
98
  "is_online": true,
99
99
  "last_seen": null,
100
- "is_deleted": false
100
+ "is_deleted": false,
101
+ "profile_version": 1
101
102
  },
102
103
  "group_name": null,
103
104
  "preview": "Hi, can we talk?",
@@ -187,7 +188,8 @@
187
188
  "bio": null,
188
189
  "is_online": true,
189
190
  "last_seen": null,
190
- "is_deleted": false
191
+ "is_deleted": false,
192
+ "profile_version": 1
191
193
  },
192
194
  "is_pinned": false,
193
195
  "pin_position": null,
@@ -207,7 +209,8 @@
207
209
  "bio": null,
208
210
  "is_online": true,
209
211
  "last_seen": null,
210
- "is_deleted": false
212
+ "is_deleted": false,
213
+ "profile_version": 1
211
214
  },
212
215
  "content": "Hello!",
213
216
  "attachment": null,
@@ -249,7 +252,8 @@
249
252
  "bio": null,
250
253
  "is_online": true,
251
254
  "last_seen": null,
252
- "is_deleted": false
255
+ "is_deleted": false,
256
+ "profile_version": 1
253
257
  },
254
258
  "is_pinned": false,
255
259
  "pin_position": null,
@@ -269,7 +273,8 @@
269
273
  "bio": null,
270
274
  "is_online": true,
271
275
  "last_seen": null,
272
- "is_deleted": false
276
+ "is_deleted": false,
277
+ "profile_version": 1
273
278
  },
274
279
  "content": "Hello!",
275
280
  "attachment": null,
@@ -313,7 +318,8 @@
313
318
  "bio": null,
314
319
  "is_online": true,
315
320
  "last_seen": null,
316
- "is_deleted": false
321
+ "is_deleted": false,
322
+ "profile_version": 1
317
323
  },
318
324
  "content": "Hello, world!",
319
325
  "attachment": null,
@@ -360,7 +366,8 @@
360
366
  "bio": null,
361
367
  "is_online": true,
362
368
  "last_seen": null,
363
- "is_deleted": false
369
+ "is_deleted": false,
370
+ "profile_version": 1
364
371
  },
365
372
  "role": "owner",
366
373
  "joined_at": "2026-10-04T12:00:00Z"
@@ -392,7 +399,8 @@
392
399
  "bio": null,
393
400
  "is_online": true,
394
401
  "last_seen": null,
395
- "is_deleted": false
402
+ "is_deleted": false,
403
+ "profile_version": 1
396
404
  },
397
405
  "role": "owner",
398
406
  "joined_at": "2026-10-04T12:00:00Z"
@@ -439,7 +447,8 @@
439
447
  "bio": null,
440
448
  "is_online": true,
441
449
  "last_seen": null,
442
- "is_deleted": false
450
+ "is_deleted": false,
451
+ "profile_version": 1
443
452
  },
444
453
  "content": "Hello!",
445
454
  "attachment": null,
@@ -545,6 +554,15 @@
545
554
  "is_typing": true,
546
555
  "action": "recording_voice"
547
556
  }
557
+ },
558
+ "server/user_updated.json": {
559
+ "type": "user_updated",
560
+ "event_id": "7217400317439950012",
561
+ "chat_id": null,
562
+ "data": {
563
+ "user_id": "7",
564
+ "profile_version": 3
565
+ }
548
566
  }
549
567
  }
550
568
  }
@@ -1,4 +1,4 @@
1
- /* Generated from api/openapi.yaml 2.1.0-alpha.26. Do not edit. */
1
+ /* Generated from api/openapi.yaml 2.1.0-alpha.27. Do not edit. */
2
2
 
3
3
  /**
4
4
  * Any WebSocket event, in either direction.
@@ -54,7 +54,8 @@ export type ServerEvent =
54
54
  | ServerRecoveryRequestEvent
55
55
  | ServerSecurityAlertEvent
56
56
  | ServerSecurityNoticeEvent
57
- | ServerTypingEvent;
57
+ | ServerTypingEvent
58
+ | ServerUserUpdatedEvent;
58
59
  export type Timestamp = string;
59
60
  export type ApprovalRequestType = "direct_message" | "group_invite";
60
61
  export type ApprovalRequestStatus = "pending" | "approved" | "rejected";
@@ -292,6 +293,10 @@ export interface ApprovalRequest {
292
293
  */
293
294
  export interface User {
294
295
  id: Id;
296
+ /**
297
+ * Grows whenever the username, display name, bio or avatar changes (not with presence). Clients keep a stored profile until a higher version arrives.
298
+ */
299
+ profile_version: number;
295
300
  username: Username;
296
301
  display_name: string;
297
302
  /**
@@ -920,3 +925,15 @@ export interface ServerTypingEvent {
920
925
  "typing" | "recording_voice" | "choosing_sticker" | "uploading_photo" | "uploading_video" | "uploading_file";
921
926
  };
922
927
  }
928
+ /**
929
+ * A user you share a chat with changed their username, display name, bio or avatar. Fetch GET /users/{user_id} again when profile_version is higher than the one you keep.
930
+ */
931
+ export interface ServerUserUpdatedEvent {
932
+ type: "user_updated";
933
+ event_id: Id;
934
+ chat_id: null;
935
+ data: {
936
+ user_id: Id;
937
+ profile_version: number;
938
+ };
939
+ }
@@ -1011,12 +1011,18 @@
1011
1011
  "bio",
1012
1012
  "is_online",
1013
1013
  "last_seen",
1014
- "is_deleted"
1014
+ "is_deleted",
1015
+ "profile_version"
1015
1016
  ],
1016
1017
  "properties": {
1017
1018
  "id": {
1018
1019
  "$ref": "#/$defs/Id"
1019
1020
  },
1021
+ "profile_version": {
1022
+ "type": "integer",
1023
+ "minimum": 0,
1024
+ "description": "Grows whenever the username, display name, bio or avatar changes (not with presence). Clients keep a stored profile until a higher version arrives."
1025
+ },
1020
1026
  "username": {
1021
1027
  "$ref": "#/$defs/Username"
1022
1028
  },
@@ -1512,12 +1518,18 @@
1512
1518
  "is_installed",
1513
1519
  "is_mine",
1514
1520
  "is_hidden",
1515
- "stickers"
1521
+ "stickers",
1522
+ "version"
1516
1523
  ],
1517
1524
  "properties": {
1518
1525
  "id": {
1519
1526
  "$ref": "#/$defs/Id"
1520
1527
  },
1528
+ "version": {
1529
+ "type": "integer",
1530
+ "minimum": 0,
1531
+ "description": "Grows whenever the title or the stickers of the pack change."
1532
+ },
1521
1533
  "title": {
1522
1534
  "type": "string",
1523
1535
  "minLength": 1,
@@ -5226,6 +5238,44 @@
5226
5238
  "data"
5227
5239
  ]
5228
5240
  },
5241
+ "ServerUserUpdatedEvent": {
5242
+ "title": "ServerUserUpdatedEvent",
5243
+ "description": "A user you share a chat with changed their username, display name, bio or avatar. Fetch GET /users/{user_id} again when profile_version is higher than the one you keep.",
5244
+ "type": "object",
5245
+ "properties": {
5246
+ "type": {
5247
+ "const": "user_updated"
5248
+ },
5249
+ "event_id": {
5250
+ "$ref": "#/$defs/Id"
5251
+ },
5252
+ "chat_id": {
5253
+ "type": "null"
5254
+ },
5255
+ "data": {
5256
+ "type": "object",
5257
+ "properties": {
5258
+ "user_id": {
5259
+ "$ref": "#/$defs/Id"
5260
+ },
5261
+ "profile_version": {
5262
+ "type": "integer",
5263
+ "minimum": 0
5264
+ }
5265
+ },
5266
+ "required": [
5267
+ "user_id",
5268
+ "profile_version"
5269
+ ]
5270
+ }
5271
+ },
5272
+ "required": [
5273
+ "type",
5274
+ "event_id",
5275
+ "chat_id",
5276
+ "data"
5277
+ ]
5278
+ },
5229
5279
  "ClientEvent": {
5230
5280
  "title": "ClientEvent",
5231
5281
  "description": "Every event a client may send.",
@@ -5328,6 +5378,9 @@
5328
5378
  },
5329
5379
  {
5330
5380
  "$ref": "#/$defs/ServerTypingEvent"
5381
+ },
5382
+ {
5383
+ "$ref": "#/$defs/ServerUserUpdatedEvent"
5331
5384
  }
5332
5385
  ]
5333
5386
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myronsi/messenger-api",
3
- "version": "2.1.0-alpha.26.next.108",
3
+ "version": "2.1.0-alpha.27.next.109",
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": {