@myronsi/messenger-api 2.0.0-alpha.6.next.48 → 2.0.0-alpha.7.next.49
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 +9 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/openapi.yaml +63 -2
- package/dist/schema.d.ts +83 -2
- package/dist/ws-events.d.ts +1 -1
- package/dist/ws-events.schema.json +1 -1
- package/package.json +1 -1
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.0.0-alpha.7
|
|
6
|
+
|
|
7
|
+
Search:
|
|
8
|
+
|
|
9
|
+
- New `GET /search/messages`: full-text search across all chats of the caller, with filters (`chat_id`, `sender_id`,
|
|
10
|
+
`type`, `from`, `to`) and `search_after` paging.
|
|
11
|
+
- `SearchHit.highlight` wraps the matched words in U+E000 and U+E001.
|
|
12
|
+
- `GET /chats/{chat_id}/messages/search` can answer `429` (searches are rate limited).
|
|
13
|
+
|
|
5
14
|
## 2.0.0-alpha.6
|
|
6
15
|
|
|
7
16
|
Groups, found while implementing them:
|
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.7. Do not edit. */
|
|
2
|
+
export declare const API_VERSION: "2.0.0-alpha.7";
|
|
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.7";
|
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.7
|
|
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
|
|
@@ -1127,6 +1127,7 @@ paths:
|
|
|
1127
1127
|
"401": { $ref: "#/components/responses/Unauthorized" }
|
|
1128
1128
|
"404": { $ref: "#/components/responses/NotFound" }
|
|
1129
1129
|
"422": { $ref: "#/components/responses/ValidationFailed" }
|
|
1130
|
+
"429": { $ref: "#/components/responses/TooManyRequests" }
|
|
1130
1131
|
/chats/{chat_id}/media:
|
|
1131
1132
|
parameters:
|
|
1132
1133
|
- $ref: "#/components/parameters/ClientVersion"
|
|
@@ -1240,6 +1241,62 @@ paths:
|
|
|
1240
1241
|
"422": { $ref: "#/components/responses/ValidationFailed" }
|
|
1241
1242
|
"429": { $ref: "#/components/responses/TooManyRequests" }
|
|
1242
1243
|
|
|
1244
|
+
# -------------------------------------------------------------- search
|
|
1245
|
+
/search/messages:
|
|
1246
|
+
parameters:
|
|
1247
|
+
- $ref: "#/components/parameters/ClientVersion"
|
|
1248
|
+
- $ref: "#/components/parameters/ClientApiVersion"
|
|
1249
|
+
get:
|
|
1250
|
+
tags: [messages]
|
|
1251
|
+
operationId: searchAllMessages
|
|
1252
|
+
summary: Search messages in all my chats
|
|
1253
|
+
description: |
|
|
1254
|
+
Full-text search across every chat the caller is in, newest first. Only chats the caller
|
|
1255
|
+
is a member of are searched, messages they deleted for themselves are left out, and every
|
|
1256
|
+
hit is checked against the message store before it is returned (a deleted message never
|
|
1257
|
+
shows, even when the index lags behind). Edits and deletions reach the results within a
|
|
1258
|
+
few seconds.
|
|
1259
|
+
parameters:
|
|
1260
|
+
- name: q
|
|
1261
|
+
in: query
|
|
1262
|
+
required: true
|
|
1263
|
+
schema: { type: string, minLength: 2, maxLength: 128 }
|
|
1264
|
+
- name: chat_id
|
|
1265
|
+
in: query
|
|
1266
|
+
description: Only this chat
|
|
1267
|
+
schema: { $ref: "#/components/schemas/Id" }
|
|
1268
|
+
- name: sender_id
|
|
1269
|
+
in: query
|
|
1270
|
+
description: Only messages of this user
|
|
1271
|
+
schema: { $ref: "#/components/schemas/Id" }
|
|
1272
|
+
- name: type
|
|
1273
|
+
in: query
|
|
1274
|
+
schema:
|
|
1275
|
+
type: string
|
|
1276
|
+
enum: [text, file, voice]
|
|
1277
|
+
- name: from
|
|
1278
|
+
in: query
|
|
1279
|
+
description: Messages created at or after this time
|
|
1280
|
+
schema: { $ref: "#/components/schemas/Timestamp" }
|
|
1281
|
+
- name: to
|
|
1282
|
+
in: query
|
|
1283
|
+
description: Messages created before this time
|
|
1284
|
+
schema: { $ref: "#/components/schemas/Timestamp" }
|
|
1285
|
+
- $ref: "#/components/parameters/Limit"
|
|
1286
|
+
- $ref: "#/components/parameters/After"
|
|
1287
|
+
responses:
|
|
1288
|
+
"426": { $ref: "#/components/responses/ClientOutdated" }
|
|
1289
|
+
"400": { $ref: "#/components/responses/BadRequest" }
|
|
1290
|
+
"200":
|
|
1291
|
+
description: Matches, newest first
|
|
1292
|
+
content:
|
|
1293
|
+
application/json:
|
|
1294
|
+
schema: { $ref: "#/components/schemas/MessageSearchPage" }
|
|
1295
|
+
"401": { $ref: "#/components/responses/Unauthorized" }
|
|
1296
|
+
"404": { $ref: "#/components/responses/NotFound" }
|
|
1297
|
+
"422": { $ref: "#/components/responses/ValidationFailed" }
|
|
1298
|
+
"429": { $ref: "#/components/responses/TooManyRequests" }
|
|
1299
|
+
|
|
1243
1300
|
# ------------------------------------------------------------ requests
|
|
1244
1301
|
/requests:
|
|
1245
1302
|
parameters:
|
|
@@ -2196,7 +2253,11 @@ components:
|
|
|
2196
2253
|
message: { $ref: "#/components/schemas/Message" }
|
|
2197
2254
|
highlight:
|
|
2198
2255
|
type: [string, "null"]
|
|
2199
|
-
description:
|
|
2256
|
+
description: |
|
|
2257
|
+
Plain-text excerpt of the matching text or file name; never HTML. The matched words are
|
|
2258
|
+
wrapped in U+E000 (start) and U+E001 (end), characters of the Unicode private use area,
|
|
2259
|
+
so a client can mark them without parsing markup. `null` when the message matched without
|
|
2260
|
+
an excerpt.
|
|
2200
2261
|
MessageSearchPage:
|
|
2201
2262
|
type: object
|
|
2202
2263
|
required: [items, next_cursor]
|
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.7. Do not edit. */
|
|
2
2
|
export interface paths {
|
|
3
3
|
"/meta": {
|
|
4
4
|
parameters: {
|
|
@@ -990,6 +990,35 @@ export interface paths {
|
|
|
990
990
|
patch?: never;
|
|
991
991
|
trace?: never;
|
|
992
992
|
};
|
|
993
|
+
"/search/messages": {
|
|
994
|
+
parameters: {
|
|
995
|
+
query?: never;
|
|
996
|
+
header?: {
|
|
997
|
+
/** @description Version of the client app, for logs and the per-client metric. */
|
|
998
|
+
"X-Client-Version"?: components["parameters"]["ClientVersion"];
|
|
999
|
+
/** @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`). */
|
|
1000
|
+
"X-Client-Api-Version"?: components["parameters"]["ClientApiVersion"];
|
|
1001
|
+
};
|
|
1002
|
+
path?: never;
|
|
1003
|
+
cookie?: never;
|
|
1004
|
+
};
|
|
1005
|
+
/**
|
|
1006
|
+
* Search messages in all my chats
|
|
1007
|
+
* @description Full-text search across every chat the caller is in, newest first. Only chats the caller
|
|
1008
|
+
* is a member of are searched, messages they deleted for themselves are left out, and every
|
|
1009
|
+
* hit is checked against the message store before it is returned (a deleted message never
|
|
1010
|
+
* shows, even when the index lags behind). Edits and deletions reach the results within a
|
|
1011
|
+
* few seconds.
|
|
1012
|
+
*/
|
|
1013
|
+
get: operations["searchAllMessages"];
|
|
1014
|
+
put?: never;
|
|
1015
|
+
post?: never;
|
|
1016
|
+
delete?: never;
|
|
1017
|
+
options?: never;
|
|
1018
|
+
head?: never;
|
|
1019
|
+
patch?: never;
|
|
1020
|
+
trace?: never;
|
|
1021
|
+
};
|
|
993
1022
|
"/requests": {
|
|
994
1023
|
parameters: {
|
|
995
1024
|
query?: never;
|
|
@@ -1550,7 +1579,12 @@ export interface components {
|
|
|
1550
1579
|
};
|
|
1551
1580
|
SearchHit: {
|
|
1552
1581
|
message: components["schemas"]["Message"];
|
|
1553
|
-
/**
|
|
1582
|
+
/**
|
|
1583
|
+
* @description Plain-text excerpt of the matching text or file name; never HTML. The matched words are
|
|
1584
|
+
* wrapped in U+E000 (start) and U+E001 (end), characters of the Unicode private use area,
|
|
1585
|
+
* so a client can mark them without parsing markup. `null` when the message matched without
|
|
1586
|
+
* an excerpt.
|
|
1587
|
+
*/
|
|
1554
1588
|
highlight?: string | null;
|
|
1555
1589
|
};
|
|
1556
1590
|
MessageSearchPage: {
|
|
@@ -3317,6 +3351,7 @@ export interface operations {
|
|
|
3317
3351
|
404: components["responses"]["NotFound"];
|
|
3318
3352
|
422: components["responses"]["ValidationFailed"];
|
|
3319
3353
|
426: components["responses"]["ClientOutdated"];
|
|
3354
|
+
429: components["responses"]["TooManyRequests"];
|
|
3320
3355
|
};
|
|
3321
3356
|
};
|
|
3322
3357
|
listChatMedia: {
|
|
@@ -3467,6 +3502,52 @@ export interface operations {
|
|
|
3467
3502
|
429: components["responses"]["TooManyRequests"];
|
|
3468
3503
|
};
|
|
3469
3504
|
};
|
|
3505
|
+
searchAllMessages: {
|
|
3506
|
+
parameters: {
|
|
3507
|
+
query: {
|
|
3508
|
+
q: string;
|
|
3509
|
+
/** @description Only this chat */
|
|
3510
|
+
chat_id?: components["schemas"]["Id"];
|
|
3511
|
+
/** @description Only messages of this user */
|
|
3512
|
+
sender_id?: components["schemas"]["Id"];
|
|
3513
|
+
type?: "text" | "file" | "voice";
|
|
3514
|
+
/** @description Messages created at or after this time */
|
|
3515
|
+
from?: components["schemas"]["Timestamp"];
|
|
3516
|
+
/** @description Messages created before this time */
|
|
3517
|
+
to?: components["schemas"]["Timestamp"];
|
|
3518
|
+
/** @description Page size */
|
|
3519
|
+
limit?: components["parameters"]["Limit"];
|
|
3520
|
+
/** @description Opaque `next_cursor` of the previous page */
|
|
3521
|
+
after?: components["parameters"]["After"];
|
|
3522
|
+
};
|
|
3523
|
+
header?: {
|
|
3524
|
+
/** @description Version of the client app, for logs and the per-client metric. */
|
|
3525
|
+
"X-Client-Version"?: components["parameters"]["ClientVersion"];
|
|
3526
|
+
/** @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`). */
|
|
3527
|
+
"X-Client-Api-Version"?: components["parameters"]["ClientApiVersion"];
|
|
3528
|
+
};
|
|
3529
|
+
path?: never;
|
|
3530
|
+
cookie?: never;
|
|
3531
|
+
};
|
|
3532
|
+
requestBody?: never;
|
|
3533
|
+
responses: {
|
|
3534
|
+
/** @description Matches, newest first */
|
|
3535
|
+
200: {
|
|
3536
|
+
headers: {
|
|
3537
|
+
[name: string]: unknown;
|
|
3538
|
+
};
|
|
3539
|
+
content: {
|
|
3540
|
+
"application/json": components["schemas"]["MessageSearchPage"];
|
|
3541
|
+
};
|
|
3542
|
+
};
|
|
3543
|
+
400: components["responses"]["BadRequest"];
|
|
3544
|
+
401: components["responses"]["Unauthorized"];
|
|
3545
|
+
404: components["responses"]["NotFound"];
|
|
3546
|
+
422: components["responses"]["ValidationFailed"];
|
|
3547
|
+
426: components["responses"]["ClientOutdated"];
|
|
3548
|
+
429: components["responses"]["TooManyRequests"];
|
|
3549
|
+
};
|
|
3550
|
+
};
|
|
3470
3551
|
listApprovalRequests: {
|
|
3471
3552
|
parameters: {
|
|
3472
3553
|
query?: {
|
package/dist/ws-events.d.ts
CHANGED
|
@@ -1178,7 +1178,7 @@
|
|
|
1178
1178
|
"string",
|
|
1179
1179
|
"null"
|
|
1180
1180
|
],
|
|
1181
|
-
"description": "Plain-text excerpt; never HTML."
|
|
1181
|
+
"description": "Plain-text excerpt of the matching text or file name; never HTML. The matched words are\nwrapped in U+E000 (start) and U+E001 (end), characters of the Unicode private use area,\nso a client can mark them without parsing markup. `null` when the message matched without\nan excerpt.\n"
|
|
1182
1182
|
}
|
|
1183
1183
|
}
|
|
1184
1184
|
},
|
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.7.next.49",
|
|
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": {
|