@linqapp/sdk 0.1.5 → 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 +36 -0
- package/README.md +31 -0
- package/client.d.mts +299 -7
- package/client.d.mts.map +1 -1
- package/client.d.ts +299 -7
- package/client.d.ts.map +1 -1
- package/client.js +294 -12
- package/client.js.map +1 -1
- package/client.mjs +294 -12
- 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/internal/utils/query.d.mts +5 -0
- package/internal/utils/query.d.mts.map +1 -0
- package/internal/utils/query.d.ts +5 -0
- package/internal/utils/query.d.ts.map +1 -0
- package/internal/utils/query.js +23 -0
- package/internal/utils/query.js.map +1 -0
- package/internal/utils/query.mjs +20 -0
- package/internal/utils/query.mjs.map +1 -0
- package/internal/utils.d.mts +1 -0
- package/internal/utils.d.ts +1 -0
- package/internal/utils.js +1 -0
- package/internal/utils.js.map +1 -1
- package/internal/utils.mjs +1 -0
- 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/attachments.d.mts +64 -0
- package/resources/attachments.d.mts.map +1 -1
- package/resources/attachments.d.ts +64 -0
- package/resources/attachments.d.ts.map +1 -1
- package/resources/attachments.js +64 -0
- package/resources/attachments.js.map +1 -1
- package/resources/attachments.mjs +64 -0
- package/resources/attachments.mjs.map +1 -1
- package/resources/capability.d.mts +12 -9
- package/resources/capability.d.mts.map +1 -1
- package/resources/capability.d.ts +12 -9
- package/resources/capability.d.ts.map +1 -1
- package/resources/capability.js +7 -4
- package/resources/capability.js.map +1 -1
- package/resources/capability.mjs +7 -4
- package/resources/capability.mjs.map +1 -1
- package/resources/chats/chats.d.mts +76 -97
- package/resources/chats/chats.d.mts.map +1 -1
- package/resources/chats/chats.d.ts +76 -97
- 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 +21 -25
- package/resources/chats/messages.d.mts.map +1 -1
- package/resources/chats/messages.d.ts +21 -25
- package/resources/chats/messages.d.ts.map +1 -1
- package/resources/chats/messages.js +16 -3
- package/resources/chats/messages.js.map +1 -1
- package/resources/chats/messages.mjs +16 -3
- package/resources/chats/messages.mjs.map +1 -1
- package/resources/chats/participants.d.mts +18 -0
- package/resources/chats/participants.d.mts.map +1 -1
- package/resources/chats/participants.d.ts +18 -0
- package/resources/chats/participants.d.ts.map +1 -1
- package/resources/chats/participants.js +18 -0
- package/resources/chats/participants.js.map +1 -1
- package/resources/chats/participants.mjs +18 -0
- package/resources/chats/participants.mjs.map +1 -1
- package/resources/chats/typing.d.mts +18 -0
- package/resources/chats/typing.d.mts.map +1 -1
- package/resources/chats/typing.d.ts +18 -0
- package/resources/chats/typing.d.ts.map +1 -1
- package/resources/chats/typing.js +18 -0
- package/resources/chats/typing.js.map +1 -1
- package/resources/chats/typing.mjs +18 -0
- package/resources/chats/typing.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 +37 -72
- package/resources/messages.d.mts.map +1 -1
- package/resources/messages.d.ts +37 -72
- package/resources/messages.d.ts.map +1 -1
- package/resources/messages.js +34 -4
- package/resources/messages.js.map +1 -1
- package/resources/messages.mjs +34 -4
- package/resources/messages.mjs.map +1 -1
- package/resources/phone-numbers.d.mts +9 -0
- package/resources/phone-numbers.d.mts.map +1 -1
- package/resources/phone-numbers.d.ts +9 -0
- package/resources/phone-numbers.d.ts.map +1 -1
- package/resources/phone-numbers.js +9 -0
- package/resources/phone-numbers.js.map +1 -1
- package/resources/phone-numbers.mjs +9 -0
- package/resources/phone-numbers.mjs.map +1 -1
- package/resources/phonenumbers.d.mts +9 -0
- package/resources/phonenumbers.d.mts.map +1 -1
- package/resources/phonenumbers.d.ts +9 -0
- package/resources/phonenumbers.d.ts.map +1 -1
- package/resources/phonenumbers.js +9 -0
- package/resources/phonenumbers.js.map +1 -1
- package/resources/phonenumbers.mjs +9 -0
- package/resources/phonenumbers.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/webhook-events.d.mts +90 -1
- package/resources/webhook-events.d.mts.map +1 -1
- package/resources/webhook-events.d.ts +90 -1
- package/resources/webhook-events.d.ts.map +1 -1
- package/resources/webhook-events.js +89 -0
- package/resources/webhook-events.js.map +1 -1
- package/resources/webhook-events.mjs +89 -0
- package/resources/webhook-events.mjs.map +1 -1
- package/resources/webhook-subscriptions.d.mts +89 -0
- package/resources/webhook-subscriptions.d.mts.map +1 -1
- package/resources/webhook-subscriptions.d.ts +89 -0
- package/resources/webhook-subscriptions.d.ts.map +1 -1
- package/resources/webhook-subscriptions.js +89 -0
- package/resources/webhook-subscriptions.js.map +1 -1
- package/resources/webhook-subscriptions.mjs +89 -0
- package/resources/webhook-subscriptions.mjs.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 +443 -37
- package/src/core/pagination.ts +212 -0
- package/src/index.ts +1 -0
- package/src/internal/utils/query.ts +23 -0
- package/src/internal/utils.ts +1 -0
- package/src/pagination.ts +2 -0
- package/src/resources/attachments.ts +64 -0
- package/src/resources/capability.ts +17 -14
- package/src/resources/chats/chats.ts +86 -115
- package/src/resources/chats/index.ts +4 -3
- package/src/resources/chats/messages.ts +30 -30
- package/src/resources/chats/participants.ts +18 -0
- package/src/resources/chats/typing.ts +18 -0
- package/src/resources/index.ts +55 -10
- package/src/resources/messages.ts +49 -90
- package/src/resources/phone-numbers.ts +9 -0
- package/src/resources/phonenumbers.ts +9 -0
- package/src/resources/shared.ts +62 -0
- package/src/resources/webhook-events.ts +90 -0
- package/src/resources/webhook-subscriptions.ts +89 -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
|
|
@@ -273,11 +323,17 @@ export interface MessageContent {
|
|
|
273
323
|
* - To send audio as an **iMessage voice memo bubble** (inline playback UI), use
|
|
274
324
|
* the dedicated `/v3/chats/{chatId}/voicememo` endpoint instead
|
|
275
325
|
*
|
|
276
|
-
* **Validation
|
|
277
|
-
*
|
|
278
|
-
*
|
|
326
|
+
* **Validation Rules:**
|
|
327
|
+
*
|
|
328
|
+
* - Consecutive text parts are not allowed. Text parts must be separated by media
|
|
329
|
+
* parts. For example, [text, text] is invalid, but [text, media, text] is valid.
|
|
330
|
+
* - Maximum of **100 parts** total.
|
|
331
|
+
* - Media parts using a public `url` (downloaded by the server on send) are capped
|
|
332
|
+
* at **40**. Parts using `attachment_id` or presigned URLs are exempt from this
|
|
333
|
+
* sub-limit. For bulk media sends exceeding 40 files, pre-upload via
|
|
334
|
+
* `POST /v3/attachments` and reference by `attachment_id` or `download_url`.
|
|
279
335
|
*/
|
|
280
|
-
parts: Array<
|
|
336
|
+
parts: Array<TextPart | MediaPart>;
|
|
281
337
|
|
|
282
338
|
/**
|
|
283
339
|
* iMessage effect to apply to this message (screen or bubble effect)
|
|
@@ -301,78 +357,16 @@ export interface MessageContent {
|
|
|
301
357
|
reply_to?: MessagesAPI.ReplyTo;
|
|
302
358
|
}
|
|
303
359
|
|
|
304
|
-
export
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
type: 'text';
|
|
310
|
-
|
|
311
|
-
/**
|
|
312
|
-
* The text content
|
|
313
|
-
*/
|
|
314
|
-
value: string;
|
|
315
|
-
|
|
316
|
-
/**
|
|
317
|
-
* Optional idempotency key for this specific message part. Use this to prevent
|
|
318
|
-
* duplicate sends of the same part.
|
|
319
|
-
*/
|
|
320
|
-
idempotency_key?: 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;
|
|
337
|
-
|
|
338
|
-
/**
|
|
339
|
-
* Optional idempotency key for this specific message part. Use this to prevent
|
|
340
|
-
* duplicate sends of the same part.
|
|
341
|
-
*/
|
|
342
|
-
idempotency_key?: string;
|
|
360
|
+
export interface TextPart {
|
|
361
|
+
/**
|
|
362
|
+
* Indicates this is a text message part
|
|
363
|
+
*/
|
|
364
|
+
type: 'text';
|
|
343
365
|
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
* **Size limit:** 10MB maximum for URL-based downloads. For larger files (up to
|
|
349
|
-
* 100MB), use the pre-upload flow: `POST /v3/attachments` to get a presigned URL,
|
|
350
|
-
* upload directly, then reference by `attachment_id`.
|
|
351
|
-
*
|
|
352
|
-
* **Requirements:**
|
|
353
|
-
*
|
|
354
|
-
* - URL must use HTTPS
|
|
355
|
-
* - File content must be a supported format (the server validates the actual file
|
|
356
|
-
* content)
|
|
357
|
-
*
|
|
358
|
-
* **Supported formats:**
|
|
359
|
-
*
|
|
360
|
-
* - Images: .jpg, .jpeg, .png, .gif, .heic, .heif, .tif, .tiff, .bmp
|
|
361
|
-
* - Videos: .mp4, .mov, .m4v, .mpeg, .mpg, .3gp
|
|
362
|
-
* - Audio: .m4a, .mp3, .aac, .caf, .wav, .aiff, .amr
|
|
363
|
-
* - Documents: .pdf, .txt, .rtf, .csv, .doc, .docx, .xls, .xlsx, .ppt, .pptx,
|
|
364
|
-
* .pages, .numbers, .key, .epub, .zip, .html, .htm
|
|
365
|
-
* - Contact & Calendar: .vcf, .ics
|
|
366
|
-
*
|
|
367
|
-
* **Tip:** Audio sent here appears as a regular file attachment. To send audio as
|
|
368
|
-
* an iMessage voice memo bubble (with inline playback), use
|
|
369
|
-
* `/v3/chats/{chatId}/voicememo`. For repeated sends of the same file, use
|
|
370
|
-
* `attachment_id` to avoid redundant downloads.
|
|
371
|
-
*
|
|
372
|
-
* Either `url` or `attachment_id` must be provided, but not both.
|
|
373
|
-
*/
|
|
374
|
-
url?: string;
|
|
375
|
-
}
|
|
366
|
+
/**
|
|
367
|
+
* The text content
|
|
368
|
+
*/
|
|
369
|
+
value: string;
|
|
376
370
|
}
|
|
377
371
|
|
|
378
372
|
/**
|
|
@@ -418,19 +412,6 @@ export namespace ChatCreateResponse {
|
|
|
418
412
|
}
|
|
419
413
|
}
|
|
420
414
|
|
|
421
|
-
export interface ChatListResponse {
|
|
422
|
-
/**
|
|
423
|
-
* List of chats
|
|
424
|
-
*/
|
|
425
|
-
chats: Array<Chat>;
|
|
426
|
-
|
|
427
|
-
/**
|
|
428
|
-
* Cursor for fetching the next page of results. Null if there are no more results
|
|
429
|
-
* to fetch. Pass this value as the `cursor` parameter in the next request.
|
|
430
|
-
*/
|
|
431
|
-
next_cursor?: string | null;
|
|
432
|
-
}
|
|
433
|
-
|
|
434
415
|
/**
|
|
435
416
|
* Response for sending a voice memo to a chat
|
|
436
417
|
*/
|
|
@@ -570,24 +551,13 @@ export interface ChatUpdateParams {
|
|
|
570
551
|
group_chat_icon?: string;
|
|
571
552
|
}
|
|
572
553
|
|
|
573
|
-
export interface
|
|
554
|
+
export interface ChatListChatsParams extends ListChatsPaginationParams {
|
|
574
555
|
/**
|
|
575
556
|
* Phone number to filter chats by. Returns all chats made from this phone number.
|
|
576
557
|
* Must be in E.164 format (e.g., `+13343284472`). The `+` is automatically
|
|
577
558
|
* URL-encoded by HTTP clients.
|
|
578
559
|
*/
|
|
579
560
|
from: string;
|
|
580
|
-
|
|
581
|
-
/**
|
|
582
|
-
* Pagination cursor from the previous response's `next_cursor` field. Omit this
|
|
583
|
-
* parameter for the first page of results.
|
|
584
|
-
*/
|
|
585
|
-
cursor?: string;
|
|
586
|
-
|
|
587
|
-
/**
|
|
588
|
-
* Maximum number of chats to return per page
|
|
589
|
-
*/
|
|
590
|
-
limit?: number;
|
|
591
561
|
}
|
|
592
562
|
|
|
593
563
|
export interface ChatSendVoicememoParams {
|
|
@@ -609,13 +579,15 @@ Chats.Messages = Messages;
|
|
|
609
579
|
export declare namespace Chats {
|
|
610
580
|
export {
|
|
611
581
|
type Chat as Chat,
|
|
582
|
+
type MediaPart as MediaPart,
|
|
612
583
|
type MessageContent as MessageContent,
|
|
584
|
+
type TextPart as TextPart,
|
|
613
585
|
type ChatCreateResponse as ChatCreateResponse,
|
|
614
|
-
type ChatListResponse as ChatListResponse,
|
|
615
586
|
type ChatSendVoicememoResponse as ChatSendVoicememoResponse,
|
|
587
|
+
type ChatsListChatsPagination as ChatsListChatsPagination,
|
|
616
588
|
type ChatCreateParams as ChatCreateParams,
|
|
617
589
|
type ChatUpdateParams as ChatUpdateParams,
|
|
618
|
-
type
|
|
590
|
+
type ChatListChatsParams as ChatListChatsParams,
|
|
619
591
|
type ChatSendVoicememoParams as ChatSendVoicememoParams,
|
|
620
592
|
};
|
|
621
593
|
|
|
@@ -632,7 +604,6 @@ export declare namespace Chats {
|
|
|
632
604
|
export {
|
|
633
605
|
Messages as Messages,
|
|
634
606
|
type SentMessage as SentMessage,
|
|
635
|
-
type MessageListResponse as MessageListResponse,
|
|
636
607
|
type MessageSendResponse as MessageSendResponse,
|
|
637
608
|
type MessageListParams as MessageListParams,
|
|
638
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,29 +2,51 @@
|
|
|
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
|
|
|
17
|
+
/**
|
|
18
|
+
* Messages are individual text or multimedia communications within a chat thread.
|
|
19
|
+
*
|
|
20
|
+
* Messages can include text, attachments, special effects (like confetti or fireworks),
|
|
21
|
+
* and reactions. All messages are associated with a specific chat and sent from a
|
|
22
|
+
* phone number you own.
|
|
23
|
+
*
|
|
24
|
+
* Messages support delivery status tracking, read receipts, and editing capabilities.
|
|
25
|
+
*/
|
|
11
26
|
export class Messages extends APIResource {
|
|
12
27
|
/**
|
|
13
28
|
* Retrieve messages from a specific chat with pagination support.
|
|
14
29
|
*
|
|
15
30
|
* @example
|
|
16
31
|
* ```ts
|
|
17
|
-
*
|
|
32
|
+
* // Automatically fetches more pages as needed.
|
|
33
|
+
* for await (const message of client.chats.messages.list(
|
|
18
34
|
* '550e8400-e29b-41d4-a716-446655440000',
|
|
19
|
-
* )
|
|
35
|
+
* )) {
|
|
36
|
+
* // ...
|
|
37
|
+
* }
|
|
20
38
|
* ```
|
|
21
39
|
*/
|
|
22
40
|
list(
|
|
23
41
|
chatID: string,
|
|
24
42
|
query: MessageListParams | null | undefined = {},
|
|
25
43
|
options?: RequestOptions,
|
|
26
|
-
):
|
|
27
|
-
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
|
+
);
|
|
28
50
|
}
|
|
29
51
|
|
|
30
52
|
/**
|
|
@@ -84,7 +106,7 @@ export interface SentMessage {
|
|
|
84
106
|
/**
|
|
85
107
|
* Message parts in order (text and media)
|
|
86
108
|
*/
|
|
87
|
-
parts: Array<
|
|
109
|
+
parts: Array<Shared.TextPartResponse | Shared.MediaPartResponse>;
|
|
88
110
|
|
|
89
111
|
/**
|
|
90
112
|
* When the message was sent
|
|
@@ -122,19 +144,6 @@ export interface SentMessage {
|
|
|
122
144
|
service?: Shared.ServiceType | null;
|
|
123
145
|
}
|
|
124
146
|
|
|
125
|
-
export interface MessageListResponse {
|
|
126
|
-
/**
|
|
127
|
-
* List of messages
|
|
128
|
-
*/
|
|
129
|
-
messages: Array<MessagesAPI.Message>;
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* Cursor for fetching the next page of results. Null if there are no more results
|
|
133
|
-
* to fetch. Pass this value as the `cursor` parameter in the next request.
|
|
134
|
-
*/
|
|
135
|
-
next_cursor?: string | null;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
147
|
/**
|
|
139
148
|
* Response for sending a message to a chat
|
|
140
149
|
*/
|
|
@@ -150,17 +159,7 @@ export interface MessageSendResponse {
|
|
|
150
159
|
message: SentMessage;
|
|
151
160
|
}
|
|
152
161
|
|
|
153
|
-
export interface MessageListParams {
|
|
154
|
-
/**
|
|
155
|
-
* Pagination cursor from previous next_cursor response
|
|
156
|
-
*/
|
|
157
|
-
cursor?: string;
|
|
158
|
-
|
|
159
|
-
/**
|
|
160
|
-
* Maximum number of messages to return
|
|
161
|
-
*/
|
|
162
|
-
limit?: number;
|
|
163
|
-
}
|
|
162
|
+
export interface MessageListParams extends ListMessagesPaginationParams {}
|
|
164
163
|
|
|
165
164
|
export interface MessageSendParams {
|
|
166
165
|
/**
|
|
@@ -174,9 +173,10 @@ export interface MessageSendParams {
|
|
|
174
173
|
export declare namespace Messages {
|
|
175
174
|
export {
|
|
176
175
|
type SentMessage as SentMessage,
|
|
177
|
-
type MessageListResponse as MessageListResponse,
|
|
178
176
|
type MessageSendResponse as MessageSendResponse,
|
|
179
177
|
type MessageListParams as MessageListParams,
|
|
180
178
|
type MessageSendParams as MessageSendParams,
|
|
181
179
|
};
|
|
182
180
|
}
|
|
181
|
+
|
|
182
|
+
export { type MessagesListMessagesPagination };
|
|
@@ -5,6 +5,24 @@ import { APIPromise } from '../../core/api-promise';
|
|
|
5
5
|
import { RequestOptions } from '../../internal/request-options';
|
|
6
6
|
import { path } from '../../internal/utils/path';
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* A Chat is a conversation thread with one or more participants.
|
|
10
|
+
*
|
|
11
|
+
* To begin a chat, you must create a Chat with at least one recipient handle.
|
|
12
|
+
* Including multiple handles creates a group chat.
|
|
13
|
+
*
|
|
14
|
+
* When creating a chat, the `from` field specifies which of your
|
|
15
|
+
* authorized phone numbers the message originates from. Your authentication token grants
|
|
16
|
+
* access to one or more phone numbers, but the `from` field determines the actual sender.
|
|
17
|
+
*
|
|
18
|
+
* **Handle Format:**
|
|
19
|
+
* - Handles can be phone numbers or email addresses
|
|
20
|
+
* - Phone numbers MUST be in E.164 format (starting with +)
|
|
21
|
+
* - Phone format: `+[country code][subscriber number]`
|
|
22
|
+
* - Example phone: `+12223334444` (US), `+442071234567` (UK), `+81312345678` (Japan)
|
|
23
|
+
* - Example email: `user@example.com`
|
|
24
|
+
* - No spaces, dashes, or parentheses in phone numbers
|
|
25
|
+
*/
|
|
8
26
|
export class Participants extends APIResource {
|
|
9
27
|
/**
|
|
10
28
|
* Add a new participant to an existing group chat.
|
|
@@ -6,6 +6,24 @@ import { buildHeaders } from '../../internal/headers';
|
|
|
6
6
|
import { RequestOptions } from '../../internal/request-options';
|
|
7
7
|
import { path } from '../../internal/utils/path';
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* A Chat is a conversation thread with one or more participants.
|
|
11
|
+
*
|
|
12
|
+
* To begin a chat, you must create a Chat with at least one recipient handle.
|
|
13
|
+
* Including multiple handles creates a group chat.
|
|
14
|
+
*
|
|
15
|
+
* When creating a chat, the `from` field specifies which of your
|
|
16
|
+
* authorized phone numbers the message originates from. Your authentication token grants
|
|
17
|
+
* access to one or more phone numbers, but the `from` field determines the actual sender.
|
|
18
|
+
*
|
|
19
|
+
* **Handle Format:**
|
|
20
|
+
* - Handles can be phone numbers or email addresses
|
|
21
|
+
* - Phone numbers MUST be in E.164 format (starting with +)
|
|
22
|
+
* - Phone format: `+[country code][subscriber number]`
|
|
23
|
+
* - Example phone: `+12223334444` (US), `+442071234567` (UK), `+81312345678` (Japan)
|
|
24
|
+
* - Example email: `user@example.com`
|
|
25
|
+
* - No spaces, dashes, or parentheses in phone numbers
|
|
26
|
+
*/
|
|
9
27
|
export class Typing extends APIResource {
|
|
10
28
|
/**
|
|
11
29
|
* Send a typing indicator to show that someone is typing in the chat.
|
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';
|