@myronsi/messenger-api 2.1.0-alpha.21 → 2.1.0-alpha.22

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,14 @@
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.22
6
+
7
+ - `Chat` gains the required, nullable `first_unread_message_id` (the oldest message the caller has not read, `null`
8
+ when `unread_count` is 0) and `last_read_message_id` (the caller's read marker), also in `chat_created` and
9
+ `chat_list_update`. Clients open a chat around `first_unread_message_id` and show the "new messages" divider there.
10
+ - `q` of `GET /chats/{chat_id}/messages/search` and `GET /search/messages` takes up to 256 characters (was 128).
11
+ - `RegisterRequest.display_name` is optional; a missing, empty or blank display name becomes the username.
12
+
5
13
  ## 2.1.0-alpha.21
6
14
 
7
15
  - User sticker packs: `POST /attachments` takes `purpose: sticker` (PNG, JPEG or still WebP up to 5 MB, stored as a
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- /* Generated from api/openapi.yaml 2.1.0-alpha.21. Do not edit. */
2
- export declare const API_VERSION: "2.1.0-alpha.21";
1
+ /* Generated from api/openapi.yaml 2.1.0-alpha.22. Do not edit. */
2
+ export declare const API_VERSION: "2.1.0-alpha.22";
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.21";
1
+ export const API_VERSION = "2.1.0-alpha.22";
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.21
4
+ version: 2.1.0-alpha.22
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
@@ -1232,7 +1232,7 @@ paths:
1232
1232
  - name: q
1233
1233
  in: query
1234
1234
  required: true
1235
- schema: { type: string, minLength: 2, maxLength: 128 }
1235
+ schema: { type: string, minLength: 2, maxLength: 256 }
1236
1236
  - $ref: "#/components/parameters/Limit"
1237
1237
  - $ref: "#/components/parameters/After"
1238
1238
  responses:
@@ -1445,7 +1445,7 @@ paths:
1445
1445
  - name: q
1446
1446
  in: query
1447
1447
  required: true
1448
- schema: { type: string, minLength: 2, maxLength: 128 }
1448
+ schema: { type: string, minLength: 2, maxLength: 256 }
1449
1449
  - name: chat_id
1450
1450
  in: query
1451
1451
  description: Only this chat
@@ -4453,10 +4453,13 @@ components:
4453
4453
  # ------------------------------------------------------------ auth
4454
4454
  RegisterRequest:
4455
4455
  type: object
4456
- required: [username, display_name, password]
4456
+ required: [username, password]
4457
4457
  properties:
4458
4458
  username: { $ref: "#/components/schemas/Username" }
4459
- display_name: { type: string, minLength: 1, maxLength: 64 }
4459
+ display_name:
4460
+ type: string
4461
+ maxLength: 64
4462
+ description: Defaults to the username when it is missing, empty or only whitespace.
4460
4463
  password: { type: string, minLength: 8, maxLength: 128, writeOnly: true }
4461
4464
  bio: { type: [string, "null"], maxLength: 500 }
4462
4465
  LoginRequest:
@@ -5405,6 +5408,8 @@ components:
5405
5408
  - peer
5406
5409
  - is_pinned
5407
5410
  - unread_count
5411
+ - first_unread_message_id
5412
+ - last_read_message_id
5408
5413
  - last_message
5409
5414
  - created_at
5410
5415
  properties:
@@ -5421,6 +5426,19 @@ components:
5421
5426
  - type: "null"
5422
5427
  is_pinned: { type: boolean }
5423
5428
  unread_count: { type: integer, minimum: 0 }
5429
+ first_unread_message_id:
5430
+ description: |
5431
+ The oldest message the caller has not read (the same messages `unread_count` counts: not their own,
5432
+ not system messages, not deleted); `null` when nothing is unread. Clients open the chat around it and
5433
+ show the "new messages" divider above it.
5434
+ oneOf:
5435
+ - $ref: "#/components/schemas/Id"
5436
+ - type: "null"
5437
+ last_read_message_id:
5438
+ description: The caller's read marker (`POST /chats/{chat_id}/read`); `null` before their first read.
5439
+ oneOf:
5440
+ - $ref: "#/components/schemas/Id"
5441
+ - type: "null"
5424
5442
  last_message:
5425
5443
  oneOf:
5426
5444
  - $ref: "#/components/schemas/Message"
package/dist/schema.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- /* Generated from api/openapi.yaml 2.1.0-alpha.21. Do not edit. */
1
+ /* Generated from api/openapi.yaml 2.1.0-alpha.22. Do not edit. */
2
2
  export interface paths {
3
3
  "/meta": {
4
4
  parameters: {
@@ -2912,7 +2912,8 @@ export interface components {
2912
2912
  };
2913
2913
  RegisterRequest: {
2914
2914
  username: components["schemas"]["Username"];
2915
- display_name: string;
2915
+ /** @description Defaults to the username when it is missing, empty or only whitespace. */
2916
+ display_name?: string;
2916
2917
  password: string;
2917
2918
  bio?: string | null;
2918
2919
  };
@@ -3450,6 +3451,14 @@ export interface components {
3450
3451
  peer: components["schemas"]["User"] | null;
3451
3452
  is_pinned: boolean;
3452
3453
  unread_count: number;
3454
+ /**
3455
+ * @description The oldest message the caller has not read (the same messages `unread_count` counts: not their own,
3456
+ * not system messages, not deleted); `null` when nothing is unread. Clients open the chat around it and
3457
+ * show the "new messages" divider above it.
3458
+ */
3459
+ first_unread_message_id: components["schemas"]["Id"] | null;
3460
+ /** @description The caller's read marker (`POST /chats/{chat_id}/read`); `null` before their first read. */
3461
+ last_read_message_id: components["schemas"]["Id"] | null;
3453
3462
  last_message: components["schemas"]["Message"] | null;
3454
3463
  /** @description Only for groups. */
3455
3464
  my_role?: components["schemas"]["GroupRole"] | null;
package/dist/ws-docs.json CHANGED
@@ -191,6 +191,8 @@
191
191
  },
192
192
  "is_pinned": false,
193
193
  "unread_count": 1,
194
+ "first_unread_message_id": "7217400317439950001",
195
+ "last_read_message_id": null,
194
196
  "last_message": {
195
197
  "id": "7217400317439950001",
196
198
  "chat_id": "42",
@@ -249,6 +251,8 @@
249
251
  },
250
252
  "is_pinned": false,
251
253
  "unread_count": 1,
254
+ "first_unread_message_id": "7217400317439950001",
255
+ "last_read_message_id": null,
252
256
  "last_message": {
253
257
  "id": "7217400317439950001",
254
258
  "chat_id": "42",
@@ -1,4 +1,4 @@
1
- /* Generated from api/openapi.yaml 2.1.0-alpha.21. Do not edit. */
1
+ /* Generated from api/openapi.yaml 2.1.0-alpha.22. Do not edit. */
2
2
 
3
3
  /**
4
4
  * Any WebSocket event, in either direction.
@@ -419,6 +419,17 @@ export interface Chat {
419
419
  peer: User | null;
420
420
  is_pinned: boolean;
421
421
  unread_count: number;
422
+ /**
423
+ * The oldest message the caller has not read (the same messages `unread_count` counts: not their own,
424
+ * not system messages, not deleted); `null` when nothing is unread. Clients open the chat around it and
425
+ * show the "new messages" divider above it.
426
+ *
427
+ */
428
+ first_unread_message_id: Id | null;
429
+ /**
430
+ * The caller's read marker (`POST /chats/{chat_id}/read`); `null` before their first read.
431
+ */
432
+ last_read_message_id: Id | null;
422
433
  last_message: Message | null;
423
434
  /**
424
435
  * Only for groups.
@@ -317,7 +317,6 @@
317
317
  "type": "object",
318
318
  "required": [
319
319
  "username",
320
- "display_name",
321
320
  "password"
322
321
  ],
323
322
  "properties": {
@@ -326,8 +325,8 @@
326
325
  },
327
326
  "display_name": {
328
327
  "type": "string",
329
- "minLength": 1,
330
- "maxLength": 64
328
+ "maxLength": 64,
329
+ "description": "Defaults to the username when it is missing, empty or only whitespace."
331
330
  },
332
331
  "password": {
333
332
  "type": "string",
@@ -2450,6 +2449,8 @@
2450
2449
  "peer",
2451
2450
  "is_pinned",
2452
2451
  "unread_count",
2452
+ "first_unread_message_id",
2453
+ "last_read_message_id",
2453
2454
  "last_message",
2454
2455
  "created_at"
2455
2456
  ],
@@ -2488,6 +2489,28 @@
2488
2489
  "type": "integer",
2489
2490
  "minimum": 0
2490
2491
  },
2492
+ "first_unread_message_id": {
2493
+ "description": "The oldest message the caller has not read (the same messages `unread_count` counts: not their own,\nnot system messages, not deleted); `null` when nothing is unread. Clients open the chat around it and\nshow the \"new messages\" divider above it.\n",
2494
+ "oneOf": [
2495
+ {
2496
+ "$ref": "#/$defs/Id"
2497
+ },
2498
+ {
2499
+ "type": "null"
2500
+ }
2501
+ ]
2502
+ },
2503
+ "last_read_message_id": {
2504
+ "description": "The caller's read marker (`POST /chats/{chat_id}/read`); `null` before their first read.",
2505
+ "oneOf": [
2506
+ {
2507
+ "$ref": "#/$defs/Id"
2508
+ },
2509
+ {
2510
+ "type": "null"
2511
+ }
2512
+ ]
2513
+ },
2491
2514
  "last_message": {
2492
2515
  "oneOf": [
2493
2516
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myronsi/messenger-api",
3
- "version": "2.1.0-alpha.21",
3
+ "version": "2.1.0-alpha.22",
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": {