@myronsi/messenger-api 2.1.0-alpha.2.next.63 → 2.1.0-alpha.4.next.68
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 +12 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/openapi.yaml +59 -3
- package/dist/schema.d.ts +130 -2
- package/dist/ws-events.d.ts +2 -2
- package/dist/ws-events.schema.json +3 -4
- package/package.json +1 -1
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.4
|
|
6
|
+
|
|
7
|
+
- Editing a file message accepts an empty `content` (HTTP `PATCH /messages/{message_id}` and the WebSocket `edit`
|
|
8
|
+
event): it removes the caption. A text message still needs at least one character.
|
|
9
|
+
|
|
10
|
+
## 2.1.0-alpha.3
|
|
11
|
+
|
|
12
|
+
- Adds `GET /notifications/avatar/{token}` and `POST /notifications/read/{token}` without a session, for the
|
|
13
|
+
sender photo and the "Mark as read" action of a web push. Both answer `404` for a forged, expired or ended token.
|
|
14
|
+
- Web push payloads add `preview`, `read_token` and, with previews on, `sender_id` and `avatar_token`. Tokens are bound to the push
|
|
15
|
+
device and its session.
|
|
16
|
+
|
|
5
17
|
## 2.1.0-alpha.2
|
|
6
18
|
|
|
7
19
|
- Adds notification preferences, session-bound push device registration and per-tab activity leases.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* Generated from api/openapi.yaml 2.1.0-alpha.
|
|
2
|
-
export declare const API_VERSION: "2.1.0-alpha.
|
|
1
|
+
/* Generated from api/openapi.yaml 2.1.0-alpha.4. Do not edit. */
|
|
2
|
+
export declare const API_VERSION: "2.1.0-alpha.4";
|
|
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.
|
|
1
|
+
export const API_VERSION = "2.1.0-alpha.4";
|
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.
|
|
4
|
+
version: 2.1.0-alpha.4
|
|
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
|
|
@@ -1281,7 +1281,8 @@ paths:
|
|
|
1281
1281
|
patch:
|
|
1282
1282
|
tags: [messages]
|
|
1283
1283
|
operationId: editMessage
|
|
1284
|
-
summary: Edit your text message
|
|
1284
|
+
summary: Edit your text message or the caption of your file
|
|
1285
|
+
description: An empty `content` removes the caption of a file message; a text message needs at least one character.
|
|
1285
1286
|
requestBody:
|
|
1286
1287
|
required: true
|
|
1287
1288
|
content:
|
|
@@ -1758,6 +1759,58 @@ paths:
|
|
|
1758
1759
|
$ref: "#/components/responses/NotFound"
|
|
1759
1760
|
"409":
|
|
1760
1761
|
$ref: "#/components/responses/Conflict"
|
|
1762
|
+
/notifications/avatar/{token}:
|
|
1763
|
+
parameters:
|
|
1764
|
+
- name: token
|
|
1765
|
+
in: path
|
|
1766
|
+
required: true
|
|
1767
|
+
description: "`avatar_token` of a push notification."
|
|
1768
|
+
schema: { type: string, maxLength: 256 }
|
|
1769
|
+
get:
|
|
1770
|
+
tags: [me]
|
|
1771
|
+
operationId: getNotificationAvatar
|
|
1772
|
+
summary: Sender avatar for a push notification
|
|
1773
|
+
description: |
|
|
1774
|
+
For the service worker, which has no session: the token in the push payload names the recipient
|
|
1775
|
+
and the sender and expires after an hour. Follows the sender's avatar visibility for the recipient.
|
|
1776
|
+
security: []
|
|
1777
|
+
responses:
|
|
1778
|
+
"200":
|
|
1779
|
+
description: Image
|
|
1780
|
+
content:
|
|
1781
|
+
image/*:
|
|
1782
|
+
schema: { type: string, format: binary }
|
|
1783
|
+
"206":
|
|
1784
|
+
description: The requested byte range (`Range` header)
|
|
1785
|
+
content:
|
|
1786
|
+
image/*:
|
|
1787
|
+
schema: { type: string, format: binary }
|
|
1788
|
+
"302":
|
|
1789
|
+
description: Redirect to a short-lived signed storage URL (with `MEDIA_SIGNED_URLS`)
|
|
1790
|
+
"304":
|
|
1791
|
+
description: Not modified (`If-None-Match` with the `ETag` of an earlier answer)
|
|
1792
|
+
"416":
|
|
1793
|
+
description: The requested range is outside the file
|
|
1794
|
+
"404": { $ref: "#/components/responses/NotFound" }
|
|
1795
|
+
/notifications/read/{token}:
|
|
1796
|
+
parameters:
|
|
1797
|
+
- name: token
|
|
1798
|
+
in: path
|
|
1799
|
+
required: true
|
|
1800
|
+
description: "`read_token` of a push notification."
|
|
1801
|
+
schema: { type: string, maxLength: 256 }
|
|
1802
|
+
post:
|
|
1803
|
+
tags: [me]
|
|
1804
|
+
operationId: markNotificationRead
|
|
1805
|
+
summary: Mark a chat read from a push notification
|
|
1806
|
+
description: |
|
|
1807
|
+
For the notification's "Mark as read" action: marks the chat read up to the notified message for
|
|
1808
|
+
the recipient the token names. The token expires after seven days.
|
|
1809
|
+
security: []
|
|
1810
|
+
responses:
|
|
1811
|
+
"204":
|
|
1812
|
+
description: Marked as read
|
|
1813
|
+
"404": { $ref: "#/components/responses/NotFound" }
|
|
1761
1814
|
/me/notification-devices:
|
|
1762
1815
|
post:
|
|
1763
1816
|
tags:
|
|
@@ -2712,7 +2765,10 @@ components:
|
|
|
2712
2765
|
type: object
|
|
2713
2766
|
required: [content]
|
|
2714
2767
|
properties:
|
|
2715
|
-
content:
|
|
2768
|
+
content:
|
|
2769
|
+
type: string
|
|
2770
|
+
maxLength: 4096
|
|
2771
|
+
description: New text, or the new caption of a file. Empty removes a file's caption; a text message rejects it.
|
|
2716
2772
|
ForwardMessageRequest:
|
|
2717
2773
|
type: object
|
|
2718
2774
|
required: [chat_ids]
|
package/dist/schema.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* Generated from api/openapi.yaml 2.1.0-alpha.
|
|
1
|
+
/* Generated from api/openapi.yaml 2.1.0-alpha.4. Do not edit. */
|
|
2
2
|
export interface paths {
|
|
3
3
|
"/meta": {
|
|
4
4
|
parameters: {
|
|
@@ -1029,7 +1029,10 @@ export interface paths {
|
|
|
1029
1029
|
delete: operations["deleteMessage"];
|
|
1030
1030
|
options?: never;
|
|
1031
1031
|
head?: never;
|
|
1032
|
-
/**
|
|
1032
|
+
/**
|
|
1033
|
+
* Edit your text message or the caption of your file
|
|
1034
|
+
* @description An empty `content` removes the caption of a file message; a text message needs at least one character.
|
|
1035
|
+
*/
|
|
1033
1036
|
patch: operations["editMessage"];
|
|
1034
1037
|
trace?: never;
|
|
1035
1038
|
};
|
|
@@ -1358,6 +1361,54 @@ export interface paths {
|
|
|
1358
1361
|
patch?: never;
|
|
1359
1362
|
trace?: never;
|
|
1360
1363
|
};
|
|
1364
|
+
"/notifications/avatar/{token}": {
|
|
1365
|
+
parameters: {
|
|
1366
|
+
query?: never;
|
|
1367
|
+
header?: never;
|
|
1368
|
+
path: {
|
|
1369
|
+
/** @description `avatar_token` of a push notification. */
|
|
1370
|
+
token: string;
|
|
1371
|
+
};
|
|
1372
|
+
cookie?: never;
|
|
1373
|
+
};
|
|
1374
|
+
/**
|
|
1375
|
+
* Sender avatar for a push notification
|
|
1376
|
+
* @description For the service worker, which has no session: the token in the push payload names the recipient
|
|
1377
|
+
* and the sender and expires after an hour. Follows the sender's avatar visibility for the recipient.
|
|
1378
|
+
*/
|
|
1379
|
+
get: operations["getNotificationAvatar"];
|
|
1380
|
+
put?: never;
|
|
1381
|
+
post?: never;
|
|
1382
|
+
delete?: never;
|
|
1383
|
+
options?: never;
|
|
1384
|
+
head?: never;
|
|
1385
|
+
patch?: never;
|
|
1386
|
+
trace?: never;
|
|
1387
|
+
};
|
|
1388
|
+
"/notifications/read/{token}": {
|
|
1389
|
+
parameters: {
|
|
1390
|
+
query?: never;
|
|
1391
|
+
header?: never;
|
|
1392
|
+
path: {
|
|
1393
|
+
/** @description `read_token` of a push notification. */
|
|
1394
|
+
token: string;
|
|
1395
|
+
};
|
|
1396
|
+
cookie?: never;
|
|
1397
|
+
};
|
|
1398
|
+
get?: never;
|
|
1399
|
+
put?: never;
|
|
1400
|
+
/**
|
|
1401
|
+
* Mark a chat read from a push notification
|
|
1402
|
+
* @description For the notification's "Mark as read" action: marks the chat read up to the notified message for
|
|
1403
|
+
* the recipient the token names. The token expires after seven days.
|
|
1404
|
+
*/
|
|
1405
|
+
post: operations["markNotificationRead"];
|
|
1406
|
+
delete?: never;
|
|
1407
|
+
options?: never;
|
|
1408
|
+
head?: never;
|
|
1409
|
+
patch?: never;
|
|
1410
|
+
trace?: never;
|
|
1411
|
+
};
|
|
1361
1412
|
"/me/notification-devices": {
|
|
1362
1413
|
parameters: {
|
|
1363
1414
|
query?: never;
|
|
@@ -1828,6 +1879,7 @@ export interface components {
|
|
|
1828
1879
|
reply_to?: components["schemas"]["Id"] | null;
|
|
1829
1880
|
};
|
|
1830
1881
|
EditMessageRequest: {
|
|
1882
|
+
/** @description New text, or the new caption of a file. Empty removes a file's caption; a text message rejects it. */
|
|
1831
1883
|
content: string;
|
|
1832
1884
|
};
|
|
1833
1885
|
ForwardMessageRequest: {
|
|
@@ -4490,6 +4542,82 @@ export interface operations {
|
|
|
4490
4542
|
409: components["responses"]["Conflict"];
|
|
4491
4543
|
};
|
|
4492
4544
|
};
|
|
4545
|
+
getNotificationAvatar: {
|
|
4546
|
+
parameters: {
|
|
4547
|
+
query?: never;
|
|
4548
|
+
header?: never;
|
|
4549
|
+
path: {
|
|
4550
|
+
/** @description `avatar_token` of a push notification. */
|
|
4551
|
+
token: string;
|
|
4552
|
+
};
|
|
4553
|
+
cookie?: never;
|
|
4554
|
+
};
|
|
4555
|
+
requestBody?: never;
|
|
4556
|
+
responses: {
|
|
4557
|
+
/** @description Image */
|
|
4558
|
+
200: {
|
|
4559
|
+
headers: {
|
|
4560
|
+
[name: string]: unknown;
|
|
4561
|
+
};
|
|
4562
|
+
content: {
|
|
4563
|
+
"image/*": string;
|
|
4564
|
+
};
|
|
4565
|
+
};
|
|
4566
|
+
/** @description The requested byte range (`Range` header) */
|
|
4567
|
+
206: {
|
|
4568
|
+
headers: {
|
|
4569
|
+
[name: string]: unknown;
|
|
4570
|
+
};
|
|
4571
|
+
content: {
|
|
4572
|
+
"image/*": string;
|
|
4573
|
+
};
|
|
4574
|
+
};
|
|
4575
|
+
/** @description Redirect to a short-lived signed storage URL (with `MEDIA_SIGNED_URLS`) */
|
|
4576
|
+
302: {
|
|
4577
|
+
headers: {
|
|
4578
|
+
[name: string]: unknown;
|
|
4579
|
+
};
|
|
4580
|
+
content?: never;
|
|
4581
|
+
};
|
|
4582
|
+
/** @description Not modified (`If-None-Match` with the `ETag` of an earlier answer) */
|
|
4583
|
+
304: {
|
|
4584
|
+
headers: {
|
|
4585
|
+
[name: string]: unknown;
|
|
4586
|
+
};
|
|
4587
|
+
content?: never;
|
|
4588
|
+
};
|
|
4589
|
+
404: components["responses"]["NotFound"];
|
|
4590
|
+
/** @description The requested range is outside the file */
|
|
4591
|
+
416: {
|
|
4592
|
+
headers: {
|
|
4593
|
+
[name: string]: unknown;
|
|
4594
|
+
};
|
|
4595
|
+
content?: never;
|
|
4596
|
+
};
|
|
4597
|
+
};
|
|
4598
|
+
};
|
|
4599
|
+
markNotificationRead: {
|
|
4600
|
+
parameters: {
|
|
4601
|
+
query?: never;
|
|
4602
|
+
header?: never;
|
|
4603
|
+
path: {
|
|
4604
|
+
/** @description `read_token` of a push notification. */
|
|
4605
|
+
token: string;
|
|
4606
|
+
};
|
|
4607
|
+
cookie?: never;
|
|
4608
|
+
};
|
|
4609
|
+
requestBody?: never;
|
|
4610
|
+
responses: {
|
|
4611
|
+
/** @description Marked as read */
|
|
4612
|
+
204: {
|
|
4613
|
+
headers: {
|
|
4614
|
+
[name: string]: unknown;
|
|
4615
|
+
};
|
|
4616
|
+
content?: never;
|
|
4617
|
+
};
|
|
4618
|
+
404: components["responses"]["NotFound"];
|
|
4619
|
+
};
|
|
4620
|
+
};
|
|
4493
4621
|
registerNotificationDevice: {
|
|
4494
4622
|
parameters: {
|
|
4495
4623
|
query?: never;
|
package/dist/ws-events.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* Generated from api/openapi.yaml 2.1.0-alpha.
|
|
1
|
+
/* Generated from api/openapi.yaml 2.1.0-alpha.4. Do not edit. */
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Any WebSocket event, in either direction.
|
|
@@ -97,7 +97,7 @@ export interface ClientDeleteEvent {
|
|
|
97
97
|
};
|
|
98
98
|
}
|
|
99
99
|
/**
|
|
100
|
-
* Edit your own text message.
|
|
100
|
+
* Edit your own text message or the caption of your file. An empty content removes a file's caption.
|
|
101
101
|
*/
|
|
102
102
|
export interface ClientEditEvent {
|
|
103
103
|
type: "edit";
|
|
@@ -1551,8 +1551,8 @@
|
|
|
1551
1551
|
"properties": {
|
|
1552
1552
|
"content": {
|
|
1553
1553
|
"type": "string",
|
|
1554
|
-
"
|
|
1555
|
-
"
|
|
1554
|
+
"maxLength": 4096,
|
|
1555
|
+
"description": "New text, or the new caption of a file. Empty removes a file's caption; a text message rejects it."
|
|
1556
1556
|
}
|
|
1557
1557
|
}
|
|
1558
1558
|
},
|
|
@@ -1965,7 +1965,7 @@
|
|
|
1965
1965
|
},
|
|
1966
1966
|
"ClientEditEvent": {
|
|
1967
1967
|
"title": "ClientEditEvent",
|
|
1968
|
-
"description": "Edit your own text message.",
|
|
1968
|
+
"description": "Edit your own text message or the caption of your file. An empty content removes a file's caption.",
|
|
1969
1969
|
"type": "object",
|
|
1970
1970
|
"properties": {
|
|
1971
1971
|
"type": {
|
|
@@ -1985,7 +1985,6 @@
|
|
|
1985
1985
|
},
|
|
1986
1986
|
"content": {
|
|
1987
1987
|
"type": "string",
|
|
1988
|
-
"minLength": 1,
|
|
1989
1988
|
"maxLength": 4096
|
|
1990
1989
|
}
|
|
1991
1990
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@myronsi/messenger-api",
|
|
3
|
-
"version": "2.1.0-alpha.
|
|
3
|
+
"version": "2.1.0-alpha.4.next.68",
|
|
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": {
|