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

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.34
6
+
7
+ - Requests folder: `Chat` gains the required `is_request`, `true` when a stranger opened the direct chat and the caller
8
+ has not replied, accepted, pinned or archived it yet. Messages in such a chat send the caller no push.
9
+ - `GET /chats` gains `folder` (`main`, the default, `requests` or `all`). Without it the answer holds only the main list.
10
+ - `POST /chats/{chat_id}/accept` moves a chat out of the Requests folder; `GET /chats/requests/count` answers
11
+ `ChatRequestCount` (`requests_count`).
12
+ - WebSocket: `chat_list_update` also goes out when a chat moves out of the Requests folder.
13
+
5
14
  ## 2.1.0-alpha.32
6
15
 
7
16
  - `Attachment` gains `placeholder` (ThumbHash), `processing` (`MediaProcessing`: `queued`, `running`, `done`,
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- /* Generated from api/openapi.yaml 2.1.0-alpha.33. Do not edit. */
2
- export declare const API_VERSION: "2.1.0-alpha.33";
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";
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.33";
1
+ export const API_VERSION = "2.1.0-alpha.34";
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.33
4
+ version: 2.1.0-alpha.34
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
@@ -1475,6 +1475,10 @@ paths:
1475
1475
  message (newest first). `last_message` is the newest message the caller can see; in
1476
1476
  direct chats its `read_by` holds the other user once they read it (with read receipts
1477
1477
  on), in groups it is empty. `unread_count` stops at 999.
1478
+
1479
+ Direct chats that a stranger opened with the caller are in the caller's Requests folder
1480
+ (`is_request`). Without `folder` the answer holds only the main list, so the Requests
1481
+ folder needs `folder=requests` (or `folder=all` for both in one list).
1478
1482
  parameters:
1479
1483
  - $ref: "#/components/parameters/Limit"
1480
1484
  - $ref: "#/components/parameters/After"
@@ -1483,6 +1487,14 @@ paths:
1483
1487
  required: false
1484
1488
  description: "`true`: only archived chats, `false`: only chats that are not archived. Without it, every chat."
1485
1489
  schema: { type: boolean }
1490
+ - name: folder
1491
+ in: query
1492
+ required: false
1493
+ description: "`main`: chats that are not requests (the default). `requests`: the caller's Requests folder. `all`: both."
1494
+ schema:
1495
+ type: string
1496
+ enum: [main, requests, all]
1497
+ default: main
1486
1498
  responses:
1487
1499
  "426": { $ref: "#/components/responses/ClientOutdated" }
1488
1500
  "400": { $ref: "#/components/responses/BadRequest" }
@@ -1502,6 +1514,10 @@ paths:
1502
1514
  chat (`200`) if there already is one. `user_id` may be the caller's own id: that opens
1503
1515
  their "Saved Messages" chat, a direct chat with the caller as its only member and as
1504
1516
  its `peer`.
1517
+
1518
+ When the other user does not count the caller as a contact (no shared chat they took
1519
+ part in, no allow exception), the new chat lands in their Requests folder
1520
+ (`is_request: true` for them only) and its messages send them no push notification.
1505
1521
  requestBody:
1506
1522
  required: true
1507
1523
  content:
@@ -1667,6 +1683,43 @@ paths:
1667
1683
  description: Not archived
1668
1684
  "401": { $ref: "#/components/responses/Unauthorized" }
1669
1685
  "404": { $ref: "#/components/responses/NotFound" }
1686
+ /chats/requests/count:
1687
+ parameters:
1688
+ - $ref: "#/components/parameters/ClientVersion"
1689
+ - $ref: "#/components/parameters/ClientApiVersion"
1690
+ get:
1691
+ tags: [chats]
1692
+ operationId: countChatRequests
1693
+ summary: Number of chats in my Requests folder
1694
+ description: Chats deleted for the caller only count again once a newer message arrives.
1695
+ responses:
1696
+ "426": { $ref: "#/components/responses/ClientOutdated" }
1697
+ "200":
1698
+ description: The number of request chats
1699
+ content:
1700
+ application/json:
1701
+ schema: { $ref: "#/components/schemas/ChatRequestCount" }
1702
+ "401": { $ref: "#/components/responses/Unauthorized" }
1703
+ /chats/{chat_id}/accept:
1704
+ parameters:
1705
+ - $ref: "#/components/parameters/ClientVersion"
1706
+ - $ref: "#/components/parameters/ClientApiVersion"
1707
+ - $ref: "#/components/parameters/ChatId"
1708
+ post:
1709
+ tags: [chats]
1710
+ operationId: acceptChatRequest
1711
+ summary: Move a chat out of the Requests folder
1712
+ description: |
1713
+ The chat moves to the caller's main list (`is_request: false`) and the caller's devices get
1714
+ `chat_list_update`. Sending a message in the chat, pinning it or archiving it does the same.
1715
+ Reading it does not. Accepting a chat that is not a request changes nothing.
1716
+ responses:
1717
+ "426": { $ref: "#/components/responses/ClientOutdated" }
1718
+ "400": { $ref: "#/components/responses/BadRequest" }
1719
+ "204":
1720
+ description: Accepted
1721
+ "401": { $ref: "#/components/responses/Unauthorized" }
1722
+ "404": { $ref: "#/components/responses/NotFound" }
1670
1723
  /chats/pins/order:
1671
1724
  parameters:
1672
1725
  - $ref: "#/components/parameters/ClientVersion"
@@ -6882,6 +6935,7 @@ components:
6882
6935
  - is_pinned
6883
6936
  - pin_position
6884
6937
  - is_archived
6938
+ - is_request
6885
6939
  - unread_count
6886
6940
  - first_unread_message_id
6887
6941
  - last_read_message_id
@@ -6906,6 +6960,11 @@ components:
6906
6960
  is_archived:
6907
6961
  type: boolean
6908
6962
  description: Whether the caller archived the chat (only for the caller).
6963
+ is_request:
6964
+ type: boolean
6965
+ description: |
6966
+ Whether the chat is in the caller's Requests folder: a stranger opened it, and the caller has not
6967
+ replied, accepted, pinned or archived it yet (only for the caller).
6909
6968
  unread_count: { type: integer, minimum: 0 }
6910
6969
  first_unread_message_id:
6911
6970
  description: |
@@ -6930,6 +6989,11 @@ components:
6930
6989
  - $ref: "#/components/schemas/GroupRole"
6931
6990
  - type: "null"
6932
6991
  created_at: { $ref: "#/components/schemas/Timestamp" }
6992
+ ChatRequestCount:
6993
+ type: object
6994
+ required: [requests_count]
6995
+ properties:
6996
+ requests_count: { type: integer, minimum: 0 }
6933
6997
  ChatPage:
6934
6998
  type: object
6935
6999
  required: [items, next_cursor]
package/dist/schema.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- /* Generated from api/openapi.yaml 2.1.0-alpha.33. Do not edit. */
1
+ /* Generated from api/openapi.yaml 2.1.0-alpha.34. Do not edit. */
2
2
  export interface paths {
3
3
  "/meta": {
4
4
  parameters: {
@@ -1249,6 +1249,10 @@ export interface paths {
1249
1249
  * message (newest first). `last_message` is the newest message the caller can see; in
1250
1250
  * direct chats its `read_by` holds the other user once they read it (with read receipts
1251
1251
  * on), in groups it is empty. `unread_count` stops at 999.
1252
+ *
1253
+ * Direct chats that a stranger opened with the caller are in the caller's Requests folder
1254
+ * (`is_request`). Without `folder` the answer holds only the main list, so the Requests
1255
+ * folder needs `folder=requests` (or `folder=all` for both in one list).
1252
1256
  */
1253
1257
  get: operations["listChats"];
1254
1258
  put?: never;
@@ -1259,6 +1263,10 @@ export interface paths {
1259
1263
  * chat (`200`) if there already is one. `user_id` may be the caller's own id: that opens
1260
1264
  * their "Saved Messages" chat, a direct chat with the caller as its only member and as
1261
1265
  * its `peer`.
1266
+ *
1267
+ * When the other user does not count the caller as a contact (no shared chat they took
1268
+ * part in, no allow exception), the new chat lands in their Requests folder
1269
+ * (`is_request: true` for them only) and its messages send them no push notification.
1262
1270
  */
1263
1271
  post: operations["createChat"];
1264
1272
  delete?: never;
@@ -1390,6 +1398,60 @@ export interface paths {
1390
1398
  patch?: never;
1391
1399
  trace?: never;
1392
1400
  };
1401
+ "/chats/requests/count": {
1402
+ parameters: {
1403
+ query?: never;
1404
+ header?: {
1405
+ /** @description Version of the client app, for logs and the per-client metric. */
1406
+ "X-Client-Version"?: components["parameters"]["ClientVersion"];
1407
+ /** @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`). */
1408
+ "X-Client-Api-Version"?: components["parameters"]["ClientApiVersion"];
1409
+ };
1410
+ path?: never;
1411
+ cookie?: never;
1412
+ };
1413
+ /**
1414
+ * Number of chats in my Requests folder
1415
+ * @description Chats deleted for the caller only count again once a newer message arrives.
1416
+ */
1417
+ get: operations["countChatRequests"];
1418
+ put?: never;
1419
+ post?: never;
1420
+ delete?: never;
1421
+ options?: never;
1422
+ head?: never;
1423
+ patch?: never;
1424
+ trace?: never;
1425
+ };
1426
+ "/chats/{chat_id}/accept": {
1427
+ parameters: {
1428
+ query?: never;
1429
+ header?: {
1430
+ /** @description Version of the client app, for logs and the per-client metric. */
1431
+ "X-Client-Version"?: components["parameters"]["ClientVersion"];
1432
+ /** @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`). */
1433
+ "X-Client-Api-Version"?: components["parameters"]["ClientApiVersion"];
1434
+ };
1435
+ path: {
1436
+ chat_id: components["parameters"]["ChatId"];
1437
+ };
1438
+ cookie?: never;
1439
+ };
1440
+ get?: never;
1441
+ put?: never;
1442
+ /**
1443
+ * Move a chat out of the Requests folder
1444
+ * @description The chat moves to the caller's main list (`is_request: false`) and the caller's devices get
1445
+ * `chat_list_update`. Sending a message in the chat, pinning it or archiving it does the same.
1446
+ * Reading it does not. Accepting a chat that is not a request changes nothing.
1447
+ */
1448
+ post: operations["acceptChatRequest"];
1449
+ delete?: never;
1450
+ options?: never;
1451
+ head?: never;
1452
+ patch?: never;
1453
+ trace?: never;
1454
+ };
1393
1455
  "/chats/pins/order": {
1394
1456
  parameters: {
1395
1457
  query?: never;
@@ -4659,6 +4721,11 @@ export interface components {
4659
4721
  pin_position: number | null;
4660
4722
  /** @description Whether the caller archived the chat (only for the caller). */
4661
4723
  is_archived: boolean;
4724
+ /**
4725
+ * @description Whether the chat is in the caller's Requests folder: a stranger opened it, and the caller has not
4726
+ * replied, accepted, pinned or archived it yet (only for the caller).
4727
+ */
4728
+ is_request: boolean;
4662
4729
  unread_count: number;
4663
4730
  /**
4664
4731
  * @description The oldest message the caller has not read (the same messages `unread_count` counts: not their own,
@@ -4673,6 +4740,9 @@ export interface components {
4673
4740
  my_role?: components["schemas"]["GroupRole"] | null;
4674
4741
  created_at: components["schemas"]["Timestamp"];
4675
4742
  };
4743
+ ChatRequestCount: {
4744
+ requests_count: number;
4745
+ };
4676
4746
  ChatPage: {
4677
4747
  items: components["schemas"]["Chat"][];
4678
4748
  next_cursor: components["schemas"]["Cursor"];
@@ -7199,6 +7269,8 @@ export interface operations {
7199
7269
  after?: components["parameters"]["After"];
7200
7270
  /** @description `true`: only archived chats, `false`: only chats that are not archived. Without it, every chat. */
7201
7271
  archived?: boolean;
7272
+ /** @description `main`: chats that are not requests (the default). `requests`: the caller's Requests folder. `all`: both. */
7273
+ folder?: "main" | "requests" | "all";
7202
7274
  };
7203
7275
  header?: {
7204
7276
  /** @description Version of the client app, for logs and the per-client metric. */
@@ -7494,6 +7566,62 @@ export interface operations {
7494
7566
  426: components["responses"]["ClientOutdated"];
7495
7567
  };
7496
7568
  };
7569
+ countChatRequests: {
7570
+ parameters: {
7571
+ query?: never;
7572
+ header?: {
7573
+ /** @description Version of the client app, for logs and the per-client metric. */
7574
+ "X-Client-Version"?: components["parameters"]["ClientVersion"];
7575
+ /** @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`). */
7576
+ "X-Client-Api-Version"?: components["parameters"]["ClientApiVersion"];
7577
+ };
7578
+ path?: never;
7579
+ cookie?: never;
7580
+ };
7581
+ requestBody?: never;
7582
+ responses: {
7583
+ /** @description The number of request chats */
7584
+ 200: {
7585
+ headers: {
7586
+ [name: string]: unknown;
7587
+ };
7588
+ content: {
7589
+ "application/json": components["schemas"]["ChatRequestCount"];
7590
+ };
7591
+ };
7592
+ 401: components["responses"]["Unauthorized"];
7593
+ 426: components["responses"]["ClientOutdated"];
7594
+ };
7595
+ };
7596
+ acceptChatRequest: {
7597
+ parameters: {
7598
+ query?: never;
7599
+ header?: {
7600
+ /** @description Version of the client app, for logs and the per-client metric. */
7601
+ "X-Client-Version"?: components["parameters"]["ClientVersion"];
7602
+ /** @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`). */
7603
+ "X-Client-Api-Version"?: components["parameters"]["ClientApiVersion"];
7604
+ };
7605
+ path: {
7606
+ chat_id: components["parameters"]["ChatId"];
7607
+ };
7608
+ cookie?: never;
7609
+ };
7610
+ requestBody?: never;
7611
+ responses: {
7612
+ /** @description Accepted */
7613
+ 204: {
7614
+ headers: {
7615
+ [name: string]: unknown;
7616
+ };
7617
+ content?: never;
7618
+ };
7619
+ 400: components["responses"]["BadRequest"];
7620
+ 401: components["responses"]["Unauthorized"];
7621
+ 404: components["responses"]["NotFound"];
7622
+ 426: components["responses"]["ClientOutdated"];
7623
+ };
7624
+ };
7497
7625
  reorderPinnedChats: {
7498
7626
  parameters: {
7499
7627
  query?: never;
package/dist/ws-docs.json CHANGED
@@ -223,6 +223,7 @@
223
223
  "is_pinned": false,
224
224
  "pin_position": null,
225
225
  "is_archived": false,
226
+ "is_request": false,
226
227
  "unread_count": 1,
227
228
  "first_unread_message_id": "7217400317439950001",
228
229
  "last_read_message_id": null,
@@ -295,6 +296,7 @@
295
296
  "is_pinned": false,
296
297
  "pin_position": null,
297
298
  "is_archived": false,
299
+ "is_request": false,
298
300
  "unread_count": 1,
299
301
  "first_unread_message_id": "7217400317439950001",
300
302
  "last_read_message_id": null,
@@ -1,4 +1,4 @@
1
- /* Generated from api/openapi.yaml 2.1.0-alpha.33. Do not edit. */
1
+ /* Generated from api/openapi.yaml 2.1.0-alpha.34. Do not edit. */
2
2
 
3
3
  /**
4
4
  * Any WebSocket event, in either direction.
@@ -622,6 +622,12 @@ export interface Chat {
622
622
  * Whether the caller archived the chat (only for the caller).
623
623
  */
624
624
  is_archived: boolean;
625
+ /**
626
+ * Whether the chat is in the caller's Requests folder: a stranger opened it, and the caller has not
627
+ * replied, accepted, pinned or archived it yet (only for the caller).
628
+ *
629
+ */
630
+ is_request: boolean;
625
631
  unread_count: number;
626
632
  /**
627
633
  * The oldest message the caller has not read (the same messages `unread_count` counts: not their own,
@@ -784,7 +790,7 @@ export interface ServerChatDeletedEvent {
784
790
  data: {};
785
791
  }
786
792
  /**
787
- * The chat-list entry changed (last message, unread count, pin).
793
+ * The chat-list entry changed (last message, unread count, pin, archive, leaving the Requests folder).
788
794
  */
789
795
  export interface ServerChatListUpdateEvent {
790
796
  type: "chat_list_update";
@@ -3345,6 +3345,7 @@
3345
3345
  "is_pinned",
3346
3346
  "pin_position",
3347
3347
  "is_archived",
3348
+ "is_request",
3348
3349
  "unread_count",
3349
3350
  "first_unread_message_id",
3350
3351
  "last_read_message_id",
@@ -3393,6 +3394,10 @@
3393
3394
  "type": "boolean",
3394
3395
  "description": "Whether the caller archived the chat (only for the caller)."
3395
3396
  },
3397
+ "is_request": {
3398
+ "type": "boolean",
3399
+ "description": "Whether the chat is in the caller's Requests folder: a stranger opened it, and the caller has not\nreplied, accepted, pinned or archived it yet (only for the caller).\n"
3400
+ },
3396
3401
  "unread_count": {
3397
3402
  "type": "integer",
3398
3403
  "minimum": 0
@@ -3445,6 +3450,18 @@
3445
3450
  }
3446
3451
  }
3447
3452
  },
3453
+ "ChatRequestCount": {
3454
+ "type": "object",
3455
+ "required": [
3456
+ "requests_count"
3457
+ ],
3458
+ "properties": {
3459
+ "requests_count": {
3460
+ "type": "integer",
3461
+ "minimum": 0
3462
+ }
3463
+ }
3464
+ },
3448
3465
  "ChatPage": {
3449
3466
  "type": "object",
3450
3467
  "required": [
@@ -5443,7 +5460,7 @@
5443
5460
  },
5444
5461
  "ServerChatListUpdateEvent": {
5445
5462
  "title": "ServerChatListUpdateEvent",
5446
- "description": "The chat-list entry changed (last message, unread count, pin).",
5463
+ "description": "The chat-list entry changed (last message, unread count, pin, archive, leaving the Requests folder).",
5447
5464
  "type": "object",
5448
5465
  "properties": {
5449
5466
  "type": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myronsi/messenger-api",
3
- "version": "2.1.0-alpha.33.next.121",
3
+ "version": "2.1.0-alpha.34.next.123",
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": {