samva 0.5.0 → 0.6.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 (63) hide show
  1. package/AGENTS.md +3 -2
  2. package/README.md +12 -2
  3. package/dist/{categories-B9Nw2v_F.js → categories-4u9Az4No.js} +24 -8
  4. package/dist/client/sdk.gen.d.ts +406 -74
  5. package/dist/client/types.gen.d.ts +2583 -279
  6. package/dist/{client-B7gEkvEq.js → client-DCM6U0-I.js} +2183 -772
  7. package/dist/{client-attribution-B2yJBXdZ.js → client-attribution-DYUSAa76.js} +2 -2
  8. package/dist/effect/analytics.d.ts +66 -0
  9. package/dist/effect/analytics.js +21 -0
  10. package/dist/effect/api-keys.d.ts +198 -34
  11. package/dist/effect/api-keys.js +1 -1
  12. package/dist/effect/attachments.d.ts +53 -0
  13. package/dist/effect/attachments.js +17 -0
  14. package/dist/effect/campaigns.d.ts +36 -18
  15. package/dist/effect/campaigns.js +1 -1
  16. package/dist/effect/categories.d.ts +3 -3
  17. package/dist/effect/categories.js +1 -1
  18. package/dist/effect/client.js +1 -1
  19. package/dist/effect/contact-groups.d.ts +375 -0
  20. package/dist/effect/contact-groups.js +29 -0
  21. package/dist/effect/contacts.d.ts +35 -19
  22. package/dist/effect/contacts.js +1 -1
  23. package/dist/effect/conversations.d.ts +179 -47
  24. package/dist/effect/conversations.js +1 -1
  25. package/dist/effect/custom-fields.d.ts +111 -0
  26. package/dist/effect/custom-fields.js +17 -0
  27. package/dist/effect/design.d.ts +2 -2
  28. package/dist/effect/design.js +1 -1
  29. package/dist/effect/email.d.ts +254 -118
  30. package/dist/effect/email.js +2 -2
  31. package/dist/effect/generated-metadata.d.ts +12 -4
  32. package/dist/effect/generated.d.ts +11189 -6155
  33. package/dist/effect/index.d.ts +6 -1
  34. package/dist/effect/index.js +8 -3
  35. package/dist/effect/internal/operation.d.ts +115 -27
  36. package/dist/effect/media.d.ts +5 -5
  37. package/dist/effect/media.js +1 -1
  38. package/dist/effect/messages.d.ts +303 -73
  39. package/dist/effect/messages.js +1 -1
  40. package/dist/effect/operations.d.ts +6 -6
  41. package/dist/effect/operations.js +1 -1
  42. package/dist/effect/organizations.d.ts +7 -110
  43. package/dist/effect/organizations.js +2 -4
  44. package/dist/effect/retry.js +1 -1
  45. package/dist/effect/scheduled-messages.d.ts +7 -7
  46. package/dist/effect/scheduled-messages.js +1 -1
  47. package/dist/effect/templates.d.ts +35 -307
  48. package/dist/effect/templates.js +3 -5
  49. package/dist/effect/unsubscribe-groups.d.ts +161 -0
  50. package/dist/effect/unsubscribe-groups.js +25 -0
  51. package/dist/effect/webhooks.d.ts +18 -18
  52. package/dist/effect/webhooks.js +2 -2
  53. package/dist/index.js +2 -2
  54. package/dist/{normalize-BiIJnycv.js → normalize-B79uJIeb.js} +13 -14
  55. package/dist/normalize.d.ts +3 -7
  56. package/dist/{operation-B4FjN6wq.js → operation-02YX3hY9.js} +96 -8
  57. package/dist/promises/errors.gen.d.ts +30 -41
  58. package/dist/promises/index.d.ts +18 -4
  59. package/dist/promises/index.js +2 -2
  60. package/dist/promises/types.gen.d.ts +1 -1
  61. package/dist/{promises-CP_nxUus.js → promises-8MaPNAam.js} +1209 -288
  62. package/dist/service-map.d.ts +155 -8
  63. package/package.json +28 -8
@@ -1,5 +1,5 @@
1
- import { n as clientAttribution, t as CLIENT_ATTRIBUTION_HEADER } from "./client-attribution-B2yJBXdZ.js";
2
- import { n as buildMessagesSendPayload, r as replyToEmailsPayload, t as buildEmailSendPayload } from "./normalize-BiIJnycv.js";
1
+ import { n as clientAttribution, t as CLIENT_ATTRIBUTION_HEADER } from "./client-attribution-DYUSAa76.js";
2
+ import { n as buildMessagesSendPayload, r as replyToEmailsPayload, t as buildEmailSendPayload } from "./normalize-B79uJIeb.js";
3
3
  //#region src/client/core/bodySerializer.gen.ts
4
4
  const jsonBodySerializer = { bodySerializer: (body) => JSON.stringify(body, (_key, value) => typeof value === "bigint" ? value.toString() : value) };
5
5
  //#endregion
@@ -678,7 +678,7 @@ var Messages = class {
678
678
  /**
679
679
  * List messages
680
680
  *
681
- * Returns a paginated list of messages, with optional filters for channel, direction, status, conversation, contact, and date range.
681
+ * Returns a paginated list of messages, with optional filters for channel, direction, status, conversation, contact, sender address, and date range.
682
682
  */
683
683
  static list(parameters, options) {
684
684
  const params = buildClientParams([parameters], [{ args: [
@@ -710,6 +710,10 @@ var Messages = class {
710
710
  in: "query",
711
711
  key: "contactId"
712
712
  },
713
+ {
714
+ in: "query",
715
+ key: "from"
716
+ },
713
717
  {
714
718
  in: "query",
715
719
  key: "startDate"
@@ -732,7 +736,7 @@ var Messages = class {
732
736
  /**
733
737
  * Send a message
734
738
  *
735
- * Sends a message on the requested channel and returns the created message with a 201 Created status. `channel` selects the payload variant. Repeating an identical request with the same optional `Idempotency-Key` header returns the original message; reusing the key for different content returns a conflict.
739
+ * Sends a message on the requested channel and returns the created message with a 201 Created status. Requires `messages:create` or the send permission of the channel it sends on, such as `email:send`. `channel` selects the payload variant. Repeating an identical request with the same optional `Idempotency-Key` header returns the original message; reusing the key for different content returns a conflict.
736
740
  */
737
741
  static send(parameters, options) {
738
742
  const params = buildClientParams([parameters], [{ args: [{
@@ -830,7 +834,7 @@ var Messages = class {
830
834
  /**
831
835
  * Validate an email message
832
836
  *
833
- * Resolves recipients, sender, and inline or published-template content without creating contacts, messages, billing reservations, quota draws, queue work, or provider calls.
837
+ * Resolves recipients, sender, and inline or published-template content without sending anything, creating contacts or messages, or counting toward your quota.
834
838
  */
835
839
  static validateEmail(parameters, options) {
836
840
  const params = buildClientParams([parameters], [{ args: [
@@ -927,7 +931,7 @@ var Operations = class {
927
931
  /**
928
932
  * List asynchronous operations
929
933
  *
930
- * Lists durable asynchronous operation state for the active organization.
934
+ * Lists asynchronous operations for the active organization.
931
935
  */
932
936
  static list(parameters, options) {
933
937
  const params = buildClientParams([parameters], [{ args: [
@@ -961,7 +965,7 @@ var Operations = class {
961
965
  /**
962
966
  * Get an asynchronous operation
963
967
  *
964
- * Returns one durable asynchronous operation from the active organization.
968
+ * Returns one asynchronous operation from the active organization.
965
969
  */
966
970
  static get(parameters, options) {
967
971
  const params = buildClientParams([parameters], [{ args: [{
@@ -981,7 +985,7 @@ var Operations = class {
981
985
  /**
982
986
  * Retry an asynchronous operation
983
987
  *
984
- * Retries the same durable execution identity when its failure is explicitly retryable. Retrying a workspace deletion additionally requires `organization:delete`.
988
+ * Retries a failed operation in place when its error is retryable. Retrying an organization deletion additionally requires `organization:delete`.
985
989
  */
986
990
  static retry(parameters, options) {
987
991
  const params = buildClientParams([parameters], [{ args: [{
@@ -1033,7 +1037,7 @@ var ScheduledMessages = class {
1033
1037
  /**
1034
1038
  * Schedule a message
1035
1039
  *
1036
- * Schedules a message for dispatch at the absolute ISO-8601 timestamp supplied in scheduledFor. Optional timezone is validated IANA display metadata only and never changes the execution instant.
1040
+ * Schedules a message for dispatch at the absolute ISO-8601 timestamp supplied in scheduledFor. Requires `messages:create` or the send permission of the channel it sends on, such as `email:send`. Optional timezone is validated IANA display metadata only and never changes the execution instant.
1037
1041
  */
1038
1042
  static create(parameters, options) {
1039
1043
  const params = buildClientParams([parameters], [{ args: [
@@ -1146,7 +1150,7 @@ var Campaigns = class {
1146
1150
  /**
1147
1151
  * List campaigns
1148
1152
  *
1149
- * Returns a paginated list of the organization's campaigns, optionally filtered by status.
1153
+ * Returns a paginated list of the organization's campaigns, optionally filtered by status. Each row carries `series`, the last 14 days of daily email sends the campaign produced, oldest first.
1150
1154
  */
1151
1155
  static list(parameters, options) {
1152
1156
  const params = buildClientParams([parameters], [{ args: [
@@ -1440,7 +1444,7 @@ var Campaigns = class {
1440
1444
  /**
1441
1445
  * Cancel a campaign run
1442
1446
  *
1443
- * Best-effort cancellation: pending recipients are skipped, while already claimed or provider-submitted deliveries may finish. Returns the updated run.
1447
+ * Best-effort cancellation: pending recipients are skipped, while deliveries already handed off for sending may finish. Returns the updated run.
1444
1448
  */
1445
1449
  static cancelRun(parameters, options) {
1446
1450
  const params = buildClientParams([parameters], [{ args: [{
@@ -1503,7 +1507,7 @@ var Email = class {
1503
1507
  /**
1504
1508
  * Get email onboarding review status
1505
1509
  *
1506
- * Returns the customer-safe workspace review decision, workflow stage, next action, and current sending-identity clearances. A missing authority row is returned as a blocked initial state.
1510
+ * Returns the customer-safe organization review decision, workflow stage, next action, and current sending-identity clearances. An organization that has not been reviewed yet is returned in the blocked initial state.
1507
1511
  */
1508
1512
  static getOnboardingReview(options) {
1509
1513
  return (options?.client ?? client).get({
@@ -1518,7 +1522,7 @@ var Email = class {
1518
1522
  /**
1519
1523
  * Reapply for email onboarding review
1520
1524
  *
1521
- * Allows a workspace owner or admin to submit a rejected workspace for review again. The expected generation prevents acting on stale status.
1525
+ * Allows an organization owner or admin to submit a rejected organization for review again. The expected generation prevents acting on stale status.
1522
1526
  */
1523
1527
  static reapplyOnboardingReview(parameters, options) {
1524
1528
  const params = buildClientParams([parameters], [{ args: [{
@@ -1543,7 +1547,7 @@ var Email = class {
1543
1547
  /**
1544
1548
  * Respond to an email onboarding information request
1545
1549
  *
1546
- * Allows workspace owners and admins to submit bounded text and up to three pending-scanned evidence uploads for the current review generation.
1550
+ * Allows organization owners and admins to submit a text response and up to three evidence uploads for the current information request.
1547
1551
  */
1548
1552
  static respondToOnboardingInformationRequest(parameters, options) {
1549
1553
  const params = buildClientParams([parameters], [{ args: [
@@ -1578,7 +1582,7 @@ var Email = class {
1578
1582
  /**
1579
1583
  * Get email tracking defaults
1580
1584
  *
1581
- * Returns the workspace's independent defaults for open and click tracking, both enabled unless configured otherwise. Recipient opt-out takes precedence over these defaults.
1585
+ * Returns the organization's independent defaults for open and click tracking, both enabled unless configured otherwise. Recipient opt-out takes precedence over these defaults.
1582
1586
  */
1583
1587
  static getTrackingDefaults(options) {
1584
1588
  return (options?.client ?? client).get({
@@ -1669,7 +1673,7 @@ var Email = class {
1669
1673
  /**
1670
1674
  * List sending domains
1671
1675
  *
1672
- * Returns a paginated list of the organization's sending domains.
1676
+ * Returns a paginated list of the organization's sending domains. Each row carries `deliverability` (bounce and complaint rates over the last 24 hours, the window the 5% bounce limit is enforced over) and `series`, the last 14 days of daily email sends attributed to the domain, oldest first.
1673
1677
  */
1674
1678
  static listDomains(parameters, options) {
1675
1679
  const params = buildClientParams([parameters], [{ args: [{
@@ -1692,7 +1696,7 @@ var Email = class {
1692
1696
  /**
1693
1697
  * Add a sending domain
1694
1698
  *
1695
- * Registers a domain for sending and returns it with the DNS records required to verify ownership and configure DKIM. Responds with 201. Supplying a connection attaches the domain to that DNS account; the domain must sit inside the zone given with it.
1699
+ * Registers a domain for sending and returns it with the DNS records required to verify ownership and configure DKIM. Responds with 201. Supplying a connection attaches the domain to that DNS account; the domain must sit inside the zone given with it. When Samva cannot register another sending domain right now, this responds with 429 and no domain is created.
1696
1700
  */
1697
1701
  static addDomain(parameters, options) {
1698
1702
  const params = buildClientParams([parameters], [{ args: [{
@@ -1720,7 +1724,7 @@ var Email = class {
1720
1724
  /**
1721
1725
  * Get domain verification
1722
1726
  *
1723
- * Returns the stored DNS and provider lifecycle snapshot without calling a provider or mutating state.
1727
+ * Returns the domain's last observed DNS and verification state. Reading it does not check DNS again or change anything; use advance to check now.
1724
1728
  */
1725
1729
  static getDomainVerification(parameters, options) {
1726
1730
  const params = buildClientParams([parameters], [{ args: [{
@@ -1740,7 +1744,7 @@ var Email = class {
1740
1744
  /**
1741
1745
  * Advance domain verification
1742
1746
  *
1743
- * Observes the required DNS records and, once they match, idempotently starts provider provisioning for the staged domain.
1747
+ * Checks the required DNS records now and, once they all match, moves the domain toward verified. Safe to call repeatedly.
1744
1748
  */
1745
1749
  static advanceDomainVerification(parameters, options) {
1746
1750
  const params = buildClientParams([parameters], [{ args: [{
@@ -1760,7 +1764,7 @@ var Email = class {
1760
1764
  /**
1761
1765
  * Stage a DKIM selector rotation
1762
1766
  *
1763
- * Creates encrypted signing custody and returns a new public DKIM record. Publish it, then advance domain verification to cut over. Retain the former record until separately approved retirement.
1767
+ * Creates a new DKIM signing key and returns its public DKIM record. Publish it, then advance domain verification to switch signing to the new key. Keep the former record published at least until `minimumRetainUntil`.
1764
1768
  */
1765
1769
  static rotateDomainDkim(parameters, options) {
1766
1770
  const params = buildClientParams([parameters], [{ args: [{
@@ -1902,7 +1906,7 @@ var Email = class {
1902
1906
  /**
1903
1907
  * Complete a one-click DNS return
1904
1908
  *
1905
- * Consumes the Domain Connect provider's redirect. Validates the signed state and, when the records were applied, kicks verification. Returns applied, cancelled (the customer declined), or invalid (state failed validation).
1909
+ * Consumes the Domain Connect provider's redirect. Validates the signed state and, when the DNS provider reports success, starts checking the domain's records. A DNS provider error is reported separately from a customer cancelling setup.
1906
1910
  */
1907
1911
  static completeDomainConnect(parameters, options) {
1908
1912
  const params = buildClientParams([parameters], [{ args: [
@@ -1917,6 +1921,10 @@ var Email = class {
1917
1921
  {
1918
1922
  in: "body",
1919
1923
  key: "error"
1924
+ },
1925
+ {
1926
+ in: "body",
1927
+ key: "errorDescription"
1920
1928
  }
1921
1929
  ] }]);
1922
1930
  return (options?.client ?? client).post({
@@ -1937,7 +1945,7 @@ var Email = class {
1937
1945
  /**
1938
1946
  * Enable inbound email for a domain
1939
1947
  *
1940
- * Enables inbound receiving for a verified domain by creating a receipt rule, and returns the rule name and its recipient addresses. Set `catchAll` to route every address on the domain; that requires a webhook endpoint, supplied as `endpointId` or already configured on the domain.
1948
+ * Enables inbound receiving for a verified domain and returns the recipient addresses it accepts. Set `catchAll` to route every address on the domain; that requires a webhook endpoint, supplied as `endpointId` or already configured on the domain.
1941
1949
  */
1942
1950
  static enableReceiving(parameters, options) {
1943
1951
  const params = buildClientParams([parameters], [{ args: [
@@ -2135,7 +2143,7 @@ var Email = class {
2135
2143
  /**
2136
2144
  * Enable a custom tracking domain
2137
2145
  *
2138
- * Provisions a custom tracking domain (default label `track`) for a verified sending domain so open/click links redirect through the customer's own subdomain. Requires the custom_tracking_domain entitlement. Returns the resulting state including the two DNS records the customer must create.
2146
+ * Provisions a custom tracking domain (default label `track`) for a verified sending domain so open/click links redirect through the customer's own subdomain. Requires a plan that includes custom tracking domains. Returns the resulting state including the two DNS records the customer must create.
2139
2147
  */
2140
2148
  static enableCustomTracking(parameters, options) {
2141
2149
  const params = buildClientParams([parameters], [{ args: [{
@@ -2183,7 +2191,7 @@ var Email = class {
2183
2191
  /**
2184
2192
  * Build an automatic Custom Tracking Domain apply URL
2185
2193
  *
2186
- * Builds the signed Domain Connect URL for the current customer-selected tracking host. The server derives the host and Cloudflare DCV UUID; exact manual CNAME records remain available.
2194
+ * Builds the signed Domain Connect URL for the current customer-selected tracking host. Samva fills in the host and the certificate validation record; the manual CNAME records remain available.
2187
2195
  */
2188
2196
  static buildCustomTrackingDomainConnectApplyUrl(parameters, options) {
2189
2197
  const params = buildClientParams([parameters], [{ args: [{
@@ -2203,7 +2211,7 @@ var Email = class {
2203
2211
  /**
2204
2212
  * Complete an automatic Custom Tracking Domain return
2205
2213
  *
2206
- * Validates the purpose- and revision-bound registrar state, then re-kicks the existing readiness reconciliation. The callback never declares the host ready or changes email tracking selection.
2214
+ * Validates the signed state returned by the DNS provider, then checks the tracking host again. Returning here never marks the host ready or changes which tracking host email uses.
2207
2215
  */
2208
2216
  static completeCustomTrackingDomainConnect(parameters, options) {
2209
2217
  const params = buildClientParams([parameters], [{ args: [
@@ -2218,6 +2226,10 @@ var Email = class {
2218
2226
  {
2219
2227
  in: "body",
2220
2228
  key: "error"
2229
+ },
2230
+ {
2231
+ in: "body",
2232
+ key: "errorDescription"
2221
2233
  }
2222
2234
  ] }]);
2223
2235
  return (options?.client ?? client).post({
@@ -2238,7 +2250,7 @@ var Email = class {
2238
2250
  /**
2239
2251
  * List sender identities
2240
2252
  *
2241
- * Returns a paginated list of sender identities, optionally filtered by verification status, active state, or default flag.
2253
+ * Returns a paginated list of sender identities, optionally filtered by verification status, active state, or default flag. Each row carries `deliverability` (bounce and complaint rates over the last 24 hours) and `series`, the last 14 days of daily email sends from the address, oldest first.
2242
2254
  */
2243
2255
  static listSenders(parameters, options) {
2244
2256
  const params = buildClientParams([parameters], [{ args: [
@@ -2276,7 +2288,7 @@ var Email = class {
2276
2288
  /**
2277
2289
  * Add a sender identity
2278
2290
  *
2279
- * Durably creates a sender identity. The required Idempotency-Key replays the original sender for an identical request and conflicts when reused with different input.
2291
+ * Creates a sender identity. The required Idempotency-Key replays the original sender for an identical request and conflicts when reused with different input.
2280
2292
  */
2281
2293
  static addSender(parameters, options) {
2282
2294
  const params = buildClientParams([parameters], [{ args: [
@@ -2339,7 +2351,7 @@ var Email = class {
2339
2351
  /**
2340
2352
  * Remove a sender identity
2341
2353
  *
2342
- * Accepts sender removal, marks it inactive, and retains its deleting lifecycle until provider identity and association cleanup is confirmed.
2354
+ * Accepts sender removal and marks the sender inactive. It reports the `deleting` lifecycle until removal finishes.
2343
2355
  */
2344
2356
  static removeSender(parameters, options) {
2345
2357
  const params = buildClientParams([parameters], [{ args: [{
@@ -2422,7 +2434,7 @@ var Email = class {
2422
2434
  /**
2423
2435
  * Enable catch-all receiving
2424
2436
  *
2425
- * Enables catch-all inbound receiving for a domain by creating a receipt rule, and returns the rule name. `endpointId` is one of the organization's webhook endpoints; every address on the domain delivers `message.received` to it. Responds with 201.
2437
+ * Enables catch-all inbound receiving for a domain. `endpointId` is one of the organization's webhook endpoints; every address on the domain delivers `message.received` to it. Responds with 201.
2426
2438
  */
2427
2439
  static enableCatchAll(parameters, options) {
2428
2440
  const params = buildClientParams([parameters], [{ args: [{
@@ -2553,7 +2565,7 @@ var Email = class {
2553
2565
  /**
2554
2566
  * List suppressed addresses
2555
2567
  *
2556
- * Returns the addresses this workspace will not send to, newest first, optionally filtered by suppression type, active or expired state, and an address substring, with limit and offset paging.
2568
+ * Returns the addresses this organization will not send to, newest first, optionally filtered by suppression type, active or expired state, and an address substring, with limit and offset paging.
2557
2569
  */
2558
2570
  static listSuppressions(parameters, options) {
2559
2571
  const params = buildClientParams([parameters], [{ args: [
@@ -2591,7 +2603,7 @@ var Email = class {
2591
2603
  /**
2592
2604
  * Remove a suppressed address
2593
2605
  *
2594
- * Deletes a suppression so this workspace can send to the address again. When the engine mirrored the address into the sending provider's suppression list, that entry is lifted first, and the deletion fails rather than reporting success if the provider refuses, so the operation stays retryable. The provider entry is left in place when another workspace still reports the same address as bouncing or complaining, because that list is shared with every workspace; the response does not say which case applied. Deliverability caveat: a bounce or complaint suppression records a real delivery failure, and sending to the address again risks the reputation damage the suppression prevented.
2606
+ * Deletes a suppression so this organization can send to the address again. If the deletion cannot complete, it fails rather than reporting success, and it is safe to retry. Deliverability caveat: a bounce or complaint suppression records a real delivery failure, and sending to the address again risks the reputation damage the suppression prevented.
2595
2607
  */
2596
2608
  static removeSuppression(parameters, options) {
2597
2609
  const params = buildClientParams([parameters], [{ args: [{
@@ -3233,7 +3245,7 @@ var Email = class {
3233
3245
  /**
3234
3246
  * Complete domain warming
3235
3247
  *
3236
- * Ends the policy. Campaign runs from the domain are no longer gated by warming windows; the workspace safeguards still apply.
3248
+ * Ends the policy. Campaign runs from the domain are no longer gated by warming windows; the organization safeguards still apply.
3237
3249
  */
3238
3250
  static completeDomainWarming(parameters, options) {
3239
3251
  const params = buildClientParams([parameters], [{ args: [{
@@ -3384,6 +3396,91 @@ var Media = class {
3384
3396
  });
3385
3397
  }
3386
3398
  };
3399
+ var Attachments = class {
3400
+ /**
3401
+ * Delete an attachment
3402
+ *
3403
+ * Deletes an attachment and returns the deleted attachment's ID.
3404
+ */
3405
+ static remove(parameters, options) {
3406
+ const params = buildClientParams([parameters], [{ args: [{
3407
+ in: "path",
3408
+ key: "id"
3409
+ }] }]);
3410
+ return (options?.client ?? client).delete({
3411
+ security: [{
3412
+ name: "x-api-key",
3413
+ type: "apiKey"
3414
+ }],
3415
+ url: "/v1/attachments/{id}",
3416
+ ...options,
3417
+ ...params
3418
+ });
3419
+ }
3420
+ /**
3421
+ * Get an attachment
3422
+ *
3423
+ * Returns metadata for a single attachment, including filename, content type, and size.
3424
+ */
3425
+ static getById(parameters, options) {
3426
+ const params = buildClientParams([parameters], [{ args: [{
3427
+ in: "path",
3428
+ key: "id"
3429
+ }] }]);
3430
+ return (options?.client ?? client).get({
3431
+ security: [{
3432
+ name: "x-api-key",
3433
+ type: "apiKey"
3434
+ }],
3435
+ url: "/v1/attachments/{id}",
3436
+ ...options,
3437
+ ...params
3438
+ });
3439
+ }
3440
+ /**
3441
+ * List message attachments
3442
+ *
3443
+ * Returns all attachments for the given message, along with a total count.
3444
+ */
3445
+ static list(parameters, options) {
3446
+ const params = buildClientParams([parameters], [{ args: [{
3447
+ in: "query",
3448
+ key: "messageId"
3449
+ }] }]);
3450
+ return (options?.client ?? client).get({
3451
+ security: [{
3452
+ name: "x-api-key",
3453
+ type: "apiKey"
3454
+ }],
3455
+ url: "/v1/attachments",
3456
+ ...options,
3457
+ ...params
3458
+ });
3459
+ }
3460
+ /**
3461
+ * Get an attachment download URL
3462
+ *
3463
+ * Generates a presigned, time-limited download URL for the attachment; expiry is configurable via the expiresIn query parameter.
3464
+ */
3465
+ static downloadUrl(parameters, options) {
3466
+ const params = buildClientParams([parameters], [{ args: [{
3467
+ in: "path",
3468
+ key: "id"
3469
+ }, {
3470
+ in: "query",
3471
+ key: "expiresIn"
3472
+ }] }]);
3473
+ return (options?.client ?? client).get({
3474
+ security: [{
3475
+ name: "x-api-key",
3476
+ type: "apiKey"
3477
+ }],
3478
+ url: "/v1/attachments/{id}/download-url",
3479
+ ...options,
3480
+ ...params
3481
+ });
3482
+ }
3483
+ };
3387
3484
  var Conversations = class {
3388
3485
  /**
3389
3486
  * List conversations
@@ -3889,7 +3986,7 @@ var Contacts = class {
3889
3986
  /**
3890
3987
  * Find a contact
3891
3988
  *
3892
- * Samva API operation.
3989
+ * Looks up a single contact by email address or external ID and returns null when no contact matches.
3893
3990
  */
3894
3991
  static find(parameters, options) {
3895
3992
  const params = buildClientParams([parameters], [{ args: [
@@ -4329,11 +4426,11 @@ var Contacts = class {
4329
4426
  });
4330
4427
  }
4331
4428
  };
4332
- var Templates = class {
4429
+ var ContactGroups = class {
4333
4430
  /**
4334
- * List templates
4431
+ * List contact groups
4335
4432
  *
4336
- * Returns a paginated list of the organization's templates, filterable by category, channel, status, and search, with configurable sorting.
4433
+ * Returns a paginated list of contact groups for the organization, filterable by type and active state.
4337
4434
  */
4338
4435
  static list(parameters, options) {
4339
4436
  const params = buildClientParams([parameters], [{ args: [
@@ -4347,27 +4444,11 @@ var Templates = class {
4347
4444
  },
4348
4445
  {
4349
4446
  in: "query",
4350
- key: "category"
4351
- },
4352
- {
4353
- in: "query",
4354
- key: "channel"
4355
- },
4356
- {
4357
- in: "query",
4358
- key: "status"
4359
- },
4360
- {
4361
- in: "query",
4362
- key: "search"
4363
- },
4364
- {
4365
- in: "query",
4366
- key: "sortBy"
4447
+ key: "type"
4367
4448
  },
4368
4449
  {
4369
4450
  in: "query",
4370
- key: "sortOrder"
4451
+ key: "isActive"
4371
4452
  }
4372
4453
  ] }]);
4373
4454
  return (options?.client ?? client).get({
@@ -4375,15 +4456,15 @@ var Templates = class {
4375
4456
  name: "x-api-key",
4376
4457
  type: "apiKey"
4377
4458
  }],
4378
- url: "/v1/templates",
4459
+ url: "/v1/contact-groups",
4379
4460
  ...options,
4380
4461
  ...params
4381
4462
  });
4382
4463
  }
4383
4464
  /**
4384
- * Create a template
4465
+ * Create a contact group
4385
4466
  *
4386
- * Creates an email template project from Samva's canonical TSX starter and returns its template entry with status 201.
4467
+ * Creates a new contact group and returns it with a 201 status.
4387
4468
  */
4388
4469
  static create(parameters, options) {
4389
4470
  const params = buildClientParams([parameters], [{ args: [
@@ -4393,31 +4474,31 @@ var Templates = class {
4393
4474
  },
4394
4475
  {
4395
4476
  in: "body",
4396
- key: "projectName"
4477
+ key: "description"
4397
4478
  },
4398
4479
  {
4399
4480
  in: "body",
4400
- key: "slug"
4481
+ key: "type"
4401
4482
  },
4402
4483
  {
4403
4484
  in: "body",
4404
- key: "galleryTemplateId"
4485
+ key: "criteria"
4405
4486
  },
4406
4487
  {
4407
4488
  in: "body",
4408
- key: "description"
4489
+ key: "color"
4409
4490
  },
4410
4491
  {
4411
4492
  in: "body",
4412
- key: "category"
4493
+ key: "icon"
4413
4494
  },
4414
4495
  {
4415
4496
  in: "body",
4416
- key: "isActive"
4497
+ key: "parentGroupId"
4417
4498
  },
4418
4499
  {
4419
4500
  in: "body",
4420
- key: "idempotencyKey"
4501
+ key: "isActive"
4421
4502
  }
4422
4503
  ] }]);
4423
4504
  return (options?.client ?? client).post({
@@ -4425,7 +4506,7 @@ var Templates = class {
4425
4506
  name: "x-api-key",
4426
4507
  type: "apiKey"
4427
4508
  }],
4428
- url: "/v1/templates",
4509
+ url: "/v1/contact-groups",
4429
4510
  ...options,
4430
4511
  ...params,
4431
4512
  headers: {
@@ -4436,98 +4517,95 @@ var Templates = class {
4436
4517
  });
4437
4518
  }
4438
4519
  /**
4439
- * List templates for the dashboard
4520
+ * Delete a contact group
4440
4521
  *
4441
- * Returns a paginated dashboard view that groups related channel templates into families and leaves standalone templates ungrouped.
4522
+ * Permanently deletes a contact group by its ID.
4442
4523
  */
4443
- static listDashboard(parameters, options) {
4444
- const params = buildClientParams([parameters], [{ args: [
4445
- {
4446
- in: "query",
4447
- key: "page"
4448
- },
4449
- {
4450
- in: "query",
4451
- key: "limit"
4452
- },
4453
- {
4454
- in: "query",
4455
- key: "allowedChannels"
4456
- },
4457
- {
4458
- in: "query",
4459
- key: "category"
4460
- },
4461
- {
4462
- in: "query",
4463
- key: "channel"
4464
- },
4465
- {
4466
- in: "query",
4467
- key: "status"
4468
- },
4469
- {
4470
- in: "query",
4471
- key: "search"
4472
- },
4473
- {
4474
- in: "query",
4475
- key: "sortBy"
4476
- },
4477
- {
4478
- in: "query",
4479
- key: "sortOrder"
4480
- }
4481
- ] }]);
4482
- return (options?.client ?? client).get({
4524
+ static remove(parameters, options) {
4525
+ const params = buildClientParams([parameters], [{ args: [{
4526
+ in: "path",
4527
+ key: "id"
4528
+ }] }]);
4529
+ return (options?.client ?? client).delete({
4483
4530
  security: [{
4484
4531
  name: "x-api-key",
4485
4532
  type: "apiKey"
4486
4533
  }],
4487
- url: "/v1/templates/dashboard",
4534
+ url: "/v1/contact-groups/{id}",
4488
4535
  ...options,
4489
4536
  ...params
4490
4537
  });
4491
4538
  }
4492
4539
  /**
4493
- * List template families
4540
+ * Get a contact group
4494
4541
  *
4495
- * Returns a paginated list of the organization's template families and members.
4542
+ * Returns a single contact group by its ID.
4496
4543
  */
4497
- static listFamilies(parameters, options) {
4544
+ static getById(parameters, options) {
4498
4545
  const params = buildClientParams([parameters], [{ args: [{
4499
- in: "query",
4500
- key: "page"
4501
- }, {
4502
- in: "query",
4503
- key: "limit"
4546
+ in: "path",
4547
+ key: "id"
4504
4548
  }] }]);
4505
4549
  return (options?.client ?? client).get({
4506
4550
  security: [{
4507
4551
  name: "x-api-key",
4508
4552
  type: "apiKey"
4509
4553
  }],
4510
- url: "/v1/templates/families",
4554
+ url: "/v1/contact-groups/{id}",
4511
4555
  ...options,
4512
4556
  ...params
4513
4557
  });
4514
4558
  }
4515
4559
  /**
4516
- * Create a template family
4560
+ * Update a contact group
4517
4561
  *
4518
- * Creates an empty template family with the supplied name and returns it with status 201.
4562
+ * Updates an existing contact group's fields and returns the updated group.
4519
4563
  */
4520
- static createFamily(parameters, options) {
4521
- const params = buildClientParams([parameters], [{ args: [{
4522
- in: "body",
4523
- key: "name"
4524
- }] }]);
4525
- return (options?.client ?? client).post({
4564
+ static update(parameters, options) {
4565
+ const params = buildClientParams([parameters], [{ args: [
4566
+ {
4567
+ in: "path",
4568
+ key: "id"
4569
+ },
4570
+ {
4571
+ in: "body",
4572
+ key: "name"
4573
+ },
4574
+ {
4575
+ in: "body",
4576
+ key: "description"
4577
+ },
4578
+ {
4579
+ in: "body",
4580
+ key: "type"
4581
+ },
4582
+ {
4583
+ in: "body",
4584
+ key: "criteria"
4585
+ },
4586
+ {
4587
+ in: "body",
4588
+ key: "color"
4589
+ },
4590
+ {
4591
+ in: "body",
4592
+ key: "icon"
4593
+ },
4594
+ {
4595
+ in: "body",
4596
+ key: "parentGroupId"
4597
+ },
4598
+ {
4599
+ in: "body",
4600
+ key: "isActive"
4601
+ }
4602
+ ] }]);
4603
+ return (options?.client ?? client).patch({
4526
4604
  security: [{
4527
4605
  name: "x-api-key",
4528
4606
  type: "apiKey"
4529
4607
  }],
4530
- url: "/v1/templates/families",
4608
+ url: "/v1/contact-groups/{id}",
4531
4609
  ...options,
4532
4610
  ...params,
4533
4611
  headers: {
@@ -4538,49 +4616,894 @@ var Templates = class {
4538
4616
  });
4539
4617
  }
4540
4618
  /**
4541
- * Delete a template family
4619
+ * Remove members from a contact group
4542
4620
  *
4543
- * Deletes a template family without deleting its member templates.
4621
+ * Removes one or more contacts from a contact group, returning the count of removed members.
4544
4622
  */
4545
- static deleteFamily(parameters, options) {
4623
+ static removeMembers(parameters, options) {
4546
4624
  const params = buildClientParams([parameters], [{ args: [{
4547
4625
  in: "path",
4548
- key: "familyId"
4626
+ key: "groupId"
4627
+ }, {
4628
+ in: "body",
4629
+ key: "contactIds"
4549
4630
  }] }]);
4550
4631
  return (options?.client ?? client).delete({
4551
4632
  security: [{
4552
4633
  name: "x-api-key",
4553
4634
  type: "apiKey"
4554
4635
  }],
4555
- url: "/v1/templates/families/{familyId}",
4636
+ url: "/v1/contact-groups/{groupId}/members",
4556
4637
  ...options,
4557
- ...params
4638
+ ...params,
4639
+ headers: {
4640
+ "Content-Type": "application/json",
4641
+ ...options?.headers,
4642
+ ...params.headers
4643
+ }
4558
4644
  });
4559
4645
  }
4560
4646
  /**
4561
- * Get a template family
4647
+ * List members of a contact group
4562
4648
  *
4563
- * Returns a template family and its channel-specific member templates.
4649
+ * Returns a paginated list of contacts belonging to a contact group.
4564
4650
  */
4565
- static getFamily(parameters, options) {
4566
- const params = buildClientParams([parameters], [{ args: [{
4567
- in: "path",
4568
- key: "familyId"
4569
- }] }]);
4651
+ static getMembers(parameters, options) {
4652
+ const params = buildClientParams([parameters], [{ args: [
4653
+ {
4654
+ in: "path",
4655
+ key: "groupId"
4656
+ },
4657
+ {
4658
+ in: "query",
4659
+ key: "page"
4660
+ },
4661
+ {
4662
+ in: "query",
4663
+ key: "limit"
4664
+ }
4665
+ ] }]);
4570
4666
  return (options?.client ?? client).get({
4571
4667
  security: [{
4572
4668
  name: "x-api-key",
4573
4669
  type: "apiKey"
4574
4670
  }],
4575
- url: "/v1/templates/families/{familyId}",
4671
+ url: "/v1/contact-groups/{groupId}/members",
4576
4672
  ...options,
4577
4673
  ...params
4578
4674
  });
4579
4675
  }
4580
4676
  /**
4581
- * Rename a template family
4677
+ * Add members to a contact group
4582
4678
  *
4583
- * Changes a template family's name and returns the updated family.
4679
+ * Adds one or more contacts to a contact group, returning counts of added and skipped members.
4680
+ */
4681
+ static addMembers(parameters, options) {
4682
+ const params = buildClientParams([parameters], [{ args: [
4683
+ {
4684
+ in: "path",
4685
+ key: "groupId"
4686
+ },
4687
+ {
4688
+ in: "body",
4689
+ key: "contactIds"
4690
+ },
4691
+ {
4692
+ in: "body",
4693
+ key: "role"
4694
+ }
4695
+ ] }]);
4696
+ return (options?.client ?? client).post({
4697
+ security: [{
4698
+ name: "x-api-key",
4699
+ type: "apiKey"
4700
+ }],
4701
+ url: "/v1/contact-groups/{groupId}/members",
4702
+ ...options,
4703
+ ...params,
4704
+ headers: {
4705
+ "Content-Type": "application/json",
4706
+ ...options?.headers,
4707
+ ...params.headers
4708
+ }
4709
+ });
4710
+ }
4711
+ /**
4712
+ * Evaluate a dynamic contact group
4713
+ *
4714
+ * Recomputes a dynamic contact group's membership from its criteria, returning counts of added, removed, and total members.
4715
+ */
4716
+ static evaluateDynamic(parameters, options) {
4717
+ const params = buildClientParams([parameters], [{ args: [{
4718
+ in: "path",
4719
+ key: "groupId"
4720
+ }] }]);
4721
+ return (options?.client ?? client).post({
4722
+ security: [{
4723
+ name: "x-api-key",
4724
+ type: "apiKey"
4725
+ }],
4726
+ url: "/v1/contact-groups/{groupId}/evaluate",
4727
+ ...options,
4728
+ ...params
4729
+ });
4730
+ }
4731
+ /**
4732
+ * Preview contact group criteria
4733
+ *
4734
+ * Evaluates group criteria without persisting, returning the matching contact count and a sample of matches.
4735
+ */
4736
+ static preview(parameters, options) {
4737
+ const params = buildClientParams([parameters], [{ args: [{
4738
+ in: "body",
4739
+ key: "criteria"
4740
+ }] }]);
4741
+ return (options?.client ?? client).post({
4742
+ security: [{
4743
+ name: "x-api-key",
4744
+ type: "apiKey"
4745
+ }],
4746
+ url: "/v1/contact-groups/preview",
4747
+ ...options,
4748
+ ...params,
4749
+ headers: {
4750
+ "Content-Type": "application/json",
4751
+ ...options?.headers,
4752
+ ...params.headers
4753
+ }
4754
+ });
4755
+ }
4756
+ };
4757
+ var CustomFields = class {
4758
+ /**
4759
+ * List custom fields
4760
+ *
4761
+ * Returns a paginated list of custom field definitions for the organization.
4762
+ */
4763
+ static list(parameters, options) {
4764
+ const params = buildClientParams([parameters], [{ args: [{
4765
+ in: "query",
4766
+ key: "page"
4767
+ }, {
4768
+ in: "query",
4769
+ key: "limit"
4770
+ }] }]);
4771
+ return (options?.client ?? client).get({
4772
+ security: [{
4773
+ name: "x-api-key",
4774
+ type: "apiKey"
4775
+ }],
4776
+ url: "/v1/custom-fields",
4777
+ ...options,
4778
+ ...params
4779
+ });
4780
+ }
4781
+ /**
4782
+ * Create a custom field
4783
+ *
4784
+ * Creates a new custom field definition and returns it with a 201 status; the field key must be unique.
4785
+ */
4786
+ static create(parameters, options) {
4787
+ const params = buildClientParams([parameters], [{ args: [
4788
+ {
4789
+ in: "body",
4790
+ key: "key"
4791
+ },
4792
+ {
4793
+ in: "body",
4794
+ key: "label"
4795
+ },
4796
+ {
4797
+ in: "body",
4798
+ key: "type"
4799
+ },
4800
+ {
4801
+ in: "body",
4802
+ key: "options"
4803
+ },
4804
+ {
4805
+ in: "body",
4806
+ key: "defaultValue"
4807
+ },
4808
+ {
4809
+ in: "body",
4810
+ key: "isRequired"
4811
+ },
4812
+ {
4813
+ in: "body",
4814
+ key: "sortOrder"
4815
+ }
4816
+ ] }]);
4817
+ return (options?.client ?? client).post({
4818
+ security: [{
4819
+ name: "x-api-key",
4820
+ type: "apiKey"
4821
+ }],
4822
+ url: "/v1/custom-fields",
4823
+ ...options,
4824
+ ...params,
4825
+ headers: {
4826
+ "Content-Type": "application/json",
4827
+ ...options?.headers,
4828
+ ...params.headers
4829
+ }
4830
+ });
4831
+ }
4832
+ /**
4833
+ * Delete a custom field
4834
+ *
4835
+ * Permanently deletes a custom field definition by its ID.
4836
+ */
4837
+ static remove(parameters, options) {
4838
+ const params = buildClientParams([parameters], [{ args: [{
4839
+ in: "path",
4840
+ key: "id"
4841
+ }] }]);
4842
+ return (options?.client ?? client).delete({
4843
+ security: [{
4844
+ name: "x-api-key",
4845
+ type: "apiKey"
4846
+ }],
4847
+ url: "/v1/custom-fields/{id}",
4848
+ ...options,
4849
+ ...params
4850
+ });
4851
+ }
4852
+ /**
4853
+ * Update a custom field
4854
+ *
4855
+ * Updates an existing custom field definition and returns the updated field.
4856
+ */
4857
+ static update(parameters, options) {
4858
+ const params = buildClientParams([parameters], [{ args: [
4859
+ {
4860
+ in: "path",
4861
+ key: "id"
4862
+ },
4863
+ {
4864
+ in: "body",
4865
+ key: "label"
4866
+ },
4867
+ {
4868
+ in: "body",
4869
+ key: "options"
4870
+ },
4871
+ {
4872
+ in: "body",
4873
+ key: "defaultValue"
4874
+ },
4875
+ {
4876
+ in: "body",
4877
+ key: "isRequired"
4878
+ },
4879
+ {
4880
+ in: "body",
4881
+ key: "sortOrder"
4882
+ }
4883
+ ] }]);
4884
+ return (options?.client ?? client).patch({
4885
+ security: [{
4886
+ name: "x-api-key",
4887
+ type: "apiKey"
4888
+ }],
4889
+ url: "/v1/custom-fields/{id}",
4890
+ ...options,
4891
+ ...params,
4892
+ headers: {
4893
+ "Content-Type": "application/json",
4894
+ ...options?.headers,
4895
+ ...params.headers
4896
+ }
4897
+ });
4898
+ }
4899
+ };
4900
+ var Unsubscribe = class {
4901
+ /**
4902
+ * List unsubscribe groups
4903
+ *
4904
+ * Returns a paginated list of the organization's unsubscribe groups.
4905
+ */
4906
+ static list(parameters, options) {
4907
+ const params = buildClientParams([parameters], [{ args: [{
4908
+ in: "query",
4909
+ key: "page"
4910
+ }, {
4911
+ in: "query",
4912
+ key: "limit"
4913
+ }] }]);
4914
+ return (options?.client ?? client).get({
4915
+ security: [{
4916
+ name: "x-api-key",
4917
+ type: "apiKey"
4918
+ }],
4919
+ url: "/v1/unsubscribe-groups",
4920
+ ...options,
4921
+ ...params
4922
+ });
4923
+ }
4924
+ /**
4925
+ * Create an unsubscribe group
4926
+ *
4927
+ * Creates a new unsubscribe group and returns it with a 201 Created status.
4928
+ */
4929
+ static create(parameters, options) {
4930
+ const params = buildClientParams([parameters], [{ args: [{
4931
+ in: "body",
4932
+ key: "name"
4933
+ }, {
4934
+ in: "body",
4935
+ key: "description"
4936
+ }] }]);
4937
+ return (options?.client ?? client).post({
4938
+ security: [{
4939
+ name: "x-api-key",
4940
+ type: "apiKey"
4941
+ }],
4942
+ url: "/v1/unsubscribe-groups",
4943
+ ...options,
4944
+ ...params,
4945
+ headers: {
4946
+ "Content-Type": "application/json",
4947
+ ...options?.headers,
4948
+ ...params.headers
4949
+ }
4950
+ });
4951
+ }
4952
+ /**
4953
+ * Delete an unsubscribe group
4954
+ *
4955
+ * Permanently deletes an unsubscribe group by its ID.
4956
+ */
4957
+ static remove(parameters, options) {
4958
+ const params = buildClientParams([parameters], [{ args: [{
4959
+ in: "path",
4960
+ key: "id"
4961
+ }] }]);
4962
+ return (options?.client ?? client).delete({
4963
+ security: [{
4964
+ name: "x-api-key",
4965
+ type: "apiKey"
4966
+ }],
4967
+ url: "/v1/unsubscribe-groups/{id}",
4968
+ ...options,
4969
+ ...params
4970
+ });
4971
+ }
4972
+ /**
4973
+ * Update an unsubscribe group
4974
+ *
4975
+ * Updates the name or description of an unsubscribe group.
4976
+ */
4977
+ static update(parameters, options) {
4978
+ const params = buildClientParams([parameters], [{ args: [
4979
+ {
4980
+ in: "path",
4981
+ key: "id"
4982
+ },
4983
+ {
4984
+ in: "body",
4985
+ key: "name"
4986
+ },
4987
+ {
4988
+ in: "body",
4989
+ key: "description"
4990
+ }
4991
+ ] }]);
4992
+ return (options?.client ?? client).patch({
4993
+ security: [{
4994
+ name: "x-api-key",
4995
+ type: "apiKey"
4996
+ }],
4997
+ url: "/v1/unsubscribe-groups/{id}",
4998
+ ...options,
4999
+ ...params,
5000
+ headers: {
5001
+ "Content-Type": "application/json",
5002
+ ...options?.headers,
5003
+ ...params.headers
5004
+ }
5005
+ });
5006
+ }
5007
+ /**
5008
+ * Remove contacts from an unsubscribe group
5009
+ *
5010
+ * Removes one or more email addresses from an unsubscribe group and returns the number removed.
5011
+ */
5012
+ static removeEmails(parameters, options) {
5013
+ const params = buildClientParams([parameters], [{ args: [{
5014
+ in: "path",
5015
+ key: "groupId"
5016
+ }, {
5017
+ in: "body",
5018
+ key: "emails"
5019
+ }] }]);
5020
+ return (options?.client ?? client).delete({
5021
+ security: [{
5022
+ name: "x-api-key",
5023
+ type: "apiKey"
5024
+ }],
5025
+ url: "/v1/unsubscribe-groups/{groupId}/members",
5026
+ ...options,
5027
+ ...params,
5028
+ headers: {
5029
+ "Content-Type": "application/json",
5030
+ ...options?.headers,
5031
+ ...params.headers
5032
+ }
5033
+ });
5034
+ }
5035
+ /**
5036
+ * List unsubscribe group members
5037
+ *
5038
+ * Returns a paginated list of the email addresses in an unsubscribe group.
5039
+ */
5040
+ static listMembers(parameters, options) {
5041
+ const params = buildClientParams([parameters], [{ args: [
5042
+ {
5043
+ in: "path",
5044
+ key: "groupId"
5045
+ },
5046
+ {
5047
+ in: "query",
5048
+ key: "page"
5049
+ },
5050
+ {
5051
+ in: "query",
5052
+ key: "limit"
5053
+ }
5054
+ ] }]);
5055
+ return (options?.client ?? client).get({
5056
+ security: [{
5057
+ name: "x-api-key",
5058
+ type: "apiKey"
5059
+ }],
5060
+ url: "/v1/unsubscribe-groups/{groupId}/members",
5061
+ ...options,
5062
+ ...params
5063
+ });
5064
+ }
5065
+ /**
5066
+ * Add contacts to an unsubscribe group
5067
+ *
5068
+ * Adds one or more email addresses to an unsubscribe group and returns the number added and the number skipped.
5069
+ */
5070
+ static addEmails(parameters, options) {
5071
+ const params = buildClientParams([parameters], [{ args: [
5072
+ {
5073
+ in: "path",
5074
+ key: "groupId"
5075
+ },
5076
+ {
5077
+ in: "body",
5078
+ key: "emails"
5079
+ },
5080
+ {
5081
+ in: "body",
5082
+ key: "source"
5083
+ }
5084
+ ] }]);
5085
+ return (options?.client ?? client).post({
5086
+ security: [{
5087
+ name: "x-api-key",
5088
+ type: "apiKey"
5089
+ }],
5090
+ url: "/v1/unsubscribe-groups/{groupId}/members",
5091
+ ...options,
5092
+ ...params,
5093
+ headers: {
5094
+ "Content-Type": "application/json",
5095
+ ...options?.headers,
5096
+ ...params.headers
5097
+ }
5098
+ });
5099
+ }
5100
+ /**
5101
+ * Check unsubscribe group membership
5102
+ *
5103
+ * Returns the unsubscribe groups that an email address has unsubscribed from, optionally limited to a specified set of groups.
5104
+ */
5105
+ static checkSubscription(parameters, options) {
5106
+ const params = buildClientParams([parameters], [{ args: [{
5107
+ in: "query",
5108
+ key: "email"
5109
+ }, {
5110
+ in: "query",
5111
+ key: "groupIds"
5112
+ }] }]);
5113
+ return (options?.client ?? client).get({
5114
+ security: [{
5115
+ name: "x-api-key",
5116
+ type: "apiKey"
5117
+ }],
5118
+ url: "/v1/unsubscribe-groups/check",
5119
+ ...options,
5120
+ ...params
5121
+ });
5122
+ }
5123
+ };
5124
+ var Analytics = class {
5125
+ /**
5126
+ * Get message volume analytics
5127
+ *
5128
+ * Returns outbound message counts over the half-open selected instant range, grouped by organization-local calendar day, week, or month. A range with traffic returns every bucket in it, including the ones that saw none; a range with no outbound traffic at all returns no buckets. A range with no `endDate` runs through the current instant, so its quiet trailing buckets are reported as zero.
5129
+ */
5130
+ static getStats(parameters, options) {
5131
+ const params = buildClientParams([parameters], [{ args: [
5132
+ {
5133
+ in: "query",
5134
+ key: "startDate"
5135
+ },
5136
+ {
5137
+ in: "query",
5138
+ key: "endDate"
5139
+ },
5140
+ {
5141
+ in: "query",
5142
+ key: "groupBy"
5143
+ },
5144
+ {
5145
+ in: "query",
5146
+ key: "channel"
5147
+ }
5148
+ ] }]);
5149
+ return (options?.client ?? client).get({
5150
+ security: [{
5151
+ name: "x-api-key",
5152
+ type: "apiKey"
5153
+ }],
5154
+ url: "/v1/analytics/stats",
5155
+ ...options,
5156
+ ...params
5157
+ });
5158
+ }
5159
+ /**
5160
+ * Get channel performance analytics
5161
+ *
5162
+ * Returns aggregate delivery metrics plus unique-message email Open and Click rates over the selected date range. `sent` counts every outbound message accepted in the range; each rate is taken over the messages the channel actually attempted, so one still waiting to be sent neither helps nor hurts it. Each engagement rate uses the corresponding tracking-eligible delivered-message cohort; repeated provider observations do not inflate the numerator.
5163
+ */
5164
+ static getChannelStats(parameters, options) {
5165
+ const params = buildClientParams([parameters], [{ args: [{
5166
+ in: "query",
5167
+ key: "startDate"
5168
+ }, {
5169
+ in: "query",
5170
+ key: "endDate"
5171
+ }] }]);
5172
+ return (options?.client ?? client).get({
5173
+ security: [{
5174
+ name: "x-api-key",
5175
+ type: "apiKey"
5176
+ }],
5177
+ url: "/v1/analytics/channel-stats",
5178
+ ...options,
5179
+ ...params
5180
+ });
5181
+ }
5182
+ /**
5183
+ * List top contacts by message volume
5184
+ *
5185
+ * Returns the contacts your organization exchanged the most messages with over the selected date range. `sortBy` chooses the traffic `messageCount` reports and ranks by: `sent` counts outbound messages addressed to the contact, `received` counts inbound messages the contact sent you, and `total` (the default) counts both. Contacts with no traffic in the range are omitted, and at most 100 are returned.
5186
+ */
5187
+ static getTopContacts(parameters, options) {
5188
+ const params = buildClientParams([parameters], [{ args: [
5189
+ {
5190
+ in: "query",
5191
+ key: "startDate"
5192
+ },
5193
+ {
5194
+ in: "query",
5195
+ key: "endDate"
5196
+ },
5197
+ {
5198
+ in: "query",
5199
+ key: "limit"
5200
+ },
5201
+ {
5202
+ in: "query",
5203
+ key: "sortBy"
5204
+ }
5205
+ ] }]);
5206
+ return (options?.client ?? client).get({
5207
+ security: [{
5208
+ name: "x-api-key",
5209
+ type: "apiKey"
5210
+ }],
5211
+ url: "/v1/analytics/top-contacts",
5212
+ ...options,
5213
+ ...params
5214
+ });
5215
+ }
5216
+ /**
5217
+ * Get hourly message distribution
5218
+ *
5219
+ * Returns outbound message counts over the half-open selected instant range, bucketed by organization-local hour. Empty ranges return no rows; non-empty ranges include all 24 hours.
5220
+ */
5221
+ static getHourlyDistribution(parameters, options) {
5222
+ const params = buildClientParams([parameters], [{ args: [{
5223
+ in: "query",
5224
+ key: "startDate"
5225
+ }, {
5226
+ in: "query",
5227
+ key: "endDate"
5228
+ }] }]);
5229
+ return (options?.client ?? client).get({
5230
+ security: [{
5231
+ name: "x-api-key",
5232
+ type: "apiKey"
5233
+ }],
5234
+ url: "/v1/analytics/hourly-distribution",
5235
+ ...options,
5236
+ ...params
5237
+ });
5238
+ }
5239
+ /**
5240
+ * Get message delivery metrics
5241
+ *
5242
+ * Returns delivered, failed, and pending rates plus average delivery time for the outbound messages accepted in the selected date range, optionally filtered by channel. Every accepted message falls into exactly one of the three, so they always sum to 100%: a complaint counts as delivered because the message arrived, a bounce counts as failed, and anything the provider has not resolved yet counts as pending. Mail your organization received is not rated here.
5243
+ */
5244
+ static getDeliveryMetrics(parameters, options) {
5245
+ const params = buildClientParams([parameters], [{ args: [
5246
+ {
5247
+ in: "query",
5248
+ key: "startDate"
5249
+ },
5250
+ {
5251
+ in: "query",
5252
+ key: "endDate"
5253
+ },
5254
+ {
5255
+ in: "query",
5256
+ key: "channel"
5257
+ }
5258
+ ] }]);
5259
+ return (options?.client ?? client).get({
5260
+ security: [{
5261
+ name: "x-api-key",
5262
+ type: "apiKey"
5263
+ }],
5264
+ url: "/v1/analytics/delivery-metrics",
5265
+ ...options,
5266
+ ...params
5267
+ });
5268
+ }
5269
+ /**
5270
+ * Export messaging analytics data
5271
+ *
5272
+ * Exports one record per outbound message accepted in the given date range as CSV or JSON and returns the file content inline. CSV follows RFC 4180: fields containing a quote, comma, or line break are quoted with embedded quotes doubled, and records are separated by CRLF. At most 10,000 records are returned, newest first.
5273
+ */
5274
+ static exportData(parameters, options) {
5275
+ const params = buildClientParams([parameters], [{ args: [
5276
+ {
5277
+ in: "body",
5278
+ key: "startDate"
5279
+ },
5280
+ {
5281
+ in: "body",
5282
+ key: "endDate"
5283
+ },
5284
+ {
5285
+ in: "body",
5286
+ key: "format"
5287
+ },
5288
+ {
5289
+ in: "body",
5290
+ key: "includeChannels"
5291
+ }
5292
+ ] }]);
5293
+ return (options?.client ?? client).post({
5294
+ security: [{
5295
+ name: "x-api-key",
5296
+ type: "apiKey"
5297
+ }],
5298
+ url: "/v1/analytics/export",
5299
+ ...options,
5300
+ ...params,
5301
+ headers: {
5302
+ "Content-Type": "application/json",
5303
+ ...options?.headers,
5304
+ ...params.headers
5305
+ }
5306
+ });
5307
+ }
5308
+ };
5309
+ var Templates = class {
5310
+ /**
5311
+ * List templates
5312
+ *
5313
+ * Returns a paginated list of the organization's templates, filterable by category, channel, status, and search, with configurable sorting.
5314
+ */
5315
+ static list(parameters, options) {
5316
+ const params = buildClientParams([parameters], [{ args: [
5317
+ {
5318
+ in: "query",
5319
+ key: "page"
5320
+ },
5321
+ {
5322
+ in: "query",
5323
+ key: "limit"
5324
+ },
5325
+ {
5326
+ in: "query",
5327
+ key: "category"
5328
+ },
5329
+ {
5330
+ in: "query",
5331
+ key: "channel"
5332
+ },
5333
+ {
5334
+ in: "query",
5335
+ key: "status"
5336
+ },
5337
+ {
5338
+ in: "query",
5339
+ key: "search"
5340
+ },
5341
+ {
5342
+ in: "query",
5343
+ key: "sortBy"
5344
+ },
5345
+ {
5346
+ in: "query",
5347
+ key: "sortOrder"
5348
+ }
5349
+ ] }]);
5350
+ return (options?.client ?? client).get({
5351
+ security: [{
5352
+ name: "x-api-key",
5353
+ type: "apiKey"
5354
+ }],
5355
+ url: "/v1/templates",
5356
+ ...options,
5357
+ ...params
5358
+ });
5359
+ }
5360
+ /**
5361
+ * Create a template
5362
+ *
5363
+ * Creates an email template project from Samva's canonical TSX starter and returns its template entry with status 201.
5364
+ */
5365
+ static create(parameters, options) {
5366
+ const params = buildClientParams([parameters], [{ args: [
5367
+ {
5368
+ in: "body",
5369
+ key: "name"
5370
+ },
5371
+ {
5372
+ in: "body",
5373
+ key: "projectName"
5374
+ },
5375
+ {
5376
+ in: "body",
5377
+ key: "slug"
5378
+ },
5379
+ {
5380
+ in: "body",
5381
+ key: "galleryTemplateId"
5382
+ },
5383
+ {
5384
+ in: "body",
5385
+ key: "description"
5386
+ },
5387
+ {
5388
+ in: "body",
5389
+ key: "category"
5390
+ },
5391
+ {
5392
+ in: "body",
5393
+ key: "isActive"
5394
+ },
5395
+ {
5396
+ in: "body",
5397
+ key: "idempotencyKey"
5398
+ }
5399
+ ] }]);
5400
+ return (options?.client ?? client).post({
5401
+ security: [{
5402
+ name: "x-api-key",
5403
+ type: "apiKey"
5404
+ }],
5405
+ url: "/v1/templates",
5406
+ ...options,
5407
+ ...params,
5408
+ headers: {
5409
+ "Content-Type": "application/json",
5410
+ ...options?.headers,
5411
+ ...params.headers
5412
+ }
5413
+ });
5414
+ }
5415
+ /**
5416
+ * List template families
5417
+ *
5418
+ * Returns a paginated list of the organization's template families and members.
5419
+ */
5420
+ static listFamilies(parameters, options) {
5421
+ const params = buildClientParams([parameters], [{ args: [{
5422
+ in: "query",
5423
+ key: "page"
5424
+ }, {
5425
+ in: "query",
5426
+ key: "limit"
5427
+ }] }]);
5428
+ return (options?.client ?? client).get({
5429
+ security: [{
5430
+ name: "x-api-key",
5431
+ type: "apiKey"
5432
+ }],
5433
+ url: "/v1/templates/families",
5434
+ ...options,
5435
+ ...params
5436
+ });
5437
+ }
5438
+ /**
5439
+ * Create a template family
5440
+ *
5441
+ * Creates an empty template family with the supplied name and returns it with status 201.
5442
+ */
5443
+ static createFamily(parameters, options) {
5444
+ const params = buildClientParams([parameters], [{ args: [{
5445
+ in: "body",
5446
+ key: "name"
5447
+ }] }]);
5448
+ return (options?.client ?? client).post({
5449
+ security: [{
5450
+ name: "x-api-key",
5451
+ type: "apiKey"
5452
+ }],
5453
+ url: "/v1/templates/families",
5454
+ ...options,
5455
+ ...params,
5456
+ headers: {
5457
+ "Content-Type": "application/json",
5458
+ ...options?.headers,
5459
+ ...params.headers
5460
+ }
5461
+ });
5462
+ }
5463
+ /**
5464
+ * Delete a template family
5465
+ *
5466
+ * Deletes a template family without deleting its member templates.
5467
+ */
5468
+ static deleteFamily(parameters, options) {
5469
+ const params = buildClientParams([parameters], [{ args: [{
5470
+ in: "path",
5471
+ key: "familyId"
5472
+ }] }]);
5473
+ return (options?.client ?? client).delete({
5474
+ security: [{
5475
+ name: "x-api-key",
5476
+ type: "apiKey"
5477
+ }],
5478
+ url: "/v1/templates/families/{familyId}",
5479
+ ...options,
5480
+ ...params
5481
+ });
5482
+ }
5483
+ /**
5484
+ * Get a template family
5485
+ *
5486
+ * Returns a template family and its channel-specific member templates.
5487
+ */
5488
+ static getFamily(parameters, options) {
5489
+ const params = buildClientParams([parameters], [{ args: [{
5490
+ in: "path",
5491
+ key: "familyId"
5492
+ }] }]);
5493
+ return (options?.client ?? client).get({
5494
+ security: [{
5495
+ name: "x-api-key",
5496
+ type: "apiKey"
5497
+ }],
5498
+ url: "/v1/templates/families/{familyId}",
5499
+ ...options,
5500
+ ...params
5501
+ });
5502
+ }
5503
+ /**
5504
+ * Rename a template family
5505
+ *
5506
+ * Changes a template family's name and returns the updated family.
4584
5507
  */
4585
5508
  static renameFamily(parameters, options) {
4586
5509
  const params = buildClientParams([parameters], [{ args: [{
@@ -4789,7 +5712,7 @@ var Templates = class {
4789
5712
  /**
4790
5713
  * Open a template project workspace
4791
5714
  *
4792
- * Creates or opens the shared project workspace at the current Artifact branch head and returns its effective files.
5715
+ * Creates or opens the shared project workspace at the latest saved version and returns its effective files.
4793
5716
  */
4794
5717
  static openWorkspace(parameters, options) {
4795
5718
  const params = buildClientParams([parameters], [{ args: [{
@@ -4837,7 +5760,7 @@ var Templates = class {
4837
5760
  /**
4838
5761
  * Reconcile a template project workspace
4839
5762
  *
4840
- * Fast-forwards or rebases the workspace onto the current Artifact branch head, retaining file conflicts for explicit resolution.
5763
+ * Fast-forwards or rebases the workspace onto the latest saved version, retaining file conflicts for explicit resolution.
4841
5764
  */
4842
5765
  static reconcileWorkspace(parameters, options) {
4843
5766
  const params = buildClientParams([parameters], [{ args: [
@@ -4923,7 +5846,7 @@ var Templates = class {
4923
5846
  /**
4924
5847
  * Save a template project workspace
4925
5848
  *
4926
- * Validates the effective project tree and creates one normal Git commit on the Artifact default branch.
5849
+ * Validates the effective project tree and saves it as one Git commit on the template repository's default branch.
4927
5850
  */
4928
5851
  static saveWorkspace(parameters, options) {
4929
5852
  const params = buildClientParams([parameters], [{ args: [
@@ -5005,7 +5928,7 @@ var Templates = class {
5005
5928
  /**
5006
5929
  * List template project commit history
5007
5930
  *
5008
- * Returns bounded history from the Artifact repository default branch.
5931
+ * Returns recent history from the template repository's default branch.
5009
5932
  */
5010
5933
  static workspaceHistory(parameters, options) {
5011
5934
  const params = buildClientParams([parameters], [{ args: [{
@@ -5220,7 +6143,7 @@ var Templates = class {
5220
6143
  /**
5221
6144
  * Issue a template project Git credential
5222
6145
  *
5223
- * Exchanges the caller's Samva authorization for a one-hour, repository-scoped Artifact Git credential.
6146
+ * Exchanges the caller's Samva authorization for a one-hour Git credential scoped to the template repository.
5224
6147
  */
5225
6148
  static issueGitCredential(parameters, options) {
5226
6149
  const params = buildClientParams([parameters], [{ args: [{
@@ -5593,7 +6516,7 @@ var Webhooks = class {
5593
6516
  /**
5594
6517
  * Get webhook delivery statistics
5595
6518
  *
5596
- * Returns aggregate pending, delivered, exhausted, and cancelled delivery counts for a webhook endpoint, plus the same counts per workspace-local calendar day over the selected period of 7, 30, or 90 days. Deliveries are retained for 90 days, so 90d is the whole history.
6519
+ * Returns aggregate pending, delivered, exhausted, and cancelled delivery counts for a webhook endpoint, plus the same counts per organization-local calendar day over the selected period of 7, 30, or 90 days. Deliveries are retained for 90 days, so 90d is the whole history.
5597
6520
  */
5598
6521
  static getStats(parameters, options) {
5599
6522
  const params = buildClientParams([parameters], [{ args: [{
@@ -5659,9 +6582,9 @@ var Webhooks = class {
5659
6582
  };
5660
6583
  var Organizations = class {
5661
6584
  /**
5662
- * Create a workspace
6585
+ * Create an organization
5663
6586
  *
5664
- * Creates a new workspace organization under the current billing account and returns it.
6587
+ * Creates a new organization under the current billing account and returns it.
5665
6588
  */
5666
6589
  static create(parameters, options) {
5667
6590
  const params = buildClientParams([parameters], [{ args: [{
@@ -5701,7 +6624,7 @@ var Organizations = class {
5701
6624
  /**
5702
6625
  * Update the current organization
5703
6626
  *
5704
- * Updates the current organization's profile, billing, locale, design, default reply-to, and default unsubscribe-group fields and returns the saved organization.
6627
+ * Updates the current organization's profile, regional defaults, design, reply-to, and unsubscribe-group defaults and returns the saved organization. `metadata` and `design` are merged into the stored values; every other field is replaced.
5705
6628
  */
5706
6629
  static update(parameters, options) {
5707
6630
  const params = buildClientParams([parameters], [{ args: [
@@ -5713,18 +6636,10 @@ var Organizations = class {
5713
6636
  in: "body",
5714
6637
  key: "slug"
5715
6638
  },
5716
- {
5717
- in: "body",
5718
- key: "billingEmail"
5719
- },
5720
6639
  {
5721
6640
  in: "body",
5722
6641
  key: "countryCode"
5723
6642
  },
5724
- {
5725
- in: "body",
5726
- key: "currency"
5727
- },
5728
6643
  {
5729
6644
  in: "body",
5730
6645
  key: "timezone"
@@ -5790,9 +6705,9 @@ var Organizations = class {
5790
6705
  });
5791
6706
  }
5792
6707
  /**
5793
- * Delete the current workspace
6708
+ * Delete the current organization
5794
6709
  *
5795
- * Starts an owner-authorized durable workspace deletion operation, confirming the workspace name in the request. Repeating the same request with the same Idempotency-Key returns the existing organization-scoped operation.
6710
+ * Starts an owner-authorized organization deletion operation, confirming the organization name in the request. Repeating the same request with the same Idempotency-Key returns the existing organization-scoped operation.
5796
6711
  */
5797
6712
  static delete(parameters, options) {
5798
6713
  const params = buildClientParams([parameters], [{ args: [{
@@ -5817,31 +6732,6 @@ var Organizations = class {
5817
6732
  }
5818
6733
  });
5819
6734
  }
5820
- /**
5821
- * Create the first workspace
5822
- *
5823
- * Creates a replacement first workspace under the signed-in user's billing account when no workspace membership remains.
5824
- */
5825
- static bootstrap(parameters, options) {
5826
- const params = buildClientParams([parameters], [{ args: [{
5827
- in: "body",
5828
- key: "name"
5829
- }] }]);
5830
- return (options?.client ?? client).post({
5831
- security: [{
5832
- name: "x-api-key",
5833
- type: "apiKey"
5834
- }],
5835
- url: "/v1/organizations/bootstrap",
5836
- ...options,
5837
- ...params,
5838
- headers: {
5839
- "Content-Type": "application/json",
5840
- ...options?.headers,
5841
- ...params.headers
5842
- }
5843
- });
5844
- }
5845
6735
  };
5846
6736
  var ApiKeys = class {
5847
6737
  /**
@@ -5899,7 +6789,7 @@ var ApiKeys = class {
5899
6789
  },
5900
6790
  {
5901
6791
  in: "body",
5902
- key: "permissions"
6792
+ key: "access"
5903
6793
  }
5904
6794
  ] }]);
5905
6795
  return (options?.client ?? client).post({
@@ -5940,7 +6830,7 @@ var ApiKeys = class {
5940
6830
  /**
5941
6831
  * Get an API key
5942
6832
  *
5943
- * Returns the API key with the given ID, including its metadata and permissions.
6833
+ * Returns the API key with the given ID, including its metadata and access.
5944
6834
  */
5945
6835
  static get(parameters, options) {
5946
6836
  const params = buildClientParams([parameters], [{ args: [{
@@ -5995,7 +6885,7 @@ var ApiKeys = class {
5995
6885
  /**
5996
6886
  * Rotate an API key
5997
6887
  *
5998
- * Issues a replacement with the same owner, name, and permissions, then deactivates the existing key. Returns the new key, including the plaintext secret.
6888
+ * Issues a replacement with the same owner, name, and access, then deactivates the existing key. Returns the new key, including the plaintext secret.
5999
6889
  */
6000
6890
  static rotate(parameters, options) {
6001
6891
  const params = buildClientParams([parameters], [{ args: [{
@@ -6122,6 +7012,13 @@ const messageOf = (tag, payload) => {
6122
7012
  const message = payload.message;
6123
7013
  return typeof message === "string" ? message : tag;
6124
7014
  };
7015
+ var AnalyticsQueryError = class extends SamvaApiError {
7016
+ _tag = "AnalyticsQueryError";
7017
+ constructor(payload, context = {}) {
7018
+ super(messageOf("AnalyticsQueryError", payload), context);
7019
+ Object.assign(this, payload);
7020
+ }
7021
+ };
6125
7022
  var BillingProviderError = class extends SamvaApiError {
6126
7023
  _tag = "BillingProviderError";
6127
7024
  constructor(payload, context = {}) {
@@ -6136,6 +7033,13 @@ var ConflictError = class extends SamvaApiError {
6136
7033
  Object.assign(this, payload);
6137
7034
  }
6138
7035
  };
7036
+ var DeliveryUnavailableError = class extends SamvaApiError {
7037
+ _tag = "DeliveryUnavailableError";
7038
+ constructor(payload, context = {}) {
7039
+ super(messageOf("DeliveryUnavailableError", payload), context);
7040
+ Object.assign(this, payload);
7041
+ }
7042
+ };
6139
7043
  var EmailChannelError = class extends SamvaApiError {
6140
7044
  _tag = "EmailChannelError";
6141
7045
  constructor(payload, context = {}) {
@@ -6164,6 +7068,13 @@ var ForbiddenError = class extends SamvaApiError {
6164
7068
  Object.assign(this, payload);
6165
7069
  }
6166
7070
  };
7071
+ var GatewayTimeoutError = class extends SamvaApiError {
7072
+ _tag = "GatewayTimeoutError";
7073
+ constructor(payload, context = {}) {
7074
+ super(messageOf("GatewayTimeoutError", payload), context);
7075
+ Object.assign(this, payload);
7076
+ }
7077
+ };
6167
7078
  var InternalError = class extends SamvaApiError {
6168
7079
  _tag = "InternalError";
6169
7080
  constructor(payload, context = {}) {
@@ -6213,30 +7124,37 @@ var ValidationError = class extends SamvaApiError {
6213
7124
  Object.assign(this, payload);
6214
7125
  }
6215
7126
  };
6216
- var WebhookEnqueueError = class extends SamvaApiError {
6217
- _tag = "WebhookEnqueueError";
6218
- constructor(payload, context = {}) {
6219
- super(messageOf("WebhookEnqueueError", payload), context);
6220
- Object.assign(this, payload);
6221
- }
6222
- };
6223
7127
  const constructors = {
7128
+ AnalyticsQueryError,
6224
7129
  BillingProviderError,
6225
7130
  ConflictError,
7131
+ DeliveryUnavailableError,
6226
7132
  EmailChannelError,
6227
7133
  ExternalServiceError,
6228
7134
  FlagDisabledError,
6229
7135
  ForbiddenError,
7136
+ GatewayTimeoutError,
6230
7137
  InternalError,
6231
7138
  OnboardingReviewRequiredError,
6232
7139
  PaymentRequiredError,
6233
7140
  RateLimitedError,
6234
7141
  ResourceNotFoundError,
6235
7142
  UnauthorizedError,
6236
- ValidationError,
6237
- WebhookEnqueueError
7143
+ ValidationError
6238
7144
  };
6239
7145
  const payloadSchemas = {
7146
+ AnalyticsQueryError: {
7147
+ type: "object",
7148
+ properties: {
7149
+ _tag: {
7150
+ type: "string",
7151
+ enum: ["AnalyticsQueryError"]
7152
+ },
7153
+ message: { type: "string" }
7154
+ },
7155
+ required: ["_tag", "message"],
7156
+ additionalProperties: false
7157
+ },
6240
7158
  BillingProviderError: {
6241
7159
  type: "object",
6242
7160
  properties: {
@@ -6244,14 +7162,9 @@ const payloadSchemas = {
6244
7162
  type: "string",
6245
7163
  enum: ["BillingProviderError"]
6246
7164
  },
6247
- operation: { type: "string" },
6248
7165
  message: { type: "string" }
6249
7166
  },
6250
- required: [
6251
- "_tag",
6252
- "operation",
6253
- "message"
6254
- ],
7167
+ required: ["_tag", "message"],
6255
7168
  additionalProperties: false,
6256
7169
  "x-category": ["transient"],
6257
7170
  "x-retryable": true
@@ -6263,14 +7176,12 @@ const payloadSchemas = {
6263
7176
  type: "string",
6264
7177
  enum: ["ConflictError"]
6265
7178
  },
6266
- operation: { type: "string" },
6267
7179
  message: { type: "string" },
6268
7180
  resource: { type: "string" },
6269
7181
  id: { anyOf: [{ type: "string" }, { type: "null" }] }
6270
7182
  },
6271
7183
  required: [
6272
7184
  "_tag",
6273
- "operation",
6274
7185
  "message",
6275
7186
  "resource"
6276
7187
  ],
@@ -6278,6 +7189,25 @@ const payloadSchemas = {
6278
7189
  "x-category": ["conflict"],
6279
7190
  "x-retryable": false
6280
7191
  },
7192
+ DeliveryUnavailableError: {
7193
+ type: "object",
7194
+ properties: {
7195
+ _tag: {
7196
+ type: "string",
7197
+ enum: ["DeliveryUnavailableError"]
7198
+ },
7199
+ message: { type: "string" },
7200
+ retryAfterSeconds: { type: "number" }
7201
+ },
7202
+ required: [
7203
+ "_tag",
7204
+ "message",
7205
+ "retryAfterSeconds"
7206
+ ],
7207
+ additionalProperties: false,
7208
+ "x-category": ["transient"],
7209
+ "x-retryable": true
7210
+ },
6281
7211
  EmailChannelError: {
6282
7212
  type: "object",
6283
7213
  properties: {
@@ -6285,7 +7215,6 @@ const payloadSchemas = {
6285
7215
  type: "string",
6286
7216
  enum: ["EmailChannelError"]
6287
7217
  },
6288
- operation: { type: "string" },
6289
7218
  reason: {
6290
7219
  type: "string",
6291
7220
  enum: [
@@ -6300,7 +7229,6 @@ const payloadSchemas = {
6300
7229
  },
6301
7230
  required: [
6302
7231
  "_tag",
6303
- "operation",
6304
7232
  "reason",
6305
7233
  "message"
6306
7234
  ],
@@ -6313,14 +7241,9 @@ const payloadSchemas = {
6313
7241
  type: "string",
6314
7242
  enum: ["ExternalServiceError"]
6315
7243
  },
6316
- operation: { type: "string" },
6317
7244
  message: { type: "string" }
6318
7245
  },
6319
- required: [
6320
- "_tag",
6321
- "operation",
6322
- "message"
6323
- ],
7246
+ required: ["_tag", "message"],
6324
7247
  additionalProperties: false,
6325
7248
  "x-category": ["transient"],
6326
7249
  "x-retryable": true
@@ -6332,14 +7255,9 @@ const payloadSchemas = {
6332
7255
  type: "string",
6333
7256
  enum: ["FlagDisabledError"]
6334
7257
  },
6335
- operation: { type: "string" },
6336
7258
  flag: { type: "string" }
6337
7259
  },
6338
- required: [
6339
- "_tag",
6340
- "operation",
6341
- "flag"
6342
- ],
7260
+ required: ["_tag", "flag"],
6343
7261
  additionalProperties: false,
6344
7262
  "x-retryable": false
6345
7263
  },
@@ -6350,17 +7268,31 @@ const payloadSchemas = {
6350
7268
  type: "string",
6351
7269
  enum: ["ForbiddenError"]
6352
7270
  },
6353
- operation: { type: "string" },
6354
7271
  message: { type: "string" }
6355
7272
  },
7273
+ required: ["_tag", "message"],
7274
+ additionalProperties: false,
7275
+ "x-category": ["auth"],
7276
+ "x-retryable": false
7277
+ },
7278
+ GatewayTimeoutError: {
7279
+ type: "object",
7280
+ properties: {
7281
+ _tag: {
7282
+ type: "string",
7283
+ enum: ["GatewayTimeoutError"]
7284
+ },
7285
+ message: { type: "string" },
7286
+ retryAfterSeconds: { type: "number" }
7287
+ },
6356
7288
  required: [
6357
7289
  "_tag",
6358
- "operation",
6359
- "message"
7290
+ "message",
7291
+ "retryAfterSeconds"
6360
7292
  ],
6361
7293
  additionalProperties: false,
6362
- "x-category": ["auth"],
6363
- "x-retryable": false
7294
+ "x-category": ["transient"],
7295
+ "x-retryable": true
6364
7296
  },
6365
7297
  InternalError: {
6366
7298
  type: "object",
@@ -6369,14 +7301,9 @@ const payloadSchemas = {
6369
7301
  type: "string",
6370
7302
  enum: ["InternalError"]
6371
7303
  },
6372
- operation: { type: "string" },
6373
7304
  message: { type: "string" }
6374
7305
  },
6375
- required: [
6376
- "_tag",
6377
- "operation",
6378
- "message"
6379
- ],
7306
+ required: ["_tag", "message"],
6380
7307
  additionalProperties: false,
6381
7308
  "x-category": ["transient"],
6382
7309
  "x-retryable": true
@@ -6388,7 +7315,6 @@ const payloadSchemas = {
6388
7315
  type: "string",
6389
7316
  enum: ["OnboardingReviewRequiredError"]
6390
7317
  },
6391
- operation: { type: "string" },
6392
7318
  code: {
6393
7319
  type: "string",
6394
7320
  enum: [
@@ -6434,7 +7360,6 @@ const payloadSchemas = {
6434
7360
  },
6435
7361
  required: [
6436
7362
  "_tag",
6437
- "operation",
6438
7363
  "code",
6439
7364
  "decision",
6440
7365
  "stage",
@@ -6451,14 +7376,12 @@ const payloadSchemas = {
6451
7376
  type: "string",
6452
7377
  enum: ["PaymentRequiredError"]
6453
7378
  },
6454
- operation: { type: "string" },
6455
7379
  resource: { type: "string" },
6456
7380
  currentUsage: { type: "number" },
6457
7381
  limit: { type: "number" }
6458
7382
  },
6459
7383
  required: [
6460
7384
  "_tag",
6461
- "operation",
6462
7385
  "resource",
6463
7386
  "currentUsage",
6464
7387
  "limit"
@@ -6474,14 +7397,9 @@ const payloadSchemas = {
6474
7397
  type: "string",
6475
7398
  enum: ["RateLimitedError"]
6476
7399
  },
6477
- operation: { type: "string" },
6478
7400
  retryAfterSeconds: { type: "number" }
6479
7401
  },
6480
- required: [
6481
- "_tag",
6482
- "operation",
6483
- "retryAfterSeconds"
6484
- ],
7402
+ required: ["_tag", "retryAfterSeconds"],
6485
7403
  additionalProperties: false,
6486
7404
  "x-category": ["throttling", "transient"],
6487
7405
  "x-retryable": true
@@ -6493,13 +7411,11 @@ const payloadSchemas = {
6493
7411
  type: "string",
6494
7412
  enum: ["ResourceNotFoundError"]
6495
7413
  },
6496
- operation: { type: "string" },
6497
7414
  resource: { type: "string" },
6498
7415
  id: { type: "string" }
6499
7416
  },
6500
7417
  required: [
6501
7418
  "_tag",
6502
- "operation",
6503
7419
  "resource",
6504
7420
  "id"
6505
7421
  ],
@@ -6514,14 +7430,9 @@ const payloadSchemas = {
6514
7430
  type: "string",
6515
7431
  enum: ["UnauthorizedError"]
6516
7432
  },
6517
- operation: { type: "string" },
6518
7433
  message: { type: "string" }
6519
7434
  },
6520
- required: [
6521
- "_tag",
6522
- "operation",
6523
- "message"
6524
- ],
7435
+ required: ["_tag", "message"],
6525
7436
  additionalProperties: false,
6526
7437
  "x-category": ["auth"],
6527
7438
  "x-retryable": false
@@ -6533,7 +7444,6 @@ const payloadSchemas = {
6533
7444
  type: "string",
6534
7445
  enum: ["ValidationError"]
6535
7446
  },
6536
- operation: { type: "string" },
6537
7447
  message: { type: "string" },
6538
7448
  fields: { anyOf: [{
6539
7449
  type: "object",
@@ -6543,34 +7453,10 @@ const payloadSchemas = {
6543
7453
  }
6544
7454
  }, { type: "null" }] }
6545
7455
  },
6546
- required: [
6547
- "_tag",
6548
- "operation",
6549
- "message"
6550
- ],
7456
+ required: ["_tag", "message"],
6551
7457
  additionalProperties: false,
6552
7458
  "x-category": ["validation"],
6553
7459
  "x-retryable": false
6554
- },
6555
- WebhookEnqueueError: {
6556
- type: "object",
6557
- properties: {
6558
- _tag: {
6559
- type: "string",
6560
- enum: ["WebhookEnqueueError"]
6561
- },
6562
- operation: { type: "string" },
6563
- reason: { type: "string" },
6564
- details: { anyOf: [{ type: "string" }, { type: "null" }] }
6565
- },
6566
- required: [
6567
- "_tag",
6568
- "operation",
6569
- "reason"
6570
- ],
6571
- additionalProperties: false,
6572
- "x-category": ["transient"],
6573
- "x-retryable": true
6574
7460
  }
6575
7461
  };
6576
7462
  const isRecord = (value) => typeof value === "object" && value !== null;
@@ -6648,6 +7534,19 @@ function fromApiError(error, context = {}) {
6648
7534
  * ```
6649
7535
  */
6650
7536
  const isObject = (value) => typeof value === "object" && value !== null;
7537
+ /**
7538
+ * The key a retry-safe call sends as `idempotency-key`: the `idempotencyKey`
7539
+ * option, else one the caller set in `headers`, else a fresh UUID. The
7540
+ * generated header parameter is applied after request headers, so it must carry
7541
+ * a caller-set header value rather than overwrite it.
7542
+ */
7543
+ function resolveIdempotencyKey(options) {
7544
+ const { idempotencyKey, ...requestOptions } = options ?? {};
7545
+ return {
7546
+ idempotencyKey: idempotencyKey ?? mergeHeaders(requestOptions.headers).get("idempotency-key") ?? crypto.randomUUID(),
7547
+ requestOptions
7548
+ };
7549
+ }
6651
7550
  function createPromiseMessagesTransport(clientInstance) {
6652
7551
  const boundMessages = createBoundService(Messages, clientInstance);
6653
7552
  return {
@@ -6658,10 +7557,16 @@ function createPromiseMessagesTransport(clientInstance) {
6658
7557
  getStatus: boundMessages.getStatus,
6659
7558
  getEvents: boundMessages.getEvents,
6660
7559
  validateEmail: boundMessages.validateEmail,
6661
- send: (input, options) => Messages.send({ emailSendMessagePayload: buildMessagesSendPayload(input) }, {
6662
- ...options,
6663
- client: clientInstance
6664
- })
7560
+ send: (input, options) => {
7561
+ const { idempotencyKey, requestOptions } = resolveIdempotencyKey(options);
7562
+ return Messages.send({
7563
+ "idempotency-key": idempotencyKey,
7564
+ emailSendMessagePayload: buildMessagesSendPayload(input)
7565
+ }, {
7566
+ ...requestOptions,
7567
+ client: clientInstance
7568
+ });
7569
+ }
6665
7570
  };
6666
7571
  }
6667
7572
  function createPromiseEmailTransport(clientInstance) {
@@ -6669,7 +7574,7 @@ function createPromiseEmailTransport(clientInstance) {
6669
7574
  return Object.assign(boundEmail, {
6670
7575
  addSender: (input, options) => {
6671
7576
  const { replyToEmails, ...sender } = input;
6672
- const { idempotencyKey = crypto.randomUUID(), ...requestOptions } = options ?? {};
7577
+ const { idempotencyKey, requestOptions } = resolveIdempotencyKey(options);
6673
7578
  return Email.addSender({
6674
7579
  "idempotency-key": idempotencyKey,
6675
7580
  ...sender,
@@ -6679,10 +7584,16 @@ function createPromiseEmailTransport(clientInstance) {
6679
7584
  client: clientInstance
6680
7585
  });
6681
7586
  },
6682
- send: (input, options) => Messages.send({ emailSendMessagePayload: buildEmailSendPayload(input) }, {
6683
- ...options,
6684
- client: clientInstance
6685
- })
7587
+ send: (input, options) => {
7588
+ const { idempotencyKey, requestOptions } = resolveIdempotencyKey(options);
7589
+ return Messages.send({
7590
+ "idempotency-key": idempotencyKey,
7591
+ emailSendMessagePayload: buildEmailSendPayload(input)
7592
+ }, {
7593
+ ...requestOptions,
7594
+ client: clientInstance
7595
+ });
7596
+ }
6686
7597
  });
6687
7598
  }
6688
7599
  function createPromiseTemplatesTransport(clientInstance) {
@@ -6763,7 +7674,12 @@ function createClient(config) {
6763
7674
  webhooks: createBoundService(Webhooks, clientInstance),
6764
7675
  operations: createBoundService(Operations, clientInstance),
6765
7676
  apiKeys: createBoundService(ApiKeys, clientInstance),
6766
- organizations: createBoundService(Organizations, clientInstance)
7677
+ organizations: createBoundService(Organizations, clientInstance),
7678
+ attachments: createBoundService(Attachments, clientInstance),
7679
+ contactGroups: createBoundService(ContactGroups, clientInstance),
7680
+ customFields: createBoundService(CustomFields, clientInstance),
7681
+ unsubscribeGroups: createBoundService(Unsubscribe, clientInstance),
7682
+ analytics: createBoundService(Analytics, clientInstance)
6767
7683
  };
6768
7684
  const promiseMessages = createPromiseMessagesTransport(clientInstance);
6769
7685
  const promiseEmail = createPromiseEmailTransport(clientInstance);
@@ -6781,10 +7697,15 @@ function createClient(config) {
6781
7697
  webhooks: createDirectService(raw.webhooks),
6782
7698
  operations: createDirectService(raw.operations),
6783
7699
  apiKeys: createDirectService(raw.apiKeys),
6784
- organizations: createDirectService(raw.organizations)
7700
+ organizations: createDirectService(raw.organizations),
7701
+ attachments: createDirectService(raw.attachments),
7702
+ contactGroups: createDirectService(raw.contactGroups),
7703
+ customFields: createDirectService(raw.customFields),
7704
+ unsubscribeGroups: createDirectService(raw.unsubscribeGroups),
7705
+ analytics: createDirectService(raw.analytics)
6785
7706
  };
6786
7707
  }
6787
7708
  //#endregion
6788
- export { WebhookEnqueueError as _, ExternalServiceError as a, InternalError as c, RateLimitedError as d, ResourceNotFoundError as f, ValidationError as g, UnauthorizedError as h, EmailChannelError as i, OnboardingReviewRequiredError as l, SamvaTransportError as m, BillingProviderError as n, FlagDisabledError as o, SamvaApiError as p, ConflictError as r, ForbiddenError as s, createClient as t, PaymentRequiredError as u, fromApiError as v };
7709
+ export { SamvaTransportError as _, DeliveryUnavailableError as a, fromApiError as b, FlagDisabledError as c, InternalError as d, OnboardingReviewRequiredError as f, SamvaApiError as g, ResourceNotFoundError as h, ConflictError as i, ForbiddenError as l, RateLimitedError as m, AnalyticsQueryError as n, EmailChannelError as o, PaymentRequiredError as p, BillingProviderError as r, ExternalServiceError as s, createClient as t, GatewayTimeoutError as u, UnauthorizedError as v, ValidationError as y };
6789
7710
 
6790
- //# sourceMappingURL=promises-CP_nxUus.js.map
7711
+ //# sourceMappingURL=promises-8MaPNAam.js.map