@linqapp/sdk 0.2.0 → 0.4.0
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 +16 -0
- package/README.md +31 -0
- package/client.d.mts +19 -6
- package/client.d.mts.map +1 -1
- package/client.d.ts +19 -6
- package/client.d.ts.map +1 -1
- package/client.js +13 -0
- package/client.js.map +1 -1
- package/client.mjs +13 -0
- package/client.mjs.map +1 -1
- package/core/pagination.d.mts +69 -0
- package/core/pagination.d.mts.map +1 -0
- package/core/pagination.d.ts +69 -0
- package/core/pagination.d.ts.map +1 -0
- package/core/pagination.js +125 -0
- package/core/pagination.js.map +1 -0
- package/core/pagination.mjs +118 -0
- package/core/pagination.mjs.map +1 -0
- package/index.d.mts +1 -0
- package/index.d.mts.map +1 -1
- package/index.d.ts +1 -0
- package/index.d.ts.map +1 -1
- package/index.js +3 -1
- package/index.js.map +1 -1
- package/index.mjs +1 -0
- package/index.mjs.map +1 -1
- package/internal/tslib.js +18 -18
- package/package.json +11 -1
- package/pagination.d.mts +2 -0
- package/pagination.d.mts.map +1 -0
- package/pagination.d.ts +2 -0
- package/pagination.d.ts.map +1 -0
- package/pagination.js +6 -0
- package/pagination.js.map +1 -0
- package/pagination.mjs +2 -0
- package/pagination.mjs.map +1 -0
- package/resources/capability.d.mts +9 -9
- package/resources/capability.d.ts +9 -9
- package/resources/capability.js +4 -4
- package/resources/capability.mjs +4 -4
- package/resources/chats/chats.d.mts +67 -84
- package/resources/chats/chats.d.mts.map +1 -1
- package/resources/chats/chats.d.ts +67 -84
- package/resources/chats/chats.d.ts.map +1 -1
- package/resources/chats/chats.js +8 -4
- package/resources/chats/chats.js.map +1 -1
- package/resources/chats/chats.mjs +9 -5
- package/resources/chats/chats.mjs.map +1 -1
- package/resources/chats/index.d.mts +2 -2
- package/resources/chats/index.d.mts.map +1 -1
- package/resources/chats/index.d.ts +2 -2
- package/resources/chats/index.d.ts.map +1 -1
- package/resources/chats/index.js.map +1 -1
- package/resources/chats/index.mjs.map +1 -1
- package/resources/chats/messages.d.mts +12 -25
- package/resources/chats/messages.d.mts.map +1 -1
- package/resources/chats/messages.d.ts +12 -25
- package/resources/chats/messages.d.ts.map +1 -1
- package/resources/chats/messages.js +7 -3
- package/resources/chats/messages.js.map +1 -1
- package/resources/chats/messages.mjs +7 -3
- package/resources/chats/messages.mjs.map +1 -1
- package/resources/index.d.mts +4 -3
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +4 -3
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +3 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +1 -0
- package/resources/index.mjs.map +1 -1
- package/resources/messages.d.mts +28 -72
- package/resources/messages.d.mts.map +1 -1
- package/resources/messages.d.ts +28 -72
- package/resources/messages.d.ts.map +1 -1
- package/resources/messages.js +25 -4
- package/resources/messages.js.map +1 -1
- package/resources/messages.mjs +25 -4
- package/resources/messages.mjs.map +1 -1
- package/resources/shared.d.mts +51 -0
- package/resources/shared.d.mts.map +1 -1
- package/resources/shared.d.ts +51 -0
- package/resources/shared.d.ts.map +1 -1
- package/resources/webhooks.d.mts +2506 -0
- package/resources/webhooks.d.mts.map +1 -0
- package/resources/webhooks.d.ts +2506 -0
- package/resources/webhooks.d.ts.map +1 -0
- package/resources/webhooks.js +12 -0
- package/resources/webhooks.js.map +1 -0
- package/resources/webhooks.mjs +8 -0
- package/resources/webhooks.mjs.map +1 -0
- package/src/client.ts +159 -20
- package/src/core/pagination.ts +212 -0
- package/src/index.ts +1 -0
- package/src/pagination.ts +2 -0
- package/src/resources/capability.ts +14 -14
- package/src/resources/chats/chats.ts +77 -100
- package/src/resources/chats/index.ts +4 -3
- package/src/resources/chats/messages.ts +21 -30
- package/src/resources/index.ts +55 -10
- package/src/resources/messages.ts +40 -90
- package/src/resources/shared.ts +62 -0
- package/src/resources/webhooks.ts +3089 -0
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -4,14 +4,7 @@ import { APIResource } from '../../core/resource';
|
|
|
4
4
|
import * as MessagesAPI from '../messages';
|
|
5
5
|
import * as Shared from '../shared';
|
|
6
6
|
import * as ChatsMessagesAPI from './messages';
|
|
7
|
-
import {
|
|
8
|
-
MessageListParams,
|
|
9
|
-
MessageListResponse,
|
|
10
|
-
MessageSendParams,
|
|
11
|
-
MessageSendResponse,
|
|
12
|
-
Messages,
|
|
13
|
-
SentMessage,
|
|
14
|
-
} from './messages';
|
|
7
|
+
import { MessageListParams, MessageSendParams, MessageSendResponse, Messages, SentMessage } from './messages';
|
|
15
8
|
import * as ParticipantsAPI from './participants';
|
|
16
9
|
import {
|
|
17
10
|
ParticipantAddParams,
|
|
@@ -23,6 +16,7 @@ import {
|
|
|
23
16
|
import * as TypingAPI from './typing';
|
|
24
17
|
import { Typing } from './typing';
|
|
25
18
|
import { APIPromise } from '../../core/api-promise';
|
|
19
|
+
import { ListChatsPagination, type ListChatsPaginationParams, PagePromise } from '../../core/pagination';
|
|
26
20
|
import { buildHeaders } from '../../internal/headers';
|
|
27
21
|
import { RequestOptions } from '../../internal/request-options';
|
|
28
22
|
import { path } from '../../internal/utils/path';
|
|
@@ -120,13 +114,19 @@ export class Chats extends APIResource {
|
|
|
120
114
|
*
|
|
121
115
|
* @example
|
|
122
116
|
* ```ts
|
|
123
|
-
*
|
|
117
|
+
* // Automatically fetches more pages as needed.
|
|
118
|
+
* for await (const chat of client.chats.listChats({
|
|
124
119
|
* from: '+13343284472',
|
|
125
|
-
* })
|
|
120
|
+
* })) {
|
|
121
|
+
* // ...
|
|
122
|
+
* }
|
|
126
123
|
* ```
|
|
127
124
|
*/
|
|
128
|
-
|
|
129
|
-
|
|
125
|
+
listChats(
|
|
126
|
+
query: ChatListChatsParams,
|
|
127
|
+
options?: RequestOptions,
|
|
128
|
+
): PagePromise<ChatsListChatsPagination, Chat> {
|
|
129
|
+
return this._client.getAPIList('/v3/chats', ListChatsPagination<Chat>, { query, ...options });
|
|
130
130
|
}
|
|
131
131
|
|
|
132
132
|
/**
|
|
@@ -203,6 +203,8 @@ export class Chats extends APIResource {
|
|
|
203
203
|
}
|
|
204
204
|
}
|
|
205
205
|
|
|
206
|
+
export type ChatsListChatsPagination = ListChatsPagination<Chat>;
|
|
207
|
+
|
|
206
208
|
export interface Chat {
|
|
207
209
|
/**
|
|
208
210
|
* Unique identifier for the chat
|
|
@@ -247,6 +249,54 @@ export interface Chat {
|
|
|
247
249
|
service?: Shared.ServiceType | null;
|
|
248
250
|
}
|
|
249
251
|
|
|
252
|
+
export interface MediaPart {
|
|
253
|
+
/**
|
|
254
|
+
* Indicates this is a media attachment part
|
|
255
|
+
*/
|
|
256
|
+
type: 'media';
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Reference to a file pre-uploaded via `POST /v3/attachments` (optional). The file
|
|
260
|
+
* is already stored, so sends using this ID skip the download step — useful when
|
|
261
|
+
* sending the same file to many recipients.
|
|
262
|
+
*
|
|
263
|
+
* Either `url` or `attachment_id` must be provided, but not both.
|
|
264
|
+
*/
|
|
265
|
+
attachment_id?: string;
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* Any publicly accessible HTTPS URL to the media file. The server downloads and
|
|
269
|
+
* sends the file automatically — no pre-upload step required.
|
|
270
|
+
*
|
|
271
|
+
* **Size limit:** 10MB maximum for URL-based downloads. For larger files (up to
|
|
272
|
+
* 100MB), use the pre-upload flow: `POST /v3/attachments` to get a presigned URL,
|
|
273
|
+
* upload directly, then reference by `attachment_id`.
|
|
274
|
+
*
|
|
275
|
+
* **Requirements:**
|
|
276
|
+
*
|
|
277
|
+
* - URL must use HTTPS
|
|
278
|
+
* - File content must be a supported format (the server validates the actual file
|
|
279
|
+
* content)
|
|
280
|
+
*
|
|
281
|
+
* **Supported formats:**
|
|
282
|
+
*
|
|
283
|
+
* - Images: .jpg, .jpeg, .png, .gif, .heic, .heif, .tif, .tiff, .bmp
|
|
284
|
+
* - Videos: .mp4, .mov, .m4v, .mpeg, .mpg, .3gp
|
|
285
|
+
* - Audio: .m4a, .mp3, .aac, .caf, .wav, .aiff, .amr
|
|
286
|
+
* - Documents: .pdf, .txt, .rtf, .csv, .doc, .docx, .xls, .xlsx, .ppt, .pptx,
|
|
287
|
+
* .pages, .numbers, .key, .epub, .zip, .html, .htm
|
|
288
|
+
* - Contact & Calendar: .vcf, .ics
|
|
289
|
+
*
|
|
290
|
+
* **Tip:** Audio sent here appears as a regular file attachment. To send audio as
|
|
291
|
+
* an iMessage voice memo bubble (with inline playback), use
|
|
292
|
+
* `/v3/chats/{chatId}/voicememo`. For repeated sends of the same file, use
|
|
293
|
+
* `attachment_id` to avoid redundant downloads.
|
|
294
|
+
*
|
|
295
|
+
* Either `url` or `attachment_id` must be provided, but not both.
|
|
296
|
+
*/
|
|
297
|
+
url?: string;
|
|
298
|
+
}
|
|
299
|
+
|
|
250
300
|
/**
|
|
251
301
|
* Message content container. Groups all message-related fields together,
|
|
252
302
|
* separating the "what" (message content) from the "where" (routing fields like
|
|
@@ -283,7 +333,7 @@ export interface MessageContent {
|
|
|
283
333
|
* sub-limit. For bulk media sends exceeding 40 files, pre-upload via
|
|
284
334
|
* `POST /v3/attachments` and reference by `attachment_id` or `download_url`.
|
|
285
335
|
*/
|
|
286
|
-
parts: Array<
|
|
336
|
+
parts: Array<TextPart | MediaPart>;
|
|
287
337
|
|
|
288
338
|
/**
|
|
289
339
|
* iMessage effect to apply to this message (screen or bubble effect)
|
|
@@ -307,66 +357,16 @@ export interface MessageContent {
|
|
|
307
357
|
reply_to?: MessagesAPI.ReplyTo;
|
|
308
358
|
}
|
|
309
359
|
|
|
310
|
-
export
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
type: 'text';
|
|
316
|
-
|
|
317
|
-
/**
|
|
318
|
-
* The text content
|
|
319
|
-
*/
|
|
320
|
-
value: string;
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
export interface MediaPart {
|
|
324
|
-
/**
|
|
325
|
-
* Indicates this is a media attachment part
|
|
326
|
-
*/
|
|
327
|
-
type: 'media';
|
|
328
|
-
|
|
329
|
-
/**
|
|
330
|
-
* Reference to a file pre-uploaded via `POST /v3/attachments` (optional). The file
|
|
331
|
-
* is already stored, so sends using this ID skip the download step — useful when
|
|
332
|
-
* sending the same file to many recipients.
|
|
333
|
-
*
|
|
334
|
-
* Either `url` or `attachment_id` must be provided, but not both.
|
|
335
|
-
*/
|
|
336
|
-
attachment_id?: string;
|
|
360
|
+
export interface TextPart {
|
|
361
|
+
/**
|
|
362
|
+
* Indicates this is a text message part
|
|
363
|
+
*/
|
|
364
|
+
type: 'text';
|
|
337
365
|
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
* **Size limit:** 10MB maximum for URL-based downloads. For larger files (up to
|
|
343
|
-
* 100MB), use the pre-upload flow: `POST /v3/attachments` to get a presigned URL,
|
|
344
|
-
* upload directly, then reference by `attachment_id`.
|
|
345
|
-
*
|
|
346
|
-
* **Requirements:**
|
|
347
|
-
*
|
|
348
|
-
* - URL must use HTTPS
|
|
349
|
-
* - File content must be a supported format (the server validates the actual file
|
|
350
|
-
* content)
|
|
351
|
-
*
|
|
352
|
-
* **Supported formats:**
|
|
353
|
-
*
|
|
354
|
-
* - Images: .jpg, .jpeg, .png, .gif, .heic, .heif, .tif, .tiff, .bmp
|
|
355
|
-
* - Videos: .mp4, .mov, .m4v, .mpeg, .mpg, .3gp
|
|
356
|
-
* - Audio: .m4a, .mp3, .aac, .caf, .wav, .aiff, .amr
|
|
357
|
-
* - Documents: .pdf, .txt, .rtf, .csv, .doc, .docx, .xls, .xlsx, .ppt, .pptx,
|
|
358
|
-
* .pages, .numbers, .key, .epub, .zip, .html, .htm
|
|
359
|
-
* - Contact & Calendar: .vcf, .ics
|
|
360
|
-
*
|
|
361
|
-
* **Tip:** Audio sent here appears as a regular file attachment. To send audio as
|
|
362
|
-
* an iMessage voice memo bubble (with inline playback), use
|
|
363
|
-
* `/v3/chats/{chatId}/voicememo`. For repeated sends of the same file, use
|
|
364
|
-
* `attachment_id` to avoid redundant downloads.
|
|
365
|
-
*
|
|
366
|
-
* Either `url` or `attachment_id` must be provided, but not both.
|
|
367
|
-
*/
|
|
368
|
-
url?: string;
|
|
369
|
-
}
|
|
366
|
+
/**
|
|
367
|
+
* The text content
|
|
368
|
+
*/
|
|
369
|
+
value: string;
|
|
370
370
|
}
|
|
371
371
|
|
|
372
372
|
/**
|
|
@@ -412,19 +412,6 @@ export namespace ChatCreateResponse {
|
|
|
412
412
|
}
|
|
413
413
|
}
|
|
414
414
|
|
|
415
|
-
export interface ChatListResponse {
|
|
416
|
-
/**
|
|
417
|
-
* List of chats
|
|
418
|
-
*/
|
|
419
|
-
chats: Array<Chat>;
|
|
420
|
-
|
|
421
|
-
/**
|
|
422
|
-
* Cursor for fetching the next page of results. Null if there are no more results
|
|
423
|
-
* to fetch. Pass this value as the `cursor` parameter in the next request.
|
|
424
|
-
*/
|
|
425
|
-
next_cursor?: string | null;
|
|
426
|
-
}
|
|
427
|
-
|
|
428
415
|
/**
|
|
429
416
|
* Response for sending a voice memo to a chat
|
|
430
417
|
*/
|
|
@@ -564,24 +551,13 @@ export interface ChatUpdateParams {
|
|
|
564
551
|
group_chat_icon?: string;
|
|
565
552
|
}
|
|
566
553
|
|
|
567
|
-
export interface
|
|
554
|
+
export interface ChatListChatsParams extends ListChatsPaginationParams {
|
|
568
555
|
/**
|
|
569
556
|
* Phone number to filter chats by. Returns all chats made from this phone number.
|
|
570
557
|
* Must be in E.164 format (e.g., `+13343284472`). The `+` is automatically
|
|
571
558
|
* URL-encoded by HTTP clients.
|
|
572
559
|
*/
|
|
573
560
|
from: string;
|
|
574
|
-
|
|
575
|
-
/**
|
|
576
|
-
* Pagination cursor from the previous response's `next_cursor` field. Omit this
|
|
577
|
-
* parameter for the first page of results.
|
|
578
|
-
*/
|
|
579
|
-
cursor?: string;
|
|
580
|
-
|
|
581
|
-
/**
|
|
582
|
-
* Maximum number of chats to return per page
|
|
583
|
-
*/
|
|
584
|
-
limit?: number;
|
|
585
561
|
}
|
|
586
562
|
|
|
587
563
|
export interface ChatSendVoicememoParams {
|
|
@@ -603,13 +579,15 @@ Chats.Messages = Messages;
|
|
|
603
579
|
export declare namespace Chats {
|
|
604
580
|
export {
|
|
605
581
|
type Chat as Chat,
|
|
582
|
+
type MediaPart as MediaPart,
|
|
606
583
|
type MessageContent as MessageContent,
|
|
584
|
+
type TextPart as TextPart,
|
|
607
585
|
type ChatCreateResponse as ChatCreateResponse,
|
|
608
|
-
type ChatListResponse as ChatListResponse,
|
|
609
586
|
type ChatSendVoicememoResponse as ChatSendVoicememoResponse,
|
|
587
|
+
type ChatsListChatsPagination as ChatsListChatsPagination,
|
|
610
588
|
type ChatCreateParams as ChatCreateParams,
|
|
611
589
|
type ChatUpdateParams as ChatUpdateParams,
|
|
612
|
-
type
|
|
590
|
+
type ChatListChatsParams as ChatListChatsParams,
|
|
613
591
|
type ChatSendVoicememoParams as ChatSendVoicememoParams,
|
|
614
592
|
};
|
|
615
593
|
|
|
@@ -626,7 +604,6 @@ export declare namespace Chats {
|
|
|
626
604
|
export {
|
|
627
605
|
Messages as Messages,
|
|
628
606
|
type SentMessage as SentMessage,
|
|
629
|
-
type MessageListResponse as MessageListResponse,
|
|
630
607
|
type MessageSendResponse as MessageSendResponse,
|
|
631
608
|
type MessageListParams as MessageListParams,
|
|
632
609
|
type MessageSendParams as MessageSendParams,
|
|
@@ -3,19 +3,20 @@
|
|
|
3
3
|
export {
|
|
4
4
|
Chats,
|
|
5
5
|
type Chat,
|
|
6
|
+
type MediaPart,
|
|
6
7
|
type MessageContent,
|
|
8
|
+
type TextPart,
|
|
7
9
|
type ChatCreateResponse,
|
|
8
|
-
type ChatListResponse,
|
|
9
10
|
type ChatSendVoicememoResponse,
|
|
10
11
|
type ChatCreateParams,
|
|
11
12
|
type ChatUpdateParams,
|
|
12
|
-
type
|
|
13
|
+
type ChatListChatsParams,
|
|
13
14
|
type ChatSendVoicememoParams,
|
|
15
|
+
type ChatsListChatsPagination,
|
|
14
16
|
} from './chats';
|
|
15
17
|
export {
|
|
16
18
|
Messages,
|
|
17
19
|
type SentMessage,
|
|
18
|
-
type MessageListResponse,
|
|
19
20
|
type MessageSendResponse,
|
|
20
21
|
type MessageListParams,
|
|
21
22
|
type MessageSendParams,
|
|
@@ -2,9 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
import { APIResource } from '../../core/resource';
|
|
4
4
|
import * as MessagesAPI from '../messages';
|
|
5
|
+
import { MessagesListMessagesPagination } from '../messages';
|
|
5
6
|
import * as Shared from '../shared';
|
|
6
7
|
import * as ChatsAPI from './chats';
|
|
7
8
|
import { APIPromise } from '../../core/api-promise';
|
|
9
|
+
import {
|
|
10
|
+
ListMessagesPagination,
|
|
11
|
+
type ListMessagesPaginationParams,
|
|
12
|
+
PagePromise,
|
|
13
|
+
} from '../../core/pagination';
|
|
8
14
|
import { RequestOptions } from '../../internal/request-options';
|
|
9
15
|
import { path } from '../../internal/utils/path';
|
|
10
16
|
|
|
@@ -23,17 +29,24 @@ export class Messages extends APIResource {
|
|
|
23
29
|
*
|
|
24
30
|
* @example
|
|
25
31
|
* ```ts
|
|
26
|
-
*
|
|
32
|
+
* // Automatically fetches more pages as needed.
|
|
33
|
+
* for await (const message of client.chats.messages.list(
|
|
27
34
|
* '550e8400-e29b-41d4-a716-446655440000',
|
|
28
|
-
* )
|
|
35
|
+
* )) {
|
|
36
|
+
* // ...
|
|
37
|
+
* }
|
|
29
38
|
* ```
|
|
30
39
|
*/
|
|
31
40
|
list(
|
|
32
41
|
chatID: string,
|
|
33
42
|
query: MessageListParams | null | undefined = {},
|
|
34
43
|
options?: RequestOptions,
|
|
35
|
-
):
|
|
36
|
-
return this._client.
|
|
44
|
+
): PagePromise<MessagesListMessagesPagination, MessagesAPI.Message> {
|
|
45
|
+
return this._client.getAPIList(
|
|
46
|
+
path`/v3/chats/${chatID}/messages`,
|
|
47
|
+
ListMessagesPagination<MessagesAPI.Message>,
|
|
48
|
+
{ query, ...options },
|
|
49
|
+
);
|
|
37
50
|
}
|
|
38
51
|
|
|
39
52
|
/**
|
|
@@ -93,7 +106,7 @@ export interface SentMessage {
|
|
|
93
106
|
/**
|
|
94
107
|
* Message parts in order (text and media)
|
|
95
108
|
*/
|
|
96
|
-
parts: Array<
|
|
109
|
+
parts: Array<Shared.TextPartResponse | Shared.MediaPartResponse>;
|
|
97
110
|
|
|
98
111
|
/**
|
|
99
112
|
* When the message was sent
|
|
@@ -131,19 +144,6 @@ export interface SentMessage {
|
|
|
131
144
|
service?: Shared.ServiceType | null;
|
|
132
145
|
}
|
|
133
146
|
|
|
134
|
-
export interface MessageListResponse {
|
|
135
|
-
/**
|
|
136
|
-
* List of messages
|
|
137
|
-
*/
|
|
138
|
-
messages: Array<MessagesAPI.Message>;
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
* Cursor for fetching the next page of results. Null if there are no more results
|
|
142
|
-
* to fetch. Pass this value as the `cursor` parameter in the next request.
|
|
143
|
-
*/
|
|
144
|
-
next_cursor?: string | null;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
147
|
/**
|
|
148
148
|
* Response for sending a message to a chat
|
|
149
149
|
*/
|
|
@@ -159,17 +159,7 @@ export interface MessageSendResponse {
|
|
|
159
159
|
message: SentMessage;
|
|
160
160
|
}
|
|
161
161
|
|
|
162
|
-
export interface MessageListParams {
|
|
163
|
-
/**
|
|
164
|
-
* Pagination cursor from previous next_cursor response
|
|
165
|
-
*/
|
|
166
|
-
cursor?: string;
|
|
167
|
-
|
|
168
|
-
/**
|
|
169
|
-
* Maximum number of messages to return
|
|
170
|
-
*/
|
|
171
|
-
limit?: number;
|
|
172
|
-
}
|
|
162
|
+
export interface MessageListParams extends ListMessagesPaginationParams {}
|
|
173
163
|
|
|
174
164
|
export interface MessageSendParams {
|
|
175
165
|
/**
|
|
@@ -183,9 +173,10 @@ export interface MessageSendParams {
|
|
|
183
173
|
export declare namespace Messages {
|
|
184
174
|
export {
|
|
185
175
|
type SentMessage as SentMessage,
|
|
186
|
-
type MessageListResponse as MessageListResponse,
|
|
187
176
|
type MessageSendResponse as MessageSendResponse,
|
|
188
177
|
type MessageListParams as MessageListParams,
|
|
189
178
|
type MessageSendParams as MessageSendParams,
|
|
190
179
|
};
|
|
191
180
|
}
|
|
181
|
+
|
|
182
|
+
export { type MessagesListMessagesPagination };
|
package/src/resources/index.ts
CHANGED
|
@@ -10,38 +10,39 @@ export {
|
|
|
10
10
|
} from './attachments';
|
|
11
11
|
export {
|
|
12
12
|
Capability,
|
|
13
|
-
type
|
|
14
|
-
type
|
|
15
|
-
type
|
|
16
|
-
type
|
|
13
|
+
type CapabilityCheckiMessageResponse,
|
|
14
|
+
type CapabilityCheckRCSResponse,
|
|
15
|
+
type CapabilityCheckiMessageParams,
|
|
16
|
+
type CapabilityCheckRCSParams,
|
|
17
17
|
} from './capability';
|
|
18
18
|
export {
|
|
19
19
|
Chats,
|
|
20
20
|
type Chat,
|
|
21
|
+
type MediaPart,
|
|
21
22
|
type MessageContent,
|
|
23
|
+
type TextPart,
|
|
22
24
|
type ChatCreateResponse,
|
|
23
|
-
type ChatListResponse,
|
|
24
25
|
type ChatSendVoicememoResponse,
|
|
25
26
|
type ChatCreateParams,
|
|
26
27
|
type ChatUpdateParams,
|
|
27
|
-
type
|
|
28
|
+
type ChatListChatsParams,
|
|
28
29
|
type ChatSendVoicememoParams,
|
|
30
|
+
type ChatsListChatsPagination,
|
|
29
31
|
} from './chats/chats';
|
|
30
32
|
export {
|
|
31
33
|
Messages,
|
|
32
34
|
type ChatHandle,
|
|
33
|
-
type MediaPart,
|
|
34
35
|
type Message,
|
|
35
36
|
type MessageEffect,
|
|
36
37
|
type Reaction,
|
|
37
38
|
type ReactionType,
|
|
38
39
|
type ReplyTo,
|
|
39
|
-
type TextPart,
|
|
40
40
|
type MessageAddReactionResponse,
|
|
41
|
-
type
|
|
41
|
+
type MessageUpdateParams,
|
|
42
42
|
type MessageDeleteParams,
|
|
43
43
|
type MessageAddReactionParams,
|
|
44
|
-
type
|
|
44
|
+
type MessageListMessagesThreadParams,
|
|
45
|
+
type MessagesListMessagesPagination,
|
|
45
46
|
} from './messages';
|
|
46
47
|
export { PhoneNumbers, type PhoneNumberListResponse } from './phone-numbers';
|
|
47
48
|
export { Phonenumbers, type PhonenumberListResponse } from './phonenumbers';
|
|
@@ -54,3 +55,47 @@ export {
|
|
|
54
55
|
type WebhookSubscriptionCreateParams,
|
|
55
56
|
type WebhookSubscriptionUpdateParams,
|
|
56
57
|
} from './webhook-subscriptions';
|
|
58
|
+
export {
|
|
59
|
+
Webhooks,
|
|
60
|
+
type MessageEventV2,
|
|
61
|
+
type MessagePayload,
|
|
62
|
+
type ReactionEventBase,
|
|
63
|
+
type SchemasMediaPartResponse,
|
|
64
|
+
type SchemasMessageEffect,
|
|
65
|
+
type SchemasTextPartResponse,
|
|
66
|
+
type MessageSentV2026WebhookEvent,
|
|
67
|
+
type MessageReceivedV2026WebhookEvent,
|
|
68
|
+
type MessageReadV2026WebhookEvent,
|
|
69
|
+
type MessageDeliveredV2026WebhookEvent,
|
|
70
|
+
type MessageFailedV2026WebhookEvent,
|
|
71
|
+
type ReactionAddedV2026WebhookEvent,
|
|
72
|
+
type ReactionRemovedV2026WebhookEvent,
|
|
73
|
+
type ParticipantAddedV2026WebhookEvent,
|
|
74
|
+
type ParticipantRemovedV2026WebhookEvent,
|
|
75
|
+
type ChatGroupNameUpdatedV2026WebhookEvent,
|
|
76
|
+
type ChatGroupIconUpdatedV2026WebhookEvent,
|
|
77
|
+
type ChatGroupNameUpdateFailedV2026WebhookEvent,
|
|
78
|
+
type ChatGroupIconUpdateFailedV2026WebhookEvent,
|
|
79
|
+
type ChatCreatedV2026WebhookEvent,
|
|
80
|
+
type ChatTypingIndicatorStartedV2026WebhookEvent,
|
|
81
|
+
type ChatTypingIndicatorStoppedV2026WebhookEvent,
|
|
82
|
+
type PhoneNumberStatusUpdatedV2026WebhookEvent,
|
|
83
|
+
type MessageSentV2025WebhookEvent,
|
|
84
|
+
type MessageReceivedV2025WebhookEvent,
|
|
85
|
+
type MessageReadV2025WebhookEvent,
|
|
86
|
+
type MessageDeliveredV2025WebhookEvent,
|
|
87
|
+
type MessageFailedV2025WebhookEvent,
|
|
88
|
+
type ReactionAddedV2025WebhookEvent,
|
|
89
|
+
type ReactionRemovedV2025WebhookEvent,
|
|
90
|
+
type ParticipantAddedV2025WebhookEvent,
|
|
91
|
+
type ParticipantRemovedV2025WebhookEvent,
|
|
92
|
+
type ChatGroupNameUpdatedV2025WebhookEvent,
|
|
93
|
+
type ChatGroupIconUpdatedV2025WebhookEvent,
|
|
94
|
+
type ChatGroupNameUpdateFailedV2025WebhookEvent,
|
|
95
|
+
type ChatGroupIconUpdateFailedV2025WebhookEvent,
|
|
96
|
+
type ChatCreatedV2025WebhookEvent,
|
|
97
|
+
type ChatTypingIndicatorStartedV2025WebhookEvent,
|
|
98
|
+
type ChatTypingIndicatorStoppedV2025WebhookEvent,
|
|
99
|
+
type PhoneNumberStatusUpdatedV2025WebhookEvent,
|
|
100
|
+
type EventsWebhookEvent,
|
|
101
|
+
} from './webhooks';
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import { APIResource } from '../core/resource';
|
|
4
4
|
import * as Shared from './shared';
|
|
5
5
|
import { APIPromise } from '../core/api-promise';
|
|
6
|
+
import { ListMessagesPagination, type ListMessagesPaginationParams, PagePromise } from '../core/pagination';
|
|
6
7
|
import { buildHeaders } from '../internal/headers';
|
|
7
8
|
import { RequestOptions } from '../internal/request-options';
|
|
8
9
|
import { path } from '../internal/utils/path';
|
|
@@ -32,6 +33,21 @@ export class Messages extends APIResource {
|
|
|
32
33
|
return this._client.get(path`/v3/messages/${messageID}`, options);
|
|
33
34
|
}
|
|
34
35
|
|
|
36
|
+
/**
|
|
37
|
+
* Edit the text content of a specific part of a previously sent message.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```ts
|
|
41
|
+
* const message = await client.messages.update(
|
|
42
|
+
* '69a37c7d-af4f-4b5e-af42-e28e98ce873a',
|
|
43
|
+
* { text: 'This is the edited message content' },
|
|
44
|
+
* );
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
update(messageID: string, body: MessageUpdateParams, options?: RequestOptions): APIPromise<Message> {
|
|
48
|
+
return this._client.patch(path`/v3/messages/${messageID}`, { body, ...options });
|
|
49
|
+
}
|
|
50
|
+
|
|
35
51
|
/**
|
|
36
52
|
* Deletes a message from the Linq API only. This does NOT unsend or remove the
|
|
37
53
|
* message from the actual chat - recipients will still see the message.
|
|
@@ -95,20 +111,28 @@ export class Messages extends APIResource {
|
|
|
95
111
|
*
|
|
96
112
|
* @example
|
|
97
113
|
* ```ts
|
|
98
|
-
*
|
|
114
|
+
* // Automatically fetches more pages as needed.
|
|
115
|
+
* for await (const message of client.messages.listMessagesThread(
|
|
99
116
|
* '69a37c7d-af4f-4b5e-af42-e28e98ce873a',
|
|
100
|
-
* )
|
|
117
|
+
* )) {
|
|
118
|
+
* // ...
|
|
119
|
+
* }
|
|
101
120
|
* ```
|
|
102
121
|
*/
|
|
103
|
-
|
|
122
|
+
listMessagesThread(
|
|
104
123
|
messageID: string,
|
|
105
|
-
query:
|
|
124
|
+
query: MessageListMessagesThreadParams | null | undefined = {},
|
|
106
125
|
options?: RequestOptions,
|
|
107
|
-
):
|
|
108
|
-
return this._client.
|
|
126
|
+
): PagePromise<MessagesListMessagesPagination, Message> {
|
|
127
|
+
return this._client.getAPIList(path`/v3/messages/${messageID}/thread`, ListMessagesPagination<Message>, {
|
|
128
|
+
query,
|
|
129
|
+
...options,
|
|
130
|
+
});
|
|
109
131
|
}
|
|
110
132
|
}
|
|
111
133
|
|
|
134
|
+
export type MessagesListMessagesPagination = ListMessagesPagination<Message>;
|
|
135
|
+
|
|
112
136
|
export interface ChatHandle {
|
|
113
137
|
/**
|
|
114
138
|
* Unique identifier for this handle
|
|
@@ -146,46 +170,6 @@ export interface ChatHandle {
|
|
|
146
170
|
status?: 'active' | 'left' | 'removed' | null;
|
|
147
171
|
}
|
|
148
172
|
|
|
149
|
-
/**
|
|
150
|
-
* A media attachment part
|
|
151
|
-
*/
|
|
152
|
-
export interface MediaPart {
|
|
153
|
-
/**
|
|
154
|
-
* Unique attachment identifier
|
|
155
|
-
*/
|
|
156
|
-
id: string;
|
|
157
|
-
|
|
158
|
-
/**
|
|
159
|
-
* Original filename
|
|
160
|
-
*/
|
|
161
|
-
filename: string;
|
|
162
|
-
|
|
163
|
-
/**
|
|
164
|
-
* MIME type of the file
|
|
165
|
-
*/
|
|
166
|
-
mime_type: string;
|
|
167
|
-
|
|
168
|
-
/**
|
|
169
|
-
* Reactions on this message part
|
|
170
|
-
*/
|
|
171
|
-
reactions: Array<Reaction> | null;
|
|
172
|
-
|
|
173
|
-
/**
|
|
174
|
-
* File size in bytes
|
|
175
|
-
*/
|
|
176
|
-
size_bytes: number;
|
|
177
|
-
|
|
178
|
-
/**
|
|
179
|
-
* Indicates this is a media attachment part
|
|
180
|
-
*/
|
|
181
|
-
type: 'media';
|
|
182
|
-
|
|
183
|
-
/**
|
|
184
|
-
* Presigned URL for downloading the attachment (expires in 1 hour).
|
|
185
|
-
*/
|
|
186
|
-
url: string;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
173
|
export interface Message {
|
|
190
174
|
/**
|
|
191
175
|
* Unique identifier for the message
|
|
@@ -246,7 +230,7 @@ export interface Message {
|
|
|
246
230
|
/**
|
|
247
231
|
* Message parts in order (text and media)
|
|
248
232
|
*/
|
|
249
|
-
parts?: Array<
|
|
233
|
+
parts?: Array<Shared.TextPartResponse | Shared.MediaPartResponse> | null;
|
|
250
234
|
|
|
251
235
|
/**
|
|
252
236
|
* Messaging service type
|
|
@@ -387,26 +371,6 @@ export interface ReplyTo {
|
|
|
387
371
|
part_index?: number;
|
|
388
372
|
}
|
|
389
373
|
|
|
390
|
-
/**
|
|
391
|
-
* A text message part
|
|
392
|
-
*/
|
|
393
|
-
export interface TextPart {
|
|
394
|
-
/**
|
|
395
|
-
* Reactions on this message part
|
|
396
|
-
*/
|
|
397
|
-
reactions: Array<Reaction> | null;
|
|
398
|
-
|
|
399
|
-
/**
|
|
400
|
-
* Indicates this is a text message part
|
|
401
|
-
*/
|
|
402
|
-
type: 'text';
|
|
403
|
-
|
|
404
|
-
/**
|
|
405
|
-
* The text content
|
|
406
|
-
*/
|
|
407
|
-
value: string;
|
|
408
|
-
}
|
|
409
|
-
|
|
410
374
|
export interface MessageAddReactionResponse {
|
|
411
375
|
message?: string;
|
|
412
376
|
|
|
@@ -415,19 +379,16 @@ export interface MessageAddReactionResponse {
|
|
|
415
379
|
trace_id?: string;
|
|
416
380
|
}
|
|
417
381
|
|
|
418
|
-
|
|
419
|
-
* Response containing messages in a thread with pagination
|
|
420
|
-
*/
|
|
421
|
-
export interface MessageRetrieveThreadResponse {
|
|
382
|
+
export interface MessageUpdateParams {
|
|
422
383
|
/**
|
|
423
|
-
*
|
|
384
|
+
* New text content for the message part
|
|
424
385
|
*/
|
|
425
|
-
|
|
386
|
+
text: string;
|
|
426
387
|
|
|
427
388
|
/**
|
|
428
|
-
*
|
|
389
|
+
* Index of the message part to edit. Defaults to 0.
|
|
429
390
|
*/
|
|
430
|
-
|
|
391
|
+
part_index?: number;
|
|
431
392
|
}
|
|
432
393
|
|
|
433
394
|
export interface MessageDeleteParams {
|
|
@@ -463,17 +424,7 @@ export interface MessageAddReactionParams {
|
|
|
463
424
|
part_index?: number;
|
|
464
425
|
}
|
|
465
426
|
|
|
466
|
-
export interface
|
|
467
|
-
/**
|
|
468
|
-
* Pagination cursor from previous next_cursor response
|
|
469
|
-
*/
|
|
470
|
-
cursor?: string;
|
|
471
|
-
|
|
472
|
-
/**
|
|
473
|
-
* Maximum number of messages to return
|
|
474
|
-
*/
|
|
475
|
-
limit?: number;
|
|
476
|
-
|
|
427
|
+
export interface MessageListMessagesThreadParams extends ListMessagesPaginationParams {
|
|
477
428
|
/**
|
|
478
429
|
* Sort order for messages (asc = oldest first, desc = newest first)
|
|
479
430
|
*/
|
|
@@ -483,17 +434,16 @@ export interface MessageRetrieveThreadParams {
|
|
|
483
434
|
export declare namespace Messages {
|
|
484
435
|
export {
|
|
485
436
|
type ChatHandle as ChatHandle,
|
|
486
|
-
type MediaPart as MediaPart,
|
|
487
437
|
type Message as Message,
|
|
488
438
|
type MessageEffect as MessageEffect,
|
|
489
439
|
type Reaction as Reaction,
|
|
490
440
|
type ReactionType as ReactionType,
|
|
491
441
|
type ReplyTo as ReplyTo,
|
|
492
|
-
type TextPart as TextPart,
|
|
493
442
|
type MessageAddReactionResponse as MessageAddReactionResponse,
|
|
494
|
-
type
|
|
443
|
+
type MessagesListMessagesPagination as MessagesListMessagesPagination,
|
|
444
|
+
type MessageUpdateParams as MessageUpdateParams,
|
|
495
445
|
type MessageDeleteParams as MessageDeleteParams,
|
|
496
446
|
type MessageAddReactionParams as MessageAddReactionParams,
|
|
497
|
-
type
|
|
447
|
+
type MessageListMessagesThreadParams as MessageListMessagesThreadParams,
|
|
498
448
|
};
|
|
499
449
|
}
|