samva 0.4.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-CsUa8ojo.js → categories-4u9Az4No.js} +28 -8
  4. package/dist/client/sdk.gen.d.ts +545 -74
  5. package/dist/client/types.gen.d.ts +3907 -747
  6. package/dist/{client-BmZK_uCt.js → client-DCM6U0-I.js} +3061 -808
  7. package/dist/{client-attribution-BslSOa_8.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 +52 -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 +191 -44
  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 +931 -97
  30. package/dist/effect/email.js +27 -3
  31. package/dist/effect/generated-metadata.d.ts +16 -4
  32. package/dist/effect/generated.d.ts +19596 -10819
  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 +124 -26
  36. package/dist/effect/media.d.ts +8 -8
  37. package/dist/effect/media.js +1 -1
  38. package/dist/effect/messages.d.ts +473 -64
  39. package/dist/effect/messages.js +5 -3
  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 +96 -12
  46. package/dist/effect/scheduled-messages.js +5 -3
  47. package/dist/effect/templates.d.ts +35 -295
  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 +52 -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-B1knNlxk.js → operation-02YX3hY9.js} +144 -8
  57. package/dist/promises/errors.gen.d.ts +47 -39
  58. package/dist/promises/index.d.ts +19 -4
  59. package/dist/promises/index.js +2 -2
  60. package/dist/promises/types.gen.d.ts +1 -1
  61. package/dist/{promises-n1opem5V.js → promises-8MaPNAam.js} +1679 -267
  62. package/dist/service-map.d.ts +221 -8
  63. package/package.json +29 -9
@@ -1,5 +1,5 @@
1
- import { n as clientAttribution, t as CLIENT_ATTRIBUTION_HEADER } from "./client-attribution-BslSOa_8.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
@@ -671,14 +671,14 @@ const createClient$1 = (config = {}) => {
671
671
  };
672
672
  //#endregion
673
673
  //#region src/client/client.gen.ts
674
- const client = createClient$1(createConfig());
674
+ const client = createClient$1(createConfig({ baseUrl: "https://api.samva.dev" }));
675
675
  //#endregion
676
676
  //#region src/client/sdk.gen.ts
677
677
  var Messages = class {
678
678
  /**
679
679
  * List messages
680
680
  *
681
- * Returns a paginated list of messages across all channels, 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: [{
@@ -828,6 +832,61 @@ var Messages = class {
828
832
  });
829
833
  }
830
834
  /**
835
+ * Validate an email message
836
+ *
837
+ * Resolves recipients, sender, and inline or published-template content without sending anything, creating contacts or messages, or counting toward your quota.
838
+ */
839
+ static validateEmail(parameters, options) {
840
+ const params = buildClientParams([parameters], [{ args: [
841
+ {
842
+ in: "body",
843
+ key: "conversationId"
844
+ },
845
+ {
846
+ in: "body",
847
+ key: "metadata"
848
+ },
849
+ {
850
+ in: "body",
851
+ key: "channel"
852
+ },
853
+ {
854
+ in: "body",
855
+ key: "to"
856
+ },
857
+ {
858
+ in: "body",
859
+ key: "cc"
860
+ },
861
+ {
862
+ in: "body",
863
+ key: "bcc"
864
+ },
865
+ {
866
+ in: "body",
867
+ key: "from"
868
+ },
869
+ {
870
+ in: "body",
871
+ key: "email"
872
+ }
873
+ ] }]);
874
+ return (options?.client ?? client).post({
875
+ security: [{
876
+ name: "x-api-key",
877
+ type: "apiKey"
878
+ }],
879
+ url: "/v1/messages/validate/email",
880
+ ...options,
881
+ ...params,
882
+ headers: {
883
+ "Content-Type": "application/json",
884
+ ...options?.headers,
885
+ ...params.headers
886
+ }
887
+ });
888
+ }
889
+ /**
831
890
  * Get message delivery status
832
891
  *
833
892
  * Returns the current delivery status of a message by its ID.
@@ -872,7 +931,7 @@ var Operations = class {
872
931
  /**
873
932
  * List asynchronous operations
874
933
  *
875
- * Lists durable asynchronous operation state for the active organization.
934
+ * Lists asynchronous operations for the active organization.
876
935
  */
877
936
  static list(parameters, options) {
878
937
  const params = buildClientParams([parameters], [{ args: [
@@ -906,7 +965,7 @@ var Operations = class {
906
965
  /**
907
966
  * Get an asynchronous operation
908
967
  *
909
- * Returns one durable asynchronous operation from the active organization.
968
+ * Returns one asynchronous operation from the active organization.
910
969
  */
911
970
  static get(parameters, options) {
912
971
  const params = buildClientParams([parameters], [{ args: [{
@@ -926,7 +985,7 @@ var Operations = class {
926
985
  /**
927
986
  * Retry an asynchronous operation
928
987
  *
929
- * 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`.
930
989
  */
931
990
  static retry(parameters, options) {
932
991
  const params = buildClientParams([parameters], [{ args: [{
@@ -978,7 +1037,7 @@ var ScheduledMessages = class {
978
1037
  /**
979
1038
  * Schedule a message
980
1039
  *
981
- * 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.
982
1041
  */
983
1042
  static create(parameters, options) {
984
1043
  const params = buildClientParams([parameters], [{ args: [
@@ -1058,12 +1117,40 @@ var ScheduledMessages = class {
1058
1117
  ...params
1059
1118
  });
1060
1119
  }
1120
+ /**
1121
+ * Resume a review-paused scheduled message
1122
+ *
1123
+ * Explicitly resumes a scheduled message after onboarding review clearance. An overdue message requires either send_now or a new future scheduledFor value.
1124
+ */
1125
+ static resume(parameters, options) {
1126
+ const params = buildClientParams([parameters], [{ args: [{
1127
+ in: "path",
1128
+ key: "id"
1129
+ }, {
1130
+ key: "body",
1131
+ map: "body"
1132
+ }] }]);
1133
+ return (options?.client ?? client).post({
1134
+ security: [{
1135
+ name: "x-api-key",
1136
+ type: "apiKey"
1137
+ }],
1138
+ url: "/v1/messages/scheduled/{id}/resume",
1139
+ ...options,
1140
+ ...params,
1141
+ headers: {
1142
+ "Content-Type": "application/json",
1143
+ ...options?.headers,
1144
+ ...params.headers
1145
+ }
1146
+ });
1147
+ }
1061
1148
  };
1062
1149
  var Campaigns = class {
1063
1150
  /**
1064
1151
  * List campaigns
1065
1152
  *
1066
- * 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.
1067
1154
  */
1068
1155
  static list(parameters, options) {
1069
1156
  const params = buildClientParams([parameters], [{ args: [
@@ -1357,7 +1444,7 @@ var Campaigns = class {
1357
1444
  /**
1358
1445
  * Cancel a campaign run
1359
1446
  *
1360
- * 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.
1361
1448
  */
1362
1449
  static cancelRun(parameters, options) {
1363
1450
  const params = buildClientParams([parameters], [{ args: [{
@@ -1417,10 +1504,85 @@ var Campaigns = class {
1417
1504
  }
1418
1505
  };
1419
1506
  var Email = class {
1507
+ /**
1508
+ * Get email onboarding review status
1509
+ *
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.
1511
+ */
1512
+ static getOnboardingReview(options) {
1513
+ return (options?.client ?? client).get({
1514
+ security: [{
1515
+ name: "x-api-key",
1516
+ type: "apiKey"
1517
+ }],
1518
+ url: "/v1/email/onboarding-review",
1519
+ ...options
1520
+ });
1521
+ }
1522
+ /**
1523
+ * Reapply for email onboarding review
1524
+ *
1525
+ * Allows an organization owner or admin to submit a rejected organization for review again. The expected generation prevents acting on stale status.
1526
+ */
1527
+ static reapplyOnboardingReview(parameters, options) {
1528
+ const params = buildClientParams([parameters], [{ args: [{
1529
+ in: "body",
1530
+ key: "expectedGeneration"
1531
+ }] }]);
1532
+ return (options?.client ?? client).post({
1533
+ security: [{
1534
+ name: "x-api-key",
1535
+ type: "apiKey"
1536
+ }],
1537
+ url: "/v1/email/onboarding-review/reapply",
1538
+ ...options,
1539
+ ...params,
1540
+ headers: {
1541
+ "Content-Type": "application/json",
1542
+ ...options?.headers,
1543
+ ...params.headers
1544
+ }
1545
+ });
1546
+ }
1547
+ /**
1548
+ * Respond to an email onboarding information request
1549
+ *
1550
+ * Allows organization owners and admins to submit a text response and up to three evidence uploads for the current information request.
1551
+ */
1552
+ static respondToOnboardingInformationRequest(parameters, options) {
1553
+ const params = buildClientParams([parameters], [{ args: [
1554
+ {
1555
+ in: "body",
1556
+ key: "expectedGeneration"
1557
+ },
1558
+ {
1559
+ in: "body",
1560
+ key: "responseText"
1561
+ },
1562
+ {
1563
+ in: "body",
1564
+ key: "evidenceMediaIds"
1565
+ }
1566
+ ] }]);
1567
+ return (options?.client ?? client).post({
1568
+ security: [{
1569
+ name: "x-api-key",
1570
+ type: "apiKey"
1571
+ }],
1572
+ url: "/v1/email/onboarding-review/respond",
1573
+ ...options,
1574
+ ...params,
1575
+ headers: {
1576
+ "Content-Type": "application/json",
1577
+ ...options?.headers,
1578
+ ...params.headers
1579
+ }
1580
+ });
1581
+ }
1420
1582
  /**
1421
1583
  * Get email tracking defaults
1422
1584
  *
1423
- * 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.
1424
1586
  */
1425
1587
  static getTrackingDefaults(options) {
1426
1588
  return (options?.client ?? client).get({
@@ -1511,7 +1673,7 @@ var Email = class {
1511
1673
  /**
1512
1674
  * List sending domains
1513
1675
  *
1514
- * 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.
1515
1677
  */
1516
1678
  static listDomains(parameters, options) {
1517
1679
  const params = buildClientParams([parameters], [{ args: [{
@@ -1534,7 +1696,7 @@ var Email = class {
1534
1696
  /**
1535
1697
  * Add a sending domain
1536
1698
  *
1537
- * 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.
1538
1700
  */
1539
1701
  static addDomain(parameters, options) {
1540
1702
  const params = buildClientParams([parameters], [{ args: [{
@@ -1562,7 +1724,7 @@ var Email = class {
1562
1724
  /**
1563
1725
  * Get domain verification
1564
1726
  *
1565
- * 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.
1566
1728
  */
1567
1729
  static getDomainVerification(parameters, options) {
1568
1730
  const params = buildClientParams([parameters], [{ args: [{
@@ -1582,7 +1744,7 @@ var Email = class {
1582
1744
  /**
1583
1745
  * Advance domain verification
1584
1746
  *
1585
- * 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.
1586
1748
  */
1587
1749
  static advanceDomainVerification(parameters, options) {
1588
1750
  const params = buildClientParams([parameters], [{ args: [{
@@ -1600,6 +1762,29 @@ var Email = class {
1600
1762
  });
1601
1763
  }
1602
1764
  /**
1765
+ * Stage a DKIM selector rotation
1766
+ *
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`.
1768
+ */
1769
+ static rotateDomainDkim(parameters, options) {
1770
+ const params = buildClientParams([parameters], [{ args: [{
1771
+ in: "headers",
1772
+ key: "idempotency-key"
1773
+ }, {
1774
+ in: "path",
1775
+ key: "id"
1776
+ }] }]);
1777
+ return (options?.client ?? client).post({
1778
+ security: [{
1779
+ name: "x-api-key",
1780
+ type: "apiKey"
1781
+ }],
1782
+ url: "/v1/email/domains/{id}/dkim-rotation",
1783
+ ...options,
1784
+ ...params
1785
+ });
1786
+ }
1787
+ /**
1603
1788
  * Remove a sending domain
1604
1789
  *
1605
1790
  * Permanently deletes a sending domain from the organization.
@@ -1721,7 +1906,7 @@ var Email = class {
1721
1906
  /**
1722
1907
  * Complete a one-click DNS return
1723
1908
  *
1724
- * 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.
1725
1910
  */
1726
1911
  static completeDomainConnect(parameters, options) {
1727
1912
  const params = buildClientParams([parameters], [{ args: [
@@ -1736,6 +1921,10 @@ var Email = class {
1736
1921
  {
1737
1922
  in: "body",
1738
1923
  key: "error"
1924
+ },
1925
+ {
1926
+ in: "body",
1927
+ key: "errorDescription"
1739
1928
  }
1740
1929
  ] }]);
1741
1930
  return (options?.client ?? client).post({
@@ -1756,7 +1945,7 @@ var Email = class {
1756
1945
  /**
1757
1946
  * Enable inbound email for a domain
1758
1947
  *
1759
- * 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.
1760
1949
  */
1761
1950
  static enableReceiving(parameters, options) {
1762
1951
  const params = buildClientParams([parameters], [{ args: [
@@ -1954,7 +2143,7 @@ var Email = class {
1954
2143
  /**
1955
2144
  * Enable a custom tracking domain
1956
2145
  *
1957
- * 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.
1958
2147
  */
1959
2148
  static enableCustomTracking(parameters, options) {
1960
2149
  const params = buildClientParams([parameters], [{ args: [{
@@ -2002,7 +2191,7 @@ var Email = class {
2002
2191
  /**
2003
2192
  * Build an automatic Custom Tracking Domain apply URL
2004
2193
  *
2005
- * 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.
2006
2195
  */
2007
2196
  static buildCustomTrackingDomainConnectApplyUrl(parameters, options) {
2008
2197
  const params = buildClientParams([parameters], [{ args: [{
@@ -2022,7 +2211,7 @@ var Email = class {
2022
2211
  /**
2023
2212
  * Complete an automatic Custom Tracking Domain return
2024
2213
  *
2025
- * 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.
2026
2215
  */
2027
2216
  static completeCustomTrackingDomainConnect(parameters, options) {
2028
2217
  const params = buildClientParams([parameters], [{ args: [
@@ -2037,6 +2226,10 @@ var Email = class {
2037
2226
  {
2038
2227
  in: "body",
2039
2228
  key: "error"
2229
+ },
2230
+ {
2231
+ in: "body",
2232
+ key: "errorDescription"
2040
2233
  }
2041
2234
  ] }]);
2042
2235
  return (options?.client ?? client).post({
@@ -2057,7 +2250,7 @@ var Email = class {
2057
2250
  /**
2058
2251
  * List sender identities
2059
2252
  *
2060
- * 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.
2061
2254
  */
2062
2255
  static listSenders(parameters, options) {
2063
2256
  const params = buildClientParams([parameters], [{ args: [
@@ -2095,7 +2288,7 @@ var Email = class {
2095
2288
  /**
2096
2289
  * Add a sender identity
2097
2290
  *
2098
- * 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.
2099
2292
  */
2100
2293
  static addSender(parameters, options) {
2101
2294
  const params = buildClientParams([parameters], [{ args: [
@@ -2158,7 +2351,7 @@ var Email = class {
2158
2351
  /**
2159
2352
  * Remove a sender identity
2160
2353
  *
2161
- * 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.
2162
2355
  */
2163
2356
  static removeSender(parameters, options) {
2164
2357
  const params = buildClientParams([parameters], [{ args: [{
@@ -2176,6 +2369,26 @@ var Email = class {
2176
2369
  });
2177
2370
  }
2178
2371
  /**
2372
+ * Get a sender identity
2373
+ *
2374
+ * Returns one sender identity owned by the authenticated organization. Other organizations' ids are reported as not found.
2375
+ */
2376
+ static getSender(parameters, options) {
2377
+ const params = buildClientParams([parameters], [{ args: [{
2378
+ in: "path",
2379
+ key: "id"
2380
+ }] }]);
2381
+ return (options?.client ?? client).get({
2382
+ security: [{
2383
+ name: "x-api-key",
2384
+ type: "apiKey"
2385
+ }],
2386
+ url: "/v1/email/senders/{id}",
2387
+ ...options,
2388
+ ...params
2389
+ });
2390
+ }
2391
+ /**
2179
2392
  * Set the organization default sender
2180
2393
  *
2181
2394
  * Marks a verified, active sender as the organization default, atomically clearing any previous default. Used for omitted-`from` sends when no default domain sender applies.
@@ -2221,7 +2434,7 @@ var Email = class {
2221
2434
  /**
2222
2435
  * Enable catch-all receiving
2223
2436
  *
2224
- * 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.
2225
2438
  */
2226
2439
  static enableCatchAll(parameters, options) {
2227
2440
  const params = buildClientParams([parameters], [{ args: [{
@@ -2352,7 +2565,7 @@ var Email = class {
2352
2565
  /**
2353
2566
  * List suppressed addresses
2354
2567
  *
2355
- * 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.
2356
2569
  */
2357
2570
  static listSuppressions(parameters, options) {
2358
2571
  const params = buildClientParams([parameters], [{ args: [
@@ -2390,7 +2603,7 @@ var Email = class {
2390
2603
  /**
2391
2604
  * Remove a suppressed address
2392
2605
  *
2393
- * 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.
2394
2607
  */
2395
2608
  static removeSuppression(parameters, options) {
2396
2609
  const params = buildClientParams([parameters], [{ args: [{
@@ -2848,34 +3061,52 @@ var Email = class {
2848
3061
  ...params
2849
3062
  });
2850
3063
  }
2851
- };
2852
- var Media = class {
2853
3064
  /**
2854
- * Create a media object
3065
+ * Get domain warming
2855
3066
  *
2856
- * Creates the media object in the pending state and returns it with the upload instruction — URL, method, and headers — for putting its bytes into storage.
3067
+ * Returns the domain's automated warming policy, its system-created 24-hour windows and policy snapshots, the rolling bounce and complaint window the safety rule reads, every pause above the plan, and the decision history. A domain without a plan returns the evidence and a null plan.
2857
3068
  */
2858
- static create(parameters, options) {
3069
+ static getDomainWarming(parameters, options) {
3070
+ const params = buildClientParams([parameters], [{ args: [{
3071
+ in: "path",
3072
+ key: "id"
3073
+ }] }]);
3074
+ return (options?.client ?? client).get({
3075
+ security: [{
3076
+ name: "x-api-key",
3077
+ type: "apiKey"
3078
+ }],
3079
+ url: "/v1/email/domains/{id}/warming",
3080
+ ...options,
3081
+ ...params
3082
+ });
3083
+ }
3084
+ /**
3085
+ * Start domain warming
3086
+ *
3087
+ * Starts an automated warming policy on a verified sending domain. Samva opens the first 24-hour campaign window immediately, then opens later windows from the saved growth policy after safe windows close. Direct sends are counted in the domain's window but never delayed. Responds with 201.
3088
+ */
3089
+ static createDomainWarmingPlan(parameters, options) {
2859
3090
  const params = buildClientParams([parameters], [{ args: [
2860
3091
  {
2861
- in: "body",
2862
- key: "filename"
3092
+ in: "path",
3093
+ key: "id"
2863
3094
  },
2864
3095
  {
2865
3096
  in: "body",
2866
- key: "contentType"
3097
+ key: "identity"
2867
3098
  },
2868
3099
  {
2869
3100
  in: "body",
2870
- key: "sizeBytes"
3101
+ key: "initialDailyRecipients"
2871
3102
  },
2872
3103
  {
2873
3104
  in: "body",
2874
- key: "purpose"
3105
+ key: "dailyGrowthPercent"
2875
3106
  },
2876
3107
  {
2877
3108
  in: "body",
2878
- key: "checksumSha256"
3109
+ key: "targetDailyRecipients"
2879
3110
  }
2880
3111
  ] }]);
2881
3112
  return (options?.client ?? client).post({
@@ -2883,7 +3114,7 @@ var Media = class {
2883
3114
  name: "x-api-key",
2884
3115
  type: "apiKey"
2885
3116
  }],
2886
- url: "/v1/media",
3117
+ url: "/v1/email/domains/{id}/warming",
2887
3118
  ...options,
2888
3119
  ...params,
2889
3120
  headers: {
@@ -2894,64 +3125,255 @@ var Media = class {
2894
3125
  });
2895
3126
  }
2896
3127
  /**
2897
- * Complete a media upload
3128
+ * Update domain warming policy
2898
3129
  *
2899
- * Verifies the uploaded object exists in storage, marks the media object ready, and returns it with a download URL.
3130
+ * Updates the growth percentage and daily target Samva uses for future 24-hour warming windows. Existing windows keep their policy snapshot, including a scheduled window, so prior authorization remains auditable.
2900
3131
  */
2901
- static complete(parameters, options) {
2902
- const params = buildClientParams([parameters], [{ args: [{
2903
- in: "path",
2904
- key: "mediaId"
2905
- }] }]);
2906
- return (options?.client ?? client).post({
3132
+ static updateDomainWarmingPolicy(parameters, options) {
3133
+ const params = buildClientParams([parameters], [{ args: [
3134
+ {
3135
+ in: "path",
3136
+ key: "id"
3137
+ },
3138
+ {
3139
+ in: "body",
3140
+ key: "dailyGrowthPercent"
3141
+ },
3142
+ {
3143
+ in: "body",
3144
+ key: "targetDailyRecipients"
3145
+ },
3146
+ {
3147
+ in: "body",
3148
+ key: "note"
3149
+ }
3150
+ ] }]);
3151
+ return (options?.client ?? client).patch({
2907
3152
  security: [{
2908
3153
  name: "x-api-key",
2909
3154
  type: "apiKey"
2910
3155
  }],
2911
- url: "/v1/media/{mediaId}/complete",
3156
+ url: "/v1/email/domains/{id}/warming/policy",
2912
3157
  ...options,
2913
- ...params
3158
+ ...params,
3159
+ headers: {
3160
+ "Content-Type": "application/json",
3161
+ ...options?.headers,
3162
+ ...params.headers
3163
+ }
2914
3164
  });
2915
3165
  }
2916
3166
  /**
2917
- * Delete a media object
3167
+ * Cancel a warming window
2918
3168
  *
2919
- * Deletes a pending media object and the bytes stored for it. Fails if the media object is already ready.
3169
+ * Cancels a scheduled or open system-created warming window. Recipients a campaign run already reserved from it stay reserved; no further runs draw from it.
2920
3170
  */
2921
- static remove(parameters, options) {
3171
+ static cancelDomainWarmingBatch(parameters, options) {
2922
3172
  const params = buildClientParams([parameters], [{ args: [{
2923
3173
  in: "path",
2924
- key: "mediaId"
3174
+ key: "id"
3175
+ }, {
3176
+ in: "path",
3177
+ key: "batchId"
2925
3178
  }] }]);
2926
3179
  return (options?.client ?? client).delete({
2927
3180
  security: [{
2928
3181
  name: "x-api-key",
2929
3182
  type: "apiKey"
2930
3183
  }],
2931
- url: "/v1/media/{mediaId}",
3184
+ url: "/v1/email/domains/{id}/warming/batches/{batchId}",
2932
3185
  ...options,
2933
3186
  ...params
2934
3187
  });
2935
3188
  }
2936
3189
  /**
2937
- * Get a media object
3190
+ * Pause domain warming
2938
3191
  *
2939
- * Returns the media object's metadata, including status, dimensions, and confirmation timestamps.
3192
+ * Pauses the plan. Campaign runs from the domain stop at their next page and queued campaign email waits until it expires; direct sends are unaffected.
2940
3193
  */
2941
- static getById(parameters, options) {
3194
+ static pauseDomainWarming(parameters, options) {
2942
3195
  const params = buildClientParams([parameters], [{ args: [{
2943
3196
  in: "path",
2944
- key: "mediaId"
3197
+ key: "id"
3198
+ }, {
3199
+ in: "body",
3200
+ key: "note"
2945
3201
  }] }]);
2946
- return (options?.client ?? client).get({
3202
+ return (options?.client ?? client).post({
2947
3203
  security: [{
2948
3204
  name: "x-api-key",
2949
3205
  type: "apiKey"
2950
3206
  }],
2951
- url: "/v1/media/{mediaId}",
3207
+ url: "/v1/email/domains/{id}/warming/pause",
2952
3208
  ...options,
2953
- ...params
2954
- });
3209
+ ...params,
3210
+ headers: {
3211
+ "Content-Type": "application/json",
3212
+ ...options?.headers,
3213
+ ...params.headers
3214
+ }
3215
+ });
3216
+ }
3217
+ /**
3218
+ * Resume domain warming
3219
+ *
3220
+ * Resumes a paused or held plan and the campaign runs it was holding. A plan the domain rule held resumes only once the domain's rolling window is under both limits again; until then the request is refused with the observed rate.
3221
+ */
3222
+ static resumeDomainWarming(parameters, options) {
3223
+ const params = buildClientParams([parameters], [{ args: [{
3224
+ in: "path",
3225
+ key: "id"
3226
+ }, {
3227
+ in: "body",
3228
+ key: "note"
3229
+ }] }]);
3230
+ return (options?.client ?? client).post({
3231
+ security: [{
3232
+ name: "x-api-key",
3233
+ type: "apiKey"
3234
+ }],
3235
+ url: "/v1/email/domains/{id}/warming/resume",
3236
+ ...options,
3237
+ ...params,
3238
+ headers: {
3239
+ "Content-Type": "application/json",
3240
+ ...options?.headers,
3241
+ ...params.headers
3242
+ }
3243
+ });
3244
+ }
3245
+ /**
3246
+ * Complete domain warming
3247
+ *
3248
+ * Ends the policy. Campaign runs from the domain are no longer gated by warming windows; the organization safeguards still apply.
3249
+ */
3250
+ static completeDomainWarming(parameters, options) {
3251
+ const params = buildClientParams([parameters], [{ args: [{
3252
+ in: "path",
3253
+ key: "id"
3254
+ }, {
3255
+ in: "body",
3256
+ key: "note"
3257
+ }] }]);
3258
+ return (options?.client ?? client).post({
3259
+ security: [{
3260
+ name: "x-api-key",
3261
+ type: "apiKey"
3262
+ }],
3263
+ url: "/v1/email/domains/{id}/warming/complete",
3264
+ ...options,
3265
+ ...params,
3266
+ headers: {
3267
+ "Content-Type": "application/json",
3268
+ ...options?.headers,
3269
+ ...params.headers
3270
+ }
3271
+ });
3272
+ }
3273
+ };
3274
+ var Media = class {
3275
+ /**
3276
+ * Create a media object
3277
+ *
3278
+ * Creates the media object in the pending state and returns it with the upload instruction — URL, method, and headers — for putting its bytes into storage.
3279
+ */
3280
+ static create(parameters, options) {
3281
+ const params = buildClientParams([parameters], [{ args: [
3282
+ {
3283
+ in: "body",
3284
+ key: "filename"
3285
+ },
3286
+ {
3287
+ in: "body",
3288
+ key: "contentType"
3289
+ },
3290
+ {
3291
+ in: "body",
3292
+ key: "sizeBytes"
3293
+ },
3294
+ {
3295
+ in: "body",
3296
+ key: "purpose"
3297
+ },
3298
+ {
3299
+ in: "body",
3300
+ key: "checksumSha256"
3301
+ }
3302
+ ] }]);
3303
+ return (options?.client ?? client).post({
3304
+ security: [{
3305
+ name: "x-api-key",
3306
+ type: "apiKey"
3307
+ }],
3308
+ url: "/v1/media",
3309
+ ...options,
3310
+ ...params,
3311
+ headers: {
3312
+ "Content-Type": "application/json",
3313
+ ...options?.headers,
3314
+ ...params.headers
3315
+ }
3316
+ });
3317
+ }
3318
+ /**
3319
+ * Complete a media upload
3320
+ *
3321
+ * Verifies the uploaded object exists in storage, marks the media object ready, and returns it with a download URL.
3322
+ */
3323
+ static complete(parameters, options) {
3324
+ const params = buildClientParams([parameters], [{ args: [{
3325
+ in: "path",
3326
+ key: "mediaId"
3327
+ }] }]);
3328
+ return (options?.client ?? client).post({
3329
+ security: [{
3330
+ name: "x-api-key",
3331
+ type: "apiKey"
3332
+ }],
3333
+ url: "/v1/media/{mediaId}/complete",
3334
+ ...options,
3335
+ ...params
3336
+ });
3337
+ }
3338
+ /**
3339
+ * Delete a media object
3340
+ *
3341
+ * Deletes a pending media object and the bytes stored for it. Fails if the media object is already ready.
3342
+ */
3343
+ static remove(parameters, options) {
3344
+ const params = buildClientParams([parameters], [{ args: [{
3345
+ in: "path",
3346
+ key: "mediaId"
3347
+ }] }]);
3348
+ return (options?.client ?? client).delete({
3349
+ security: [{
3350
+ name: "x-api-key",
3351
+ type: "apiKey"
3352
+ }],
3353
+ url: "/v1/media/{mediaId}",
3354
+ ...options,
3355
+ ...params
3356
+ });
3357
+ }
3358
+ /**
3359
+ * Get a media object
3360
+ *
3361
+ * Returns the media object's metadata, including status, dimensions, and confirmation timestamps.
3362
+ */
3363
+ static getById(parameters, options) {
3364
+ const params = buildClientParams([parameters], [{ args: [{
3365
+ in: "path",
3366
+ key: "mediaId"
3367
+ }] }]);
3368
+ return (options?.client ?? client).get({
3369
+ security: [{
3370
+ name: "x-api-key",
3371
+ type: "apiKey"
3372
+ }],
3373
+ url: "/v1/media/{mediaId}",
3374
+ ...options,
3375
+ ...params
3376
+ });
2955
3377
  }
2956
3378
  /**
2957
3379
  * Get a media download URL
@@ -2974,6 +3396,91 @@ var Media = class {
2974
3396
  });
2975
3397
  }
2976
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
+ };
2977
3484
  var Conversations = class {
2978
3485
  /**
2979
3486
  * List conversations
@@ -3479,7 +3986,7 @@ var Contacts = class {
3479
3986
  /**
3480
3987
  * Find a contact
3481
3988
  *
3482
- * Samva API operation.
3989
+ * Looks up a single contact by email address or external ID and returns null when no contact matches.
3483
3990
  */
3484
3991
  static find(parameters, options) {
3485
3992
  const params = buildClientParams([parameters], [{ args: [
@@ -3913,9 +4420,889 @@ var Contacts = class {
3913
4420
  name: "x-api-key",
3914
4421
  type: "apiKey"
3915
4422
  }],
3916
- url: "/v1/contacts/{id}/groups",
4423
+ url: "/v1/contacts/{id}/groups",
4424
+ ...options,
4425
+ ...params
4426
+ });
4427
+ }
4428
+ };
4429
+ var ContactGroups = class {
4430
+ /**
4431
+ * List contact groups
4432
+ *
4433
+ * Returns a paginated list of contact groups for the organization, filterable by type and active state.
4434
+ */
4435
+ static list(parameters, options) {
4436
+ const params = buildClientParams([parameters], [{ args: [
4437
+ {
4438
+ in: "query",
4439
+ key: "page"
4440
+ },
4441
+ {
4442
+ in: "query",
4443
+ key: "limit"
4444
+ },
4445
+ {
4446
+ in: "query",
4447
+ key: "type"
4448
+ },
4449
+ {
4450
+ in: "query",
4451
+ key: "isActive"
4452
+ }
4453
+ ] }]);
4454
+ return (options?.client ?? client).get({
4455
+ security: [{
4456
+ name: "x-api-key",
4457
+ type: "apiKey"
4458
+ }],
4459
+ url: "/v1/contact-groups",
4460
+ ...options,
4461
+ ...params
4462
+ });
4463
+ }
4464
+ /**
4465
+ * Create a contact group
4466
+ *
4467
+ * Creates a new contact group and returns it with a 201 status.
4468
+ */
4469
+ static create(parameters, options) {
4470
+ const params = buildClientParams([parameters], [{ args: [
4471
+ {
4472
+ in: "body",
4473
+ key: "name"
4474
+ },
4475
+ {
4476
+ in: "body",
4477
+ key: "description"
4478
+ },
4479
+ {
4480
+ in: "body",
4481
+ key: "type"
4482
+ },
4483
+ {
4484
+ in: "body",
4485
+ key: "criteria"
4486
+ },
4487
+ {
4488
+ in: "body",
4489
+ key: "color"
4490
+ },
4491
+ {
4492
+ in: "body",
4493
+ key: "icon"
4494
+ },
4495
+ {
4496
+ in: "body",
4497
+ key: "parentGroupId"
4498
+ },
4499
+ {
4500
+ in: "body",
4501
+ key: "isActive"
4502
+ }
4503
+ ] }]);
4504
+ return (options?.client ?? client).post({
4505
+ security: [{
4506
+ name: "x-api-key",
4507
+ type: "apiKey"
4508
+ }],
4509
+ url: "/v1/contact-groups",
4510
+ ...options,
4511
+ ...params,
4512
+ headers: {
4513
+ "Content-Type": "application/json",
4514
+ ...options?.headers,
4515
+ ...params.headers
4516
+ }
4517
+ });
4518
+ }
4519
+ /**
4520
+ * Delete a contact group
4521
+ *
4522
+ * Permanently deletes a contact group by its ID.
4523
+ */
4524
+ static remove(parameters, options) {
4525
+ const params = buildClientParams([parameters], [{ args: [{
4526
+ in: "path",
4527
+ key: "id"
4528
+ }] }]);
4529
+ return (options?.client ?? client).delete({
4530
+ security: [{
4531
+ name: "x-api-key",
4532
+ type: "apiKey"
4533
+ }],
4534
+ url: "/v1/contact-groups/{id}",
4535
+ ...options,
4536
+ ...params
4537
+ });
4538
+ }
4539
+ /**
4540
+ * Get a contact group
4541
+ *
4542
+ * Returns a single contact group by its ID.
4543
+ */
4544
+ static getById(parameters, options) {
4545
+ const params = buildClientParams([parameters], [{ args: [{
4546
+ in: "path",
4547
+ key: "id"
4548
+ }] }]);
4549
+ return (options?.client ?? client).get({
4550
+ security: [{
4551
+ name: "x-api-key",
4552
+ type: "apiKey"
4553
+ }],
4554
+ url: "/v1/contact-groups/{id}",
4555
+ ...options,
4556
+ ...params
4557
+ });
4558
+ }
4559
+ /**
4560
+ * Update a contact group
4561
+ *
4562
+ * Updates an existing contact group's fields and returns the updated group.
4563
+ */
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({
4604
+ security: [{
4605
+ name: "x-api-key",
4606
+ type: "apiKey"
4607
+ }],
4608
+ url: "/v1/contact-groups/{id}",
4609
+ ...options,
4610
+ ...params,
4611
+ headers: {
4612
+ "Content-Type": "application/json",
4613
+ ...options?.headers,
4614
+ ...params.headers
4615
+ }
4616
+ });
4617
+ }
4618
+ /**
4619
+ * Remove members from a contact group
4620
+ *
4621
+ * Removes one or more contacts from a contact group, returning the count of removed members.
4622
+ */
4623
+ static removeMembers(parameters, options) {
4624
+ const params = buildClientParams([parameters], [{ args: [{
4625
+ in: "path",
4626
+ key: "groupId"
4627
+ }, {
4628
+ in: "body",
4629
+ key: "contactIds"
4630
+ }] }]);
4631
+ return (options?.client ?? client).delete({
4632
+ security: [{
4633
+ name: "x-api-key",
4634
+ type: "apiKey"
4635
+ }],
4636
+ url: "/v1/contact-groups/{groupId}/members",
4637
+ ...options,
4638
+ ...params,
4639
+ headers: {
4640
+ "Content-Type": "application/json",
4641
+ ...options?.headers,
4642
+ ...params.headers
4643
+ }
4644
+ });
4645
+ }
4646
+ /**
4647
+ * List members of a contact group
4648
+ *
4649
+ * Returns a paginated list of contacts belonging to a contact group.
4650
+ */
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
+ ] }]);
4666
+ return (options?.client ?? client).get({
4667
+ security: [{
4668
+ name: "x-api-key",
4669
+ type: "apiKey"
4670
+ }],
4671
+ url: "/v1/contact-groups/{groupId}/members",
4672
+ ...options,
4673
+ ...params
4674
+ });
4675
+ }
4676
+ /**
4677
+ * Add members to a contact group
4678
+ *
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",
3917
5299
  ...options,
3918
- ...params
5300
+ ...params,
5301
+ headers: {
5302
+ "Content-Type": "application/json",
5303
+ ...options?.headers,
5304
+ ...params.headers
5305
+ }
3919
5306
  });
3920
5307
  }
3921
5308
  };
@@ -4026,60 +5413,6 @@ var Templates = class {
4026
5413
  });
4027
5414
  }
4028
5415
  /**
4029
- * List templates for the dashboard
4030
- *
4031
- * Returns a paginated dashboard view that groups related channel templates into families and leaves standalone templates ungrouped.
4032
- */
4033
- static listDashboard(parameters, options) {
4034
- const params = buildClientParams([parameters], [{ args: [
4035
- {
4036
- in: "query",
4037
- key: "page"
4038
- },
4039
- {
4040
- in: "query",
4041
- key: "limit"
4042
- },
4043
- {
4044
- in: "query",
4045
- key: "allowedChannels"
4046
- },
4047
- {
4048
- in: "query",
4049
- key: "category"
4050
- },
4051
- {
4052
- in: "query",
4053
- key: "channel"
4054
- },
4055
- {
4056
- in: "query",
4057
- key: "status"
4058
- },
4059
- {
4060
- in: "query",
4061
- key: "search"
4062
- },
4063
- {
4064
- in: "query",
4065
- key: "sortBy"
4066
- },
4067
- {
4068
- in: "query",
4069
- key: "sortOrder"
4070
- }
4071
- ] }]);
4072
- return (options?.client ?? client).get({
4073
- security: [{
4074
- name: "x-api-key",
4075
- type: "apiKey"
4076
- }],
4077
- url: "/v1/templates/dashboard",
4078
- ...options,
4079
- ...params
4080
- });
4081
- }
4082
- /**
4083
5416
  * List template families
4084
5417
  *
4085
5418
  * Returns a paginated list of the organization's template families and members.
@@ -4379,7 +5712,7 @@ var Templates = class {
4379
5712
  /**
4380
5713
  * Open a template project workspace
4381
5714
  *
4382
- * 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.
4383
5716
  */
4384
5717
  static openWorkspace(parameters, options) {
4385
5718
  const params = buildClientParams([parameters], [{ args: [{
@@ -4427,7 +5760,7 @@ var Templates = class {
4427
5760
  /**
4428
5761
  * Reconcile a template project workspace
4429
5762
  *
4430
- * 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.
4431
5764
  */
4432
5765
  static reconcileWorkspace(parameters, options) {
4433
5766
  const params = buildClientParams([parameters], [{ args: [
@@ -4513,7 +5846,7 @@ var Templates = class {
4513
5846
  /**
4514
5847
  * Save a template project workspace
4515
5848
  *
4516
- * 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.
4517
5850
  */
4518
5851
  static saveWorkspace(parameters, options) {
4519
5852
  const params = buildClientParams([parameters], [{ args: [
@@ -4595,7 +5928,7 @@ var Templates = class {
4595
5928
  /**
4596
5929
  * List template project commit history
4597
5930
  *
4598
- * Returns bounded history from the Artifact repository default branch.
5931
+ * Returns recent history from the template repository's default branch.
4599
5932
  */
4600
5933
  static workspaceHistory(parameters, options) {
4601
5934
  const params = buildClientParams([parameters], [{ args: [{
@@ -4810,7 +6143,7 @@ var Templates = class {
4810
6143
  /**
4811
6144
  * Issue a template project Git credential
4812
6145
  *
4813
- * 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.
4814
6147
  */
4815
6148
  static issueGitCredential(parameters, options) {
4816
6149
  const params = buildClientParams([parameters], [{ args: [{
@@ -4960,7 +6293,7 @@ var Webhooks = class {
4960
6293
  /**
4961
6294
  * List webhooks
4962
6295
  *
4963
- * Returns a paginated list of the organization's webhook endpoints, optionally filtered by a name search.
6296
+ * Returns a paginated list of the organization's webhook endpoints with each endpoint's delivery counts, optionally filtered by name search and status.
4964
6297
  */
4965
6298
  static list(parameters, options) {
4966
6299
  const params = buildClientParams([parameters], [{ args: [
@@ -4975,6 +6308,10 @@ var Webhooks = class {
4975
6308
  {
4976
6309
  in: "query",
4977
6310
  key: "search"
6311
+ },
6312
+ {
6313
+ in: "query",
6314
+ key: "status"
4978
6315
  }
4979
6316
  ] }]);
4980
6317
  return (options?.client ?? client).get({
@@ -5156,7 +6493,7 @@ var Webhooks = class {
5156
6493
  /**
5157
6494
  * List webhook delivery logs
5158
6495
  *
5159
- * Returns recent deliveries and their nested attempt diagnostics for a webhook endpoint.
6496
+ * Returns recent deliveries for a webhook endpoint, each naming the event type and time it was made for, with its nested attempt diagnostics.
5160
6497
  */
5161
6498
  static getLogs(parameters, options) {
5162
6499
  const params = buildClientParams([parameters], [{ args: [{
@@ -5179,12 +6516,15 @@ var Webhooks = class {
5179
6516
  /**
5180
6517
  * Get webhook delivery statistics
5181
6518
  *
5182
- * Returns aggregate pending, delivered, exhausted, and cancelled delivery counts for a webhook endpoint.
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.
5183
6520
  */
5184
6521
  static getStats(parameters, options) {
5185
6522
  const params = buildClientParams([parameters], [{ args: [{
5186
6523
  in: "path",
5187
6524
  key: "webhookId"
6525
+ }, {
6526
+ in: "query",
6527
+ key: "period"
5188
6528
  }] }]);
5189
6529
  return (options?.client ?? client).get({
5190
6530
  security: [{
@@ -5242,9 +6582,9 @@ var Webhooks = class {
5242
6582
  };
5243
6583
  var Organizations = class {
5244
6584
  /**
5245
- * Create a workspace
6585
+ * Create an organization
5246
6586
  *
5247
- * 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.
5248
6588
  */
5249
6589
  static create(parameters, options) {
5250
6590
  const params = buildClientParams([parameters], [{ args: [{
@@ -5284,7 +6624,7 @@ var Organizations = class {
5284
6624
  /**
5285
6625
  * Update the current organization
5286
6626
  *
5287
- * 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.
5288
6628
  */
5289
6629
  static update(parameters, options) {
5290
6630
  const params = buildClientParams([parameters], [{ args: [
@@ -5296,18 +6636,10 @@ var Organizations = class {
5296
6636
  in: "body",
5297
6637
  key: "slug"
5298
6638
  },
5299
- {
5300
- in: "body",
5301
- key: "billingEmail"
5302
- },
5303
6639
  {
5304
6640
  in: "body",
5305
6641
  key: "countryCode"
5306
6642
  },
5307
- {
5308
- in: "body",
5309
- key: "currency"
5310
- },
5311
6643
  {
5312
6644
  in: "body",
5313
6645
  key: "timezone"
@@ -5373,9 +6705,9 @@ var Organizations = class {
5373
6705
  });
5374
6706
  }
5375
6707
  /**
5376
- * Delete the current workspace
6708
+ * Delete the current organization
5377
6709
  *
5378
- * 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.
5379
6711
  */
5380
6712
  static delete(parameters, options) {
5381
6713
  const params = buildClientParams([parameters], [{ args: [{
@@ -5400,31 +6732,6 @@ var Organizations = class {
5400
6732
  }
5401
6733
  });
5402
6734
  }
5403
- /**
5404
- * Create the first workspace
5405
- *
5406
- * Creates a replacement first workspace under the signed-in user's billing account when no workspace membership remains.
5407
- */
5408
- static bootstrap(parameters, options) {
5409
- const params = buildClientParams([parameters], [{ args: [{
5410
- in: "body",
5411
- key: "name"
5412
- }] }]);
5413
- return (options?.client ?? client).post({
5414
- security: [{
5415
- name: "x-api-key",
5416
- type: "apiKey"
5417
- }],
5418
- url: "/v1/organizations/bootstrap",
5419
- ...options,
5420
- ...params,
5421
- headers: {
5422
- "Content-Type": "application/json",
5423
- ...options?.headers,
5424
- ...params.headers
5425
- }
5426
- });
5427
- }
5428
6735
  };
5429
6736
  var ApiKeys = class {
5430
6737
  /**
@@ -5482,7 +6789,7 @@ var ApiKeys = class {
5482
6789
  },
5483
6790
  {
5484
6791
  in: "body",
5485
- key: "permissions"
6792
+ key: "access"
5486
6793
  }
5487
6794
  ] }]);
5488
6795
  return (options?.client ?? client).post({
@@ -5523,7 +6830,7 @@ var ApiKeys = class {
5523
6830
  /**
5524
6831
  * Get an API key
5525
6832
  *
5526
- * 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.
5527
6834
  */
5528
6835
  static get(parameters, options) {
5529
6836
  const params = buildClientParams([parameters], [{ args: [{
@@ -5578,7 +6885,7 @@ var ApiKeys = class {
5578
6885
  /**
5579
6886
  * Rotate an API key
5580
6887
  *
5581
- * 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.
5582
6889
  */
5583
6890
  static rotate(parameters, options) {
5584
6891
  const params = buildClientParams([parameters], [{ args: [{
@@ -5705,6 +7012,13 @@ const messageOf = (tag, payload) => {
5705
7012
  const message = payload.message;
5706
7013
  return typeof message === "string" ? message : tag;
5707
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
+ };
5708
7022
  var BillingProviderError = class extends SamvaApiError {
5709
7023
  _tag = "BillingProviderError";
5710
7024
  constructor(payload, context = {}) {
@@ -5719,6 +7033,13 @@ var ConflictError = class extends SamvaApiError {
5719
7033
  Object.assign(this, payload);
5720
7034
  }
5721
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
+ };
5722
7043
  var EmailChannelError = class extends SamvaApiError {
5723
7044
  _tag = "EmailChannelError";
5724
7045
  constructor(payload, context = {}) {
@@ -5747,6 +7068,13 @@ var ForbiddenError = class extends SamvaApiError {
5747
7068
  Object.assign(this, payload);
5748
7069
  }
5749
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
+ };
5750
7078
  var InternalError = class extends SamvaApiError {
5751
7079
  _tag = "InternalError";
5752
7080
  constructor(payload, context = {}) {
@@ -5754,6 +7082,13 @@ var InternalError = class extends SamvaApiError {
5754
7082
  Object.assign(this, payload);
5755
7083
  }
5756
7084
  };
7085
+ var OnboardingReviewRequiredError = class extends SamvaApiError {
7086
+ _tag = "OnboardingReviewRequiredError";
7087
+ constructor(payload, context = {}) {
7088
+ super(messageOf("OnboardingReviewRequiredError", payload), context);
7089
+ Object.assign(this, payload);
7090
+ }
7091
+ };
5757
7092
  var PaymentRequiredError = class extends SamvaApiError {
5758
7093
  _tag = "PaymentRequiredError";
5759
7094
  constructor(payload, context = {}) {
@@ -5789,29 +7124,37 @@ var ValidationError = class extends SamvaApiError {
5789
7124
  Object.assign(this, payload);
5790
7125
  }
5791
7126
  };
5792
- var WebhookEnqueueError = class extends SamvaApiError {
5793
- _tag = "WebhookEnqueueError";
5794
- constructor(payload, context = {}) {
5795
- super(messageOf("WebhookEnqueueError", payload), context);
5796
- Object.assign(this, payload);
5797
- }
5798
- };
5799
7127
  const constructors = {
7128
+ AnalyticsQueryError,
5800
7129
  BillingProviderError,
5801
7130
  ConflictError,
7131
+ DeliveryUnavailableError,
5802
7132
  EmailChannelError,
5803
7133
  ExternalServiceError,
5804
7134
  FlagDisabledError,
5805
7135
  ForbiddenError,
7136
+ GatewayTimeoutError,
5806
7137
  InternalError,
7138
+ OnboardingReviewRequiredError,
5807
7139
  PaymentRequiredError,
5808
7140
  RateLimitedError,
5809
7141
  ResourceNotFoundError,
5810
7142
  UnauthorizedError,
5811
- ValidationError,
5812
- WebhookEnqueueError
7143
+ ValidationError
5813
7144
  };
5814
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
+ },
5815
7158
  BillingProviderError: {
5816
7159
  type: "object",
5817
7160
  properties: {
@@ -5819,14 +7162,9 @@ const payloadSchemas = {
5819
7162
  type: "string",
5820
7163
  enum: ["BillingProviderError"]
5821
7164
  },
5822
- operation: { type: "string" },
5823
7165
  message: { type: "string" }
5824
7166
  },
5825
- required: [
5826
- "_tag",
5827
- "operation",
5828
- "message"
5829
- ],
7167
+ required: ["_tag", "message"],
5830
7168
  additionalProperties: false,
5831
7169
  "x-category": ["transient"],
5832
7170
  "x-retryable": true
@@ -5838,14 +7176,12 @@ const payloadSchemas = {
5838
7176
  type: "string",
5839
7177
  enum: ["ConflictError"]
5840
7178
  },
5841
- operation: { type: "string" },
5842
7179
  message: { type: "string" },
5843
7180
  resource: { type: "string" },
5844
7181
  id: { anyOf: [{ type: "string" }, { type: "null" }] }
5845
7182
  },
5846
7183
  required: [
5847
7184
  "_tag",
5848
- "operation",
5849
7185
  "message",
5850
7186
  "resource"
5851
7187
  ],
@@ -5853,6 +7189,25 @@ const payloadSchemas = {
5853
7189
  "x-category": ["conflict"],
5854
7190
  "x-retryable": false
5855
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
+ },
5856
7211
  EmailChannelError: {
5857
7212
  type: "object",
5858
7213
  properties: {
@@ -5860,7 +7215,6 @@ const payloadSchemas = {
5860
7215
  type: "string",
5861
7216
  enum: ["EmailChannelError"]
5862
7217
  },
5863
- operation: { type: "string" },
5864
7218
  reason: {
5865
7219
  type: "string",
5866
7220
  enum: [
@@ -5875,7 +7229,6 @@ const payloadSchemas = {
5875
7229
  },
5876
7230
  required: [
5877
7231
  "_tag",
5878
- "operation",
5879
7232
  "reason",
5880
7233
  "message"
5881
7234
  ],
@@ -5888,14 +7241,9 @@ const payloadSchemas = {
5888
7241
  type: "string",
5889
7242
  enum: ["ExternalServiceError"]
5890
7243
  },
5891
- operation: { type: "string" },
5892
7244
  message: { type: "string" }
5893
7245
  },
5894
- required: [
5895
- "_tag",
5896
- "operation",
5897
- "message"
5898
- ],
7246
+ required: ["_tag", "message"],
5899
7247
  additionalProperties: false,
5900
7248
  "x-category": ["transient"],
5901
7249
  "x-retryable": true
@@ -5907,14 +7255,9 @@ const payloadSchemas = {
5907
7255
  type: "string",
5908
7256
  enum: ["FlagDisabledError"]
5909
7257
  },
5910
- operation: { type: "string" },
5911
7258
  flag: { type: "string" }
5912
7259
  },
5913
- required: [
5914
- "_tag",
5915
- "operation",
5916
- "flag"
5917
- ],
7260
+ required: ["_tag", "flag"],
5918
7261
  additionalProperties: false,
5919
7262
  "x-retryable": false
5920
7263
  },
@@ -5925,17 +7268,31 @@ const payloadSchemas = {
5925
7268
  type: "string",
5926
7269
  enum: ["ForbiddenError"]
5927
7270
  },
5928
- operation: { type: "string" },
5929
7271
  message: { type: "string" }
5930
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
+ },
5931
7288
  required: [
5932
7289
  "_tag",
5933
- "operation",
5934
- "message"
7290
+ "message",
7291
+ "retryAfterSeconds"
5935
7292
  ],
5936
7293
  additionalProperties: false,
5937
- "x-category": ["auth"],
5938
- "x-retryable": false
7294
+ "x-category": ["transient"],
7295
+ "x-retryable": true
5939
7296
  },
5940
7297
  InternalError: {
5941
7298
  type: "object",
@@ -5944,17 +7301,73 @@ const payloadSchemas = {
5944
7301
  type: "string",
5945
7302
  enum: ["InternalError"]
5946
7303
  },
5947
- operation: { type: "string" },
5948
7304
  message: { type: "string" }
5949
7305
  },
7306
+ required: ["_tag", "message"],
7307
+ additionalProperties: false,
7308
+ "x-category": ["transient"],
7309
+ "x-retryable": true
7310
+ },
7311
+ OnboardingReviewRequiredError: {
7312
+ type: "object",
7313
+ properties: {
7314
+ _tag: {
7315
+ type: "string",
7316
+ enum: ["OnboardingReviewRequiredError"]
7317
+ },
7318
+ code: {
7319
+ type: "string",
7320
+ enum: [
7321
+ "review_required",
7322
+ "review_in_progress",
7323
+ "information_required",
7324
+ "review_rejected",
7325
+ "identity_review_required",
7326
+ "identity_review_rejected",
7327
+ "identity_changed"
7328
+ ]
7329
+ },
7330
+ decision: {
7331
+ type: "string",
7332
+ enum: [
7333
+ "undecided",
7334
+ "approved",
7335
+ "rejected",
7336
+ "exempt"
7337
+ ]
7338
+ },
7339
+ stage: {
7340
+ type: "string",
7341
+ enum: [
7342
+ "collecting",
7343
+ "automated_review",
7344
+ "manual_review",
7345
+ "information_requested",
7346
+ "complete"
7347
+ ]
7348
+ },
7349
+ nextAction: {
7350
+ type: "string",
7351
+ enum: [
7352
+ "wait_for_review",
7353
+ "provide_information",
7354
+ "verify_sending_identity",
7355
+ "reapply",
7356
+ "contact_support"
7357
+ ]
7358
+ },
7359
+ identityId: { anyOf: [{ type: "string" }, { type: "null" }] }
7360
+ },
5950
7361
  required: [
5951
7362
  "_tag",
5952
- "operation",
5953
- "message"
7363
+ "code",
7364
+ "decision",
7365
+ "stage",
7366
+ "nextAction"
5954
7367
  ],
5955
7368
  additionalProperties: false,
5956
- "x-category": ["transient"],
5957
- "x-retryable": true
7369
+ "x-category": ["validation"],
7370
+ "x-retryable": false
5958
7371
  },
5959
7372
  PaymentRequiredError: {
5960
7373
  type: "object",
@@ -5963,14 +7376,12 @@ const payloadSchemas = {
5963
7376
  type: "string",
5964
7377
  enum: ["PaymentRequiredError"]
5965
7378
  },
5966
- operation: { type: "string" },
5967
7379
  resource: { type: "string" },
5968
7380
  currentUsage: { type: "number" },
5969
7381
  limit: { type: "number" }
5970
7382
  },
5971
7383
  required: [
5972
7384
  "_tag",
5973
- "operation",
5974
7385
  "resource",
5975
7386
  "currentUsage",
5976
7387
  "limit"
@@ -5986,14 +7397,9 @@ const payloadSchemas = {
5986
7397
  type: "string",
5987
7398
  enum: ["RateLimitedError"]
5988
7399
  },
5989
- operation: { type: "string" },
5990
7400
  retryAfterSeconds: { type: "number" }
5991
7401
  },
5992
- required: [
5993
- "_tag",
5994
- "operation",
5995
- "retryAfterSeconds"
5996
- ],
7402
+ required: ["_tag", "retryAfterSeconds"],
5997
7403
  additionalProperties: false,
5998
7404
  "x-category": ["throttling", "transient"],
5999
7405
  "x-retryable": true
@@ -6005,13 +7411,11 @@ const payloadSchemas = {
6005
7411
  type: "string",
6006
7412
  enum: ["ResourceNotFoundError"]
6007
7413
  },
6008
- operation: { type: "string" },
6009
7414
  resource: { type: "string" },
6010
7415
  id: { type: "string" }
6011
7416
  },
6012
7417
  required: [
6013
7418
  "_tag",
6014
- "operation",
6015
7419
  "resource",
6016
7420
  "id"
6017
7421
  ],
@@ -6026,14 +7430,9 @@ const payloadSchemas = {
6026
7430
  type: "string",
6027
7431
  enum: ["UnauthorizedError"]
6028
7432
  },
6029
- operation: { type: "string" },
6030
7433
  message: { type: "string" }
6031
7434
  },
6032
- required: [
6033
- "_tag",
6034
- "operation",
6035
- "message"
6036
- ],
7435
+ required: ["_tag", "message"],
6037
7436
  additionalProperties: false,
6038
7437
  "x-category": ["auth"],
6039
7438
  "x-retryable": false
@@ -6045,7 +7444,6 @@ const payloadSchemas = {
6045
7444
  type: "string",
6046
7445
  enum: ["ValidationError"]
6047
7446
  },
6048
- operation: { type: "string" },
6049
7447
  message: { type: "string" },
6050
7448
  fields: { anyOf: [{
6051
7449
  type: "object",
@@ -6055,34 +7453,10 @@ const payloadSchemas = {
6055
7453
  }
6056
7454
  }, { type: "null" }] }
6057
7455
  },
6058
- required: [
6059
- "_tag",
6060
- "operation",
6061
- "message"
6062
- ],
7456
+ required: ["_tag", "message"],
6063
7457
  additionalProperties: false,
6064
7458
  "x-category": ["validation"],
6065
7459
  "x-retryable": false
6066
- },
6067
- WebhookEnqueueError: {
6068
- type: "object",
6069
- properties: {
6070
- _tag: {
6071
- type: "string",
6072
- enum: ["WebhookEnqueueError"]
6073
- },
6074
- operation: { type: "string" },
6075
- reason: { type: "string" },
6076
- details: { anyOf: [{ type: "string" }, { type: "null" }] }
6077
- },
6078
- required: [
6079
- "_tag",
6080
- "operation",
6081
- "reason"
6082
- ],
6083
- additionalProperties: false,
6084
- "x-category": ["transient"],
6085
- "x-retryable": true
6086
7460
  }
6087
7461
  };
6088
7462
  const isRecord = (value) => typeof value === "object" && value !== null;
@@ -6110,8 +7484,10 @@ const matchesSchema = (value, schema) => {
6110
7484
  if (schema.required?.some((key) => !Object.hasOwn(value, key)) === true) return false;
6111
7485
  const properties = schema.properties ?? {};
6112
7486
  for (const [key, propertySchema] of Object.entries(properties)) if (Object.hasOwn(value, key) && !matchesSchema(value[key], propertySchema)) return false;
6113
- if (typeof schema.additionalProperties === "object") {
6114
- for (const [key, propertyValue] of Object.entries(value)) if (!(key in properties) && !matchesSchema(propertyValue, schema.additionalProperties)) return false;
7487
+ if (schema.additionalProperties === false) {
7488
+ if (Object.keys(value).some((key) => !Object.hasOwn(properties, key))) return false;
7489
+ } else if (typeof schema.additionalProperties === "object") {
7490
+ for (const [key, propertyValue] of Object.entries(value)) if (!Object.hasOwn(properties, key) && !matchesSchema(propertyValue, schema.additionalProperties)) return false;
6115
7491
  }
6116
7492
  return true;
6117
7493
  };
@@ -6119,7 +7495,7 @@ const matchesSchema = (value, schema) => {
6119
7495
  function fromApiError(error, context = {}) {
6120
7496
  if (error instanceof SamvaApiError) return error;
6121
7497
  if (error instanceof SamvaTransportError) return error;
6122
- if (isRecord(error) && typeof error._tag === "string" && error._tag in constructors) {
7498
+ if (isRecord(error) && typeof error._tag === "string" && Object.hasOwn(constructors, error._tag)) {
6123
7499
  const tag = error._tag;
6124
7500
  if (!matchesSchema(error, payloadSchemas[tag])) return new SamvaTransportError(error, context);
6125
7501
  const Constructor = constructors[tag];
@@ -6158,6 +7534,19 @@ function fromApiError(error, context = {}) {
6158
7534
  * ```
6159
7535
  */
6160
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
+ }
6161
7550
  function createPromiseMessagesTransport(clientInstance) {
6162
7551
  const boundMessages = createBoundService(Messages, clientInstance);
6163
7552
  return {
@@ -6167,10 +7556,17 @@ function createPromiseMessagesTransport(clientInstance) {
6167
7556
  getEmail: boundMessages.getEmail,
6168
7557
  getStatus: boundMessages.getStatus,
6169
7558
  getEvents: boundMessages.getEvents,
6170
- send: (input, options) => Messages.send({ emailSendMessagePayload: buildMessagesSendPayload(input) }, {
6171
- ...options,
6172
- client: clientInstance
6173
- })
7559
+ validateEmail: boundMessages.validateEmail,
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
+ }
6174
7570
  };
6175
7571
  }
6176
7572
  function createPromiseEmailTransport(clientInstance) {
@@ -6178,7 +7574,7 @@ function createPromiseEmailTransport(clientInstance) {
6178
7574
  return Object.assign(boundEmail, {
6179
7575
  addSender: (input, options) => {
6180
7576
  const { replyToEmails, ...sender } = input;
6181
- const { idempotencyKey = crypto.randomUUID(), ...requestOptions } = options ?? {};
7577
+ const { idempotencyKey, requestOptions } = resolveIdempotencyKey(options);
6182
7578
  return Email.addSender({
6183
7579
  "idempotency-key": idempotencyKey,
6184
7580
  ...sender,
@@ -6188,10 +7584,16 @@ function createPromiseEmailTransport(clientInstance) {
6188
7584
  client: clientInstance
6189
7585
  });
6190
7586
  },
6191
- send: (input, options) => Messages.send({ emailSendMessagePayload: buildEmailSendPayload(input) }, {
6192
- ...options,
6193
- client: clientInstance
6194
- })
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
+ }
6195
7597
  });
6196
7598
  }
6197
7599
  function createPromiseTemplatesTransport(clientInstance) {
@@ -6272,7 +7674,12 @@ function createClient(config) {
6272
7674
  webhooks: createBoundService(Webhooks, clientInstance),
6273
7675
  operations: createBoundService(Operations, clientInstance),
6274
7676
  apiKeys: createBoundService(ApiKeys, clientInstance),
6275
- 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)
6276
7683
  };
6277
7684
  const promiseMessages = createPromiseMessagesTransport(clientInstance);
6278
7685
  const promiseEmail = createPromiseEmailTransport(clientInstance);
@@ -6290,10 +7697,15 @@ function createClient(config) {
6290
7697
  webhooks: createDirectService(raw.webhooks),
6291
7698
  operations: createDirectService(raw.operations),
6292
7699
  apiKeys: createDirectService(raw.apiKeys),
6293
- 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)
6294
7706
  };
6295
7707
  }
6296
7708
  //#endregion
6297
- export { fromApiError as _, ExternalServiceError as a, InternalError as c, ResourceNotFoundError as d, SamvaApiError as f, WebhookEnqueueError as g, ValidationError as h, EmailChannelError as i, PaymentRequiredError as l, UnauthorizedError as m, BillingProviderError as n, FlagDisabledError as o, SamvaTransportError as p, ConflictError as r, ForbiddenError as s, createClient as t, RateLimitedError as u };
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 };
6298
7710
 
6299
- //# sourceMappingURL=promises-n1opem5V.js.map
7711
+ //# sourceMappingURL=promises-8MaPNAam.js.map