silon-sdk 0.2.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 (151) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +560 -0
  3. package/dist/client.d.ts +141 -0
  4. package/dist/client.d.ts.map +1 -0
  5. package/dist/client.js +249 -0
  6. package/dist/client.js.map +1 -0
  7. package/dist/errors.d.ts +117 -0
  8. package/dist/errors.d.ts.map +1 -0
  9. package/dist/errors.js +199 -0
  10. package/dist/errors.js.map +1 -0
  11. package/dist/index.d.ts +51 -0
  12. package/dist/index.d.ts.map +1 -0
  13. package/dist/index.js +36 -0
  14. package/dist/index.js.map +1 -0
  15. package/dist/internal/utils.d.ts +24 -0
  16. package/dist/internal/utils.d.ts.map +1 -0
  17. package/dist/internal/utils.js +58 -0
  18. package/dist/internal/utils.js.map +1 -0
  19. package/dist/pagination.d.ts +52 -0
  20. package/dist/pagination.d.ts.map +1 -0
  21. package/dist/pagination.js +80 -0
  22. package/dist/pagination.js.map +1 -0
  23. package/dist/resources/auth.d.ts +20 -0
  24. package/dist/resources/auth.d.ts.map +1 -0
  25. package/dist/resources/auth.js +41 -0
  26. package/dist/resources/auth.js.map +1 -0
  27. package/dist/resources/broadcasts.d.ts +63 -0
  28. package/dist/resources/broadcasts.d.ts.map +1 -0
  29. package/dist/resources/broadcasts.js +103 -0
  30. package/dist/resources/broadcasts.js.map +1 -0
  31. package/dist/resources/bulk.d.ts +60 -0
  32. package/dist/resources/bulk.d.ts.map +1 -0
  33. package/dist/resources/bulk.js +137 -0
  34. package/dist/resources/bulk.js.map +1 -0
  35. package/dist/resources/client-groups.d.ts +50 -0
  36. package/dist/resources/client-groups.d.ts.map +1 -0
  37. package/dist/resources/client-groups.js +97 -0
  38. package/dist/resources/client-groups.js.map +1 -0
  39. package/dist/resources/clients.d.ts +51 -0
  40. package/dist/resources/clients.d.ts.map +1 -0
  41. package/dist/resources/clients.js +99 -0
  42. package/dist/resources/clients.js.map +1 -0
  43. package/dist/resources/events.d.ts +22 -0
  44. package/dist/resources/events.d.ts.map +1 -0
  45. package/dist/resources/events.js +38 -0
  46. package/dist/resources/events.js.map +1 -0
  47. package/dist/resources/messages.d.ts +99 -0
  48. package/dist/resources/messages.d.ts.map +1 -0
  49. package/dist/resources/messages.js +167 -0
  50. package/dist/resources/messages.js.map +1 -0
  51. package/dist/resources/otp.d.ts +26 -0
  52. package/dist/resources/otp.d.ts.map +1 -0
  53. package/dist/resources/otp.js +40 -0
  54. package/dist/resources/otp.js.map +1 -0
  55. package/dist/resources/profile.d.ts +18 -0
  56. package/dist/resources/profile.d.ts.map +1 -0
  57. package/dist/resources/profile.js +40 -0
  58. package/dist/resources/profile.js.map +1 -0
  59. package/dist/resources/push.d.ts +45 -0
  60. package/dist/resources/push.d.ts.map +1 -0
  61. package/dist/resources/push.js +103 -0
  62. package/dist/resources/push.js.map +1 -0
  63. package/dist/resources/reports.d.ts +44 -0
  64. package/dist/resources/reports.d.ts.map +1 -0
  65. package/dist/resources/reports.js +127 -0
  66. package/dist/resources/reports.js.map +1 -0
  67. package/dist/resources/suppressions.d.ts +54 -0
  68. package/dist/resources/suppressions.d.ts.map +1 -0
  69. package/dist/resources/suppressions.js +79 -0
  70. package/dist/resources/suppressions.js.map +1 -0
  71. package/dist/resources/templates.d.ts +58 -0
  72. package/dist/resources/templates.d.ts.map +1 -0
  73. package/dist/resources/templates.js +96 -0
  74. package/dist/resources/templates.js.map +1 -0
  75. package/dist/resources/webhook-endpoints.d.ts +54 -0
  76. package/dist/resources/webhook-endpoints.d.ts.map +1 -0
  77. package/dist/resources/webhook-endpoints.js +96 -0
  78. package/dist/resources/webhook-endpoints.js.map +1 -0
  79. package/dist/resources/whatsapp-templates.d.ts +20 -0
  80. package/dist/resources/whatsapp-templates.d.ts.map +1 -0
  81. package/dist/resources/whatsapp-templates.js +33 -0
  82. package/dist/resources/whatsapp-templates.js.map +1 -0
  83. package/dist/types/auth.d.ts +34 -0
  84. package/dist/types/auth.d.ts.map +1 -0
  85. package/dist/types/auth.js +8 -0
  86. package/dist/types/auth.js.map +1 -0
  87. package/dist/types/broadcasts.d.ts +174 -0
  88. package/dist/types/broadcasts.d.ts.map +1 -0
  89. package/dist/types/broadcasts.js +8 -0
  90. package/dist/types/broadcasts.js.map +1 -0
  91. package/dist/types/bulk.d.ts +161 -0
  92. package/dist/types/bulk.d.ts.map +1 -0
  93. package/dist/types/bulk.js +8 -0
  94. package/dist/types/bulk.js.map +1 -0
  95. package/dist/types/client-groups.d.ts +52 -0
  96. package/dist/types/client-groups.d.ts.map +1 -0
  97. package/dist/types/client-groups.js +8 -0
  98. package/dist/types/client-groups.js.map +1 -0
  99. package/dist/types/clients.d.ts +64 -0
  100. package/dist/types/clients.d.ts.map +1 -0
  101. package/dist/types/clients.js +8 -0
  102. package/dist/types/clients.js.map +1 -0
  103. package/dist/types/events.d.ts +64 -0
  104. package/dist/types/events.d.ts.map +1 -0
  105. package/dist/types/events.js +9 -0
  106. package/dist/types/events.js.map +1 -0
  107. package/dist/types/messages.d.ts +334 -0
  108. package/dist/types/messages.d.ts.map +1 -0
  109. package/dist/types/messages.js +8 -0
  110. package/dist/types/messages.js.map +1 -0
  111. package/dist/types/otp.d.ts +61 -0
  112. package/dist/types/otp.d.ts.map +1 -0
  113. package/dist/types/otp.js +8 -0
  114. package/dist/types/otp.js.map +1 -0
  115. package/dist/types/profile.d.ts +37 -0
  116. package/dist/types/profile.d.ts.map +1 -0
  117. package/dist/types/profile.js +8 -0
  118. package/dist/types/profile.js.map +1 -0
  119. package/dist/types/push.d.ts +90 -0
  120. package/dist/types/push.d.ts.map +1 -0
  121. package/dist/types/push.js +8 -0
  122. package/dist/types/push.js.map +1 -0
  123. package/dist/types/reports.d.ts +109 -0
  124. package/dist/types/reports.d.ts.map +1 -0
  125. package/dist/types/reports.js +8 -0
  126. package/dist/types/reports.js.map +1 -0
  127. package/dist/types/suppressions.d.ts +72 -0
  128. package/dist/types/suppressions.d.ts.map +1 -0
  129. package/dist/types/suppressions.js +8 -0
  130. package/dist/types/suppressions.js.map +1 -0
  131. package/dist/types/templates.d.ts +96 -0
  132. package/dist/types/templates.d.ts.map +1 -0
  133. package/dist/types/templates.js +9 -0
  134. package/dist/types/templates.js.map +1 -0
  135. package/dist/types/webhook-endpoints.d.ts +123 -0
  136. package/dist/types/webhook-endpoints.d.ts.map +1 -0
  137. package/dist/types/webhook-endpoints.js +8 -0
  138. package/dist/types/webhook-endpoints.js.map +1 -0
  139. package/dist/types/whatsapp-templates.d.ts +59 -0
  140. package/dist/types/whatsapp-templates.d.ts.map +1 -0
  141. package/dist/types/whatsapp-templates.js +8 -0
  142. package/dist/types/whatsapp-templates.js.map +1 -0
  143. package/dist/version.d.ts +3 -0
  144. package/dist/version.d.ts.map +1 -0
  145. package/dist/version.js +3 -0
  146. package/dist/version.js.map +1 -0
  147. package/dist/webhooks.d.ts +48 -0
  148. package/dist/webhooks.d.ts.map +1 -0
  149. package/dist/webhooks.js +97 -0
  150. package/dist/webhooks.js.map +1 -0
  151. package/package.json +60 -0
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Types for the ClientGroups (CRM) resource.
3
+ *
4
+ * Field names mirror the wire format exactly (snake_case) and date-times are
5
+ * ISO-8601 strings — this SDK performs no casing or date transformation.
6
+ */
7
+ import type { ClientProfile } from "./clients.js";
8
+ /** A CRM client group (`/api/v1/crm/group/`). */
9
+ export interface ClientGroup {
10
+ id: number;
11
+ name: string;
12
+ /** Pass as `audience.slug` with `audience.type: "client_group"`. */
13
+ slug: string;
14
+ is_active?: boolean;
15
+ /** Member profiles (read-only; write membership via `client_ids`). */
16
+ clients?: ClientProfile[];
17
+ }
18
+ /**
19
+ * Query parameters for {@link ClientGroups.listPaginated} — the canonical,
20
+ * cursor-paginated list at `GET /api/v1/crm/groups/` (newest first by id).
21
+ */
22
+ export interface ClientGroupListParams {
23
+ /** Opaque pagination cursor from a previous page. */
24
+ cursor?: string | null;
25
+ /** Page size (default 50, max 100). */
26
+ limit?: number | null;
27
+ }
28
+ /** Parameters for {@link ClientGroups.create} (`POST /api/v1/crm/groups/`). */
29
+ export interface ClientGroupCreateParams {
30
+ name: string;
31
+ slug: string;
32
+ /** Write-only: `client_id`s that make up the membership. */
33
+ client_ids?: string[] | null;
34
+ is_active?: boolean | null;
35
+ }
36
+ /** Parameters for {@link ClientGroups.update} (PATCH — partial). */
37
+ export interface ClientGroupUpdateParams {
38
+ name?: string | null;
39
+ slug?: string | null;
40
+ /** Write-only: REPLACES the whole membership when given. */
41
+ client_ids?: string[] | null;
42
+ is_active?: boolean | null;
43
+ }
44
+ /** Parameters for {@link ClientGroups.replace} (PUT — full replace). */
45
+ export interface ClientGroupReplaceParams {
46
+ name: string;
47
+ slug: string;
48
+ /** Write-only: the complete membership after the replace. */
49
+ client_ids: string[];
50
+ is_active?: boolean | null;
51
+ }
52
+ //# sourceMappingURL=client-groups.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client-groups.d.ts","sourceRoot":"","sources":["../../src/types/client-groups.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAElD,iDAAiD;AACjD,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,oEAAoE;IACpE,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,sEAAsE;IACtE,OAAO,CAAC,EAAE,aAAa,EAAE,CAAC;CAC3B;AAED;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACpC,qDAAqD;IACrD,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAEvB,uCAAuC;IACvC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB;AAED,+EAA+E;AAC/E,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,4DAA4D;IAC5D,UAAU,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAC7B,SAAS,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;CAC5B;AAED,oEAAoE;AACpE,MAAM,WAAW,uBAAuB;IACtC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,4DAA4D;IAC5D,UAAU,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAC7B,SAAS,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;CAC5B;AAED,wEAAwE;AACxE,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,6DAA6D;IAC7D,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;CAC5B"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Types for the ClientGroups (CRM) resource.
3
+ *
4
+ * Field names mirror the wire format exactly (snake_case) and date-times are
5
+ * ISO-8601 strings — this SDK performs no casing or date transformation.
6
+ */
7
+ export {};
8
+ //# sourceMappingURL=client-groups.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client-groups.js","sourceRoot":"","sources":["../../src/types/client-groups.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Types for the Clients (CRM) resource.
3
+ *
4
+ * Field names mirror the wire format exactly (snake_case) and date-times are
5
+ * ISO-8601 strings — this SDK performs no casing or date transformation.
6
+ */
7
+ /** A CRM contact (`/api/v1/crm/client/`). */
8
+ export interface ClientProfile {
9
+ /**
10
+ * Your stable identifier for this contact — the value passed as
11
+ * `to.client_id` (or inside an `audience`) when sending a message.
12
+ */
13
+ client_id: string;
14
+ first_name?: string;
15
+ last_name?: string;
16
+ email?: string;
17
+ phone_number?: string;
18
+ civil_id?: string | null;
19
+ notes?: string;
20
+ /** Preferred content language, e.g. `"en"`, `"ar"`. */
21
+ default_language?: string;
22
+ /** Channel used when a send does not specify one, e.g. `"whatsapp"`. */
23
+ default_channel?: string;
24
+ }
25
+ /** Parameters for {@link Clients.create} (`POST /api/v1/crm/client/`). */
26
+ export interface ClientCreateParams {
27
+ /** Your stable identifier for the contact. Required, immutable. */
28
+ client_id: string;
29
+ first_name?: string | null;
30
+ last_name?: string | null;
31
+ email?: string | null;
32
+ phone_number?: string | null;
33
+ civil_id?: string | null;
34
+ notes?: string | null;
35
+ default_language?: string | null;
36
+ default_channel?: string | null;
37
+ }
38
+ /**
39
+ * Query parameters for {@link Clients.listPaginated} — the canonical,
40
+ * cursor-paginated list at `GET /api/v1/crm/clients/` (newest first by
41
+ * registration date).
42
+ */
43
+ export interface ClientListParams {
44
+ /** Opaque pagination cursor from a previous page. */
45
+ cursor?: string | null;
46
+ /** Page size (default 50, max 100). */
47
+ limit?: number | null;
48
+ }
49
+ /**
50
+ * Parameters for {@link Clients.update} (PATCH — partial) and
51
+ * {@link Clients.replace} (PUT — full replace). `client_id` itself is
52
+ * immutable and never part of the body.
53
+ */
54
+ export interface ClientUpdateParams {
55
+ first_name?: string | null;
56
+ last_name?: string | null;
57
+ email?: string | null;
58
+ phone_number?: string | null;
59
+ civil_id?: string | null;
60
+ notes?: string | null;
61
+ default_language?: string | null;
62
+ default_channel?: string | null;
63
+ }
64
+ //# sourceMappingURL=clients.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clients.d.ts","sourceRoot":"","sources":["../../src/types/clients.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,6CAA6C;AAC7C,MAAM,WAAW,aAAa;IAC5B;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,C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gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACjC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Types for the Clients (CRM) resource.
3
+ *
4
+ * Field names mirror the wire format exactly (snake_case) and date-times are
5
+ * ISO-8601 strings — this SDK performs no casing or date transformation.
6
+ */
7
+ export {};
8
+ //# sourceMappingURL=clients.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clients.js","sourceRoot":"","sources":["../../src/types/clients.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Event envelope types — the exact JSON returned by the Events API and
3
+ * POSTed to subscribed webhook endpoints.
4
+ *
5
+ * Field names mirror the wire format (snake_case); date-times are ISO-8601
6
+ * strings.
7
+ */
8
+ /**
9
+ * The `data` payload carried inside an event envelope.
10
+ *
11
+ * The shape varies by the envelope's `type` — `message.delivered` /
12
+ * `message.failed` carry a settled-message snapshot, while
13
+ * `broadcast.completed` carries aggregate counts. Every field is therefore
14
+ * optional; branch on the parent envelope's `type`.
15
+ */
16
+ export interface EventData {
17
+ id?: string | null;
18
+ object?: string | null;
19
+ channel?: string | null;
20
+ recipient?: string | null;
21
+ client_id?: string | null;
22
+ status?: string | null;
23
+ error?: string | null;
24
+ broadcast_id?: string | null;
25
+ provider?: string | null;
26
+ external_id?: string | null;
27
+ /** ISO-8601 date-time string. */
28
+ sent_at?: string | null;
29
+ /** ISO-8601 date-time string. */
30
+ created_at?: string | null;
31
+ /** `false` when the underlying send ran in test mode. */
32
+ livemode?: boolean | null;
33
+ target_count?: number | null;
34
+ sent?: number | null;
35
+ failed?: number | null;
36
+ }
37
+ /** Query parameters for {@link Events.list}. */
38
+ export interface EventListParams {
39
+ /** Only return events of this type, e.g. `"message.failed"`. */
40
+ type?: string | null;
41
+ /** Opaque pagination cursor from a previous page. */
42
+ cursor?: string | null;
43
+ /** Page size. */
44
+ limit?: number | null;
45
+ }
46
+ /** An event envelope. */
47
+ export interface Event {
48
+ /** Opaque event id, `evt_` prefixed. */
49
+ id: string;
50
+ object: string;
51
+ /** `message.delivered` / `message.failed` / `broadcast.completed`. */
52
+ type: string;
53
+ /**
54
+ * `false` when the event was produced by a test-mode (`sk_test_`) send;
55
+ * `true` for live traffic. Test events deliver only to `livemode: false`
56
+ * webhook endpoints, live events only to `livemode: true` ones.
57
+ */
58
+ livemode?: boolean;
59
+ api_version?: string;
60
+ /** ISO-8601 date-time string. */
61
+ created?: string | null;
62
+ data?: EventData;
63
+ }
64
+ //# sourceMappingURL=events.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/types/events.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;;;GAOG;AACH,MAAM,WAAW,SAAS;IACxB,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,iCAAiC;IACjC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,iCAAiC;IACjC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,yDAAyD;IACzD,QAAQ,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAG1B,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB;AAED,gDAAgD;AAChD,MAAM,WAAW,eAAe;IAC9B,gEAAgE;IAChE,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,qDAAqD;IACrD,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,iBAAiB;IACjB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB;AAED,yBAAyB;AACzB,MAAM,WAAW,KAAK;IACpB,wCAAwC;IACxC,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,sEAAsE;IACtE,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iCAAiC;IACjC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Event envelope types — the exact JSON returned by the Events API and
3
+ * POSTed to subscribed webhook endpoints.
4
+ *
5
+ * Field names mirror the wire format (snake_case); date-times are ISO-8601
6
+ * strings.
7
+ */
8
+ export {};
9
+ //# sourceMappingURL=events.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events.js","sourceRoot":"","sources":["../../src/types/events.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
@@ -0,0 +1,334 @@
1
+ /**
2
+ * Types for the Messages resource.
3
+ *
4
+ * Field names mirror the wire format exactly (snake_case) and date-times are
5
+ * ISO-8601 strings — this SDK performs no casing or date transformation.
6
+ */
7
+ import type { SkippedBreakdown } from "./broadcasts.js";
8
+ /** Parameters for {@link Messages.send} (`POST /api/v1/messages/`). */
9
+ export interface MessageSendParams {
10
+ /** Delivery channel, e.g. `"sms"`, `"whatsapp"`, `"email"`, `"push"`, `"web_push"`. Required. */
11
+ channel: string;
12
+ /**
13
+ * Single recipient, e.g. `{client_id}`, `{phone_number}`, `{email}` or
14
+ * `{device_token}`. Exactly one of `to` / `audience` is required.
15
+ */
16
+ to?: Record<string, unknown> | null;
17
+ /**
18
+ * Broadcast selector, e.g. `{type: "client_group", slug}` or
19
+ * `{type: "client_ids", client_ids: [...]}`. Exactly one of `to` /
20
+ * `audience` is required.
21
+ */
22
+ audience?: Record<string, unknown> | null;
23
+ /** Message content, e.g. `{body}` or `{subject, body}` for email. */
24
+ content?: Record<string, unknown> | null;
25
+ /**
26
+ * Stored-template reference (`client.templates`), e.g.
27
+ * `{slug, context}`. Pin an older immutable revision with an optional
28
+ * `version` (int): `{slug, version: 3}` — an unknown pinned version rejects
29
+ * `422 template-version-not-found`; omit `version` to render the latest.
30
+ */
31
+ template?: Record<string, unknown> | null;
32
+ /** Provider override, e.g. `"meta_cloud"`, `"twilio"`, `"fcm"`. */
33
+ provider?: string | null;
34
+ /** Sender override (honoured only by providers that support it). */
35
+ sender?: string | null;
36
+ /** Push only: application slug the device tokens belong to. */
37
+ application?: string | null;
38
+ /** Web-widget messages: the widget key. */
39
+ widget_key?: string | null;
40
+ /** Push priority, e.g. `"high"`. */
41
+ priority?: string | null;
42
+ /** Push time-to-live, in seconds. */
43
+ ttl?: number | null;
44
+ /** WhatsApp-specific free-form options. */
45
+ whatsapp?: Record<string, unknown> | null;
46
+ /** WhatsApp template block, e.g. `{name, language, variables}`. */
47
+ whatsapp_template?: Record<string, unknown> | null;
48
+ /**
49
+ * Schedule the send: an ISO-8601 date-time string WITH a UTC offset
50
+ * (e.g. `"2026-07-15T09:00:00+03:00"`), strictly in the future and at most
51
+ * 90 days ahead — otherwise the server rejects with `422 send-at-invalid`
52
+ * (naive date-times are rejected too). The string is passed through
53
+ * verbatim (this SDK performs no date transformation — for a `Date`, call
54
+ * `.toISOString()` yourself). The envelope answers `status: "scheduled"`
55
+ * and the same `id` tracks the send through dispatch; cancel while still
56
+ * scheduled via {@link Messages.cancel}.
57
+ */
58
+ send_at?: string | null;
59
+ /**
60
+ * Transactional/legal bypass: deliver even if the recipient is on the
61
+ * suppression list (`client.suppressions`). Single-recipient sends ONLY,
62
+ * and the API key must carry the `suppressions:override` scope (in no
63
+ * default preset — granted explicitly): without it the server rejects
64
+ * `403 missing-scope`; sent alongside `audience` (or on batches /
65
+ * broadcasts) it is rejected `422 override-not-allowed`. An overridden
66
+ * send proceeds and its delivery row is flagged
67
+ * `suppression_overridden: true`.
68
+ */
69
+ override_suppression?: boolean | null;
70
+ /**
71
+ * Sent as the `Idempotency-Key` request header — NOT part of the JSON
72
+ * body. Auto-generated UUIDv4 when omitted, so retries never double-send.
73
+ */
74
+ idempotency_key?: string | null;
75
+ /**
76
+ * Extra JSON fields merged into the request body last (forward
77
+ * compatibility escape hatch) — NOT itself a wire field.
78
+ */
79
+ extra_body?: Record<string, unknown> | null;
80
+ }
81
+ /** Parameters for {@link Messages.sendBatch} (`POST /api/v1/messages/batch/`). */
82
+ export interface MessageBatchParams {
83
+ /**
84
+ * 1–500 message rows, each a free-form map with the same shape as a
85
+ * {@link Messages.send} body minus `audience` (rows are single-recipient by
86
+ * definition): `to` (required), optional `channel` (overrides the top-level
87
+ * default), `content` / `template`, `provider`, `sender`, `application`,
88
+ * `widget_key`, `priority`, `ttl`, `whatsapp`, `whatsapp_template`.
89
+ * Exactly one of `messages` / `file` is required.
90
+ */
91
+ messages?: Record<string, unknown>[] | null;
92
+ /**
93
+ * The saved server-side name of a CSV uploaded via
94
+ * `client.bulk.files.upload` (the response `name`). Rows expand
95
+ * asynchronously through the bulk pipeline; CSV columns override the
96
+ * request-level defaults per row. Exactly one of `messages` / `file` is
97
+ * required.
98
+ */
99
+ file?: string | null;
100
+ /**
101
+ * Default channel for every row that doesn't set its own, e.g. `"sms"`,
102
+ * `"email"`, `"whatsapp"`. A row's own `channel` (or CSV column) wins; one
103
+ * of the two must yield a channel for every row.
104
+ */
105
+ channel?: string | null;
106
+ /** Default message content for rows without their own, e.g. `{body}`. */
107
+ content?: Record<string, unknown> | null;
108
+ /**
109
+ * Default stored-template reference (`client.templates`), e.g.
110
+ * `{slug, context}`; pin a revision with an optional `version` (int)
111
+ * `{slug, version: 3}`. Applies to every row (or CSV column) that doesn't
112
+ * set its own.
113
+ */
114
+ template?: Record<string, unknown> | null;
115
+ /** Default provider override, e.g. `"meta_cloud"`, `"twilio"`, `"fcm"`. */
116
+ provider?: string | null;
117
+ /** Default sender override (honoured only by providers that support it). */
118
+ sender?: string | null;
119
+ /** Push only: default application slug the device tokens belong to. */
120
+ application?: string | null;
121
+ /** Web-widget messages: default widget key. */
122
+ widget_key?: string | null;
123
+ /** Default push priority, e.g. `"high"`. */
124
+ priority?: string | null;
125
+ /** Default push time-to-live, in seconds. */
126
+ ttl?: number | null;
127
+ /** Default WhatsApp-specific free-form options. */
128
+ whatsapp?: Record<string, unknown> | null;
129
+ /** Default WhatsApp template block, e.g. `{name, language, variables}`. */
130
+ whatsapp_template?: Record<string, unknown> | null;
131
+ /**
132
+ * FILE form only: schedule the batch — an ISO-8601 date-time string WITH a
133
+ * UTC offset, strictly in the future, at most 90 days ahead (otherwise
134
+ * `422 send-at-invalid`). The envelope answers `status: "scheduled"` and
135
+ * rows expand + send at dispatch time. Rejected `422 batch-invalid` with
136
+ * inline `messages` (schedule those individually via {@link Messages.send},
137
+ * which supports per-message cancel); not a row default. The string is
138
+ * passed through verbatim (no date transformation).
139
+ */
140
+ send_at?: string | null;
141
+ /**
142
+ * Sent as the `Idempotency-Key` request header — NOT part of the JSON
143
+ * body. Auto-generated UUIDv4 when omitted, so retries never double-send.
144
+ */
145
+ idempotency_key?: string | null;
146
+ /**
147
+ * Extra JSON fields merged into the request body last (forward
148
+ * compatibility escape hatch) — NOT itself a wire field.
149
+ */
150
+ extra_body?: Record<string, unknown> | null;
151
+ }
152
+ /**
153
+ * Envelope from `POST /api/v1/messages/` (202) — also returned by
154
+ * {@link Messages.cancel} (200, with `status: "canceled"`).
155
+ */
156
+ export interface MessageAccepted {
157
+ /**
158
+ * Tracking id for the message, or the broadcast id. Stable across the
159
+ * lifecycle of a scheduled send: the same id resolves before and after
160
+ * dispatch.
161
+ */
162
+ id: string;
163
+ /** `"message"` for a single recipient, `"broadcast"` for an audience fan-out. */
164
+ object: string;
165
+ channel: string;
166
+ /**
167
+ * `"queued"` — or `"scheduled"` when the request carried `send_at`
168
+ * (`"canceled"` from the cancel endpoint).
169
+ */
170
+ status: string;
171
+ /**
172
+ * `false` when the request ran in test mode (an `sk_test_` key): nothing
173
+ * reaches a provider and nothing is billed. `true` for live traffic.
174
+ */
175
+ livemode?: boolean;
176
+ /**
177
+ * Broadcast only: number of recipients targeted (null on scheduled
178
+ * broadcasts whose audience resolves at dispatch time).
179
+ */
180
+ target_count?: number | null;
181
+ /**
182
+ * Broadcast only: number of recipients skipped (suppressed, wrong channel,
183
+ * duplicates) — the sum of the {@link skipped} breakdown.
184
+ */
185
+ skipped_count?: number | null;
186
+ /**
187
+ * Broadcast only: itemised skip counts summing to `skipped_count` — null
188
+ * when `target_count` is null (scheduled audience resolves at dispatch);
189
+ * absent on servers predating the suppression feature.
190
+ */
191
+ skipped?: SkippedBreakdown | null;
192
+ }
193
+ /** One per-row message envelope inside a {@link BatchAccepted}. */
194
+ export interface BatchMessage {
195
+ /** Tracking id for this row — pollable at `GET /api/v1/messages/{id}/`. */
196
+ id: string;
197
+ /** Always `"message"`. */
198
+ object: string;
199
+ channel: string;
200
+ status: string;
201
+ }
202
+ /** 202 envelope from `POST /api/v1/messages/batch/`. */
203
+ export interface BatchAccepted {
204
+ /**
205
+ * The batch id. On the inline form, poll the per-row message ids instead
206
+ * (inline batches have no GET endpoint); on the file form this IS the bulk
207
+ * batch id — per-row status reads via `client.bulk.retrieve(id)` and the
208
+ * bulk reports.
209
+ */
210
+ id: string;
211
+ /** Always `"batch"`. */
212
+ object: string;
213
+ /**
214
+ * `false` when the batch ran in test mode (an `sk_test_` key): no row
215
+ * reaches a provider and nothing is billed. `true` for live traffic.
216
+ */
217
+ livemode?: boolean;
218
+ /**
219
+ * File form only: aggregate batch status — `"queued"`, or `"scheduled"`
220
+ * when the request carried `send_at` (expansion + send both run at
221
+ * dispatch time).
222
+ */
223
+ status?: string;
224
+ /**
225
+ * File form only: number of data rows in the CSV, present only when
226
+ * cheaply known.
227
+ */
228
+ row_count?: number | null;
229
+ /**
230
+ * Inline form only: per-row message envelopes, in request order —
231
+ * suppressed rows are omitted (skipped, never an error). Absent on the
232
+ * file form (rows expand asynchronously).
233
+ */
234
+ messages?: BatchMessage[];
235
+ /**
236
+ * Inline form only: number of rows skipped instead of queued — the sum of
237
+ * the {@link skipped} breakdown. The file form reports its skips on the
238
+ * bulk read side (`client.bulk.retrieve(id)`) once async expansion runs.
239
+ */
240
+ skipped_count?: number | null;
241
+ /**
242
+ * Inline form only: itemised skip counts summing to `skipped_count`;
243
+ * absent on the file form and on servers predating the suppression
244
+ * feature.
245
+ */
246
+ skipped?: SkippedBreakdown | null;
247
+ }
248
+ /** One recipient row inside a message-status batch. */
249
+ export interface MessageStatusItem {
250
+ client_id?: string;
251
+ phone_number?: string;
252
+ email?: string;
253
+ is_read?: boolean;
254
+ read_count?: number;
255
+ /**
256
+ * `true` when the send bypassed a matching suppression via
257
+ * `override_suppression` (see {@link MessageSendParams}).
258
+ */
259
+ suppression_overridden?: boolean | null;
260
+ }
261
+ /**
262
+ * One attested status transition in a message's {@link MessageStatus.timeline}.
263
+ */
264
+ export interface MessageTimelineEntry {
265
+ /**
266
+ * The transition's status. Adds `"delivered"` to the aggregate vocabulary:
267
+ * `"scheduled"`, `"queued"`, `"sent"`, `"delivered"`, `"failed"` or
268
+ * `"canceled"`. `"delivered"` is per-recipient granularity and appears ONLY
269
+ * in the timeline (never as the top-level {@link MessageStatus.status}),
270
+ * only on single-recipient sends whose channel reports receipts.
271
+ */
272
+ status: string;
273
+ /** ISO-8601 date-time the transition was attested at. */
274
+ at: string;
275
+ /** The provider that attested it, when known. */
276
+ provider?: string | null;
277
+ }
278
+ /**
279
+ * Body of `GET /api/v1/messages/{event_id}/`.
280
+ *
281
+ * Prefer the modern keys (`id`, `object`, `channel`, `timeline`). The legacy
282
+ * keys (`event_id`, `is_sent`, `messages`) remain populated but are
283
+ * DEPRECATED — see each field.
284
+ */
285
+ export interface MessageStatus {
286
+ /**
287
+ * Tracking id — the same value as the path id (and the create envelope's
288
+ * `id`). Stable across a scheduled send's lifecycle.
289
+ */
290
+ id: string;
291
+ /** Always `"message"`. */
292
+ object: string;
293
+ /**
294
+ * The resolved channel, or `null` when the delivery rows don't agree on
295
+ * one.
296
+ */
297
+ channel: string | null;
298
+ /**
299
+ * Ordered status transitions (ASCENDING by `at`). A scheduled send answers
300
+ * `[{status: "scheduled", at}]` until dispatch; the timeline's status
301
+ * vocabulary adds the per-recipient `"delivered"` (see
302
+ * {@link MessageTimelineEntry}).
303
+ */
304
+ timeline: MessageTimelineEntry[];
305
+ /**
306
+ * `false` when the send ran in test mode (an `sk_test_` key) — its status
307
+ * transitions are simulated.
308
+ */
309
+ livemode?: boolean;
310
+ /**
311
+ * Aggregate lifecycle status: `"scheduled"` (created with `send_at`, not
312
+ * yet dispatched), `"queued"`, `"sent"`, `"failed"`, or `"canceled"` after
313
+ * a successful {@link Messages.cancel}. Never `"delivered"` (that appears
314
+ * only in the {@link timeline}).
315
+ */
316
+ status?: string;
317
+ /** Scheduled sends only: ISO-8601 date-time the send will dispatch at. */
318
+ send_at?: string | null;
319
+ /**
320
+ * @deprecated Alias of {@link id} — prefer `id`. Kept for back-compat.
321
+ */
322
+ event_id: string;
323
+ /**
324
+ * @deprecated Prefer {@link status} / {@link timeline}. Kept for back-compat.
325
+ */
326
+ is_sent: boolean;
327
+ /**
328
+ * @deprecated Per-recipient delivery rows — prefer {@link timeline}. Kept
329
+ * for back-compat; empty while the send is still `"scheduled"` (or was
330
+ * `"canceled"`).
331
+ */
332
+ messages?: MessageStatusItem[];
333
+ }
334
+ //# sourceMappingURL=messages.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/types/messages.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAExD,uEAAuE;AACvE,MAAM,WAAW,iBAAiB;IAChC,iGAAiG;IACjG,OAAO,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAEpC;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAE1C,qEAAqE;IACrE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAEzC;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAE1C,mEAAmE;IACnE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAEzB,oEAAoE;IACpE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAEvB,+DAA+D;IAC/D,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE5B,2CAA2C;IAC3C,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE3B,oCAAoC;IACpC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAEzB,qCAAqC;IACrC,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAEpB,2CAA2C;IAC3C,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAE1C,mEAAmE;IACnE,iBAAiB,CAAC,EAAE,MAAM,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AAO,EAAE,OAAO,CAAC;IACjB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,iBAAiB,EAAE,CAAC;CAChC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Types for the Messages resource.
3
+ *
4
+ * Field names mirror the wire format exactly (snake_case) and date-times are
5
+ * ISO-8601 strings — this SDK performs no casing or date transformation.
6
+ */
7
+ export {};
8
+ //# sourceMappingURL=messages.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"messages.js","sourceRoot":"","sources":["../../src/types/messages.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Types for the OTP resource.
3
+ *
4
+ * Field names mirror the wire format exactly (snake_case) and date-times are
5
+ * ISO-8601 strings — this SDK performs no casing or date transformation.
6
+ */
7
+ /** Parameters for {@link Otp.send} (`POST /api/v1/otp/send/`). */
8
+ export interface OtpSendParams {
9
+ /** Configured OTP purpose slug, e.g. `"login"` — decides the channel. */
10
+ purpose: string;
11
+ /**
12
+ * Recipient — exactly one of `client_id` / `phone_number` / `email`
13
+ * (validated server-side).
14
+ */
15
+ to: Record<string, unknown>;
16
+ /**
17
+ * Sent as the `Idempotency-Key` request header — NOT part of the JSON
18
+ * body. Auto-generated UUIDv4 when omitted, so retries never double-send.
19
+ */
20
+ idempotency_key?: string | null;
21
+ }
22
+ /** 202 body of `POST /api/v1/otp/send/`. */
23
+ export interface OtpSendResult {
24
+ /** Opaque id for this OTP; pass it back to {@link Otp.verify}. */
25
+ otp_id: string;
26
+ /**
27
+ * ISO-8601 date-time string. Verifying after this rejects with
28
+ * {@link GoneError} (410).
29
+ */
30
+ expires_at: string;
31
+ /** Channel the code was dispatched over (decided by the purpose). */
32
+ channel: string;
33
+ /**
34
+ * `false` when the OTP was issued by a test-mode (`sk_test_`) request —
35
+ * never dispatched; the magic code `"000000"` verifies.
36
+ */
37
+ livemode?: boolean;
38
+ task_ids?: string[];
39
+ }
40
+ /** Parameters for {@link Otp.verify} (`POST /api/v1/otp/verify/`). */
41
+ export interface OtpVerifyParams {
42
+ /** The `otp_id` returned by {@link Otp.send}. */
43
+ otp_id: string;
44
+ /** The code the user entered (sent verbatim). */
45
+ code: string;
46
+ }
47
+ /**
48
+ * 200 body of `POST /api/v1/otp/verify/`.
49
+ *
50
+ * A wrong code rejects with {@link BadRequestError} whose `.body` carries
51
+ * `{"verified": false, "remaining_attempts": N}`.
52
+ */
53
+ export interface OtpVerifyResult {
54
+ verified: boolean;
55
+ purpose: string;
56
+ /** `false` when the OTP was issued by a test-mode (`sk_test_`) request. */
57
+ livemode?: boolean;
58
+ /** ISO-8601 date-time string. */
59
+ verified_at: string;
60
+ }
61
+ //# sourceMappingURL=otp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"otp.d.ts","sourceRoot":"","sources":["../../src/types/otp.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,kEAAkE;AAClE,MAAM,WAAW,aAAa;IAC5B,yEAAyE;IACzE,OAAO,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,EAAE,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAE5B;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACjC;AAED,4CAA4C;AAC5C,MAAM,WAAW,aAAa;IAC5B,kEAAkE;IAClE,MAAM,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB,qEAAqE;IACrE,OAAO,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB;AAED,sEAAsE;AACtE,MAAM,WAAW,eAAe;IAC9B,iDAAiD;IACjD,MAAM,EAAE,MAAM,CAAC;IACf,iDAAiD;IACjD,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,2EAA2E;IAC3E,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,iCAAiC;IACjC,WAAW,EAAE,MAAM,CAAC;CACrB"}