@myronsi/messenger-api 2.0.0-alpha.4.next.44 → 2.0.0-alpha.6.next.48
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 +18 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/openapi.yaml +24 -5
- package/dist/schema.d.ts +29 -7
- package/dist/ws-events.d.ts +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,24 @@
|
|
|
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.0.0-alpha.6
|
|
6
|
+
|
|
7
|
+
Groups, found while implementing them:
|
|
8
|
+
|
|
9
|
+
- `POST /groups` can answer `403`: a member who does not allow invitations from the caller fails the request.
|
|
10
|
+
- `PUT /groups/{chat_id}/avatar` (`422`: not an image the caller uploaded as an avatar) and
|
|
11
|
+
`POST /groups/{chat_id}/transfer-owner` (`422`: to yourself) document their validation errors.
|
|
12
|
+
|
|
13
|
+
## 2.0.0-alpha.5
|
|
14
|
+
|
|
15
|
+
Chats, found while implementing the chat list:
|
|
16
|
+
|
|
17
|
+
- `DELETE /chats/{chat_id}` deletes a direct chat for both users (as v1 did), not "for yourself"; a group is `422`.
|
|
18
|
+
- `POST /chats` can answer `422` (a chat with yourself, a too long `initial_message`).
|
|
19
|
+
- `PUT /chats/{chat_id}/pin`: at most 10 pinned chats (`409`).
|
|
20
|
+
- `GET /chats` documents its order, what `last_message` and its `read_by` hold, and that `unread_count` stops at 999.
|
|
21
|
+
- `DELETE /me` can answer `429` (repeated wrong passwords).
|
|
22
|
+
|
|
5
23
|
## 2.0.0-alpha.4
|
|
6
24
|
|
|
7
25
|
Media, found while implementing uploads:
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* Generated from api/openapi.yaml 2.0.0-alpha.
|
|
2
|
-
export declare const API_VERSION: "2.0.0-alpha.
|
|
1
|
+
/* Generated from api/openapi.yaml 2.0.0-alpha.6. Do not edit. */
|
|
2
|
+
export declare const API_VERSION: "2.0.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.0.0-alpha.
|
|
1
|
+
export const API_VERSION = "2.0.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.0.0-alpha.
|
|
4
|
+
version: 2.0.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
|
|
@@ -324,6 +324,7 @@ paths:
|
|
|
324
324
|
description: Account deleted
|
|
325
325
|
"401": { $ref: "#/components/responses/Unauthorized" }
|
|
326
326
|
"403": { $ref: "#/components/responses/Forbidden" }
|
|
327
|
+
"429": { $ref: "#/components/responses/TooManyRequests" }
|
|
327
328
|
/me/avatar:
|
|
328
329
|
parameters:
|
|
329
330
|
- $ref: "#/components/parameters/ClientVersion"
|
|
@@ -884,7 +885,12 @@ paths:
|
|
|
884
885
|
tags: [chats]
|
|
885
886
|
operationId: listChats
|
|
886
887
|
summary: My chats with last message and unread count
|
|
887
|
-
description:
|
|
888
|
+
description: |
|
|
889
|
+
One request replaces `GET /chats/list/{username}` and `GET /groups/list/{username}`.
|
|
890
|
+
Pinned chats come first (most recently pinned first), then the others by their last
|
|
891
|
+
message (newest first). `last_message` is the newest message the caller can see; in
|
|
892
|
+
direct chats its `read_by` holds the other user once they read it (with read receipts
|
|
893
|
+
on), in groups it is empty. `unread_count` stops at 999.
|
|
888
894
|
parameters:
|
|
889
895
|
- $ref: "#/components/parameters/Limit"
|
|
890
896
|
- $ref: "#/components/parameters/After"
|
|
@@ -931,6 +937,7 @@ paths:
|
|
|
931
937
|
"401": { $ref: "#/components/responses/Unauthorized" }
|
|
932
938
|
"403": { $ref: "#/components/responses/Forbidden" }
|
|
933
939
|
"404": { $ref: "#/components/responses/NotFound" }
|
|
940
|
+
"422": { $ref: "#/components/responses/ValidationFailed" }
|
|
934
941
|
"429": { $ref: "#/components/responses/TooManyRequests" }
|
|
935
942
|
/chats/{chat_id}:
|
|
936
943
|
parameters:
|
|
@@ -954,8 +961,11 @@ paths:
|
|
|
954
961
|
delete:
|
|
955
962
|
tags: [chats]
|
|
956
963
|
operationId: deleteChat
|
|
957
|
-
summary: Delete a direct chat
|
|
958
|
-
description:
|
|
964
|
+
summary: Delete a direct chat
|
|
965
|
+
description: |
|
|
966
|
+
Deletes the chat and its messages for both users (as v1 did); both get `chat_deleted`.
|
|
967
|
+
For groups use `DELETE /groups/{chat_id}` (owner) or `POST /groups/{chat_id}/leave`;
|
|
968
|
+
a group here is `422`.
|
|
959
969
|
responses:
|
|
960
970
|
"426": { $ref: "#/components/responses/ClientOutdated" }
|
|
961
971
|
"400": { $ref: "#/components/responses/BadRequest" }
|
|
@@ -963,6 +973,7 @@ paths:
|
|
|
963
973
|
description: Deleted
|
|
964
974
|
"401": { $ref: "#/components/responses/Unauthorized" }
|
|
965
975
|
"404": { $ref: "#/components/responses/NotFound" }
|
|
976
|
+
"422": { $ref: "#/components/responses/ValidationFailed" }
|
|
966
977
|
/chats/{chat_id}/pin:
|
|
967
978
|
parameters:
|
|
968
979
|
- $ref: "#/components/parameters/ClientVersion"
|
|
@@ -972,6 +983,7 @@ paths:
|
|
|
972
983
|
tags: [chats]
|
|
973
984
|
operationId: pinChat
|
|
974
985
|
summary: Pin a chat
|
|
986
|
+
description: At most 10 chats can be pinned (`409` beyond that). Pinning a pinned chat changes nothing.
|
|
975
987
|
responses:
|
|
976
988
|
"426": { $ref: "#/components/responses/ClientOutdated" }
|
|
977
989
|
"400": { $ref: "#/components/responses/BadRequest" }
|
|
@@ -1321,7 +1333,9 @@ paths:
|
|
|
1321
1333
|
tags: [groups]
|
|
1322
1334
|
operationId: createGroup
|
|
1323
1335
|
summary: Create a group
|
|
1324
|
-
description:
|
|
1336
|
+
description: |
|
|
1337
|
+
Members whose `group_invites` setting requires approval get an approval request instead of being added.
|
|
1338
|
+
If any of them does not allow invitations from the caller at all, nothing is created (`403`).
|
|
1325
1339
|
requestBody:
|
|
1326
1340
|
required: true
|
|
1327
1341
|
content:
|
|
@@ -1336,6 +1350,7 @@ paths:
|
|
|
1336
1350
|
schema: { $ref: "#/components/schemas/Group" }
|
|
1337
1351
|
"400": { $ref: "#/components/responses/BadRequest" }
|
|
1338
1352
|
"401": { $ref: "#/components/responses/Unauthorized" }
|
|
1353
|
+
"403": { $ref: "#/components/responses/Forbidden" }
|
|
1339
1354
|
"422": { $ref: "#/components/responses/ValidationFailed" }
|
|
1340
1355
|
"429": { $ref: "#/components/responses/TooManyRequests" }
|
|
1341
1356
|
/groups/{chat_id}:
|
|
@@ -1399,6 +1414,7 @@ paths:
|
|
|
1399
1414
|
tags: [groups]
|
|
1400
1415
|
operationId: setGroupAvatar
|
|
1401
1416
|
summary: Set the group avatar from an uploaded attachment
|
|
1417
|
+
description: The attachment must be an image the caller uploaded with purpose `avatar` (`422` otherwise).
|
|
1402
1418
|
requestBody:
|
|
1403
1419
|
required: true
|
|
1404
1420
|
content:
|
|
@@ -1415,6 +1431,7 @@ paths:
|
|
|
1415
1431
|
"401": { $ref: "#/components/responses/Unauthorized" }
|
|
1416
1432
|
"403": { $ref: "#/components/responses/Forbidden" }
|
|
1417
1433
|
"404": { $ref: "#/components/responses/NotFound" }
|
|
1434
|
+
"422": { $ref: "#/components/responses/ValidationFailed" }
|
|
1418
1435
|
/groups/{chat_id}/participants:
|
|
1419
1436
|
parameters:
|
|
1420
1437
|
- $ref: "#/components/parameters/ClientVersion"
|
|
@@ -1489,6 +1506,7 @@ paths:
|
|
|
1489
1506
|
tags: [groups]
|
|
1490
1507
|
operationId: transferGroupOwnership
|
|
1491
1508
|
summary: Make another member the owner
|
|
1509
|
+
description: The previous owner becomes an admin. Transferring to yourself is `422`.
|
|
1492
1510
|
requestBody:
|
|
1493
1511
|
required: true
|
|
1494
1512
|
content:
|
|
@@ -1505,6 +1523,7 @@ paths:
|
|
|
1505
1523
|
"401": { $ref: "#/components/responses/Unauthorized" }
|
|
1506
1524
|
"403": { $ref: "#/components/responses/Forbidden" }
|
|
1507
1525
|
"404": { $ref: "#/components/responses/NotFound" }
|
|
1526
|
+
"422": { $ref: "#/components/responses/ValidationFailed" }
|
|
1508
1527
|
/groups/{chat_id}/leave:
|
|
1509
1528
|
parameters:
|
|
1510
1529
|
- $ref: "#/components/parameters/ClientVersion"
|
package/dist/schema.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* Generated from api/openapi.yaml 2.0.0-alpha.
|
|
1
|
+
/* Generated from api/openapi.yaml 2.0.0-alpha.6. Do not edit. */
|
|
2
2
|
export interface paths {
|
|
3
3
|
"/meta": {
|
|
4
4
|
parameters: {
|
|
@@ -746,7 +746,11 @@ export interface paths {
|
|
|
746
746
|
};
|
|
747
747
|
/**
|
|
748
748
|
* My chats with last message and unread count
|
|
749
|
-
* @description One request replaces `GET /chats/list/{username}` and `GET /groups/list/{username}
|
|
749
|
+
* @description One request replaces `GET /chats/list/{username}` and `GET /groups/list/{username}`.
|
|
750
|
+
* Pinned chats come first (most recently pinned first), then the others by their last
|
|
751
|
+
* message (newest first). `last_message` is the newest message the caller can see; in
|
|
752
|
+
* direct chats its `read_by` holds the other user once they read it (with read receipts
|
|
753
|
+
* on), in groups it is empty. `unread_count` stops at 999.
|
|
750
754
|
*/
|
|
751
755
|
get: operations["listChats"];
|
|
752
756
|
put?: never;
|
|
@@ -782,8 +786,10 @@ export interface paths {
|
|
|
782
786
|
put?: never;
|
|
783
787
|
post?: never;
|
|
784
788
|
/**
|
|
785
|
-
* Delete a direct chat
|
|
786
|
-
* @description
|
|
789
|
+
* Delete a direct chat
|
|
790
|
+
* @description Deletes the chat and its messages for both users (as v1 did); both get `chat_deleted`.
|
|
791
|
+
* For groups use `DELETE /groups/{chat_id}` (owner) or `POST /groups/{chat_id}/leave`;
|
|
792
|
+
* a group here is `422`.
|
|
787
793
|
*/
|
|
788
794
|
delete: operations["deleteChat"];
|
|
789
795
|
options?: never;
|
|
@@ -806,7 +812,10 @@ export interface paths {
|
|
|
806
812
|
cookie?: never;
|
|
807
813
|
};
|
|
808
814
|
get?: never;
|
|
809
|
-
/**
|
|
815
|
+
/**
|
|
816
|
+
* Pin a chat
|
|
817
|
+
* @description At most 10 chats can be pinned (`409` beyond that). Pinning a pinned chat changes nothing.
|
|
818
|
+
*/
|
|
810
819
|
put: operations["pinChat"];
|
|
811
820
|
post?: never;
|
|
812
821
|
/** Unpin a chat */
|
|
@@ -1069,6 +1078,7 @@ export interface paths {
|
|
|
1069
1078
|
/**
|
|
1070
1079
|
* Create a group
|
|
1071
1080
|
* @description Members whose `group_invites` setting requires approval get an approval request instead of being added.
|
|
1081
|
+
* If any of them does not allow invitations from the caller at all, nothing is created (`403`).
|
|
1072
1082
|
*/
|
|
1073
1083
|
post: operations["createGroup"];
|
|
1074
1084
|
delete?: never;
|
|
@@ -1118,7 +1128,10 @@ export interface paths {
|
|
|
1118
1128
|
cookie?: never;
|
|
1119
1129
|
};
|
|
1120
1130
|
get?: never;
|
|
1121
|
-
/**
|
|
1131
|
+
/**
|
|
1132
|
+
* Set the group avatar from an uploaded attachment
|
|
1133
|
+
* @description The attachment must be an image the caller uploaded with purpose `avatar` (`422` otherwise).
|
|
1134
|
+
*/
|
|
1122
1135
|
put: operations["setGroupAvatar"];
|
|
1123
1136
|
post?: never;
|
|
1124
1137
|
delete?: never;
|
|
@@ -1193,7 +1206,10 @@ export interface paths {
|
|
|
1193
1206
|
};
|
|
1194
1207
|
get?: never;
|
|
1195
1208
|
put?: never;
|
|
1196
|
-
/**
|
|
1209
|
+
/**
|
|
1210
|
+
* Make another member the owner
|
|
1211
|
+
* @description The previous owner becomes an admin. Transferring to yourself is `422`.
|
|
1212
|
+
*/
|
|
1197
1213
|
post: operations["transferGroupOwnership"];
|
|
1198
1214
|
delete?: never;
|
|
1199
1215
|
options?: never;
|
|
@@ -2090,6 +2106,7 @@ export interface operations {
|
|
|
2090
2106
|
401: components["responses"]["Unauthorized"];
|
|
2091
2107
|
403: components["responses"]["Forbidden"];
|
|
2092
2108
|
426: components["responses"]["ClientOutdated"];
|
|
2109
|
+
429: components["responses"]["TooManyRequests"];
|
|
2093
2110
|
};
|
|
2094
2111
|
};
|
|
2095
2112
|
updateMe: {
|
|
@@ -3014,6 +3031,7 @@ export interface operations {
|
|
|
3014
3031
|
401: components["responses"]["Unauthorized"];
|
|
3015
3032
|
403: components["responses"]["Forbidden"];
|
|
3016
3033
|
404: components["responses"]["NotFound"];
|
|
3034
|
+
422: components["responses"]["ValidationFailed"];
|
|
3017
3035
|
426: components["responses"]["ClientOutdated"];
|
|
3018
3036
|
429: components["responses"]["TooManyRequests"];
|
|
3019
3037
|
};
|
|
@@ -3075,6 +3093,7 @@ export interface operations {
|
|
|
3075
3093
|
400: components["responses"]["BadRequest"];
|
|
3076
3094
|
401: components["responses"]["Unauthorized"];
|
|
3077
3095
|
404: components["responses"]["NotFound"];
|
|
3096
|
+
422: components["responses"]["ValidationFailed"];
|
|
3078
3097
|
426: components["responses"]["ClientOutdated"];
|
|
3079
3098
|
};
|
|
3080
3099
|
};
|
|
@@ -3610,6 +3629,7 @@ export interface operations {
|
|
|
3610
3629
|
};
|
|
3611
3630
|
400: components["responses"]["BadRequest"];
|
|
3612
3631
|
401: components["responses"]["Unauthorized"];
|
|
3632
|
+
403: components["responses"]["Forbidden"];
|
|
3613
3633
|
422: components["responses"]["ValidationFailed"];
|
|
3614
3634
|
426: components["responses"]["ClientOutdated"];
|
|
3615
3635
|
429: components["responses"]["TooManyRequests"];
|
|
@@ -3746,6 +3766,7 @@ export interface operations {
|
|
|
3746
3766
|
401: components["responses"]["Unauthorized"];
|
|
3747
3767
|
403: components["responses"]["Forbidden"];
|
|
3748
3768
|
404: components["responses"]["NotFound"];
|
|
3769
|
+
422: components["responses"]["ValidationFailed"];
|
|
3749
3770
|
426: components["responses"]["ClientOutdated"];
|
|
3750
3771
|
};
|
|
3751
3772
|
};
|
|
@@ -3888,6 +3909,7 @@ export interface operations {
|
|
|
3888
3909
|
401: components["responses"]["Unauthorized"];
|
|
3889
3910
|
403: components["responses"]["Forbidden"];
|
|
3890
3911
|
404: components["responses"]["NotFound"];
|
|
3912
|
+
422: components["responses"]["ValidationFailed"];
|
|
3891
3913
|
426: components["responses"]["ClientOutdated"];
|
|
3892
3914
|
};
|
|
3893
3915
|
};
|
package/dist/ws-events.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@myronsi/messenger-api",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.6.next.48",
|
|
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": {
|