@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,6 +1,8 @@
1
1
  import { APIResource } from "../../core/resource.mjs";
2
- import * as MessagesAPI from "./messages.mjs";
3
- import { MessageListParams, MessageListResponse, MessageSendParams, MessageSendResponse, Messages } from "./messages.mjs";
2
+ import * as ChatsAPI from "./chats.mjs";
3
+ import * as MessagesAPI from "../messages.mjs";
4
+ import * as ChatsMessagesAPI from "./messages.mjs";
5
+ import { MessageListParams, MessageListResponse, MessageSendParams, MessageSendResponse, Messages, SentMessage } from "./messages.mjs";
4
6
  import * as ParticipantsAPI from "./participants.mjs";
5
7
  import { ParticipantAddParams, ParticipantAddResponse, ParticipantRemoveParams, ParticipantRemoveResponse, Participants } from "./participants.mjs";
6
8
  import * as TypingAPI from "./typing.mjs";
@@ -10,7 +12,7 @@ import { RequestOptions } from "../../internal/request-options.mjs";
10
12
  export declare class Chats extends APIResource {
11
13
  participants: ParticipantsAPI.Participants;
12
14
  typing: TypingAPI.Typing;
13
- messages: MessagesAPI.Messages;
15
+ messages: ChatsMessagesAPI.Messages;
14
16
  /**
15
17
  * Create a new chat with specified participants and send an initial message. The
16
18
  * initial message is required when creating a chat.
@@ -56,7 +58,7 @@ export declare class Chats extends APIResource {
56
58
  * );
57
59
  * ```
58
60
  */
59
- retrieve(chatID: string, options?: RequestOptions): APIPromise<ChatRetrieveResponse>;
61
+ retrieve(chatID: string, options?: RequestOptions): APIPromise<Chat>;
60
62
  /**
61
63
  * Update chat properties such as display name and group chat icon.
62
64
  *
@@ -68,7 +70,7 @@ export declare class Chats extends APIResource {
68
70
  * );
69
71
  * ```
70
72
  */
71
- update(chatID: string, body: ChatUpdateParams, options?: RequestOptions): APIPromise<ChatUpdateResponse>;
73
+ update(chatID: string, body: ChatUpdateParams, options?: RequestOptions): APIPromise<Chat>;
72
74
  /**
73
75
  * Retrieves a paginated list of chats for the authenticated partner filtered by
74
76
  * phone number. Returns all chats involving the specified phone number with their
@@ -151,343 +153,7 @@ export declare class Chats extends APIResource {
151
153
  */
152
154
  shareContactCard(chatID: string, options?: RequestOptions): APIPromise<void>;
153
155
  }
154
- /**
155
- * Response for creating a new chat with an initial message
156
- */
157
- export interface ChatCreateResponse {
158
- chat: ChatCreateResponse.Chat;
159
- }
160
- export declare namespace ChatCreateResponse {
161
- interface Chat {
162
- /**
163
- * Unique identifier for the created chat (UUID)
164
- */
165
- id: string;
166
- /**
167
- * Display name for the chat. Defaults to a comma-separated list of recipient
168
- * handles. Can be updated for group chats.
169
- */
170
- display_name: string | null;
171
- /**
172
- * List of participants in the chat. Always contains at least two handles (your
173
- * phone number and the other participant).
174
- */
175
- handles: Array<Chat.Handle>;
176
- /**
177
- * Whether this is a group chat
178
- */
179
- is_group: boolean;
180
- /**
181
- * A message that was sent (used in CreateChat and SendMessage responses)
182
- */
183
- message: Chat.Message;
184
- /**
185
- * Messaging service type
186
- */
187
- service: 'iMessage' | 'SMS' | 'RCS';
188
- }
189
- namespace Chat {
190
- interface Handle {
191
- /**
192
- * Unique identifier for this handle
193
- */
194
- id: string;
195
- /**
196
- * Phone number (E.164) or email address of the participant
197
- */
198
- handle: string;
199
- /**
200
- * When this participant joined the chat
201
- */
202
- joined_at: string;
203
- /**
204
- * Messaging service type
205
- */
206
- service: 'iMessage' | 'SMS' | 'RCS';
207
- /**
208
- * Whether this handle belongs to the sender (your phone number)
209
- */
210
- is_me?: boolean | null;
211
- /**
212
- * When they left (if applicable)
213
- */
214
- left_at?: string | null;
215
- /**
216
- * Participant status
217
- */
218
- status?: 'active' | 'left' | 'removed' | null;
219
- }
220
- /**
221
- * A message that was sent (used in CreateChat and SendMessage responses)
222
- */
223
- interface Message {
224
- /**
225
- * Message identifier (UUID)
226
- */
227
- id: string;
228
- /**
229
- * Current delivery status of a message
230
- */
231
- delivery_status: 'pending' | 'queued' | 'sent' | 'delivered' | 'failed';
232
- /**
233
- * Whether the message has been read
234
- */
235
- is_read: boolean;
236
- /**
237
- * Message parts in order (text and media)
238
- */
239
- parts: Array<Message.TextPartResponse | Message.MediaPartResponse>;
240
- /**
241
- * When the message was sent
242
- */
243
- sent_at: string;
244
- /**
245
- * When the message was delivered
246
- */
247
- delivered_at?: string | null;
248
- /**
249
- * iMessage effect applied to a message (screen or bubble effect)
250
- */
251
- effect?: Message.Effect | null;
252
- /**
253
- * The sender of this message as a full handle object
254
- */
255
- from_handle?: Message.FromHandle | null;
256
- /**
257
- * Messaging service type
258
- */
259
- preferred_service?: 'iMessage' | 'SMS' | 'RCS' | null;
260
- /**
261
- * Indicates this message is a threaded reply to another message
262
- */
263
- reply_to?: Message.ReplyTo | null;
264
- /**
265
- * Messaging service type
266
- */
267
- service?: 'iMessage' | 'SMS' | 'RCS' | null;
268
- }
269
- namespace Message {
270
- /**
271
- * A text message part
272
- */
273
- interface TextPartResponse {
274
- /**
275
- * Reactions on this message part
276
- */
277
- reactions: Array<TextPartResponse.Reaction> | null;
278
- /**
279
- * Indicates this is a text message part
280
- */
281
- type: 'text';
282
- /**
283
- * The text content
284
- */
285
- value: string;
286
- }
287
- namespace TextPartResponse {
288
- interface Reaction {
289
- handle: Reaction.Handle;
290
- /**
291
- * Whether this reaction is from the current user
292
- */
293
- is_me: boolean;
294
- /**
295
- * Type of reaction. Standard iMessage tapbacks are love, like, dislike, laugh,
296
- * emphasize, question. Custom emoji reactions have type "custom" with the actual
297
- * emoji in the custom_emoji field.
298
- */
299
- type: 'love' | 'like' | 'dislike' | 'laugh' | 'emphasize' | 'question' | 'custom';
300
- /**
301
- * Custom emoji if type is "custom", null otherwise
302
- */
303
- custom_emoji?: string | null;
304
- }
305
- namespace Reaction {
306
- interface Handle {
307
- /**
308
- * Unique identifier for this handle
309
- */
310
- id: string;
311
- /**
312
- * Phone number (E.164) or email address of the participant
313
- */
314
- handle: string;
315
- /**
316
- * When this participant joined the chat
317
- */
318
- joined_at: string;
319
- /**
320
- * Messaging service type
321
- */
322
- service: 'iMessage' | 'SMS' | 'RCS';
323
- /**
324
- * Whether this handle belongs to the sender (your phone number)
325
- */
326
- is_me?: boolean | null;
327
- /**
328
- * When they left (if applicable)
329
- */
330
- left_at?: string | null;
331
- /**
332
- * Participant status
333
- */
334
- status?: 'active' | 'left' | 'removed' | null;
335
- }
336
- }
337
- }
338
- /**
339
- * A media attachment part
340
- */
341
- interface MediaPartResponse {
342
- /**
343
- * Unique attachment identifier
344
- */
345
- id: string;
346
- /**
347
- * Original filename
348
- */
349
- filename: string;
350
- /**
351
- * MIME type of the file
352
- */
353
- mime_type: string;
354
- /**
355
- * Reactions on this message part
356
- */
357
- reactions: Array<MediaPartResponse.Reaction> | null;
358
- /**
359
- * File size in bytes
360
- */
361
- size_bytes: number;
362
- /**
363
- * Indicates this is a media attachment part
364
- */
365
- type: 'media';
366
- /**
367
- * Presigned URL for downloading the attachment (expires in 1 hour).
368
- */
369
- url: string;
370
- }
371
- namespace MediaPartResponse {
372
- interface Reaction {
373
- handle: Reaction.Handle;
374
- /**
375
- * Whether this reaction is from the current user
376
- */
377
- is_me: boolean;
378
- /**
379
- * Type of reaction. Standard iMessage tapbacks are love, like, dislike, laugh,
380
- * emphasize, question. Custom emoji reactions have type "custom" with the actual
381
- * emoji in the custom_emoji field.
382
- */
383
- type: 'love' | 'like' | 'dislike' | 'laugh' | 'emphasize' | 'question' | 'custom';
384
- /**
385
- * Custom emoji if type is "custom", null otherwise
386
- */
387
- custom_emoji?: string | null;
388
- }
389
- namespace Reaction {
390
- interface Handle {
391
- /**
392
- * Unique identifier for this handle
393
- */
394
- id: string;
395
- /**
396
- * Phone number (E.164) or email address of the participant
397
- */
398
- handle: string;
399
- /**
400
- * When this participant joined the chat
401
- */
402
- joined_at: string;
403
- /**
404
- * Messaging service type
405
- */
406
- service: 'iMessage' | 'SMS' | 'RCS';
407
- /**
408
- * Whether this handle belongs to the sender (your phone number)
409
- */
410
- is_me?: boolean | null;
411
- /**
412
- * When they left (if applicable)
413
- */
414
- left_at?: string | null;
415
- /**
416
- * Participant status
417
- */
418
- status?: 'active' | 'left' | 'removed' | null;
419
- }
420
- }
421
- }
422
- /**
423
- * iMessage effect applied to a message (screen or bubble effect)
424
- */
425
- interface Effect {
426
- /**
427
- * Name of the effect. Common values:
428
- *
429
- * - Screen effects: confetti, fireworks, lasers, sparkles, celebration, hearts,
430
- * love, balloons, happy_birthday, echo, spotlight
431
- * - Bubble effects: slam, loud, gentle, invisible
432
- */
433
- name?: string;
434
- /**
435
- * Type of effect
436
- */
437
- type?: 'screen' | 'bubble';
438
- }
439
- /**
440
- * The sender of this message as a full handle object
441
- */
442
- interface FromHandle {
443
- /**
444
- * Unique identifier for this handle
445
- */
446
- id: string;
447
- /**
448
- * Phone number (E.164) or email address of the participant
449
- */
450
- handle: string;
451
- /**
452
- * When this participant joined the chat
453
- */
454
- joined_at: string;
455
- /**
456
- * Messaging service type
457
- */
458
- service: 'iMessage' | 'SMS' | 'RCS';
459
- /**
460
- * Whether this handle belongs to the sender (your phone number)
461
- */
462
- is_me?: boolean | null;
463
- /**
464
- * When they left (if applicable)
465
- */
466
- left_at?: string | null;
467
- /**
468
- * Participant status
469
- */
470
- status?: 'active' | 'left' | 'removed' | null;
471
- }
472
- /**
473
- * Indicates this message is a threaded reply to another message
474
- */
475
- interface ReplyTo {
476
- /**
477
- * The ID of the message to reply to
478
- */
479
- message_id: string;
480
- /**
481
- * The specific message part to reply to (0-based index). Defaults to 0 (first
482
- * part) if not provided. Use this when replying to a specific part of a multipart
483
- * message.
484
- */
485
- part_index?: number;
486
- }
487
- }
488
- }
489
- }
490
- export interface ChatRetrieveResponse {
156
+ export interface Chat {
491
157
  /**
492
158
  * Unique identifier for the chat
493
159
  */
@@ -505,7 +171,7 @@ export interface ChatRetrieveResponse {
505
171
  * List of chat participants with full handle details. Always contains at least two
506
172
  * handles (your phone number and the other participant).
507
173
  */
508
- handles: Array<ChatRetrieveResponse.Handle>;
174
+ handles: Array<MessagesAPI.ChatHandle>;
509
175
  /**
510
176
  * Whether the chat is archived
511
177
  */
@@ -521,189 +187,175 @@ export interface ChatRetrieveResponse {
521
187
  /**
522
188
  * Messaging service type
523
189
  */
524
- service?: 'iMessage' | 'SMS' | 'RCS' | null;
525
- }
526
- export declare namespace ChatRetrieveResponse {
527
- interface Handle {
528
- /**
529
- * Unique identifier for this handle
530
- */
531
- id: string;
532
- /**
533
- * Phone number (E.164) or email address of the participant
534
- */
535
- handle: string;
536
- /**
537
- * When this participant joined the chat
538
- */
539
- joined_at: string;
540
- /**
541
- * Messaging service type
542
- */
543
- service: 'iMessage' | 'SMS' | 'RCS';
544
- /**
545
- * Whether this handle belongs to the sender (your phone number)
546
- */
547
- is_me?: boolean | null;
548
- /**
549
- * When they left (if applicable)
550
- */
551
- left_at?: string | null;
552
- /**
553
- * Participant status
554
- */
555
- status?: 'active' | 'left' | 'removed' | null;
556
- }
190
+ service?: ServiceType | null;
557
191
  }
558
- export interface ChatUpdateResponse {
559
- /**
560
- * Unique identifier for the chat
561
- */
562
- id: string;
563
- /**
564
- * When the chat was created
565
- */
566
- created_at: string;
567
- /**
568
- * Display name for the chat. Defaults to a comma-separated list of recipient
569
- * handles. Can be updated for group chats.
570
- */
571
- display_name: string | null;
192
+ /**
193
+ * Message content container. Groups all message-related fields together,
194
+ * separating the "what" (message content) from the "where" (routing fields like
195
+ * from/to).
196
+ */
197
+ export interface MessageContent {
572
198
  /**
573
- * List of chat participants with full handle details. Always contains at least two
574
- * handles (your phone number and the other participant).
199
+ * Array of message parts. Each part can be either text or media. Parts are
200
+ * displayed in order. Text and media can be mixed.
201
+ *
202
+ * **Supported Media:**
203
+ *
204
+ * - Images: .jpg, .jpeg, .png, .gif, .heic, .heif, .tif, .tiff, .bmp
205
+ * - Videos: .mp4, .mov, .m4v, .mpeg, .mpg, .3gp
206
+ * - Audio: .m4a, .mp3, .aac, .caf, .wav, .aiff, .amr
207
+ * - Documents: .pdf, .txt, .rtf, .csv, .doc, .docx, .xls, .xlsx, .ppt, .pptx,
208
+ * .pages, .numbers, .key, .epub, .zip, .html, .htm
209
+ * - Contact & Calendar: .vcf, .ics
210
+ *
211
+ * **Audio:**
212
+ *
213
+ * - Audio files (.m4a, .mp3, .aac, .caf, .wav, .aiff, .amr) are fully supported as
214
+ * media parts
215
+ * - To send audio as an **iMessage voice memo bubble** (inline playback UI), use
216
+ * the dedicated `/v3/chats/{chatId}/voicememo` endpoint instead
217
+ *
218
+ * **Validation Rule:** Consecutive text parts are not allowed. Text parts must be
219
+ * separated by media parts. For example, [text, text] is invalid, but [text,
220
+ * media, text] is valid.
575
221
  */
576
- handles: Array<ChatUpdateResponse.Handle>;
222
+ parts: Array<MessageContent.TextPart | MessageContent.MediaPart>;
577
223
  /**
578
- * Whether the chat is archived
224
+ * iMessage effect to apply to this message (screen or bubble effect)
579
225
  */
580
- is_archived: boolean;
226
+ effect?: MessagesAPI.MessageEffect;
581
227
  /**
582
- * Whether this is a group chat
228
+ * Optional idempotency key for this message. Use this to prevent duplicate sends
229
+ * of the same message.
583
230
  */
584
- is_group: boolean;
231
+ idempotency_key?: string;
585
232
  /**
586
- * When the chat was last updated
233
+ * Messaging service type
587
234
  */
588
- updated_at: string;
235
+ preferred_service?: ServiceType;
589
236
  /**
590
- * Messaging service type
237
+ * Reply to another message to create a threaded conversation
591
238
  */
592
- service?: 'iMessage' | 'SMS' | 'RCS' | null;
239
+ reply_to?: MessagesAPI.ReplyTo;
593
240
  }
594
- export declare namespace ChatUpdateResponse {
595
- interface Handle {
241
+ export declare namespace MessageContent {
242
+ interface TextPart {
596
243
  /**
597
- * Unique identifier for this handle
244
+ * Indicates this is a text message part
598
245
  */
599
- id: string;
246
+ type: 'text';
600
247
  /**
601
- * Phone number (E.164) or email address of the participant
248
+ * The text content
602
249
  */
603
- handle: string;
250
+ value: string;
604
251
  /**
605
- * When this participant joined the chat
252
+ * Optional idempotency key for this specific message part. Use this to prevent
253
+ * duplicate sends of the same part.
606
254
  */
607
- joined_at: string;
255
+ idempotency_key?: string;
256
+ }
257
+ interface MediaPart {
608
258
  /**
609
- * Messaging service type
259
+ * Indicates this is a media attachment part
610
260
  */
611
- service: 'iMessage' | 'SMS' | 'RCS';
261
+ type: 'media';
612
262
  /**
613
- * Whether this handle belongs to the sender (your phone number)
263
+ * Reference to a file pre-uploaded via `POST /v3/attachments` (optional). The file
264
+ * is already stored, so sends using this ID skip the download step — useful when
265
+ * sending the same file to many recipients.
266
+ *
267
+ * Either `url` or `attachment_id` must be provided, but not both.
614
268
  */
615
- is_me?: boolean | null;
269
+ attachment_id?: string;
616
270
  /**
617
- * When they left (if applicable)
271
+ * Optional idempotency key for this specific message part. Use this to prevent
272
+ * duplicate sends of the same part.
618
273
  */
619
- left_at?: string | null;
274
+ idempotency_key?: string;
620
275
  /**
621
- * Participant status
276
+ * Any publicly accessible HTTPS URL to the media file. The server downloads and
277
+ * sends the file automatically — no pre-upload step required.
278
+ *
279
+ * **Size limit:** 10MB maximum for URL-based downloads. For larger files (up to
280
+ * 100MB), use the pre-upload flow: `POST /v3/attachments` to get a presigned URL,
281
+ * upload directly, then reference by `attachment_id`.
282
+ *
283
+ * **Requirements:**
284
+ *
285
+ * - URL must use HTTPS
286
+ * - File content must be a supported format (the server validates the actual file
287
+ * content)
288
+ *
289
+ * **Supported formats:**
290
+ *
291
+ * - Images: .jpg, .jpeg, .png, .gif, .heic, .heif, .tif, .tiff, .bmp
292
+ * - Videos: .mp4, .mov, .m4v, .mpeg, .mpg, .3gp
293
+ * - Audio: .m4a, .mp3, .aac, .caf, .wav, .aiff, .amr
294
+ * - Documents: .pdf, .txt, .rtf, .csv, .doc, .docx, .xls, .xlsx, .ppt, .pptx,
295
+ * .pages, .numbers, .key, .epub, .zip, .html, .htm
296
+ * - Contact & Calendar: .vcf, .ics
297
+ *
298
+ * **Tip:** Audio sent here appears as a regular file attachment. To send audio as
299
+ * an iMessage voice memo bubble (with inline playback), use
300
+ * `/v3/chats/{chatId}/voicememo`. For repeated sends of the same file, use
301
+ * `attachment_id` to avoid redundant downloads.
302
+ *
303
+ * Either `url` or `attachment_id` must be provided, but not both.
622
304
  */
623
- status?: 'active' | 'left' | 'removed' | null;
305
+ url?: string;
624
306
  }
625
307
  }
626
- export interface ChatListResponse {
627
- /**
628
- * List of chats
629
- */
630
- chats: Array<ChatListResponse.Chat>;
631
- /**
632
- * Cursor for fetching the next page of results. Null if there are no more results
633
- * to fetch. Pass this value as the `cursor` parameter in the next request.
634
- */
635
- next_cursor?: string | null;
308
+ /**
309
+ * Messaging service type
310
+ */
311
+ export type ServiceType = 'iMessage' | 'SMS' | 'RCS';
312
+ /**
313
+ * Response for creating a new chat with an initial message
314
+ */
315
+ export interface ChatCreateResponse {
316
+ chat: ChatCreateResponse.Chat;
636
317
  }
637
- export declare namespace ChatListResponse {
318
+ export declare namespace ChatCreateResponse {
638
319
  interface Chat {
639
320
  /**
640
- * Unique identifier for the chat
321
+ * Unique identifier for the created chat (UUID)
641
322
  */
642
323
  id: string;
643
- /**
644
- * When the chat was created
645
- */
646
- created_at: string;
647
324
  /**
648
325
  * Display name for the chat. Defaults to a comma-separated list of recipient
649
326
  * handles. Can be updated for group chats.
650
327
  */
651
328
  display_name: string | null;
652
329
  /**
653
- * List of chat participants with full handle details. Always contains at least two
654
- * handles (your phone number and the other participant).
655
- */
656
- handles: Array<Chat.Handle>;
657
- /**
658
- * Whether the chat is archived
330
+ * List of participants in the chat. Always contains at least two handles (your
331
+ * phone number and the other participant).
659
332
  */
660
- is_archived: boolean;
333
+ handles: Array<MessagesAPI.ChatHandle>;
661
334
  /**
662
335
  * Whether this is a group chat
663
336
  */
664
337
  is_group: boolean;
665
338
  /**
666
- * When the chat was last updated
339
+ * A message that was sent (used in CreateChat and SendMessage responses)
667
340
  */
668
- updated_at: string;
341
+ message: ChatsMessagesAPI.SentMessage;
669
342
  /**
670
343
  * Messaging service type
671
344
  */
672
- service?: 'iMessage' | 'SMS' | 'RCS' | null;
673
- }
674
- namespace Chat {
675
- interface Handle {
676
- /**
677
- * Unique identifier for this handle
678
- */
679
- id: string;
680
- /**
681
- * Phone number (E.164) or email address of the participant
682
- */
683
- handle: string;
684
- /**
685
- * When this participant joined the chat
686
- */
687
- joined_at: string;
688
- /**
689
- * Messaging service type
690
- */
691
- service: 'iMessage' | 'SMS' | 'RCS';
692
- /**
693
- * Whether this handle belongs to the sender (your phone number)
694
- */
695
- is_me?: boolean | null;
696
- /**
697
- * When they left (if applicable)
698
- */
699
- left_at?: string | null;
700
- /**
701
- * Participant status
702
- */
703
- status?: 'active' | 'left' | 'removed' | null;
704
- }
345
+ service: ChatsAPI.ServiceType;
705
346
  }
706
347
  }
348
+ export interface ChatListResponse {
349
+ /**
350
+ * List of chats
351
+ */
352
+ chats: Array<Chat>;
353
+ /**
354
+ * Cursor for fetching the next page of results. Null if there are no more results
355
+ * to fetch. Pass this value as the `cursor` parameter in the next request.
356
+ */
357
+ next_cursor?: string | null;
358
+ }
707
359
  /**
708
360
  * Response for sending a voice memo to a chat
709
361
  */
@@ -737,7 +389,7 @@ export declare namespace ChatSendVoicememoResponse {
737
389
  /**
738
390
  * Messaging service type
739
391
  */
740
- service?: 'iMessage' | 'SMS' | 'RCS' | null;
392
+ service?: ChatsAPI.ServiceType | null;
741
393
  }
742
394
  namespace VoiceMemo {
743
395
  interface Chat {
@@ -748,7 +400,7 @@ export declare namespace ChatSendVoicememoResponse {
748
400
  /**
749
401
  * Chat participants
750
402
  */
751
- handles: Array<Chat.Handle>;
403
+ handles: Array<MessagesAPI.ChatHandle>;
752
404
  /**
753
405
  * Whether the chat is active
754
406
  */
@@ -760,39 +412,7 @@ export declare namespace ChatSendVoicememoResponse {
760
412
  /**
761
413
  * Messaging service type
762
414
  */
763
- service: 'iMessage' | 'SMS' | 'RCS';
764
- }
765
- namespace Chat {
766
- interface Handle {
767
- /**
768
- * Unique identifier for this handle
769
- */
770
- id: string;
771
- /**
772
- * Phone number (E.164) or email address of the participant
773
- */
774
- handle: string;
775
- /**
776
- * When this participant joined the chat
777
- */
778
- joined_at: string;
779
- /**
780
- * Messaging service type
781
- */
782
- service: 'iMessage' | 'SMS' | 'RCS';
783
- /**
784
- * Whether this handle belongs to the sender (your phone number)
785
- */
786
- is_me?: boolean | null;
787
- /**
788
- * When they left (if applicable)
789
- */
790
- left_at?: string | null;
791
- /**
792
- * Participant status
793
- */
794
- status?: 'active' | 'left' | 'removed' | null;
795
- }
415
+ service: ChatsAPI.ServiceType;
796
416
  }
797
417
  interface VoiceMemo {
798
418
  /**
@@ -833,163 +453,13 @@ export interface ChatCreateParams {
833
453
  * separating the "what" (message content) from the "where" (routing fields like
834
454
  * from/to).
835
455
  */
836
- message: ChatCreateParams.Message;
456
+ message: MessageContent;
837
457
  /**
838
458
  * Array of recipient handles (phone numbers in E.164 format or email addresses).
839
459
  * For individual chats, provide one recipient. For group chats, provide multiple.
840
460
  */
841
461
  to: Array<string>;
842
462
  }
843
- export declare namespace ChatCreateParams {
844
- /**
845
- * Message content container. Groups all message-related fields together,
846
- * separating the "what" (message content) from the "where" (routing fields like
847
- * from/to).
848
- */
849
- interface Message {
850
- /**
851
- * Array of message parts. Each part can be either text or media. Parts are
852
- * displayed in order. Text and media can be mixed.
853
- *
854
- * **Supported Media:**
855
- *
856
- * - Images: .jpg, .jpeg, .png, .gif, .heic, .heif, .tif, .tiff, .bmp
857
- * - Videos: .mp4, .mov, .m4v, .mpeg, .mpg, .3gp
858
- * - Audio: .m4a, .mp3, .aac, .caf, .wav, .aiff, .amr
859
- * - Documents: .pdf, .txt, .rtf, .csv, .doc, .docx, .xls, .xlsx, .ppt, .pptx,
860
- * .pages, .numbers, .key, .epub, .zip, .html, .htm
861
- * - Contact & Calendar: .vcf, .ics
862
- *
863
- * **Audio:**
864
- *
865
- * - Audio files (.m4a, .mp3, .aac, .caf, .wav, .aiff, .amr) are fully supported as
866
- * media parts
867
- * - To send audio as an **iMessage voice memo bubble** (inline playback UI), use
868
- * the dedicated `/v3/chats/{chatId}/voicememo` endpoint instead
869
- *
870
- * **Validation Rule:** Consecutive text parts are not allowed. Text parts must be
871
- * separated by media parts. For example, [text, text] is invalid, but [text,
872
- * media, text] is valid.
873
- */
874
- parts: Array<Message.TextPart | Message.MediaPart>;
875
- /**
876
- * iMessage effect to apply to this message (screen or bubble effect)
877
- */
878
- effect?: Message.Effect;
879
- /**
880
- * Optional idempotency key for this message. Use this to prevent duplicate sends
881
- * of the same message.
882
- */
883
- idempotency_key?: string;
884
- /**
885
- * Messaging service type
886
- */
887
- preferred_service?: 'iMessage' | 'SMS' | 'RCS';
888
- /**
889
- * Reply to another message to create a threaded conversation
890
- */
891
- reply_to?: Message.ReplyTo;
892
- }
893
- namespace Message {
894
- interface TextPart {
895
- /**
896
- * Indicates this is a text message part
897
- */
898
- type: 'text';
899
- /**
900
- * The text content
901
- */
902
- value: string;
903
- /**
904
- * Optional idempotency key for this specific message part. Use this to prevent
905
- * duplicate sends of the same part.
906
- */
907
- idempotency_key?: string;
908
- }
909
- interface MediaPart {
910
- /**
911
- * Indicates this is a media attachment part
912
- */
913
- type: 'media';
914
- /**
915
- * Reference to a file pre-uploaded via `POST /v3/attachments` (optional). The file
916
- * is already stored, so sends using this ID skip the download step — useful when
917
- * sending the same file to many recipients.
918
- *
919
- * Either `url` or `attachment_id` must be provided, but not both.
920
- */
921
- attachment_id?: string;
922
- /**
923
- * Optional idempotency key for this specific message part. Use this to prevent
924
- * duplicate sends of the same part.
925
- */
926
- idempotency_key?: string;
927
- /**
928
- * Any publicly accessible HTTPS URL to the media file. The server downloads and
929
- * sends the file automatically — no pre-upload step required.
930
- *
931
- * **Size limit:** 10MB maximum for URL-based downloads. For larger files (up to
932
- * 100MB), use the pre-upload flow: `POST /v3/attachments` to get a presigned URL,
933
- * upload directly, then reference by `attachment_id`.
934
- *
935
- * **Requirements:**
936
- *
937
- * - URL must use HTTPS
938
- * - File content must be a supported format (the server validates the actual file
939
- * content)
940
- *
941
- * **Supported formats:**
942
- *
943
- * - Images: .jpg, .jpeg, .png, .gif, .heic, .heif, .tif, .tiff, .bmp
944
- * - Videos: .mp4, .mov, .m4v, .mpeg, .mpg, .3gp
945
- * - Audio: .m4a, .mp3, .aac, .caf, .wav, .aiff, .amr
946
- * - Documents: .pdf, .txt, .rtf, .csv, .doc, .docx, .xls, .xlsx, .ppt, .pptx,
947
- * .pages, .numbers, .key, .epub, .zip, .html, .htm
948
- * - Contact & Calendar: .vcf, .ics
949
- *
950
- * **Tip:** Audio sent here appears as a regular file attachment. To send audio as
951
- * an iMessage voice memo bubble (with inline playback), use
952
- * `/v3/chats/{chatId}/voicememo`. For repeated sends of the same file, use
953
- * `attachment_id` to avoid redundant downloads.
954
- *
955
- * Either `url` or `attachment_id` must be provided, but not both.
956
- */
957
- url?: string;
958
- }
959
- /**
960
- * iMessage effect to apply to this message (screen or bubble effect)
961
- */
962
- interface Effect {
963
- /**
964
- * Name of the effect. Common values:
965
- *
966
- * - Screen effects: confetti, fireworks, lasers, sparkles, celebration, hearts,
967
- * love, balloons, happy_birthday, echo, spotlight
968
- * - Bubble effects: slam, loud, gentle, invisible
969
- */
970
- name?: string;
971
- /**
972
- * Type of effect
973
- */
974
- type?: 'screen' | 'bubble';
975
- }
976
- /**
977
- * Reply to another message to create a threaded conversation
978
- */
979
- interface ReplyTo {
980
- /**
981
- * The ID of the message to reply to
982
- */
983
- message_id: string;
984
- /**
985
- * The specific message part to reply to (0-based index). Defaults to 0 (first
986
- * part) if not provided. Use this when replying to a specific part of a multipart
987
- * message.
988
- */
989
- part_index?: number;
990
- }
991
- }
992
- }
993
463
  export interface ChatUpdateParams {
994
464
  /**
995
465
  * New display name for the chat (group chats only)
@@ -1028,9 +498,9 @@ export interface ChatSendVoicememoParams {
1028
498
  voice_memo_url: string;
1029
499
  }
1030
500
  export declare namespace Chats {
1031
- export { type ChatCreateResponse as ChatCreateResponse, type ChatRetrieveResponse as ChatRetrieveResponse, type ChatUpdateResponse as ChatUpdateResponse, type ChatListResponse as ChatListResponse, type ChatSendVoicememoResponse as ChatSendVoicememoResponse, type ChatCreateParams as ChatCreateParams, type ChatUpdateParams as ChatUpdateParams, type ChatListParams as ChatListParams, type ChatSendVoicememoParams as ChatSendVoicememoParams, };
501
+ export { type Chat as Chat, type MessageContent as MessageContent, type ServiceType as ServiceType, type ChatCreateResponse as ChatCreateResponse, type ChatListResponse as ChatListResponse, type ChatSendVoicememoResponse as ChatSendVoicememoResponse, type ChatCreateParams as ChatCreateParams, type ChatUpdateParams as ChatUpdateParams, type ChatListParams as ChatListParams, type ChatSendVoicememoParams as ChatSendVoicememoParams, };
1032
502
  export { Participants as Participants, type ParticipantAddResponse as ParticipantAddResponse, type ParticipantRemoveResponse as ParticipantRemoveResponse, type ParticipantAddParams as ParticipantAddParams, type ParticipantRemoveParams as ParticipantRemoveParams, };
1033
503
  export { Typing as Typing };
1034
- export { Messages as Messages, type MessageListResponse as MessageListResponse, type MessageSendResponse as MessageSendResponse, type MessageListParams as MessageListParams, type MessageSendParams as MessageSendParams, };
504
+ export { Messages as Messages, type SentMessage as SentMessage, type MessageListResponse as MessageListResponse, type MessageSendResponse as MessageSendResponse, type MessageListParams as MessageListParams, type MessageSendParams as MessageSendParams, };
1035
505
  }
1036
506
  //# sourceMappingURL=chats.d.mts.map