@sentdm/sentdm 0.41.0 → 0.43.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.
Files changed (120) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/client.d.mts +20 -3
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +20 -3
  5. package/client.d.ts.map +1 -1
  6. package/client.js +15 -0
  7. package/client.js.map +1 -1
  8. package/client.mjs +15 -0
  9. package/client.mjs.map +1 -1
  10. package/core/pagination.d.mts +25 -0
  11. package/core/pagination.d.mts.map +1 -1
  12. package/core/pagination.d.ts +25 -0
  13. package/core/pagination.d.ts.map +1 -1
  14. package/core/pagination.js +28 -1
  15. package/core/pagination.js.map +1 -1
  16. package/core/pagination.mjs +26 -0
  17. package/core/pagination.mjs.map +1 -1
  18. package/package.json +1 -1
  19. package/resources/calls/calls.d.mts +388 -0
  20. package/resources/calls/calls.d.mts.map +1 -0
  21. package/resources/calls/calls.d.ts +388 -0
  22. package/resources/calls/calls.d.ts.map +1 -0
  23. package/resources/calls/calls.js +159 -0
  24. package/resources/calls/calls.js.map +1 -0
  25. package/resources/calls/calls.mjs +154 -0
  26. package/resources/calls/calls.mjs.map +1 -0
  27. package/resources/calls/index.d.mts +3 -0
  28. package/resources/calls/index.d.mts.map +1 -0
  29. package/resources/calls/index.d.ts +3 -0
  30. package/resources/calls/index.d.ts.map +1 -0
  31. package/resources/calls/index.js +9 -0
  32. package/resources/calls/index.js.map +1 -0
  33. package/resources/calls/index.mjs +4 -0
  34. package/resources/calls/index.mjs.map +1 -0
  35. package/resources/calls/participants.d.mts +258 -0
  36. package/resources/calls/participants.d.mts.map +1 -0
  37. package/resources/calls/participants.d.ts +258 -0
  38. package/resources/calls/participants.d.ts.map +1 -0
  39. package/resources/calls/participants.js +158 -0
  40. package/resources/calls/participants.js.map +1 -0
  41. package/resources/calls/participants.mjs +154 -0
  42. package/resources/calls/participants.mjs.map +1 -0
  43. package/resources/calls.d.mts +2 -0
  44. package/resources/calls.d.mts.map +1 -0
  45. package/resources/calls.d.ts +2 -0
  46. package/resources/calls.d.ts.map +1 -0
  47. package/resources/calls.js +6 -0
  48. package/resources/calls.js.map +1 -0
  49. package/resources/calls.mjs +3 -0
  50. package/resources/calls.mjs.map +1 -0
  51. package/resources/channels/channels.d.mts +10 -0
  52. package/resources/channels/channels.d.mts.map +1 -0
  53. package/resources/channels/channels.d.ts +10 -0
  54. package/resources/channels/channels.d.ts.map +1 -0
  55. package/resources/channels/channels.js +17 -0
  56. package/resources/channels/channels.js.map +1 -0
  57. package/resources/channels/channels.mjs +12 -0
  58. package/resources/channels/channels.mjs.map +1 -0
  59. package/resources/channels/index.d.mts +3 -0
  60. package/resources/channels/index.d.mts.map +1 -0
  61. package/resources/channels/index.d.ts +3 -0
  62. package/resources/channels/index.d.ts.map +1 -0
  63. package/resources/channels/index.js +9 -0
  64. package/resources/channels/index.js.map +1 -0
  65. package/resources/channels/index.mjs +4 -0
  66. package/resources/channels/index.mjs.map +1 -0
  67. package/resources/channels/voice.d.mts +654 -0
  68. package/resources/channels/voice.d.mts.map +1 -0
  69. package/resources/channels/voice.d.ts +654 -0
  70. package/resources/channels/voice.d.ts.map +1 -0
  71. package/resources/channels/voice.js +285 -0
  72. package/resources/channels/voice.js.map +1 -0
  73. package/resources/channels/voice.mjs +281 -0
  74. package/resources/channels/voice.mjs.map +1 -0
  75. package/resources/channels.d.mts +2 -0
  76. package/resources/channels.d.mts.map +1 -0
  77. package/resources/channels.d.ts +2 -0
  78. package/resources/channels.d.ts.map +1 -0
  79. package/resources/channels.js +6 -0
  80. package/resources/channels.js.map +1 -0
  81. package/resources/channels.mjs +3 -0
  82. package/resources/channels.mjs.map +1 -0
  83. package/resources/index.d.mts +3 -1
  84. package/resources/index.d.mts.map +1 -1
  85. package/resources/index.d.ts +3 -1
  86. package/resources/index.d.ts.map +1 -1
  87. package/resources/index.js +5 -1
  88. package/resources/index.js.map +1 -1
  89. package/resources/index.mjs +2 -0
  90. package/resources/index.mjs.map +1 -1
  91. package/resources/messages.d.mts +13 -8
  92. package/resources/messages.d.mts.map +1 -1
  93. package/resources/messages.d.ts +13 -8
  94. package/resources/messages.d.ts.map +1 -1
  95. package/resources/messages.js +7 -4
  96. package/resources/messages.js.map +1 -1
  97. package/resources/messages.mjs +7 -4
  98. package/resources/messages.mjs.map +1 -1
  99. package/resources/webhooks.d.mts +112 -109
  100. package/resources/webhooks.d.mts.map +1 -1
  101. package/resources/webhooks.d.ts +112 -109
  102. package/resources/webhooks.d.ts.map +1 -1
  103. package/src/client.ts +62 -0
  104. package/src/core/pagination.ts +59 -0
  105. package/src/resources/calls/calls.ts +556 -0
  106. package/src/resources/calls/index.ts +31 -0
  107. package/src/resources/calls/participants.ts +367 -0
  108. package/src/resources/calls.ts +3 -0
  109. package/src/resources/channels/channels.ts +61 -0
  110. package/src/resources/channels/index.ts +27 -0
  111. package/src/resources/channels/voice.ts +864 -0
  112. package/src/resources/channels.ts +3 -0
  113. package/src/resources/index.ts +21 -0
  114. package/src/resources/messages.ts +13 -8
  115. package/src/resources/webhooks.ts +127 -122
  116. package/src/version.ts +1 -1
  117. package/version.d.mts +1 -1
  118. package/version.d.ts +1 -1
  119. package/version.js +1 -1
  120. package/version.mjs +1 -1
@@ -0,0 +1,3 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ export * from './channels/index';
@@ -1,5 +1,24 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
+ export {
4
+ Calls,
5
+ type APIResponseOfCall,
6
+ type APIResponseOfCallRecordings,
7
+ type APIResponseOfCallsList,
8
+ type Call,
9
+ type CallParty,
10
+ type CallRecording,
11
+ type CallRecordings,
12
+ type CallTimelineEntry,
13
+ type CallsList,
14
+ type CallRetrieveParams,
15
+ type CallListParams,
16
+ type CallHangupParams,
17
+ type CallListRecordingsParams,
18
+ type CallRecordParams,
19
+ type CallsCallsPage,
20
+ } from './calls/calls';
21
+ export { Channels } from './channels/channels';
3
22
  export {
4
23
  Contacts,
5
24
  type APIResponseOfContact,
@@ -90,6 +109,8 @@ export {
90
109
  Webhooks,
91
110
  type APIMeta,
92
111
  type APIResponseWebhook,
112
+ type CallEvent,
113
+ type CallEventPayload,
93
114
  type ChannelEvent,
94
115
  type ChannelEventPayload,
95
116
  type ContactEvent,
@@ -15,6 +15,8 @@ import { path } from '../internal/utils/path';
15
15
  * **A message needs a sender.** What you can send, where, and at what cost is decided by the markets under **Channels** — so a recipient in a country you hold no sender for is refused here rather than queued.
16
16
  *
17
17
  * **A message can be resent on its id.** `POST /v3/messages/{id}/resend` puts a finished message — typically one BLOCKED for insufficient balance — back through the send pipeline. It is a new attempt, not a free retry: every policy runs again, the message is billed again, and its status webhooks fire again. A FILTERED message is never resendable.
18
+ *
19
+ * **A scheduled message can be called off.** `POST /v3/messages/{id}/cancel` cancels a send you scheduled with `scheduled_at`, as long as it has not been released yet. Cancelling is free, fires `message.cancelled`, and is final — a cancelled message cannot be resent.
18
20
  */
19
21
  export class Messages extends APIResource {
20
22
  /**
@@ -48,10 +50,11 @@ export class Messages extends APIResource {
48
50
  /**
49
51
  * Retrieves the current status and details of a message by ID. Includes delivery
50
52
  * status, timestamps, and error information if applicable. A message that is or
51
- * was held for a later time (a send you scheduled with scheduled_at, or a
52
- * quiet-hours hold) is returned as a ScheduledMessageResponse: the same fields
53
- * plus scheduled_at, the release instant in UTC. A message sent immediately has no
54
- * scheduled_at key.
53
+ * was held for a later time (a send you scheduled with scheduled_at, a quiet-hours
54
+ * hold, or a message you cancelled while it was held) is returned as a
55
+ * ScheduledMessageResponse: the same fields plus scheduled_at, the instant it is
56
+ * held for in UTC — or, on a CANCELLED message, the instant that was called off. A
57
+ * message sent immediately has no scheduled_at key.
55
58
  *
56
59
  * @example
57
60
  * ```ts
@@ -213,10 +216,12 @@ export namespace MessageRetrieveActivitiesResponse {
213
216
  reason_code?: string | null;
214
217
 
215
218
  /**
216
- * SCHEDULED activities only: when the held message will be released for delivery,
217
- * in UTC. Same wire name as on the send response, the message and the webhook.
218
- * Omitted on every other activity. A message that quiet hours moved at release has
219
- * two SCHEDULED entries, each carrying the instant as it stood at that moment.
219
+ * SCHEDULED and CANCELLED activities only, in UTC: on a SCHEDULED entry, when the
220
+ * held message will be released for delivery; on a CANCELLED entry, the instant
221
+ * that was called off. Same wire name as on the send response, the message and the
222
+ * webhook. Omitted on every other activity. A message that quiet hours moved at
223
+ * release has two SCHEDULED entries, each carrying the instant as it stood at that
224
+ * moment.
220
225
  */
221
226
  scheduled_at?: string | null;
222
227
 
@@ -338,6 +338,122 @@ export interface APIResponseWebhook {
338
338
  success?: boolean;
339
339
  }
340
340
 
341
+ /**
342
+ * The envelope Sent POSTs to a subscribed webhook endpoint. Every event shares
343
+ * this shape and varies only in Payload.
344
+ */
345
+ export interface CallEvent {
346
+ /**
347
+ * The specific event within the family, for example message.delivered,
348
+ * message.received or contact.opt_out. Absent on events that have no subtype, so
349
+ * treat it as optional.
350
+ */
351
+ event?: string | null;
352
+
353
+ /**
354
+ * The event family, for example message, templates or contact. Route on this
355
+ * first, then on event for the specific change.
356
+ */
357
+ field?: string;
358
+
359
+ /**
360
+ * Body of a call.initiated, call.answered, call.completed, call.failed or
361
+ * call.recording_ready event. Which of them occurred is the envelope's event.
362
+ *
363
+ * Shaped like the message, inbound, template and channel payloads: account_id
364
+ * names the account the event is about, channel names the channel, and updated_at
365
+ * is when the change happened on the call, in the same yyyy-MM-ddTHH:mm:ssZ form.
366
+ * duration_seconds and price are added on call.completed, reason on call.failed
367
+ * and recording_id on call.recording_ready; each is omitted rather than sent as
368
+ * null when it does not apply.
369
+ *
370
+ * Casing is snake_case because these ride the same webhook stream customers
371
+ * already parse message_id from; the question/answer contract is a separate
372
+ * surface and stays camelCase. Nothing here is provider-shaped: no provider call
373
+ * id, no namespaced identity.
374
+ */
375
+ payload?: CallEventPayload | null;
376
+
377
+ /**
378
+ * The event-specific body.
379
+ */
380
+ request_id?: string | null;
381
+
382
+ /**
383
+ * When Sent emitted the event, in UTC (yyyy-MM-ddTHH:mm:ssZ). This is the emission
384
+ * time, not the time the underlying change happened. Use the timestamp inside the
385
+ * payload for the latter.
386
+ */
387
+ timestamp?: string;
388
+ }
389
+
390
+ /**
391
+ * Body of a call.initiated, call.answered, call.completed, call.failed or
392
+ * call.recording_ready event. Which of them occurred is the envelope's event.
393
+ *
394
+ * Shaped like the message, inbound, template and channel payloads: account_id
395
+ * names the account the event is about, channel names the channel, and updated_at
396
+ * is when the change happened on the call, in the same yyyy-MM-ddTHH:mm:ssZ form.
397
+ * duration_seconds and price are added on call.completed, reason on call.failed
398
+ * and recording_id on call.recording_ready; each is omitted rather than sent as
399
+ * null when it does not apply.
400
+ *
401
+ * Casing is snake_case because these ride the same webhook stream customers
402
+ * already parse message_id from; the question/answer contract is a separate
403
+ * surface and stays camelCase. Nothing here is provider-shaped: no provider call
404
+ * id, no namespaced identity.
405
+ */
406
+ export interface CallEventPayload {
407
+ /**
408
+ * Sent's call id, the same one the customer saw on the first question.
409
+ */
410
+ call_id: string;
411
+
412
+ /**
413
+ * The account the call belongs to: the key's own customer, or the sender profile
414
+ * it acted as.
415
+ */
416
+ account_id?: string;
417
+
418
+ /**
419
+ * Always voice.
420
+ */
421
+ channel?: string;
422
+
423
+ /**
424
+ * How long the call lasted. Only on call.completed.
425
+ */
426
+ duration_seconds?: number | null;
427
+
428
+ /**
429
+ * The customer number that owns the call, in E.164 format.
430
+ */
431
+ number?: string;
432
+
433
+ /**
434
+ * What the call was charged. Only on call.completed, and omitted there until
435
+ * billing has recorded the charge.
436
+ */
437
+ price?: number | null;
438
+
439
+ /**
440
+ * The machine-readable reason the call did not complete. Only on call.failed, and
441
+ * omitted when no reason was recorded.
442
+ */
443
+ reason?: string | null;
444
+
445
+ /**
446
+ * The recording that became available, the same id GET /v3/calls/{id}/recordings
447
+ * lists it under. Only on call.recording_ready, which is sent once per recording.
448
+ */
449
+ recording_id?: string | null;
450
+
451
+ /**
452
+ * When the change happened on the call, as opposed to when the event was emitted.
453
+ */
454
+ updated_at?: string;
455
+ }
456
+
341
457
  /**
342
458
  * The envelope Sent POSTs to a subscribed webhook endpoint. Every event shares
343
459
  * this shape and varies only in Payload.
@@ -1057,13 +1173,18 @@ export interface MessageEventPayload {
1057
1173
  /**
1058
1174
  * message.scheduled only: why the message is held, either because you scheduled it
1059
1175
  * or because the recipient is inside a protected quiet-hours window. Omitted on
1060
- * every other event.
1176
+ * every other event, including message.cancelled — that is a property of the hold,
1177
+ * not of the cancellation, and repeating it there would read as "why was this
1178
+ * cancelled", which it does not answer.
1061
1179
  */
1062
1180
  schedule_reason?: string | null;
1063
1181
 
1064
1182
  /**
1065
- * message.scheduled only: when the held message will be released for delivery, in
1066
- * UTC (yyyy-MM-ddTHH:mm:ssZ). Omitted on every other event.
1183
+ * message.scheduled and message.cancelled only, in UTC (yyyy-MM-ddTHH:mm:ssZ): on
1184
+ * message.scheduled it is when the held message will be released for delivery, on
1185
+ * message.cancelled the release instant that was called off — the same instant,
1186
+ * before and after. A consumer that recorded a future send from the first event
1187
+ * has what it needs to un-record it from the second. Omitted on every other event.
1067
1188
  */
1068
1189
  scheduled_at?: string | null;
1069
1190
 
@@ -1387,7 +1508,7 @@ export interface WebhookListEventsResponse {
1387
1508
  | ChannelEvent
1388
1509
  | ContactEvent
1389
1510
  | WebhookListEventsResponse.SentDmServicesCommonServicesWebhooksContractsWebhookEventOfLinkWebhookPayload
1390
- | WebhookListEventsResponse.SentDmServicesCommonServicesWebhooksContractsWebhookEventOfCallWebhookPayload;
1511
+ | CallEvent;
1391
1512
 
1392
1513
  event_type?: string;
1393
1514
 
@@ -1610,124 +1731,6 @@ export namespace WebhookListEventsResponse {
1610
1731
  traffic_class?: string | null;
1611
1732
  }
1612
1733
  }
1613
-
1614
- /**
1615
- * The envelope Sent POSTs to a subscribed webhook endpoint. Every event shares
1616
- * this shape and varies only in Payload.
1617
- */
1618
- export interface SentDmServicesCommonServicesWebhooksContractsWebhookEventOfCallWebhookPayload {
1619
- /**
1620
- * The specific event within the family, for example message.delivered,
1621
- * message.received or contact.opt_out. Absent on events that have no subtype, so
1622
- * treat it as optional.
1623
- */
1624
- event?: string | null;
1625
-
1626
- /**
1627
- * The event family, for example message, templates or contact. Route on this
1628
- * first, then on event for the specific change.
1629
- */
1630
- field?: string;
1631
-
1632
- /**
1633
- * Body of a call.initiated, call.answered, call.completed, call.failed or
1634
- * call.recording_ready event. Which of them occurred is the envelope's event.
1635
- *
1636
- * Shaped like the message, inbound, template and channel payloads: account_id
1637
- * names the account the event is about, channel names the channel, and updated_at
1638
- * is when the change happened on the call, in the same yyyy-MM-ddTHH:mm:ssZ form.
1639
- * duration_seconds and price are added on call.completed, reason on call.failed
1640
- * and recording_id on call.recording_ready; each is omitted rather than sent as
1641
- * null when it does not apply.
1642
- *
1643
- * Casing is snake_case because these ride the same webhook stream customers
1644
- * already parse message_id from; the question/answer contract is a separate
1645
- * surface and stays camelCase. Nothing here is provider-shaped: no provider call
1646
- * id, no namespaced identity.
1647
- */
1648
- payload?: SentDmServicesCommonServicesWebhooksContractsWebhookEventOfCallWebhookPayload.Payload | null;
1649
-
1650
- /**
1651
- * The event-specific body.
1652
- */
1653
- request_id?: string | null;
1654
-
1655
- /**
1656
- * When Sent emitted the event, in UTC (yyyy-MM-ddTHH:mm:ssZ). This is the emission
1657
- * time, not the time the underlying change happened. Use the timestamp inside the
1658
- * payload for the latter.
1659
- */
1660
- timestamp?: string;
1661
- }
1662
-
1663
- export namespace SentDmServicesCommonServicesWebhooksContractsWebhookEventOfCallWebhookPayload {
1664
- /**
1665
- * Body of a call.initiated, call.answered, call.completed, call.failed or
1666
- * call.recording_ready event. Which of them occurred is the envelope's event.
1667
- *
1668
- * Shaped like the message, inbound, template and channel payloads: account_id
1669
- * names the account the event is about, channel names the channel, and updated_at
1670
- * is when the change happened on the call, in the same yyyy-MM-ddTHH:mm:ssZ form.
1671
- * duration_seconds and price are added on call.completed, reason on call.failed
1672
- * and recording_id on call.recording_ready; each is omitted rather than sent as
1673
- * null when it does not apply.
1674
- *
1675
- * Casing is snake_case because these ride the same webhook stream customers
1676
- * already parse message_id from; the question/answer contract is a separate
1677
- * surface and stays camelCase. Nothing here is provider-shaped: no provider call
1678
- * id, no namespaced identity.
1679
- */
1680
- export interface Payload {
1681
- /**
1682
- * Sent's call id, the same one the customer saw on the first question.
1683
- */
1684
- call_id: string;
1685
-
1686
- /**
1687
- * The account the call belongs to: the key's own customer, or the sender profile
1688
- * it acted as.
1689
- */
1690
- account_id?: string;
1691
-
1692
- /**
1693
- * Always voice.
1694
- */
1695
- channel?: string;
1696
-
1697
- /**
1698
- * How long the call lasted. Only on call.completed.
1699
- */
1700
- duration_seconds?: number | null;
1701
-
1702
- /**
1703
- * The customer number that owns the call, in E.164 format.
1704
- */
1705
- number?: string;
1706
-
1707
- /**
1708
- * What the call was charged. Only on call.completed, and omitted there until
1709
- * billing has recorded the charge.
1710
- */
1711
- price?: number | null;
1712
-
1713
- /**
1714
- * The machine-readable reason the call did not complete. Only on call.failed, and
1715
- * omitted when no reason was recorded.
1716
- */
1717
- reason?: string | null;
1718
-
1719
- /**
1720
- * The recording that became available, the same id GET /v3/calls/{id}/recordings
1721
- * lists it under. Only on call.recording_ready, which is sent once per recording.
1722
- */
1723
- recording_id?: string | null;
1724
-
1725
- /**
1726
- * When the change happened on the call, as opposed to when the event was emitted.
1727
- */
1728
- updated_at?: string;
1729
- }
1730
- }
1731
1734
  }
1732
1735
 
1733
1736
  /**
@@ -2079,6 +2082,8 @@ export declare namespace Webhooks {
2079
2082
  export {
2080
2083
  type APIMeta as APIMeta,
2081
2084
  type APIResponseWebhook as APIResponseWebhook,
2085
+ type CallEvent as CallEvent,
2086
+ type CallEventPayload as CallEventPayload,
2082
2087
  type ChannelEvent as ChannelEvent,
2083
2088
  type ChannelEventPayload as ChannelEventPayload,
2084
2089
  type ContactEvent as ContactEvent,
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.41.0'; // x-release-please-version
1
+ export const VERSION = '0.43.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.41.0";
1
+ export declare const VERSION = "0.43.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.41.0";
1
+ export declare const VERSION = "0.43.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '0.41.0'; // x-release-please-version
4
+ exports.VERSION = '0.43.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.41.0'; // x-release-please-version
1
+ export const VERSION = '0.43.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map