@myronsi/messenger-api 2.1.0-alpha.4.next.68 → 2.1.0-alpha.6.next.71
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 +34 -3
- package/dist/schema.d.ts +22 -3
- package/dist/ws-events.d.ts +20 -2
- package/dist/ws-events.schema.json +55 -1
- 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.6
|
|
6
|
+
|
|
7
|
+
- `Message` adds optional `reply_preview` (`ReplyPreview`: id, type, sender, the first 100 characters of the
|
|
8
|
+
text, attachment, is_deleted) on history pages and `message` events, so a reply shows what it answers even
|
|
9
|
+
when that message is not loaded. It is absent when the answered message is gone or hidden for the recipient.
|
|
10
|
+
|
|
11
|
+
## 2.1.0-alpha.5
|
|
12
|
+
|
|
13
|
+
- A user's `avatar_url` adds `?rev={revision}`, which changes with every new avatar. `GET /users/{user_id}/avatar`
|
|
14
|
+
accepts `rev`; while it matches the current avatar, the answer is `Cache-Control: private, max-age=31536000, immutable`.
|
|
15
|
+
- `GET /attachments/{attachment_id}/content` is cached for a year (`immutable`): an attachment's bytes never change.
|
|
16
|
+
|
|
5
17
|
## 2.1.0-alpha.4
|
|
6
18
|
|
|
7
19
|
- Editing a file message accepts an empty `content` (HTTP `PATCH /messages/{message_id}` and the WebSocket `edit`
|
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.6. Do not edit. */
|
|
2
|
+
export declare const API_VERSION: "2.1.0-alpha.6";
|
|
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.6";
|
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.6
|
|
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
|
|
@@ -825,12 +825,18 @@ paths:
|
|
|
825
825
|
summary: Current avatar image
|
|
826
826
|
description: |
|
|
827
827
|
Respects the avatar visibility of the user; falls back to the default avatar. With `version`, an
|
|
828
|
-
earlier avatar of the history (`AvatarVersion.url`).
|
|
828
|
+
earlier avatar of the history (`AvatarVersion.url`). `avatar_url` carries `rev`, the revision of the
|
|
829
|
+
current avatar: while it matches, the answer may be cached for a year (`immutable`), because a new
|
|
830
|
+
avatar gets a new `rev` and so a new URL.
|
|
829
831
|
parameters:
|
|
830
832
|
- name: version
|
|
831
833
|
in: query
|
|
832
834
|
description: "`id` of an `AvatarVersion` of this user."
|
|
833
835
|
schema: { $ref: "#/components/schemas/Id" }
|
|
836
|
+
- name: rev
|
|
837
|
+
in: query
|
|
838
|
+
description: Revision of the current avatar, as given in `avatar_url`.
|
|
839
|
+
schema: { type: string, maxLength: 64 }
|
|
834
840
|
responses:
|
|
835
841
|
"426": { $ref: "#/components/responses/ClientOutdated" }
|
|
836
842
|
"400": { $ref: "#/components/responses/BadRequest" }
|
|
@@ -2518,7 +2524,7 @@ components:
|
|
|
2518
2524
|
description: The requesting user's own name for this user, if set.
|
|
2519
2525
|
avatar_url:
|
|
2520
2526
|
type: [string, "null"]
|
|
2521
|
-
description: Path of the avatar, always same-origin (`/api/v2/users/{id}/avatar`).
|
|
2527
|
+
description: Path of the avatar, always same-origin (`/api/v2/users/{id}/avatar?rev={revision}`).
|
|
2522
2528
|
bio: { type: [string, "null"] }
|
|
2523
2529
|
is_online: { type: boolean }
|
|
2524
2530
|
last_seen:
|
|
@@ -2635,6 +2641,29 @@ components:
|
|
|
2635
2641
|
- $ref: "#/components/schemas/Id"
|
|
2636
2642
|
- type: "null"
|
|
2637
2643
|
sender_name: { type: string }
|
|
2644
|
+
ReplyPreview:
|
|
2645
|
+
type: object
|
|
2646
|
+
description: |
|
|
2647
|
+
What a reply shows of the message it answers, so a client can draw the quote without loading that
|
|
2648
|
+
message. Set on messages of history pages and `message` events when the recipient can see the answered
|
|
2649
|
+
message; absent when it is gone or hidden for them, and on chat-list previews and search results.
|
|
2650
|
+
required: [id, type, sender, content, attachment, is_deleted]
|
|
2651
|
+
properties:
|
|
2652
|
+
id: { $ref: "#/components/schemas/Id" }
|
|
2653
|
+
type: { $ref: "#/components/schemas/MessageType" }
|
|
2654
|
+
sender:
|
|
2655
|
+
oneOf:
|
|
2656
|
+
- $ref: "#/components/schemas/User"
|
|
2657
|
+
- type: "null"
|
|
2658
|
+
content:
|
|
2659
|
+
type: [string, "null"]
|
|
2660
|
+
maxLength: 100
|
|
2661
|
+
description: The first 100 characters of the text or caption; `null` when deleted or empty.
|
|
2662
|
+
attachment:
|
|
2663
|
+
oneOf:
|
|
2664
|
+
- $ref: "#/components/schemas/Attachment"
|
|
2665
|
+
- type: "null"
|
|
2666
|
+
is_deleted: { type: boolean }
|
|
2638
2667
|
Message:
|
|
2639
2668
|
type: object
|
|
2640
2669
|
required:
|
|
@@ -2672,6 +2701,8 @@ components:
|
|
|
2672
2701
|
oneOf:
|
|
2673
2702
|
- $ref: "#/components/schemas/Id"
|
|
2674
2703
|
- type: "null"
|
|
2704
|
+
reply_preview:
|
|
2705
|
+
$ref: "#/components/schemas/ReplyPreview"
|
|
2675
2706
|
forwarded_from:
|
|
2676
2707
|
oneOf:
|
|
2677
2708
|
- $ref: "#/components/schemas/ForwardedFrom"
|
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.6. Do not edit. */
|
|
2
2
|
export interface paths {
|
|
3
3
|
"/meta": {
|
|
4
4
|
parameters: {
|
|
@@ -681,7 +681,9 @@ export interface paths {
|
|
|
681
681
|
/**
|
|
682
682
|
* Current avatar image
|
|
683
683
|
* @description Respects the avatar visibility of the user; falls back to the default avatar. With `version`, an
|
|
684
|
-
* earlier avatar of the history (`AvatarVersion.url`).
|
|
684
|
+
* earlier avatar of the history (`AvatarVersion.url`). `avatar_url` carries `rev`, the revision of the
|
|
685
|
+
* current avatar: while it matches, the answer may be cached for a year (`immutable`), because a new
|
|
686
|
+
* avatar gets a new `rev` and so a new URL.
|
|
685
687
|
*/
|
|
686
688
|
get: operations["getUserAvatar"];
|
|
687
689
|
put?: never;
|
|
@@ -1756,7 +1758,7 @@ export interface components {
|
|
|
1756
1758
|
display_name: string;
|
|
1757
1759
|
/** @description The requesting user's own name for this user, if set. */
|
|
1758
1760
|
contact_name?: string | null;
|
|
1759
|
-
/** @description Path of the avatar, always same-origin (`/api/v2/users/{id}/avatar`). */
|
|
1761
|
+
/** @description Path of the avatar, always same-origin (`/api/v2/users/{id}/avatar?rev={revision}`). */
|
|
1760
1762
|
avatar_url: string | null;
|
|
1761
1763
|
bio: string | null;
|
|
1762
1764
|
is_online: boolean;
|
|
@@ -1826,6 +1828,20 @@ export interface components {
|
|
|
1826
1828
|
sender_id: components["schemas"]["Id"] | null;
|
|
1827
1829
|
sender_name: string;
|
|
1828
1830
|
};
|
|
1831
|
+
/**
|
|
1832
|
+
* @description What a reply shows of the message it answers, so a client can draw the quote without loading that
|
|
1833
|
+
* message. Set on messages of history pages and `message` events when the recipient can see the answered
|
|
1834
|
+
* message; absent when it is gone or hidden for them, and on chat-list previews and search results.
|
|
1835
|
+
*/
|
|
1836
|
+
ReplyPreview: {
|
|
1837
|
+
id: components["schemas"]["Id"];
|
|
1838
|
+
type: components["schemas"]["MessageType"];
|
|
1839
|
+
sender: components["schemas"]["User"] | null;
|
|
1840
|
+
/** @description The first 100 characters of the text or caption; `null` when deleted or empty. */
|
|
1841
|
+
content: string | null;
|
|
1842
|
+
attachment: components["schemas"]["Attachment"] | null;
|
|
1843
|
+
is_deleted: boolean;
|
|
1844
|
+
};
|
|
1829
1845
|
Message: {
|
|
1830
1846
|
id: components["schemas"]["Id"];
|
|
1831
1847
|
chat_id: components["schemas"]["Id"];
|
|
@@ -1836,6 +1852,7 @@ export interface components {
|
|
|
1836
1852
|
content: string | null;
|
|
1837
1853
|
attachment: components["schemas"]["Attachment"] | null;
|
|
1838
1854
|
reply_to: components["schemas"]["Id"] | null;
|
|
1855
|
+
reply_preview?: components["schemas"]["ReplyPreview"];
|
|
1839
1856
|
forwarded_from: components["schemas"]["ForwardedFrom"] | null;
|
|
1840
1857
|
reactions: components["schemas"]["Reaction"][];
|
|
1841
1858
|
read_by: components["schemas"]["ReadReceipt"][];
|
|
@@ -3195,6 +3212,8 @@ export interface operations {
|
|
|
3195
3212
|
query?: {
|
|
3196
3213
|
/** @description `id` of an `AvatarVersion` of this user. */
|
|
3197
3214
|
version?: components["schemas"]["Id"];
|
|
3215
|
+
/** @description Revision of the current avatar, as given in `avatar_url`. */
|
|
3216
|
+
rev?: string;
|
|
3198
3217
|
};
|
|
3199
3218
|
header?: {
|
|
3200
3219
|
/** @description Version of the client app, for logs and the per-client metric. */
|
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.6. Do not edit. */
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Any WebSocket event, in either direction.
|
|
@@ -253,7 +253,7 @@ export interface User {
|
|
|
253
253
|
*/
|
|
254
254
|
contact_name?: string | null;
|
|
255
255
|
/**
|
|
256
|
-
* Path of the avatar, always same-origin (`/api/v2/users/{id}/avatar`).
|
|
256
|
+
* Path of the avatar, always same-origin (`/api/v2/users/{id}/avatar?rev={revision}`).
|
|
257
257
|
*/
|
|
258
258
|
avatar_url: string | null;
|
|
259
259
|
bio: string | null;
|
|
@@ -307,6 +307,7 @@ export interface Message {
|
|
|
307
307
|
content: string | null;
|
|
308
308
|
attachment: Attachment | null;
|
|
309
309
|
reply_to: Id | null;
|
|
310
|
+
reply_preview?: ReplyPreview;
|
|
310
311
|
forwarded_from: ForwardedFrom | null;
|
|
311
312
|
reactions: Reaction[];
|
|
312
313
|
read_by: ReadReceipt[];
|
|
@@ -337,6 +338,23 @@ export interface Attachment {
|
|
|
337
338
|
duration_ms?: number | null;
|
|
338
339
|
waveform?: number[] | null;
|
|
339
340
|
}
|
|
341
|
+
/**
|
|
342
|
+
* What a reply shows of the message it answers, so a client can draw the quote without loading that
|
|
343
|
+
* message. Set on messages of history pages and `message` events when the recipient can see the answered
|
|
344
|
+
* message; absent when it is gone or hidden for them, and on chat-list previews and search results.
|
|
345
|
+
*
|
|
346
|
+
*/
|
|
347
|
+
export interface ReplyPreview {
|
|
348
|
+
id: Id;
|
|
349
|
+
type: MessageType;
|
|
350
|
+
sender: User | null;
|
|
351
|
+
/**
|
|
352
|
+
* The first 100 characters of the text or caption; `null` when deleted or empty.
|
|
353
|
+
*/
|
|
354
|
+
content: string | null;
|
|
355
|
+
attachment: Attachment | null;
|
|
356
|
+
is_deleted: boolean;
|
|
357
|
+
}
|
|
340
358
|
export interface ForwardedFrom {
|
|
341
359
|
message_id: Id;
|
|
342
360
|
sender_id: Id | null;
|
|
@@ -979,7 +979,7 @@
|
|
|
979
979
|
"string",
|
|
980
980
|
"null"
|
|
981
981
|
],
|
|
982
|
-
"description": "Path of the avatar, always same-origin (`/api/v2/users/{id}/avatar`)."
|
|
982
|
+
"description": "Path of the avatar, always same-origin (`/api/v2/users/{id}/avatar?rev={revision}`)."
|
|
983
983
|
},
|
|
984
984
|
"bio": {
|
|
985
985
|
"type": [
|
|
@@ -1276,6 +1276,57 @@
|
|
|
1276
1276
|
}
|
|
1277
1277
|
}
|
|
1278
1278
|
},
|
|
1279
|
+
"ReplyPreview": {
|
|
1280
|
+
"type": "object",
|
|
1281
|
+
"description": "What a reply shows of the message it answers, so a client can draw the quote without loading that\nmessage. Set on messages of history pages and `message` events when the recipient can see the answered\nmessage; absent when it is gone or hidden for them, and on chat-list previews and search results.\n",
|
|
1282
|
+
"required": [
|
|
1283
|
+
"id",
|
|
1284
|
+
"type",
|
|
1285
|
+
"sender",
|
|
1286
|
+
"content",
|
|
1287
|
+
"attachment",
|
|
1288
|
+
"is_deleted"
|
|
1289
|
+
],
|
|
1290
|
+
"properties": {
|
|
1291
|
+
"id": {
|
|
1292
|
+
"$ref": "#/$defs/Id"
|
|
1293
|
+
},
|
|
1294
|
+
"type": {
|
|
1295
|
+
"$ref": "#/$defs/MessageType"
|
|
1296
|
+
},
|
|
1297
|
+
"sender": {
|
|
1298
|
+
"oneOf": [
|
|
1299
|
+
{
|
|
1300
|
+
"$ref": "#/$defs/User"
|
|
1301
|
+
},
|
|
1302
|
+
{
|
|
1303
|
+
"type": "null"
|
|
1304
|
+
}
|
|
1305
|
+
]
|
|
1306
|
+
},
|
|
1307
|
+
"content": {
|
|
1308
|
+
"type": [
|
|
1309
|
+
"string",
|
|
1310
|
+
"null"
|
|
1311
|
+
],
|
|
1312
|
+
"maxLength": 100,
|
|
1313
|
+
"description": "The first 100 characters of the text or caption; `null` when deleted or empty."
|
|
1314
|
+
},
|
|
1315
|
+
"attachment": {
|
|
1316
|
+
"oneOf": [
|
|
1317
|
+
{
|
|
1318
|
+
"$ref": "#/$defs/Attachment"
|
|
1319
|
+
},
|
|
1320
|
+
{
|
|
1321
|
+
"type": "null"
|
|
1322
|
+
}
|
|
1323
|
+
]
|
|
1324
|
+
},
|
|
1325
|
+
"is_deleted": {
|
|
1326
|
+
"type": "boolean"
|
|
1327
|
+
}
|
|
1328
|
+
}
|
|
1329
|
+
},
|
|
1279
1330
|
"Message": {
|
|
1280
1331
|
"type": "object",
|
|
1281
1332
|
"required": [
|
|
@@ -1342,6 +1393,9 @@
|
|
|
1342
1393
|
}
|
|
1343
1394
|
]
|
|
1344
1395
|
},
|
|
1396
|
+
"reply_preview": {
|
|
1397
|
+
"$ref": "#/$defs/ReplyPreview"
|
|
1398
|
+
},
|
|
1345
1399
|
"forwarded_from": {
|
|
1346
1400
|
"oneOf": [
|
|
1347
1401
|
{
|
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.6.next.71",
|
|
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": {
|