@linqapp/sdk 0.1.0 → 0.1.3

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.
Files changed (223) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/LICENSE +198 -4
  3. package/README.md +52 -52
  4. package/client.d.mts +34 -22
  5. package/client.d.mts.map +1 -1
  6. package/client.d.ts +34 -22
  7. package/client.d.ts.map +1 -1
  8. package/client.js +50 -41
  9. package/client.js.map +1 -1
  10. package/client.mjs +49 -40
  11. package/client.mjs.map +1 -1
  12. package/core/api-promise.d.mts +2 -2
  13. package/core/api-promise.d.mts.map +1 -1
  14. package/core/api-promise.d.ts +2 -2
  15. package/core/api-promise.d.ts.map +1 -1
  16. package/core/api-promise.js.map +1 -1
  17. package/core/api-promise.mjs.map +1 -1
  18. package/core/error.d.mts +2 -2
  19. package/core/error.d.mts.map +1 -1
  20. package/core/error.d.ts +2 -2
  21. package/core/error.d.ts.map +1 -1
  22. package/core/error.js +4 -4
  23. package/core/error.js.map +1 -1
  24. package/core/error.mjs +2 -2
  25. package/core/error.mjs.map +1 -1
  26. package/core/resource.d.mts +3 -3
  27. package/core/resource.d.mts.map +1 -1
  28. package/core/resource.d.ts +3 -3
  29. package/core/resource.d.ts.map +1 -1
  30. package/core/resource.js.map +1 -1
  31. package/core/resource.mjs.map +1 -1
  32. package/index.d.mts +3 -3
  33. package/index.d.mts.map +1 -1
  34. package/index.d.ts +3 -3
  35. package/index.d.ts.map +1 -1
  36. package/index.js +4 -4
  37. package/index.js.map +1 -1
  38. package/index.mjs +3 -3
  39. package/index.mjs.map +1 -1
  40. package/internal/parse.d.mts +2 -2
  41. package/internal/parse.d.mts.map +1 -1
  42. package/internal/parse.d.ts +2 -2
  43. package/internal/parse.d.ts.map +1 -1
  44. package/internal/parse.js.map +1 -1
  45. package/internal/parse.mjs.map +1 -1
  46. package/internal/shims.js +1 -1
  47. package/internal/shims.js.map +1 -1
  48. package/internal/shims.mjs +1 -1
  49. package/internal/shims.mjs.map +1 -1
  50. package/internal/uploads.d.mts +4 -4
  51. package/internal/uploads.d.mts.map +1 -1
  52. package/internal/uploads.d.ts +4 -4
  53. package/internal/uploads.d.ts.map +1 -1
  54. package/internal/uploads.js.map +1 -1
  55. package/internal/uploads.mjs.map +1 -1
  56. package/internal/utils/base64.js +2 -2
  57. package/internal/utils/base64.js.map +1 -1
  58. package/internal/utils/base64.mjs +3 -3
  59. package/internal/utils/base64.mjs.map +1 -1
  60. package/internal/utils/log.d.mts +3 -3
  61. package/internal/utils/log.d.mts.map +1 -1
  62. package/internal/utils/log.d.ts +3 -3
  63. package/internal/utils/log.d.ts.map +1 -1
  64. package/internal/utils/log.js.map +1 -1
  65. package/internal/utils/log.mjs.map +1 -1
  66. package/internal/utils/path.js +1 -1
  67. package/internal/utils/path.js.map +1 -1
  68. package/internal/utils/path.mjs +2 -2
  69. package/internal/utils/path.mjs.map +1 -1
  70. package/internal/utils/values.js +5 -5
  71. package/internal/utils/values.js.map +1 -1
  72. package/internal/utils/values.mjs +6 -6
  73. package/internal/utils/values.mjs.map +1 -1
  74. package/package.json +4 -4
  75. package/resources/attachments.d.mts +28 -3
  76. package/resources/attachments.d.mts.map +1 -1
  77. package/resources/attachments.d.ts +28 -3
  78. package/resources/attachments.d.ts.map +1 -1
  79. package/resources/capability.d.mts +74 -0
  80. package/resources/capability.d.mts.map +1 -0
  81. package/resources/capability.d.ts +74 -0
  82. package/resources/capability.d.ts.map +1 -0
  83. package/resources/capability.js +36 -0
  84. package/resources/capability.js.map +1 -0
  85. package/resources/capability.mjs +32 -0
  86. package/resources/capability.mjs.map +1 -0
  87. package/resources/chats/chats.d.mts +133 -663
  88. package/resources/chats/chats.d.mts.map +1 -1
  89. package/resources/chats/chats.d.ts +133 -663
  90. package/resources/chats/chats.d.ts.map +1 -1
  91. package/resources/chats/chats.js +2 -2
  92. package/resources/chats/chats.js.map +1 -1
  93. package/resources/chats/chats.mjs +2 -2
  94. package/resources/chats/chats.mjs.map +1 -1
  95. package/resources/chats/index.d.mts +2 -2
  96. package/resources/chats/index.d.mts.map +1 -1
  97. package/resources/chats/index.d.ts +2 -2
  98. package/resources/chats/index.d.ts.map +1 -1
  99. package/resources/chats/index.js.map +1 -1
  100. package/resources/chats/index.mjs.map +1 -1
  101. package/resources/chats/messages.d.mts +55 -716
  102. package/resources/chats/messages.d.mts.map +1 -1
  103. package/resources/chats/messages.d.ts +55 -716
  104. package/resources/chats/messages.d.ts.map +1 -1
  105. package/resources/chats/messages.js.map +1 -1
  106. package/resources/chats/messages.mjs.map +1 -1
  107. package/resources/index.d.mts +8 -5
  108. package/resources/index.d.mts.map +1 -1
  109. package/resources/index.d.ts +8 -5
  110. package/resources/index.d.ts.map +1 -1
  111. package/resources/index.js +9 -3
  112. package/resources/index.js.map +1 -1
  113. package/resources/index.mjs +5 -2
  114. package/resources/index.mjs.map +1 -1
  115. package/resources/messages.d.mts +129 -553
  116. package/resources/messages.d.mts.map +1 -1
  117. package/resources/messages.d.ts +129 -553
  118. package/resources/messages.d.ts.map +1 -1
  119. package/resources/messages.js +1 -1
  120. package/resources/messages.js.map +1 -1
  121. package/resources/messages.mjs +1 -1
  122. package/resources/messages.mjs.map +1 -1
  123. package/resources/phone-numbers.d.mts +1 -50
  124. package/resources/phone-numbers.d.mts.map +1 -1
  125. package/resources/phone-numbers.d.ts +1 -50
  126. package/resources/phone-numbers.d.ts.map +1 -1
  127. package/resources/phone-numbers.js +0 -8
  128. package/resources/phone-numbers.js.map +1 -1
  129. package/resources/phone-numbers.mjs +0 -8
  130. package/resources/phone-numbers.mjs.map +1 -1
  131. package/resources/phonenumbers.d.mts +58 -0
  132. package/resources/phonenumbers.d.mts.map +1 -0
  133. package/resources/phonenumbers.d.ts +58 -0
  134. package/resources/phonenumbers.d.ts.map +1 -0
  135. package/resources/phonenumbers.js +17 -0
  136. package/resources/phonenumbers.js.map +1 -0
  137. package/resources/phonenumbers.mjs +13 -0
  138. package/resources/phonenumbers.mjs.map +1 -0
  139. package/resources/webhook-events.d.mts +29 -0
  140. package/resources/webhook-events.d.mts.map +1 -0
  141. package/resources/webhook-events.d.ts +29 -0
  142. package/resources/webhook-events.d.ts.map +1 -0
  143. package/resources/{webhooks/events.js → webhook-events.js} +5 -10
  144. package/resources/webhook-events.js.map +1 -0
  145. package/resources/{webhooks/events.mjs → webhook-events.mjs} +3 -8
  146. package/resources/webhook-events.mjs.map +1 -0
  147. package/resources/webhook-subscriptions.d.mts +184 -0
  148. package/resources/webhook-subscriptions.d.mts.map +1 -0
  149. package/resources/webhook-subscriptions.d.ts +184 -0
  150. package/resources/webhook-subscriptions.d.ts.map +1 -0
  151. package/resources/{webhooks/subscriptions.js → webhook-subscriptions.js} +16 -16
  152. package/resources/webhook-subscriptions.js.map +1 -0
  153. package/resources/{webhooks/subscriptions.mjs → webhook-subscriptions.mjs} +14 -14
  154. package/resources/webhook-subscriptions.mjs.map +1 -0
  155. package/src/client.ts +97 -41
  156. package/src/core/api-promise.ts +4 -4
  157. package/src/core/error.ts +2 -2
  158. package/src/core/resource.ts +3 -3
  159. package/src/index.ts +3 -3
  160. package/src/internal/parse.ts +2 -2
  161. package/src/internal/shims.ts +1 -1
  162. package/src/internal/uploads.ts +5 -5
  163. package/src/internal/utils/base64.ts +3 -3
  164. package/src/internal/utils/log.ts +3 -3
  165. package/src/internal/utils/path.ts +2 -2
  166. package/src/internal/utils/values.ts +6 -6
  167. package/src/resources/attachments.ts +81 -106
  168. package/src/resources/capability.ts +98 -0
  169. package/src/resources/chats/chats.ts +135 -770
  170. package/src/resources/chats/index.ts +4 -2
  171. package/src/resources/chats/messages.ts +60 -839
  172. package/src/resources/index.ts +29 -9
  173. package/src/resources/messages.ts +153 -659
  174. package/src/resources/phone-numbers.ts +1 -65
  175. package/src/resources/phonenumbers.ts +72 -0
  176. package/src/resources/webhook-events.ts +57 -0
  177. package/src/resources/webhook-subscriptions.ts +238 -0
  178. package/src/version.ts +1 -1
  179. package/version.d.mts +1 -1
  180. package/version.d.ts +1 -1
  181. package/version.js +1 -1
  182. package/version.mjs +1 -1
  183. package/resources/webhooks/events.d.mts +0 -30
  184. package/resources/webhooks/events.d.mts.map +0 -1
  185. package/resources/webhooks/events.d.ts +0 -30
  186. package/resources/webhooks/events.d.ts.map +0 -1
  187. package/resources/webhooks/events.js.map +0 -1
  188. package/resources/webhooks/events.mjs.map +0 -1
  189. package/resources/webhooks/index.d.mts +0 -4
  190. package/resources/webhooks/index.d.mts.map +0 -1
  191. package/resources/webhooks/index.d.ts +0 -4
  192. package/resources/webhooks/index.d.ts.map +0 -1
  193. package/resources/webhooks/index.js +0 -11
  194. package/resources/webhooks/index.js.map +0 -1
  195. package/resources/webhooks/index.mjs +0 -5
  196. package/resources/webhooks/index.mjs.map +0 -1
  197. package/resources/webhooks/subscriptions.d.mts +0 -237
  198. package/resources/webhooks/subscriptions.d.mts.map +0 -1
  199. package/resources/webhooks/subscriptions.d.ts +0 -237
  200. package/resources/webhooks/subscriptions.d.ts.map +0 -1
  201. package/resources/webhooks/subscriptions.js.map +0 -1
  202. package/resources/webhooks/subscriptions.mjs.map +0 -1
  203. package/resources/webhooks/webhooks.d.mts +0 -14
  204. package/resources/webhooks/webhooks.d.mts.map +0 -1
  205. package/resources/webhooks/webhooks.d.ts +0 -14
  206. package/resources/webhooks/webhooks.d.ts.map +0 -1
  207. package/resources/webhooks/webhooks.js +0 -21
  208. package/resources/webhooks/webhooks.js.map +0 -1
  209. package/resources/webhooks/webhooks.mjs +0 -16
  210. package/resources/webhooks/webhooks.mjs.map +0 -1
  211. package/resources/webhooks.d.mts +0 -2
  212. package/resources/webhooks.d.mts.map +0 -1
  213. package/resources/webhooks.d.ts +0 -2
  214. package/resources/webhooks.d.ts.map +0 -1
  215. package/resources/webhooks.js +0 -6
  216. package/resources/webhooks.js.map +0 -1
  217. package/resources/webhooks.mjs +0 -3
  218. package/resources/webhooks.mjs.map +0 -1
  219. package/src/resources/webhooks/events.ts +0 -55
  220. package/src/resources/webhooks/index.ts +0 -13
  221. package/src/resources/webhooks/subscriptions.ts +0 -409
  222. package/src/resources/webhooks/webhooks.ts +0 -37
  223. package/src/resources/webhooks.ts +0 -3
@@ -1,13 +1,16 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  import { APIResource } from '../../core/resource';
4
- import * as MessagesAPI from './messages';
4
+ import * as ChatsAPI from './chats';
5
+ import * as MessagesAPI from '../messages';
6
+ import * as ChatsMessagesAPI from './messages';
5
7
  import {
6
8
  MessageListParams,
7
9
  MessageListResponse,
8
10
  MessageSendParams,
9
11
  MessageSendResponse,
10
12
  Messages,
13
+ SentMessage,
11
14
  } from './messages';
12
15
  import * as ParticipantsAPI from './participants';
13
16
  import {
@@ -27,7 +30,7 @@ import { path } from '../../internal/utils/path';
27
30
  export class Chats extends APIResource {
28
31
  participants: ParticipantsAPI.Participants = new ParticipantsAPI.Participants(this._client);
29
32
  typing: TypingAPI.Typing = new TypingAPI.Typing(this._client);
30
- messages: MessagesAPI.Messages = new MessagesAPI.Messages(this._client);
33
+ messages: ChatsMessagesAPI.Messages = new ChatsMessagesAPI.Messages(this._client);
31
34
 
32
35
  /**
33
36
  * Create a new chat with specified participants and send an initial message. The
@@ -77,7 +80,7 @@ export class Chats extends APIResource {
77
80
  * );
78
81
  * ```
79
82
  */
80
- retrieve(chatID: string, options?: RequestOptions): APIPromise<ChatRetrieveResponse> {
83
+ retrieve(chatID: string, options?: RequestOptions): APIPromise<Chat> {
81
84
  return this._client.get(path`/v3/chats/${chatID}`, options);
82
85
  }
83
86
 
@@ -92,7 +95,7 @@ export class Chats extends APIResource {
92
95
  * );
93
96
  * ```
94
97
  */
95
- update(chatID: string, body: ChatUpdateParams, options?: RequestOptions): APIPromise<ChatUpdateResponse> {
98
+ update(chatID: string, body: ChatUpdateParams, options?: RequestOptions): APIPromise<Chat> {
96
99
  return this._client.put(path`/v3/chats/${chatID}`, { body, ...options });
97
100
  }
98
101
 
@@ -200,411 +203,7 @@ export class Chats extends APIResource {
200
203
  }
201
204
  }
202
205
 
203
- /**
204
- * Response for creating a new chat with an initial message
205
- */
206
- export interface ChatCreateResponse {
207
- chat: ChatCreateResponse.Chat;
208
- }
209
-
210
- export namespace ChatCreateResponse {
211
- export interface Chat {
212
- /**
213
- * Unique identifier for the created chat (UUID)
214
- */
215
- id: string;
216
-
217
- /**
218
- * Display name for the chat. Defaults to a comma-separated list of recipient
219
- * handles. Can be updated for group chats.
220
- */
221
- display_name: string | null;
222
-
223
- /**
224
- * List of participants in the chat. Always contains at least two handles (your
225
- * phone number and the other participant).
226
- */
227
- handles: Array<Chat.Handle>;
228
-
229
- /**
230
- * Whether this is a group chat
231
- */
232
- is_group: boolean;
233
-
234
- /**
235
- * A message that was sent (used in CreateChat and SendMessage responses)
236
- */
237
- message: Chat.Message;
238
-
239
- /**
240
- * Messaging service type
241
- */
242
- service: 'iMessage' | 'SMS' | 'RCS';
243
- }
244
-
245
- export namespace Chat {
246
- export interface Handle {
247
- /**
248
- * Unique identifier for this handle
249
- */
250
- id: string;
251
-
252
- /**
253
- * Phone number (E.164) or email address of the participant
254
- */
255
- handle: string;
256
-
257
- /**
258
- * When this participant joined the chat
259
- */
260
- joined_at: string;
261
-
262
- /**
263
- * Messaging service type
264
- */
265
- service: 'iMessage' | 'SMS' | 'RCS';
266
-
267
- /**
268
- * Whether this handle belongs to the sender (your phone number)
269
- */
270
- is_me?: boolean | null;
271
-
272
- /**
273
- * When they left (if applicable)
274
- */
275
- left_at?: string | null;
276
-
277
- /**
278
- * Participant status
279
- */
280
- status?: 'active' | 'left' | 'removed' | null;
281
- }
282
-
283
- /**
284
- * A message that was sent (used in CreateChat and SendMessage responses)
285
- */
286
- export interface Message {
287
- /**
288
- * Message identifier (UUID)
289
- */
290
- id: string;
291
-
292
- /**
293
- * Current delivery status of a message
294
- */
295
- delivery_status: 'pending' | 'queued' | 'sent' | 'delivered' | 'failed';
296
-
297
- /**
298
- * Whether the message has been read
299
- */
300
- is_read: boolean;
301
-
302
- /**
303
- * Message parts in order (text and media)
304
- */
305
- parts: Array<Message.TextPartResponse | Message.MediaPartResponse>;
306
-
307
- /**
308
- * When the message was sent
309
- */
310
- sent_at: string;
311
-
312
- /**
313
- * When the message was delivered
314
- */
315
- delivered_at?: string | null;
316
-
317
- /**
318
- * iMessage effect applied to a message (screen or bubble effect)
319
- */
320
- effect?: Message.Effect | null;
321
-
322
- /**
323
- * The sender of this message as a full handle object
324
- */
325
- from_handle?: Message.FromHandle | null;
326
-
327
- /**
328
- * Messaging service type
329
- */
330
- preferred_service?: 'iMessage' | 'SMS' | 'RCS' | null;
331
-
332
- /**
333
- * Indicates this message is a threaded reply to another message
334
- */
335
- reply_to?: Message.ReplyTo | null;
336
-
337
- /**
338
- * Messaging service type
339
- */
340
- service?: 'iMessage' | 'SMS' | 'RCS' | null;
341
- }
342
-
343
- export namespace Message {
344
- /**
345
- * A text message part
346
- */
347
- export interface TextPartResponse {
348
- /**
349
- * Reactions on this message part
350
- */
351
- reactions: Array<TextPartResponse.Reaction> | null;
352
-
353
- /**
354
- * Indicates this is a text message part
355
- */
356
- type: 'text';
357
-
358
- /**
359
- * The text content
360
- */
361
- value: string;
362
- }
363
-
364
- export namespace TextPartResponse {
365
- export interface Reaction {
366
- handle: Reaction.Handle;
367
-
368
- /**
369
- * Whether this reaction is from the current user
370
- */
371
- is_me: boolean;
372
-
373
- /**
374
- * Type of reaction. Standard iMessage tapbacks are love, like, dislike, laugh,
375
- * emphasize, question. Custom emoji reactions have type "custom" with the actual
376
- * emoji in the custom_emoji field.
377
- */
378
- type: 'love' | 'like' | 'dislike' | 'laugh' | 'emphasize' | 'question' | 'custom';
379
-
380
- /**
381
- * Custom emoji if type is "custom", null otherwise
382
- */
383
- custom_emoji?: string | null;
384
- }
385
-
386
- export namespace Reaction {
387
- export interface Handle {
388
- /**
389
- * Unique identifier for this handle
390
- */
391
- id: string;
392
-
393
- /**
394
- * Phone number (E.164) or email address of the participant
395
- */
396
- handle: string;
397
-
398
- /**
399
- * When this participant joined the chat
400
- */
401
- joined_at: string;
402
-
403
- /**
404
- * Messaging service type
405
- */
406
- service: 'iMessage' | 'SMS' | 'RCS';
407
-
408
- /**
409
- * Whether this handle belongs to the sender (your phone number)
410
- */
411
- is_me?: boolean | null;
412
-
413
- /**
414
- * When they left (if applicable)
415
- */
416
- left_at?: string | null;
417
-
418
- /**
419
- * Participant status
420
- */
421
- status?: 'active' | 'left' | 'removed' | null;
422
- }
423
- }
424
- }
425
-
426
- /**
427
- * A media attachment part
428
- */
429
- export interface MediaPartResponse {
430
- /**
431
- * Unique attachment identifier
432
- */
433
- id: string;
434
-
435
- /**
436
- * Original filename
437
- */
438
- filename: string;
439
-
440
- /**
441
- * MIME type of the file
442
- */
443
- mime_type: string;
444
-
445
- /**
446
- * Reactions on this message part
447
- */
448
- reactions: Array<MediaPartResponse.Reaction> | null;
449
-
450
- /**
451
- * File size in bytes
452
- */
453
- size_bytes: number;
454
-
455
- /**
456
- * Indicates this is a media attachment part
457
- */
458
- type: 'media';
459
-
460
- /**
461
- * Presigned URL for downloading the attachment (expires in 1 hour).
462
- */
463
- url: string;
464
- }
465
-
466
- export namespace MediaPartResponse {
467
- export interface Reaction {
468
- handle: Reaction.Handle;
469
-
470
- /**
471
- * Whether this reaction is from the current user
472
- */
473
- is_me: boolean;
474
-
475
- /**
476
- * Type of reaction. Standard iMessage tapbacks are love, like, dislike, laugh,
477
- * emphasize, question. Custom emoji reactions have type "custom" with the actual
478
- * emoji in the custom_emoji field.
479
- */
480
- type: 'love' | 'like' | 'dislike' | 'laugh' | 'emphasize' | 'question' | 'custom';
481
-
482
- /**
483
- * Custom emoji if type is "custom", null otherwise
484
- */
485
- custom_emoji?: string | null;
486
- }
487
-
488
- export namespace Reaction {
489
- export interface Handle {
490
- /**
491
- * Unique identifier for this handle
492
- */
493
- id: string;
494
-
495
- /**
496
- * Phone number (E.164) or email address of the participant
497
- */
498
- handle: string;
499
-
500
- /**
501
- * When this participant joined the chat
502
- */
503
- joined_at: string;
504
-
505
- /**
506
- * Messaging service type
507
- */
508
- service: 'iMessage' | 'SMS' | 'RCS';
509
-
510
- /**
511
- * Whether this handle belongs to the sender (your phone number)
512
- */
513
- is_me?: boolean | null;
514
-
515
- /**
516
- * When they left (if applicable)
517
- */
518
- left_at?: string | null;
519
-
520
- /**
521
- * Participant status
522
- */
523
- status?: 'active' | 'left' | 'removed' | null;
524
- }
525
- }
526
- }
527
-
528
- /**
529
- * iMessage effect applied to a message (screen or bubble effect)
530
- */
531
- export interface Effect {
532
- /**
533
- * Name of the effect. Common values:
534
- *
535
- * - Screen effects: confetti, fireworks, lasers, sparkles, celebration, hearts,
536
- * love, balloons, happy_birthday, echo, spotlight
537
- * - Bubble effects: slam, loud, gentle, invisible
538
- */
539
- name?: string;
540
-
541
- /**
542
- * Type of effect
543
- */
544
- type?: 'screen' | 'bubble';
545
- }
546
-
547
- /**
548
- * The sender of this message as a full handle object
549
- */
550
- export interface FromHandle {
551
- /**
552
- * Unique identifier for this handle
553
- */
554
- id: string;
555
-
556
- /**
557
- * Phone number (E.164) or email address of the participant
558
- */
559
- handle: string;
560
-
561
- /**
562
- * When this participant joined the chat
563
- */
564
- joined_at: string;
565
-
566
- /**
567
- * Messaging service type
568
- */
569
- service: 'iMessage' | 'SMS' | 'RCS';
570
-
571
- /**
572
- * Whether this handle belongs to the sender (your phone number)
573
- */
574
- is_me?: boolean | null;
575
-
576
- /**
577
- * When they left (if applicable)
578
- */
579
- left_at?: string | null;
580
-
581
- /**
582
- * Participant status
583
- */
584
- status?: 'active' | 'left' | 'removed' | null;
585
- }
586
-
587
- /**
588
- * Indicates this message is a threaded reply to another message
589
- */
590
- export interface ReplyTo {
591
- /**
592
- * The ID of the message to reply to
593
- */
594
- message_id: string;
595
-
596
- /**
597
- * The specific message part to reply to (0-based index). Defaults to 0 (first
598
- * part) if not provided. Use this when replying to a specific part of a multipart
599
- * message.
600
- */
601
- part_index?: number;
602
- }
603
- }
604
- }
605
- }
606
-
607
- export interface ChatRetrieveResponse {
206
+ export interface Chat {
608
207
  /**
609
208
  * Unique identifier for the chat
610
209
  */
@@ -625,7 +224,7 @@ export interface ChatRetrieveResponse {
625
224
  * List of chat participants with full handle details. Always contains at least two
626
225
  * handles (your phone number and the other participant).
627
226
  */
628
- handles: Array<ChatRetrieveResponse.Handle>;
227
+ handles: Array<MessagesAPI.ChatHandle>;
629
228
 
630
229
  /**
631
230
  * Whether the chat is archived
@@ -645,156 +244,156 @@ export interface ChatRetrieveResponse {
645
244
  /**
646
245
  * Messaging service type
647
246
  */
648
- service?: 'iMessage' | 'SMS' | 'RCS' | null;
649
- }
650
-
651
- export namespace ChatRetrieveResponse {
652
- export interface Handle {
653
- /**
654
- * Unique identifier for this handle
655
- */
656
- id: string;
657
-
658
- /**
659
- * Phone number (E.164) or email address of the participant
660
- */
661
- handle: string;
662
-
663
- /**
664
- * When this participant joined the chat
665
- */
666
- joined_at: string;
667
-
668
- /**
669
- * Messaging service type
670
- */
671
- service: 'iMessage' | 'SMS' | 'RCS';
672
-
673
- /**
674
- * Whether this handle belongs to the sender (your phone number)
675
- */
676
- is_me?: boolean | null;
677
-
678
- /**
679
- * When they left (if applicable)
680
- */
681
- left_at?: string | null;
682
-
683
- /**
684
- * Participant status
685
- */
686
- status?: 'active' | 'left' | 'removed' | null;
687
- }
247
+ service?: ServiceType | null;
688
248
  }
689
249
 
690
- export interface ChatUpdateResponse {
691
- /**
692
- * Unique identifier for the chat
693
- */
694
- id: string;
695
-
696
- /**
697
- * When the chat was created
698
- */
699
- created_at: string;
700
-
701
- /**
702
- * Display name for the chat. Defaults to a comma-separated list of recipient
703
- * handles. Can be updated for group chats.
704
- */
705
- display_name: string | null;
706
-
250
+ /**
251
+ * Message content container. Groups all message-related fields together,
252
+ * separating the "what" (message content) from the "where" (routing fields like
253
+ * from/to).
254
+ */
255
+ export interface MessageContent {
707
256
  /**
708
- * List of chat participants with full handle details. Always contains at least two
709
- * handles (your phone number and the other participant).
257
+ * Array of message parts. Each part can be either text or media. Parts are
258
+ * displayed in order. Text and media can be mixed.
259
+ *
260
+ * **Supported Media:**
261
+ *
262
+ * - Images: .jpg, .jpeg, .png, .gif, .heic, .heif, .tif, .tiff, .bmp
263
+ * - Videos: .mp4, .mov, .m4v, .mpeg, .mpg, .3gp
264
+ * - Audio: .m4a, .mp3, .aac, .caf, .wav, .aiff, .amr
265
+ * - Documents: .pdf, .txt, .rtf, .csv, .doc, .docx, .xls, .xlsx, .ppt, .pptx,
266
+ * .pages, .numbers, .key, .epub, .zip, .html, .htm
267
+ * - Contact & Calendar: .vcf, .ics
268
+ *
269
+ * **Audio:**
270
+ *
271
+ * - Audio files (.m4a, .mp3, .aac, .caf, .wav, .aiff, .amr) are fully supported as
272
+ * media parts
273
+ * - To send audio as an **iMessage voice memo bubble** (inline playback UI), use
274
+ * the dedicated `/v3/chats/{chatId}/voicememo` endpoint instead
275
+ *
276
+ * **Validation Rule:** Consecutive text parts are not allowed. Text parts must be
277
+ * separated by media parts. For example, [text, text] is invalid, but [text,
278
+ * media, text] is valid.
710
279
  */
711
- handles: Array<ChatUpdateResponse.Handle>;
280
+ parts: Array<MessageContent.TextPart | MessageContent.MediaPart>;
712
281
 
713
282
  /**
714
- * Whether the chat is archived
283
+ * iMessage effect to apply to this message (screen or bubble effect)
715
284
  */
716
- is_archived: boolean;
285
+ effect?: MessagesAPI.MessageEffect;
717
286
 
718
287
  /**
719
- * Whether this is a group chat
288
+ * Optional idempotency key for this message. Use this to prevent duplicate sends
289
+ * of the same message.
720
290
  */
721
- is_group: boolean;
291
+ idempotency_key?: string;
722
292
 
723
293
  /**
724
- * When the chat was last updated
294
+ * Messaging service type
725
295
  */
726
- updated_at: string;
296
+ preferred_service?: ServiceType;
727
297
 
728
298
  /**
729
- * Messaging service type
299
+ * Reply to another message to create a threaded conversation
730
300
  */
731
- service?: 'iMessage' | 'SMS' | 'RCS' | null;
301
+ reply_to?: MessagesAPI.ReplyTo;
732
302
  }
733
303
 
734
- export namespace ChatUpdateResponse {
735
- export interface Handle {
304
+ export namespace MessageContent {
305
+ export interface TextPart {
736
306
  /**
737
- * Unique identifier for this handle
307
+ * Indicates this is a text message part
738
308
  */
739
- id: string;
309
+ type: 'text';
740
310
 
741
311
  /**
742
- * Phone number (E.164) or email address of the participant
312
+ * The text content
743
313
  */
744
- handle: string;
314
+ value: string;
745
315
 
746
316
  /**
747
- * When this participant joined the chat
317
+ * Optional idempotency key for this specific message part. Use this to prevent
318
+ * duplicate sends of the same part.
748
319
  */
749
- joined_at: string;
320
+ idempotency_key?: string;
321
+ }
750
322
 
323
+ export interface MediaPart {
751
324
  /**
752
- * Messaging service type
325
+ * Indicates this is a media attachment part
753
326
  */
754
- service: 'iMessage' | 'SMS' | 'RCS';
327
+ type: 'media';
755
328
 
756
329
  /**
757
- * Whether this handle belongs to the sender (your phone number)
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.
758
335
  */
759
- is_me?: boolean | null;
336
+ attachment_id?: string;
760
337
 
761
338
  /**
762
- * When they left (if applicable)
339
+ * Optional idempotency key for this specific message part. Use this to prevent
340
+ * duplicate sends of the same part.
763
341
  */
764
- left_at?: string | null;
342
+ idempotency_key?: string;
765
343
 
766
344
  /**
767
- * Participant status
345
+ * Any publicly accessible HTTPS URL to the media file. The server downloads and
346
+ * sends the file automatically — no pre-upload step required.
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.
768
373
  */
769
- status?: 'active' | 'left' | 'removed' | null;
374
+ url?: string;
770
375
  }
771
376
  }
772
377
 
773
- export interface ChatListResponse {
774
- /**
775
- * List of chats
776
- */
777
- chats: Array<ChatListResponse.Chat>;
378
+ /**
379
+ * Messaging service type
380
+ */
381
+ export type ServiceType = 'iMessage' | 'SMS' | 'RCS';
778
382
 
779
- /**
780
- * Cursor for fetching the next page of results. Null if there are no more results
781
- * to fetch. Pass this value as the `cursor` parameter in the next request.
782
- */
783
- next_cursor?: string | null;
383
+ /**
384
+ * Response for creating a new chat with an initial message
385
+ */
386
+ export interface ChatCreateResponse {
387
+ chat: ChatCreateResponse.Chat;
784
388
  }
785
389
 
786
- export namespace ChatListResponse {
390
+ export namespace ChatCreateResponse {
787
391
  export interface Chat {
788
392
  /**
789
- * Unique identifier for the chat
393
+ * Unique identifier for the created chat (UUID)
790
394
  */
791
395
  id: string;
792
396
 
793
- /**
794
- * When the chat was created
795
- */
796
- created_at: string;
797
-
798
397
  /**
799
398
  * Display name for the chat. Defaults to a comma-separated list of recipient
800
399
  * handles. Can be updated for group chats.
@@ -802,15 +401,10 @@ export namespace ChatListResponse {
802
401
  display_name: string | null;
803
402
 
804
403
  /**
805
- * List of chat participants with full handle details. Always contains at least two
806
- * handles (your phone number and the other participant).
807
- */
808
- handles: Array<Chat.Handle>;
809
-
810
- /**
811
- * Whether the chat is archived
404
+ * List of participants in the chat. Always contains at least two handles (your
405
+ * phone number and the other participant).
812
406
  */
813
- is_archived: boolean;
407
+ handles: Array<MessagesAPI.ChatHandle>;
814
408
 
815
409
  /**
816
410
  * Whether this is a group chat
@@ -818,54 +412,28 @@ export namespace ChatListResponse {
818
412
  is_group: boolean;
819
413
 
820
414
  /**
821
- * When the chat was last updated
415
+ * A message that was sent (used in CreateChat and SendMessage responses)
822
416
  */
823
- updated_at: string;
417
+ message: ChatsMessagesAPI.SentMessage;
824
418
 
825
419
  /**
826
420
  * Messaging service type
827
421
  */
828
- service?: 'iMessage' | 'SMS' | 'RCS' | null;
422
+ service: ChatsAPI.ServiceType;
829
423
  }
424
+ }
830
425
 
831
- export namespace Chat {
832
- export interface Handle {
833
- /**
834
- * Unique identifier for this handle
835
- */
836
- id: string;
837
-
838
- /**
839
- * Phone number (E.164) or email address of the participant
840
- */
841
- handle: string;
842
-
843
- /**
844
- * When this participant joined the chat
845
- */
846
- joined_at: string;
847
-
848
- /**
849
- * Messaging service type
850
- */
851
- service: 'iMessage' | 'SMS' | 'RCS';
852
-
853
- /**
854
- * Whether this handle belongs to the sender (your phone number)
855
- */
856
- is_me?: boolean | null;
857
-
858
- /**
859
- * When they left (if applicable)
860
- */
861
- left_at?: string | null;
426
+ export interface ChatListResponse {
427
+ /**
428
+ * List of chats
429
+ */
430
+ chats: Array<Chat>;
862
431
 
863
- /**
864
- * Participant status
865
- */
866
- status?: 'active' | 'left' | 'removed' | null;
867
- }
868
- }
432
+ /**
433
+ * Cursor for fetching the next page of results. Null if there are no more results
434
+ * to fetch. Pass this value as the `cursor` parameter in the next request.
435
+ */
436
+ next_cursor?: string | null;
869
437
  }
870
438
 
871
439
  /**
@@ -909,7 +477,7 @@ export namespace ChatSendVoicememoResponse {
909
477
  /**
910
478
  * Messaging service type
911
479
  */
912
- service?: 'iMessage' | 'SMS' | 'RCS' | null;
480
+ service?: ChatsAPI.ServiceType | null;
913
481
  }
914
482
 
915
483
  export namespace VoiceMemo {
@@ -922,7 +490,7 @@ export namespace ChatSendVoicememoResponse {
922
490
  /**
923
491
  * Chat participants
924
492
  */
925
- handles: Array<Chat.Handle>;
493
+ handles: Array<MessagesAPI.ChatHandle>;
926
494
 
927
495
  /**
928
496
  * Whether the chat is active
@@ -937,46 +505,7 @@ export namespace ChatSendVoicememoResponse {
937
505
  /**
938
506
  * Messaging service type
939
507
  */
940
- service: 'iMessage' | 'SMS' | 'RCS';
941
- }
942
-
943
- export namespace Chat {
944
- export interface Handle {
945
- /**
946
- * Unique identifier for this handle
947
- */
948
- id: string;
949
-
950
- /**
951
- * Phone number (E.164) or email address of the participant
952
- */
953
- handle: string;
954
-
955
- /**
956
- * When this participant joined the chat
957
- */
958
- joined_at: string;
959
-
960
- /**
961
- * Messaging service type
962
- */
963
- service: 'iMessage' | 'SMS' | 'RCS';
964
-
965
- /**
966
- * Whether this handle belongs to the sender (your phone number)
967
- */
968
- is_me?: boolean | null;
969
-
970
- /**
971
- * When they left (if applicable)
972
- */
973
- left_at?: string | null;
974
-
975
- /**
976
- * Participant status
977
- */
978
- status?: 'active' | 'left' | 'removed' | null;
979
- }
508
+ service: ChatsAPI.ServiceType;
980
509
  }
981
510
 
982
511
  export interface VoiceMemo {
@@ -1025,7 +554,7 @@ export interface ChatCreateParams {
1025
554
  * separating the "what" (message content) from the "where" (routing fields like
1026
555
  * from/to).
1027
556
  */
1028
- message: ChatCreateParams.Message;
557
+ message: MessageContent;
1029
558
 
1030
559
  /**
1031
560
  * Array of recipient handles (phone numbers in E.164 format or email addresses).
@@ -1034,172 +563,6 @@ export interface ChatCreateParams {
1034
563
  to: Array<string>;
1035
564
  }
1036
565
 
1037
- export namespace ChatCreateParams {
1038
- /**
1039
- * Message content container. Groups all message-related fields together,
1040
- * separating the "what" (message content) from the "where" (routing fields like
1041
- * from/to).
1042
- */
1043
- export interface Message {
1044
- /**
1045
- * Array of message parts. Each part can be either text or media. Parts are
1046
- * displayed in order. Text and media can be mixed.
1047
- *
1048
- * **Supported Media:**
1049
- *
1050
- * - Images: .jpg, .jpeg, .png, .gif, .heic, .heif, .tif, .tiff, .bmp
1051
- * - Videos: .mp4, .mov, .m4v, .mpeg, .mpg, .3gp
1052
- * - Audio: .m4a, .mp3, .aac, .caf, .wav, .aiff, .amr
1053
- * - Documents: .pdf, .txt, .rtf, .csv, .doc, .docx, .xls, .xlsx, .ppt, .pptx,
1054
- * .pages, .numbers, .key, .epub, .zip, .html, .htm
1055
- * - Contact & Calendar: .vcf, .ics
1056
- *
1057
- * **Audio:**
1058
- *
1059
- * - Audio files (.m4a, .mp3, .aac, .caf, .wav, .aiff, .amr) are fully supported as
1060
- * media parts
1061
- * - To send audio as an **iMessage voice memo bubble** (inline playback UI), use
1062
- * the dedicated `/v3/chats/{chatId}/voicememo` endpoint instead
1063
- *
1064
- * **Validation Rule:** Consecutive text parts are not allowed. Text parts must be
1065
- * separated by media parts. For example, [text, text] is invalid, but [text,
1066
- * media, text] is valid.
1067
- */
1068
- parts: Array<Message.TextPart | Message.MediaPart>;
1069
-
1070
- /**
1071
- * iMessage effect to apply to this message (screen or bubble effect)
1072
- */
1073
- effect?: Message.Effect;
1074
-
1075
- /**
1076
- * Optional idempotency key for this message. Use this to prevent duplicate sends
1077
- * of the same message.
1078
- */
1079
- idempotency_key?: string;
1080
-
1081
- /**
1082
- * Messaging service type
1083
- */
1084
- preferred_service?: 'iMessage' | 'SMS' | 'RCS';
1085
-
1086
- /**
1087
- * Reply to another message to create a threaded conversation
1088
- */
1089
- reply_to?: Message.ReplyTo;
1090
- }
1091
-
1092
- export namespace Message {
1093
- export interface TextPart {
1094
- /**
1095
- * Indicates this is a text message part
1096
- */
1097
- type: 'text';
1098
-
1099
- /**
1100
- * The text content
1101
- */
1102
- value: string;
1103
-
1104
- /**
1105
- * Optional idempotency key for this specific message part. Use this to prevent
1106
- * duplicate sends of the same part.
1107
- */
1108
- idempotency_key?: string;
1109
- }
1110
-
1111
- export interface MediaPart {
1112
- /**
1113
- * Indicates this is a media attachment part
1114
- */
1115
- type: 'media';
1116
-
1117
- /**
1118
- * Reference to a file pre-uploaded via `POST /v3/attachments` (optional). The file
1119
- * is already stored, so sends using this ID skip the download step — useful when
1120
- * sending the same file to many recipients.
1121
- *
1122
- * Either `url` or `attachment_id` must be provided, but not both.
1123
- */
1124
- attachment_id?: string;
1125
-
1126
- /**
1127
- * Optional idempotency key for this specific message part. Use this to prevent
1128
- * duplicate sends of the same part.
1129
- */
1130
- idempotency_key?: string;
1131
-
1132
- /**
1133
- * Any publicly accessible HTTPS URL to the media file. The server downloads and
1134
- * sends the file automatically — no pre-upload step required.
1135
- *
1136
- * **Size limit:** 10MB maximum for URL-based downloads. For larger files (up to
1137
- * 100MB), use the pre-upload flow: `POST /v3/attachments` to get a presigned URL,
1138
- * upload directly, then reference by `attachment_id`.
1139
- *
1140
- * **Requirements:**
1141
- *
1142
- * - URL must use HTTPS
1143
- * - File content must be a supported format (the server validates the actual file
1144
- * content)
1145
- *
1146
- * **Supported formats:**
1147
- *
1148
- * - Images: .jpg, .jpeg, .png, .gif, .heic, .heif, .tif, .tiff, .bmp
1149
- * - Videos: .mp4, .mov, .m4v, .mpeg, .mpg, .3gp
1150
- * - Audio: .m4a, .mp3, .aac, .caf, .wav, .aiff, .amr
1151
- * - Documents: .pdf, .txt, .rtf, .csv, .doc, .docx, .xls, .xlsx, .ppt, .pptx,
1152
- * .pages, .numbers, .key, .epub, .zip, .html, .htm
1153
- * - Contact & Calendar: .vcf, .ics
1154
- *
1155
- * **Tip:** Audio sent here appears as a regular file attachment. To send audio as
1156
- * an iMessage voice memo bubble (with inline playback), use
1157
- * `/v3/chats/{chatId}/voicememo`. For repeated sends of the same file, use
1158
- * `attachment_id` to avoid redundant downloads.
1159
- *
1160
- * Either `url` or `attachment_id` must be provided, but not both.
1161
- */
1162
- url?: string;
1163
- }
1164
-
1165
- /**
1166
- * iMessage effect to apply to this message (screen or bubble effect)
1167
- */
1168
- export interface Effect {
1169
- /**
1170
- * Name of the effect. Common values:
1171
- *
1172
- * - Screen effects: confetti, fireworks, lasers, sparkles, celebration, hearts,
1173
- * love, balloons, happy_birthday, echo, spotlight
1174
- * - Bubble effects: slam, loud, gentle, invisible
1175
- */
1176
- name?: string;
1177
-
1178
- /**
1179
- * Type of effect
1180
- */
1181
- type?: 'screen' | 'bubble';
1182
- }
1183
-
1184
- /**
1185
- * Reply to another message to create a threaded conversation
1186
- */
1187
- export interface ReplyTo {
1188
- /**
1189
- * The ID of the message to reply to
1190
- */
1191
- message_id: string;
1192
-
1193
- /**
1194
- * The specific message part to reply to (0-based index). Defaults to 0 (first
1195
- * part) if not provided. Use this when replying to a specific part of a multipart
1196
- * message.
1197
- */
1198
- part_index?: number;
1199
- }
1200
- }
1201
- }
1202
-
1203
566
  export interface ChatUpdateParams {
1204
567
  /**
1205
568
  * New display name for the chat (group chats only)
@@ -1250,9 +613,10 @@ Chats.Messages = Messages;
1250
613
 
1251
614
  export declare namespace Chats {
1252
615
  export {
616
+ type Chat as Chat,
617
+ type MessageContent as MessageContent,
618
+ type ServiceType as ServiceType,
1253
619
  type ChatCreateResponse as ChatCreateResponse,
1254
- type ChatRetrieveResponse as ChatRetrieveResponse,
1255
- type ChatUpdateResponse as ChatUpdateResponse,
1256
620
  type ChatListResponse as ChatListResponse,
1257
621
  type ChatSendVoicememoResponse as ChatSendVoicememoResponse,
1258
622
  type ChatCreateParams as ChatCreateParams,
@@ -1273,6 +637,7 @@ export declare namespace Chats {
1273
637
 
1274
638
  export {
1275
639
  Messages as Messages,
640
+ type SentMessage as SentMessage,
1276
641
  type MessageListResponse as MessageListResponse,
1277
642
  type MessageSendResponse as MessageSendResponse,
1278
643
  type MessageListParams as MessageListParams,