@myronsi/messenger-api 2.1.0-alpha.45 → 2.1.0-alpha.46.next.165
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 +417 -4
- package/dist/schema.d.ts +592 -3
- package/dist/ws-docs.json +25 -1
- package/dist/ws-events.d.ts +90 -2
- package/dist/ws-events.schema.json +562 -5
- 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.1.0-alpha.46
|
|
6
|
+
|
|
7
|
+
- Chat import from Telegram and WhatsApp: `GET`/`POST /chats/{chat_id}/imports` (`listChatImports`,
|
|
8
|
+
`startChatImport`), `GET`/`DELETE /imports/{import_id}` (`getChatImport`, `removeChatImport`),
|
|
9
|
+
`PUT /imports/{import_id}/messages` (`addImportedMessages`), `POST /imports/{import_id}/finish`
|
|
10
|
+
(`finishChatImport`), `PUT /imports/{import_id}/senders/{sender_key}` (`assignImportSender`) and
|
|
11
|
+
`POST /imports/{import_id}/senders/{sender_key}/decision` (`decideImportSender`). New schemas `ChatImport`,
|
|
12
|
+
`ChatImportList`, `ChatImportSender`, `ChatImportState`, `ImportSource`, `ImportSenderKey`, `ImportSenderState`,
|
|
13
|
+
`StartChatImportRequest`, `StartChatImportSender`, `ImportedMessage`, `ImportedMessageType`,
|
|
14
|
+
`AddImportedMessagesRequest`, `ImportProgress`, `AssignImportSenderRequest`, `DecideImportSenderRequest`,
|
|
15
|
+
`MessageImport` and `ImportSummary`; new path parameters `ImportId` and `ImportSenderKey`.
|
|
16
|
+
- `Message` gains `import`; for imported messages `created_at` is the time in the other messenger, and `sender` is
|
|
17
|
+
`null` until the member behind the name confirms it.
|
|
18
|
+
- `SystemEventKind` gains `history_imported`, `history_import_ended` and `imported_note`; `SystemEvent` gains
|
|
19
|
+
`import` and `text`.
|
|
20
|
+
- `SyncChange.type` gains `history_imported`.
|
|
21
|
+
- WebSocket server events `import_update` and `import_sender_update`.
|
|
22
|
+
|
|
5
23
|
## 2.1.0-alpha.45
|
|
6
24
|
|
|
7
25
|
- `GET /search/messages` gains the query parameter `kind` (`MediaKind`: `image`, `visual`, `audio`, `voice`, `file`,
|
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.46. Do not edit. */
|
|
2
|
+
export declare const API_VERSION: "2.1.0-alpha.46";
|
|
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.46";
|
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.46
|
|
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
|
|
@@ -62,6 +62,8 @@ tags:
|
|
|
62
62
|
description: Approval requests (direct messages and group invites)
|
|
63
63
|
- name: websocket
|
|
64
64
|
description: Realtime connection (see `websocket.md`)
|
|
65
|
+
- name: imports
|
|
66
|
+
description: Chat histories imported from other messengers
|
|
65
67
|
- name: calls
|
|
66
68
|
description: Audio calls (see `docs/calls.md` and `docs/calls-e2ee.md`)
|
|
67
69
|
- name: public
|
|
@@ -2354,6 +2356,213 @@ paths:
|
|
|
2354
2356
|
schema: { $ref: "#/components/schemas/PinnedMessagePage" }
|
|
2355
2357
|
"401": { $ref: "#/components/responses/Unauthorized" }
|
|
2356
2358
|
"404": { $ref: "#/components/responses/NotFound" }
|
|
2359
|
+
/chats/{chat_id}/imports:
|
|
2360
|
+
parameters:
|
|
2361
|
+
- $ref: "#/components/parameters/ClientVersion"
|
|
2362
|
+
- $ref: "#/components/parameters/ClientApiVersion"
|
|
2363
|
+
- $ref: "#/components/parameters/ChatId"
|
|
2364
|
+
get:
|
|
2365
|
+
tags: [imports]
|
|
2366
|
+
operationId: listChatImports
|
|
2367
|
+
summary: The imported histories of a chat
|
|
2368
|
+
description: |
|
|
2369
|
+
Imports that are running or done, oldest period first. A sender the importer assigned to a member is
|
|
2370
|
+
`pending` or `declined` only for the importer and that member; everyone else sees it as `unassigned`
|
|
2371
|
+
without `user_id` until the member confirms.
|
|
2372
|
+
responses:
|
|
2373
|
+
"426": { $ref: "#/components/responses/ClientOutdated" }
|
|
2374
|
+
"200":
|
|
2375
|
+
description: The imports
|
|
2376
|
+
content:
|
|
2377
|
+
application/json:
|
|
2378
|
+
schema: { $ref: "#/components/schemas/ChatImportList" }
|
|
2379
|
+
"401": { $ref: "#/components/responses/Unauthorized" }
|
|
2380
|
+
"404": { $ref: "#/components/responses/NotFound" }
|
|
2381
|
+
post:
|
|
2382
|
+
tags: [imports]
|
|
2383
|
+
operationId: startChatImport
|
|
2384
|
+
summary: Start importing a history from another messenger
|
|
2385
|
+
description: |
|
|
2386
|
+
The client parses the export (Telegram Desktop JSON or a WhatsApp chat export) on the device, uploads the
|
|
2387
|
+
files with `POST /attachments`, then sends the messages in order with `PUT /imports/{import_id}/messages`
|
|
2388
|
+
and ends with `POST /imports/{import_id}/finish`.
|
|
2389
|
+
|
|
2390
|
+
In a direct chat either user may import, not in a chat in the Requests folder or with a block (`403`). In a
|
|
2391
|
+
group only an admin or the owner may (`403`). One import per chat runs at a time (`409`). The messages are
|
|
2392
|
+
placed above the oldest message of the chat, in their original order; a second import goes next to the
|
|
2393
|
+
imports whose periods it follows, and an import whose period overlaps an existing one is `409`.
|
|
2394
|
+
|
|
2395
|
+
`senders` lists every name of the export. `me: true` marks the caller's own messages. `user_id` suggests a
|
|
2396
|
+
member of the chat for a name; that member confirms it after the import is finished. Every other name is
|
|
2397
|
+
shown as text.
|
|
2398
|
+
requestBody:
|
|
2399
|
+
required: true
|
|
2400
|
+
content:
|
|
2401
|
+
application/json:
|
|
2402
|
+
schema: { $ref: "#/components/schemas/StartChatImportRequest" }
|
|
2403
|
+
responses:
|
|
2404
|
+
"426": { $ref: "#/components/responses/ClientOutdated" }
|
|
2405
|
+
"400": { $ref: "#/components/responses/BadRequest" }
|
|
2406
|
+
"201":
|
|
2407
|
+
description: The import, running
|
|
2408
|
+
content:
|
|
2409
|
+
application/json:
|
|
2410
|
+
schema: { $ref: "#/components/schemas/ChatImport" }
|
|
2411
|
+
"401": { $ref: "#/components/responses/Unauthorized" }
|
|
2412
|
+
"403": { $ref: "#/components/responses/Forbidden" }
|
|
2413
|
+
"404": { $ref: "#/components/responses/NotFound" }
|
|
2414
|
+
"409": { $ref: "#/components/responses/Conflict" }
|
|
2415
|
+
"422": { $ref: "#/components/responses/ValidationFailed" }
|
|
2416
|
+
/imports/{import_id}:
|
|
2417
|
+
parameters:
|
|
2418
|
+
- $ref: "#/components/parameters/ClientVersion"
|
|
2419
|
+
- $ref: "#/components/parameters/ClientApiVersion"
|
|
2420
|
+
- $ref: "#/components/parameters/ImportId"
|
|
2421
|
+
get:
|
|
2422
|
+
tags: [imports]
|
|
2423
|
+
operationId: getChatImport
|
|
2424
|
+
summary: One import, for resuming it or showing its senders
|
|
2425
|
+
responses:
|
|
2426
|
+
"426": { $ref: "#/components/responses/ClientOutdated" }
|
|
2427
|
+
"200":
|
|
2428
|
+
description: The import
|
|
2429
|
+
content:
|
|
2430
|
+
application/json:
|
|
2431
|
+
schema: { $ref: "#/components/schemas/ChatImport" }
|
|
2432
|
+
"401": { $ref: "#/components/responses/Unauthorized" }
|
|
2433
|
+
"404": { $ref: "#/components/responses/NotFound" }
|
|
2434
|
+
delete:
|
|
2435
|
+
tags: [imports]
|
|
2436
|
+
operationId: removeChatImport
|
|
2437
|
+
summary: Remove an imported history
|
|
2438
|
+
description: |
|
|
2439
|
+
The importer, or the owner of a group, removes every message of the import for everyone. The messages
|
|
2440
|
+
disappear at once (`import_update` with state `removing`); the worker deletes them afterwards.
|
|
2441
|
+
responses:
|
|
2442
|
+
"426": { $ref: "#/components/responses/ClientOutdated" }
|
|
2443
|
+
"202":
|
|
2444
|
+
description: Removing
|
|
2445
|
+
"401": { $ref: "#/components/responses/Unauthorized" }
|
|
2446
|
+
"403": { $ref: "#/components/responses/Forbidden" }
|
|
2447
|
+
"404": { $ref: "#/components/responses/NotFound" }
|
|
2448
|
+
/imports/{import_id}/messages:
|
|
2449
|
+
parameters:
|
|
2450
|
+
- $ref: "#/components/parameters/ClientVersion"
|
|
2451
|
+
- $ref: "#/components/parameters/ClientApiVersion"
|
|
2452
|
+
- $ref: "#/components/parameters/ImportId"
|
|
2453
|
+
put:
|
|
2454
|
+
tags: [imports]
|
|
2455
|
+
operationId: addImportedMessages
|
|
2456
|
+
summary: Add the next batch of messages to a running import
|
|
2457
|
+
description: |
|
|
2458
|
+
Only the importer. `from_index` must be the import's `next_index`; a batch that was stored already answers
|
|
2459
|
+
with the current `next_index`, so a retry after a lost answer is safe. Another `from_index` is `409`.
|
|
2460
|
+
Attachments must be the importer's own uploads. Imported messages send no push and count as read.
|
|
2461
|
+
requestBody:
|
|
2462
|
+
required: true
|
|
2463
|
+
content:
|
|
2464
|
+
application/json:
|
|
2465
|
+
schema: { $ref: "#/components/schemas/AddImportedMessagesRequest" }
|
|
2466
|
+
responses:
|
|
2467
|
+
"426": { $ref: "#/components/responses/ClientOutdated" }
|
|
2468
|
+
"400": { $ref: "#/components/responses/BadRequest" }
|
|
2469
|
+
"200":
|
|
2470
|
+
description: Stored
|
|
2471
|
+
content:
|
|
2472
|
+
application/json:
|
|
2473
|
+
schema: { $ref: "#/components/schemas/ImportProgress" }
|
|
2474
|
+
"401": { $ref: "#/components/responses/Unauthorized" }
|
|
2475
|
+
"403": { $ref: "#/components/responses/Forbidden" }
|
|
2476
|
+
"404": { $ref: "#/components/responses/NotFound" }
|
|
2477
|
+
"409": { $ref: "#/components/responses/Conflict" }
|
|
2478
|
+
"422": { $ref: "#/components/responses/ValidationFailed" }
|
|
2479
|
+
/imports/{import_id}/finish:
|
|
2480
|
+
parameters:
|
|
2481
|
+
- $ref: "#/components/parameters/ClientVersion"
|
|
2482
|
+
- $ref: "#/components/parameters/ClientApiVersion"
|
|
2483
|
+
- $ref: "#/components/parameters/ImportId"
|
|
2484
|
+
post:
|
|
2485
|
+
tags: [imports]
|
|
2486
|
+
operationId: finishChatImport
|
|
2487
|
+
summary: Finish an import once every message is stored
|
|
2488
|
+
description: |
|
|
2489
|
+
Only the importer, once `next_index` equals `message_count` (`422` before). Adds the closing system
|
|
2490
|
+
message, tells every member to load the chat again (`import_update`, sync change `history_imported`) and
|
|
2491
|
+
asks each assigned member to confirm their messages (`import_sender_update`).
|
|
2492
|
+
responses:
|
|
2493
|
+
"426": { $ref: "#/components/responses/ClientOutdated" }
|
|
2494
|
+
"200":
|
|
2495
|
+
description: The finished import
|
|
2496
|
+
content:
|
|
2497
|
+
application/json:
|
|
2498
|
+
schema: { $ref: "#/components/schemas/ChatImport" }
|
|
2499
|
+
"401": { $ref: "#/components/responses/Unauthorized" }
|
|
2500
|
+
"403": { $ref: "#/components/responses/Forbidden" }
|
|
2501
|
+
"404": { $ref: "#/components/responses/NotFound" }
|
|
2502
|
+
"422": { $ref: "#/components/responses/ValidationFailed" }
|
|
2503
|
+
/imports/{import_id}/senders/{sender_key}:
|
|
2504
|
+
parameters:
|
|
2505
|
+
- $ref: "#/components/parameters/ClientVersion"
|
|
2506
|
+
- $ref: "#/components/parameters/ClientApiVersion"
|
|
2507
|
+
- $ref: "#/components/parameters/ImportId"
|
|
2508
|
+
- $ref: "#/components/parameters/ImportSenderKey"
|
|
2509
|
+
put:
|
|
2510
|
+
tags: [imports]
|
|
2511
|
+
operationId: assignImportSender
|
|
2512
|
+
summary: Suggest a member for a name of the export, or take the suggestion back
|
|
2513
|
+
description: |
|
|
2514
|
+
Only the importer. `user_id` must be another member of the chat; `null` makes the name text again. A name
|
|
2515
|
+
that is `me` or `confirmed` cannot be reassigned, and a member who declined or withdrew a name cannot be
|
|
2516
|
+
suggested for it again (`409`).
|
|
2517
|
+
requestBody:
|
|
2518
|
+
required: true
|
|
2519
|
+
content:
|
|
2520
|
+
application/json:
|
|
2521
|
+
schema: { $ref: "#/components/schemas/AssignImportSenderRequest" }
|
|
2522
|
+
responses:
|
|
2523
|
+
"426": { $ref: "#/components/responses/ClientOutdated" }
|
|
2524
|
+
"400": { $ref: "#/components/responses/BadRequest" }
|
|
2525
|
+
"200":
|
|
2526
|
+
description: The sender
|
|
2527
|
+
content:
|
|
2528
|
+
application/json:
|
|
2529
|
+
schema: { $ref: "#/components/schemas/ChatImportSender" }
|
|
2530
|
+
"401": { $ref: "#/components/responses/Unauthorized" }
|
|
2531
|
+
"403": { $ref: "#/components/responses/Forbidden" }
|
|
2532
|
+
"404": { $ref: "#/components/responses/NotFound" }
|
|
2533
|
+
"409": { $ref: "#/components/responses/Conflict" }
|
|
2534
|
+
"422": { $ref: "#/components/responses/ValidationFailed" }
|
|
2535
|
+
/imports/{import_id}/senders/{sender_key}/decision:
|
|
2536
|
+
parameters:
|
|
2537
|
+
- $ref: "#/components/parameters/ClientVersion"
|
|
2538
|
+
- $ref: "#/components/parameters/ClientApiVersion"
|
|
2539
|
+
- $ref: "#/components/parameters/ImportId"
|
|
2540
|
+
- $ref: "#/components/parameters/ImportSenderKey"
|
|
2541
|
+
post:
|
|
2542
|
+
tags: [imports]
|
|
2543
|
+
operationId: decideImportSender
|
|
2544
|
+
summary: Confirm or decline that a name of the export is you, or withdraw a confirmation
|
|
2545
|
+
description: |
|
|
2546
|
+
Only the member the importer suggested, once the import is finished. `confirm` links the messages of the
|
|
2547
|
+
name to the caller's account for everyone; `decline` keeps them as text; `withdraw` turns a confirmed name
|
|
2548
|
+
back into text. After `decline` or `withdraw` the importer cannot suggest the caller for that name again.
|
|
2549
|
+
`404` when the caller is not the suggested member or the name is not in the matching state.
|
|
2550
|
+
requestBody:
|
|
2551
|
+
required: true
|
|
2552
|
+
content:
|
|
2553
|
+
application/json:
|
|
2554
|
+
schema: { $ref: "#/components/schemas/DecideImportSenderRequest" }
|
|
2555
|
+
responses:
|
|
2556
|
+
"426": { $ref: "#/components/responses/ClientOutdated" }
|
|
2557
|
+
"400": { $ref: "#/components/responses/BadRequest" }
|
|
2558
|
+
"200":
|
|
2559
|
+
description: The sender
|
|
2560
|
+
content:
|
|
2561
|
+
application/json:
|
|
2562
|
+
schema: { $ref: "#/components/schemas/ChatImportSender" }
|
|
2563
|
+
"401": { $ref: "#/components/responses/Unauthorized" }
|
|
2564
|
+
"404": { $ref: "#/components/responses/NotFound" }
|
|
2565
|
+
"422": { $ref: "#/components/responses/ValidationFailed" }
|
|
2357
2566
|
/chats/{chat_id}/messages/forward:
|
|
2358
2567
|
parameters:
|
|
2359
2568
|
- $ref: "#/components/parameters/ClientVersion"
|
|
@@ -6078,6 +6287,16 @@ components:
|
|
|
6078
6287
|
in: path
|
|
6079
6288
|
required: true
|
|
6080
6289
|
schema: { $ref: "#/components/schemas/Id" }
|
|
6290
|
+
ImportId:
|
|
6291
|
+
name: import_id
|
|
6292
|
+
in: path
|
|
6293
|
+
required: true
|
|
6294
|
+
schema: { $ref: "#/components/schemas/Id" }
|
|
6295
|
+
ImportSenderKey:
|
|
6296
|
+
name: sender_key
|
|
6297
|
+
in: path
|
|
6298
|
+
required: true
|
|
6299
|
+
schema: { $ref: "#/components/schemas/ImportSenderKey" }
|
|
6081
6300
|
UserId:
|
|
6082
6301
|
name: user_id
|
|
6083
6302
|
in: path
|
|
@@ -7770,10 +7989,11 @@ components:
|
|
|
7770
7989
|
message and its `scope`. `pins_changed`: load the pins of the chat again. `history_cleared`: drop the
|
|
7771
7990
|
messages up to and including `before_message_id` (`scope` says for whom). `chat_hidden`: the caller
|
|
7772
7991
|
deleted the chat for themselves up to `before_message_id`.
|
|
7992
|
+
`history_imported`: an imported history was added, removed or a sender confirmed; load the chat again.
|
|
7773
7993
|
properties:
|
|
7774
7994
|
type:
|
|
7775
7995
|
type: string
|
|
7776
|
-
enum: [message_updated, message_deleted, pins_changed, history_cleared, chat_hidden]
|
|
7996
|
+
enum: [message_updated, message_deleted, pins_changed, history_cleared, chat_hidden, history_imported]
|
|
7777
7997
|
chat_id: { $ref: "#/components/schemas/Id" }
|
|
7778
7998
|
message_id: { $ref: "#/components/schemas/Id" }
|
|
7779
7999
|
scope:
|
|
@@ -7852,12 +8072,16 @@ components:
|
|
|
7852
8072
|
read_by:
|
|
7853
8073
|
type: array
|
|
7854
8074
|
items: { $ref: "#/components/schemas/ReadReceipt" }
|
|
7855
|
-
created_at:
|
|
8075
|
+
created_at:
|
|
8076
|
+
description: When the message was sent; for an imported message, when it was sent in the other messenger.
|
|
8077
|
+
allOf: [{ $ref: "#/components/schemas/Timestamp" }]
|
|
7856
8078
|
edited_at:
|
|
7857
8079
|
oneOf:
|
|
7858
8080
|
- $ref: "#/components/schemas/Timestamp"
|
|
7859
8081
|
- type: "null"
|
|
7860
8082
|
is_deleted: { type: boolean }
|
|
8083
|
+
import:
|
|
8084
|
+
$ref: "#/components/schemas/MessageImport"
|
|
7861
8085
|
removed_by_moderation:
|
|
7862
8086
|
type: boolean
|
|
7863
8087
|
description: |
|
|
@@ -7905,7 +8129,7 @@ components:
|
|
|
7905
8129
|
height: { type: [integer, "null"], minimum: 1 }
|
|
7906
8130
|
SystemEventKind:
|
|
7907
8131
|
type: string
|
|
7908
|
-
enum: [group_created, member_added, member_joined, member_removed, member_left, call, message_pinned, message_unpinned]
|
|
8132
|
+
enum: [group_created, member_added, member_joined, member_removed, member_left, call, message_pinned, message_unpinned, history_imported, history_import_ended, imported_note]
|
|
7909
8133
|
SystemEvent:
|
|
7910
8134
|
type: object
|
|
7911
8135
|
description: |
|
|
@@ -7913,6 +8137,8 @@ components:
|
|
|
7913
8137
|
are the display names at the time of the event. `target` fields are set for `member_added` and
|
|
7914
8138
|
`member_removed`. `call` is set for `call` messages: one per call, posted when the call ends, `actor` is the
|
|
7915
8139
|
initiator. `message_id` and `snippet` are set for `message_pinned` and `message_unpinned`.
|
|
8140
|
+
`history_imported` opens and `history_import_ended` closes an imported history; both carry `import`, and
|
|
8141
|
+
`actor` is the importer. `imported_note` is a line of the export that is not a message; its text is `text`.
|
|
7916
8142
|
required: [kind, actor_id, actor_name]
|
|
7917
8143
|
properties:
|
|
7918
8144
|
kind: { $ref: "#/components/schemas/SystemEventKind" }
|
|
@@ -7934,6 +8160,11 @@ components:
|
|
|
7934
8160
|
Start of the pinned message's text at the time of the event (at most 60 characters plus `…`); empty for a
|
|
7935
8161
|
message without text, which clients name by its `message_type`.
|
|
7936
8162
|
message_type: { $ref: "#/components/schemas/MessageType" }
|
|
8163
|
+
import: { $ref: "#/components/schemas/ImportSummary" }
|
|
8164
|
+
text:
|
|
8165
|
+
type: string
|
|
8166
|
+
maxLength: 4096
|
|
8167
|
+
description: The line of the export, for `imported_note`.
|
|
7937
8168
|
MessagePage:
|
|
7938
8169
|
type: object
|
|
7939
8170
|
required: [items, next_cursor, prev_cursor]
|
|
@@ -8295,6 +8526,188 @@ components:
|
|
|
8295
8526
|
description: Newest pin first
|
|
8296
8527
|
items: { $ref: "#/components/schemas/PinnedMessage" }
|
|
8297
8528
|
next_cursor: { $ref: "#/components/schemas/Cursor" }
|
|
8529
|
+
ImportSource:
|
|
8530
|
+
type: string
|
|
8531
|
+
enum: [telegram, whatsapp]
|
|
8532
|
+
ChatImportState:
|
|
8533
|
+
type: string
|
|
8534
|
+
description: "`running`: messages are being added. `done`: finished. `removing`: being removed."
|
|
8535
|
+
enum: [running, done, removing]
|
|
8536
|
+
ImportSenderKey:
|
|
8537
|
+
type: string
|
|
8538
|
+
description: The client's key for one name of the export.
|
|
8539
|
+
pattern: "^[A-Za-z0-9_-]{1,64}$"
|
|
8540
|
+
ImportSenderState:
|
|
8541
|
+
type: string
|
|
8542
|
+
description: |
|
|
8543
|
+
`me`: the importer's own messages. `unassigned`: shown as text. `pending`: suggested for `user_id`, who has
|
|
8544
|
+
not answered. `confirmed`: `user_id` confirmed; the messages show their account. `declined`: the suggested
|
|
8545
|
+
member said no; shown as text.
|
|
8546
|
+
enum: [me, unassigned, pending, confirmed, declined]
|
|
8547
|
+
ChatImportSender:
|
|
8548
|
+
type: object
|
|
8549
|
+
required: [key, name, message_count, state, user_id]
|
|
8550
|
+
properties:
|
|
8551
|
+
key: { $ref: "#/components/schemas/ImportSenderKey" }
|
|
8552
|
+
name: { type: string, minLength: 1, maxLength: 128 }
|
|
8553
|
+
message_count: { type: integer, minimum: 0 }
|
|
8554
|
+
state: { $ref: "#/components/schemas/ImportSenderState" }
|
|
8555
|
+
user_id:
|
|
8556
|
+
oneOf:
|
|
8557
|
+
- $ref: "#/components/schemas/Id"
|
|
8558
|
+
- type: "null"
|
|
8559
|
+
ChatImport:
|
|
8560
|
+
type: object
|
|
8561
|
+
required: [id, chat_id, source, state, message_count, file_count, first_at, last_at, next_index, imported_by, created_at, finished_at, senders]
|
|
8562
|
+
properties:
|
|
8563
|
+
id: { $ref: "#/components/schemas/Id" }
|
|
8564
|
+
chat_id: { $ref: "#/components/schemas/Id" }
|
|
8565
|
+
source: { $ref: "#/components/schemas/ImportSource" }
|
|
8566
|
+
state: { $ref: "#/components/schemas/ChatImportState" }
|
|
8567
|
+
message_count: { type: integer, minimum: 1, maximum: 100000 }
|
|
8568
|
+
file_count: { type: integer, minimum: 0, maximum: 5000 }
|
|
8569
|
+
first_at: { $ref: "#/components/schemas/Timestamp" }
|
|
8570
|
+
last_at: { $ref: "#/components/schemas/Timestamp" }
|
|
8571
|
+
next_index:
|
|
8572
|
+
type: integer
|
|
8573
|
+
minimum: 0
|
|
8574
|
+
description: How many messages are stored; the `from_index` of the next batch.
|
|
8575
|
+
imported_by:
|
|
8576
|
+
oneOf:
|
|
8577
|
+
- $ref: "#/components/schemas/Id"
|
|
8578
|
+
- type: "null"
|
|
8579
|
+
created_at: { $ref: "#/components/schemas/Timestamp" }
|
|
8580
|
+
finished_at:
|
|
8581
|
+
oneOf:
|
|
8582
|
+
- $ref: "#/components/schemas/Timestamp"
|
|
8583
|
+
- type: "null"
|
|
8584
|
+
senders:
|
|
8585
|
+
type: array
|
|
8586
|
+
items: { $ref: "#/components/schemas/ChatImportSender" }
|
|
8587
|
+
ChatImportList:
|
|
8588
|
+
type: object
|
|
8589
|
+
required: [items]
|
|
8590
|
+
properties:
|
|
8591
|
+
items:
|
|
8592
|
+
type: array
|
|
8593
|
+
items: { $ref: "#/components/schemas/ChatImport" }
|
|
8594
|
+
StartChatImportSender:
|
|
8595
|
+
type: object
|
|
8596
|
+
required: [key, name, message_count]
|
|
8597
|
+
properties:
|
|
8598
|
+
key: { $ref: "#/components/schemas/ImportSenderKey" }
|
|
8599
|
+
name: { type: string, minLength: 1, maxLength: 128 }
|
|
8600
|
+
message_count: { type: integer, minimum: 0 }
|
|
8601
|
+
me:
|
|
8602
|
+
type: boolean
|
|
8603
|
+
description: The caller's own messages; at most one sender.
|
|
8604
|
+
user_id:
|
|
8605
|
+
description: A member of the chat suggested for this name; not with `me`.
|
|
8606
|
+
allOf: [{ $ref: "#/components/schemas/Id" }]
|
|
8607
|
+
StartChatImportRequest:
|
|
8608
|
+
type: object
|
|
8609
|
+
required: [source, message_count, file_count, first_at, last_at, senders]
|
|
8610
|
+
properties:
|
|
8611
|
+
source: { $ref: "#/components/schemas/ImportSource" }
|
|
8612
|
+
message_count: { type: integer, minimum: 1, maximum: 100000 }
|
|
8613
|
+
file_count: { type: integer, minimum: 0, maximum: 5000 }
|
|
8614
|
+
first_at: { $ref: "#/components/schemas/Timestamp" }
|
|
8615
|
+
last_at: { $ref: "#/components/schemas/Timestamp" }
|
|
8616
|
+
senders:
|
|
8617
|
+
type: array
|
|
8618
|
+
minItems: 1
|
|
8619
|
+
maxItems: 200
|
|
8620
|
+
items: { $ref: "#/components/schemas/StartChatImportSender" }
|
|
8621
|
+
ImportedMessageType:
|
|
8622
|
+
type: string
|
|
8623
|
+
description: "`note`: a line of the export that is not a message (for example that someone joined), shown as a system message."
|
|
8624
|
+
enum: [text, file, voice, note]
|
|
8625
|
+
ImportedMessage:
|
|
8626
|
+
type: object
|
|
8627
|
+
required: [index, original_at, type]
|
|
8628
|
+
properties:
|
|
8629
|
+
index:
|
|
8630
|
+
type: integer
|
|
8631
|
+
minimum: 0
|
|
8632
|
+
description: Position in the import, counting from 0 without gaps.
|
|
8633
|
+
sender_key:
|
|
8634
|
+
description: Required except for `note`.
|
|
8635
|
+
allOf: [{ $ref: "#/components/schemas/ImportSenderKey" }]
|
|
8636
|
+
original_at:
|
|
8637
|
+
description: When the message was sent in the other messenger; between the import's `first_at` and `last_at`.
|
|
8638
|
+
allOf: [{ $ref: "#/components/schemas/Timestamp" }]
|
|
8639
|
+
type: { $ref: "#/components/schemas/ImportedMessageType" }
|
|
8640
|
+
content:
|
|
8641
|
+
type: [string, "null"]
|
|
8642
|
+
maxLength: 4096
|
|
8643
|
+
attachment_ids:
|
|
8644
|
+
type: array
|
|
8645
|
+
description: The importer's uploads; two to ten images or videos make an album.
|
|
8646
|
+
minItems: 1
|
|
8647
|
+
maxItems: 10
|
|
8648
|
+
uniqueItems: true
|
|
8649
|
+
items: { $ref: "#/components/schemas/AttachmentRef" }
|
|
8650
|
+
reply_to_index:
|
|
8651
|
+
type: integer
|
|
8652
|
+
minimum: 0
|
|
8653
|
+
description: "`index` of an earlier message of the import that this one answers."
|
|
8654
|
+
AddImportedMessagesRequest:
|
|
8655
|
+
type: object
|
|
8656
|
+
required: [from_index, messages]
|
|
8657
|
+
properties:
|
|
8658
|
+
from_index: { type: integer, minimum: 0 }
|
|
8659
|
+
messages:
|
|
8660
|
+
type: array
|
|
8661
|
+
minItems: 1
|
|
8662
|
+
maxItems: 500
|
|
8663
|
+
items: { $ref: "#/components/schemas/ImportedMessage" }
|
|
8664
|
+
ImportProgress:
|
|
8665
|
+
type: object
|
|
8666
|
+
required: [next_index]
|
|
8667
|
+
properties:
|
|
8668
|
+
next_index: { type: integer, minimum: 0 }
|
|
8669
|
+
AssignImportSenderRequest:
|
|
8670
|
+
type: object
|
|
8671
|
+
required: [user_id]
|
|
8672
|
+
properties:
|
|
8673
|
+
user_id:
|
|
8674
|
+
oneOf:
|
|
8675
|
+
- $ref: "#/components/schemas/Id"
|
|
8676
|
+
- type: "null"
|
|
8677
|
+
DecideImportSenderRequest:
|
|
8678
|
+
type: object
|
|
8679
|
+
required: [decision]
|
|
8680
|
+
properties:
|
|
8681
|
+
decision:
|
|
8682
|
+
type: string
|
|
8683
|
+
enum: [confirm, decline, withdraw]
|
|
8684
|
+
MessageImport:
|
|
8685
|
+
type: object
|
|
8686
|
+
description: Set on messages that came from an import.
|
|
8687
|
+
required: [import_id, source, original_at]
|
|
8688
|
+
properties:
|
|
8689
|
+
import_id: { $ref: "#/components/schemas/Id" }
|
|
8690
|
+
source: { $ref: "#/components/schemas/ImportSource" }
|
|
8691
|
+
original_at: { $ref: "#/components/schemas/Timestamp" }
|
|
8692
|
+
sender_name:
|
|
8693
|
+
type: string
|
|
8694
|
+
description: The name in the export; absent on system messages.
|
|
8695
|
+
sender_state:
|
|
8696
|
+
type: string
|
|
8697
|
+
description: |
|
|
8698
|
+
`me`: the importer's own message, `sender` is the importer. `confirmed`: the member confirmed the name,
|
|
8699
|
+
`sender` is that member. `unconfirmed`: `sender` is `null`; show `sender_name` as text. Absent on system
|
|
8700
|
+
messages.
|
|
8701
|
+
enum: [me, confirmed, unconfirmed]
|
|
8702
|
+
ImportSummary:
|
|
8703
|
+
type: object
|
|
8704
|
+
required: [import_id, source, message_count, first_at, last_at]
|
|
8705
|
+
properties:
|
|
8706
|
+
import_id: { $ref: "#/components/schemas/Id" }
|
|
8707
|
+
source: { $ref: "#/components/schemas/ImportSource" }
|
|
8708
|
+
message_count: { type: integer, minimum: 1 }
|
|
8709
|
+
first_at: { $ref: "#/components/schemas/Timestamp" }
|
|
8710
|
+
last_at: { $ref: "#/components/schemas/Timestamp" }
|
|
8298
8711
|
CreateChatRequest:
|
|
8299
8712
|
type: object
|
|
8300
8713
|
required: [user_id]
|