samva 0.5.0 → 0.7.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 (65) hide show
  1. package/AGENTS.md +3 -2
  2. package/README.md +14 -4
  3. package/dist/{categories-B9Nw2v_F.js → categories-DvsHUJtX.js} +32 -8
  4. package/dist/client/sdk.gen.d.ts +493 -88
  5. package/dist/client/types.gen.d.ts +3136 -416
  6. package/dist/{client-B7gEkvEq.js → client-5O8KsY5Z.js} +2638 -902
  7. package/dist/{client-attribution-B2yJBXdZ.js → client-attribution-27MNycCV.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/brands.d.ts +212 -0
  15. package/dist/effect/brands.js +24 -0
  16. package/dist/effect/campaigns.d.ts +36 -18
  17. package/dist/effect/campaigns.js +1 -1
  18. package/dist/effect/categories.d.ts +3 -3
  19. package/dist/effect/categories.js +1 -1
  20. package/dist/effect/client.js +1 -1
  21. package/dist/effect/contact-groups.d.ts +375 -0
  22. package/dist/effect/contact-groups.js +29 -0
  23. package/dist/effect/contacts.d.ts +35 -19
  24. package/dist/effect/contacts.js +1 -1
  25. package/dist/effect/conversations.d.ts +188 -47
  26. package/dist/effect/conversations.js +1 -1
  27. package/dist/effect/custom-fields.d.ts +111 -0
  28. package/dist/effect/custom-fields.js +17 -0
  29. package/dist/effect/email.d.ts +268 -121
  30. package/dist/effect/email.js +2 -2
  31. package/dist/effect/generated-metadata.d.ts +20 -4
  32. package/dist/effect/generated.d.ts +13934 -7968
  33. package/dist/effect/index.d.ts +7 -2
  34. package/dist/effect/index.js +9 -4
  35. package/dist/effect/internal/operation.d.ts +121 -27
  36. package/dist/effect/media.d.ts +5 -5
  37. package/dist/effect/media.js +1 -1
  38. package/dist/effect/messages.d.ts +319 -73
  39. package/dist/effect/messages.js +1 -1
  40. package/dist/effect/operations.d.ts +6 -6
  41. package/dist/effect/operations.js +1 -1
  42. package/dist/effect/organizations.d.ts +7 -374
  43. package/dist/effect/organizations.js +2 -4
  44. package/dist/effect/retry.js +1 -1
  45. package/dist/effect/scheduled-messages.d.ts +7 -7
  46. package/dist/effect/scheduled-messages.js +1 -1
  47. package/dist/effect/templates.d.ts +263 -305
  48. package/dist/effect/templates.js +7 -5
  49. package/dist/effect/unsubscribe-groups.d.ts +161 -0
  50. package/dist/effect/unsubscribe-groups.js +25 -0
  51. package/dist/effect/webhooks.d.ts +18 -18
  52. package/dist/effect/webhooks.js +2 -2
  53. package/dist/index.js +2 -2
  54. package/dist/{normalize-BiIJnycv.js → normalize-B79uJIeb.js} +13 -14
  55. package/dist/normalize.d.ts +3 -7
  56. package/dist/{operation-B4FjN6wq.js → operation-Cb5V9FJ7.js} +123 -11
  57. package/dist/promises/errors.gen.d.ts +50 -43
  58. package/dist/promises/index.d.ts +20 -6
  59. package/dist/promises/index.js +2 -2
  60. package/dist/promises/types.gen.d.ts +1 -1
  61. package/dist/{promises-CP_nxUus.js → promises-C2yyw-pf.js} +1582 -368
  62. package/dist/service-map.d.ts +189 -12
  63. package/package.json +32 -12
  64. package/dist/effect/design.d.ts +0 -209
  65. package/dist/effect/design.js +0 -13
@@ -1,5 +1,5 @@
1
- import { n as clientAttribution, t as CLIENT_ATTRIBUTION_HEADER } from "./client-attribution-B2yJBXdZ.js";
2
- import { n as buildMessagesSendPayload, r as replyToEmailsPayload, t as buildEmailSendPayload } from "./normalize-BiIJnycv.js";
1
+ import { n as clientAttribution, t as CLIENT_ATTRIBUTION_HEADER } from "./client-attribution-27MNycCV.js";
2
+ import { n as buildMessagesSendPayload, r as replyToEmailsPayload, t as buildEmailSendPayload } from "./normalize-B79uJIeb.js";
3
3
  //#region src/client/core/bodySerializer.gen.ts
4
4
  const jsonBodySerializer = { bodySerializer: (body) => JSON.stringify(body, (_key, value) => typeof value === "bigint" ? value.toString() : value) };
5
5
  //#endregion
@@ -678,7 +678,7 @@ var Messages = class {
678
678
  /**
679
679
  * List messages
680
680
  *
681
- * Returns a paginated list of messages, with optional filters for channel, direction, status, conversation, contact, and date range.
681
+ * Returns a paginated list of messages, with optional filters for channel, direction, status, conversation, contact, sender address, and date range.
682
682
  */
683
683
  static list(parameters, options) {
684
684
  const params = buildClientParams([parameters], [{ args: [
@@ -710,6 +710,10 @@ var Messages = class {
710
710
  in: "query",
711
711
  key: "contactId"
712
712
  },
713
+ {
714
+ in: "query",
715
+ key: "from"
716
+ },
713
717
  {
714
718
  in: "query",
715
719
  key: "startDate"
@@ -732,7 +736,7 @@ var Messages = class {
732
736
  /**
733
737
  * Send a message
734
738
  *
735
- * Sends a message on the requested channel and returns the created message with a 201 Created status. `channel` selects the payload variant. Repeating an identical request with the same optional `Idempotency-Key` header returns the original message; reusing the key for different content returns a conflict.
739
+ * Sends a message on the requested channel and returns the created message with a 201 Created status. Requires `messages:create` or the send permission of the channel it sends on, such as `email:send`. `channel` selects the payload variant. Repeating an identical request with the same optional `Idempotency-Key` header returns the original message; reusing the key for different content returns a conflict.
736
740
  */
737
741
  static send(parameters, options) {
738
742
  const params = buildClientParams([parameters], [{ args: [{
@@ -830,7 +834,7 @@ var Messages = class {
830
834
  /**
831
835
  * Validate an email message
832
836
  *
833
- * Resolves recipients, sender, and inline or published-template content without creating contacts, messages, billing reservations, quota draws, queue work, or provider calls.
837
+ * Resolves recipients, sender, and inline or published-template content without sending anything, creating contacts or messages, or counting toward your quota.
834
838
  */
835
839
  static validateEmail(parameters, options) {
836
840
  const params = buildClientParams([parameters], [{ args: [
@@ -927,7 +931,7 @@ var Operations = class {
927
931
  /**
928
932
  * List asynchronous operations
929
933
  *
930
- * Lists durable asynchronous operation state for the active organization.
934
+ * Lists asynchronous operations for the active organization.
931
935
  */
932
936
  static list(parameters, options) {
933
937
  const params = buildClientParams([parameters], [{ args: [
@@ -961,7 +965,7 @@ var Operations = class {
961
965
  /**
962
966
  * Get an asynchronous operation
963
967
  *
964
- * Returns one durable asynchronous operation from the active organization.
968
+ * Returns one asynchronous operation from the active organization.
965
969
  */
966
970
  static get(parameters, options) {
967
971
  const params = buildClientParams([parameters], [{ args: [{
@@ -981,7 +985,7 @@ var Operations = class {
981
985
  /**
982
986
  * Retry an asynchronous operation
983
987
  *
984
- * Retries the same durable execution identity when its failure is explicitly retryable. Retrying a workspace deletion additionally requires `organization:delete`.
988
+ * Retries a failed operation in place when its error is retryable. Retrying an organization deletion additionally requires `organization:delete`.
985
989
  */
986
990
  static retry(parameters, options) {
987
991
  const params = buildClientParams([parameters], [{ args: [{
@@ -1033,7 +1037,7 @@ var ScheduledMessages = class {
1033
1037
  /**
1034
1038
  * Schedule a message
1035
1039
  *
1036
- * Schedules a message for dispatch at the absolute ISO-8601 timestamp supplied in scheduledFor. Optional timezone is validated IANA display metadata only and never changes the execution instant.
1040
+ * Schedules a message for dispatch at the absolute ISO-8601 timestamp supplied in scheduledFor. Requires `messages:create` or the send permission of the channel it sends on, such as `email:send`. Optional timezone is validated IANA display metadata only and never changes the execution instant.
1037
1041
  */
1038
1042
  static create(parameters, options) {
1039
1043
  const params = buildClientParams([parameters], [{ args: [
@@ -1146,7 +1150,7 @@ var Campaigns = class {
1146
1150
  /**
1147
1151
  * List campaigns
1148
1152
  *
1149
- * Returns a paginated list of the organization's campaigns, optionally filtered by status.
1153
+ * Returns a paginated list of the organization's campaigns, optionally filtered by status. Each row carries `series`, the last 14 days of daily email sends the campaign produced, oldest first.
1150
1154
  */
1151
1155
  static list(parameters, options) {
1152
1156
  const params = buildClientParams([parameters], [{ args: [
@@ -1336,7 +1340,7 @@ var Campaigns = class {
1336
1340
  /**
1337
1341
  * Schedule a campaign run
1338
1342
  *
1339
- * Schedules an email campaign run at the absolute ISO-8601 instant in scheduledFor, or immediately when omitted. The optional idempotencyKey is scoped to the organization and replays return the original run.
1343
+ * Schedules an email campaign run at the absolute ISO-8601 instant in scheduledFor, or immediately when omitted. The optional idempotencyKey is scoped to the organization and replays return the original run. An email campaign must carry the brand footer: it is refused with CampaignFooterRequiredError when its footer is off and its template renders no BrandFooter, and with BrandAddressRequiredError when a brand that signs it off has no postal address.
1340
1344
  */
1341
1345
  static scheduleRun(parameters, options) {
1342
1346
  const params = buildClientParams([parameters], [{ args: [
@@ -1440,7 +1444,7 @@ var Campaigns = class {
1440
1444
  /**
1441
1445
  * Cancel a campaign run
1442
1446
  *
1443
- * Best-effort cancellation: pending recipients are skipped, while already claimed or provider-submitted deliveries may finish. Returns the updated run.
1447
+ * Best-effort cancellation: pending recipients are skipped, while deliveries already handed off for sending may finish. Returns the updated run.
1444
1448
  */
1445
1449
  static cancelRun(parameters, options) {
1446
1450
  const params = buildClientParams([parameters], [{ args: [{
@@ -1503,7 +1507,7 @@ var Email = class {
1503
1507
  /**
1504
1508
  * Get email onboarding review status
1505
1509
  *
1506
- * Returns the customer-safe workspace review decision, workflow stage, next action, and current sending-identity clearances. A missing authority row is returned as a blocked initial state.
1510
+ * Returns the customer-safe organization review decision, workflow stage, next action, and current sending-identity clearances. An organization that has not been reviewed yet is returned in the blocked initial state.
1507
1511
  */
1508
1512
  static getOnboardingReview(options) {
1509
1513
  return (options?.client ?? client).get({
@@ -1518,7 +1522,7 @@ var Email = class {
1518
1522
  /**
1519
1523
  * Reapply for email onboarding review
1520
1524
  *
1521
- * Allows a workspace owner or admin to submit a rejected workspace for review again. The expected generation prevents acting on stale status.
1525
+ * Allows an organization owner or admin to submit a rejected organization for review again. The expected generation prevents acting on stale status.
1522
1526
  */
1523
1527
  static reapplyOnboardingReview(parameters, options) {
1524
1528
  const params = buildClientParams([parameters], [{ args: [{
@@ -1543,7 +1547,7 @@ var Email = class {
1543
1547
  /**
1544
1548
  * Respond to an email onboarding information request
1545
1549
  *
1546
- * Allows workspace owners and admins to submit bounded text and up to three pending-scanned evidence uploads for the current review generation.
1550
+ * Allows organization owners and admins to submit a text response and up to three evidence uploads for the current information request.
1547
1551
  */
1548
1552
  static respondToOnboardingInformationRequest(parameters, options) {
1549
1553
  const params = buildClientParams([parameters], [{ args: [
@@ -1578,7 +1582,7 @@ var Email = class {
1578
1582
  /**
1579
1583
  * Get email tracking defaults
1580
1584
  *
1581
- * Returns the workspace's independent defaults for open and click tracking, both enabled unless configured otherwise. Recipient opt-out takes precedence over these defaults.
1585
+ * Returns the organization's independent defaults for open and click tracking, both enabled unless configured otherwise. Recipient opt-out takes precedence over these defaults.
1582
1586
  */
1583
1587
  static getTrackingDefaults(options) {
1584
1588
  return (options?.client ?? client).get({
@@ -1669,16 +1673,23 @@ var Email = class {
1669
1673
  /**
1670
1674
  * List sending domains
1671
1675
  *
1672
- * Returns a paginated list of the organization's sending domains.
1676
+ * Returns a paginated list of the organization's sending domains. `sendable=true` lists only domains a send can use now: active, and verified, or verified before and degraded since. Each row carries `deliverability` (bounce and complaint rates over the last 24 hours, the window the 5% bounce limit is enforced over) and `series`, the last 14 days of daily email sends attributed to the domain, oldest first.
1673
1677
  */
1674
1678
  static listDomains(parameters, options) {
1675
- const params = buildClientParams([parameters], [{ args: [{
1676
- in: "query",
1677
- key: "page"
1678
- }, {
1679
- in: "query",
1680
- key: "limit"
1681
- }] }]);
1679
+ const params = buildClientParams([parameters], [{ args: [
1680
+ {
1681
+ in: "query",
1682
+ key: "page"
1683
+ },
1684
+ {
1685
+ in: "query",
1686
+ key: "limit"
1687
+ },
1688
+ {
1689
+ in: "query",
1690
+ key: "sendable"
1691
+ }
1692
+ ] }]);
1682
1693
  return (options?.client ?? client).get({
1683
1694
  security: [{
1684
1695
  name: "x-api-key",
@@ -1692,7 +1703,7 @@ var Email = class {
1692
1703
  /**
1693
1704
  * Add a sending domain
1694
1705
  *
1695
- * Registers a domain for sending and returns it with the DNS records required to verify ownership and configure DKIM. Responds with 201. Supplying a connection attaches the domain to that DNS account; the domain must sit inside the zone given with it.
1706
+ * 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. A banned organization is refused with 403.
1696
1707
  */
1697
1708
  static addDomain(parameters, options) {
1698
1709
  const params = buildClientParams([parameters], [{ args: [{
@@ -1720,7 +1731,7 @@ var Email = class {
1720
1731
  /**
1721
1732
  * Get domain verification
1722
1733
  *
1723
- * Returns the stored DNS and provider lifecycle snapshot without calling a provider or mutating state.
1734
+ * Returns the domain's last observed DNS and verification state. Reading it does not check DNS again or change anything; use advance to check now.
1724
1735
  */
1725
1736
  static getDomainVerification(parameters, options) {
1726
1737
  const params = buildClientParams([parameters], [{ args: [{
@@ -1740,7 +1751,7 @@ var Email = class {
1740
1751
  /**
1741
1752
  * Advance domain verification
1742
1753
  *
1743
- * Observes the required DNS records and, once they match, idempotently starts provider provisioning for the staged domain.
1754
+ * Checks the required DNS records now and, once they all match, moves the domain toward verified. Safe to call repeatedly.
1744
1755
  */
1745
1756
  static advanceDomainVerification(parameters, options) {
1746
1757
  const params = buildClientParams([parameters], [{ args: [{
@@ -1760,7 +1771,7 @@ var Email = class {
1760
1771
  /**
1761
1772
  * Stage a DKIM selector rotation
1762
1773
  *
1763
- * Creates encrypted signing custody and returns a new public DKIM record. Publish it, then advance domain verification to cut over. Retain the former record until separately approved retirement.
1774
+ * Creates a new DKIM signing key and returns its public DKIM record. Publish it, then advance domain verification to switch signing to the new key. Keep the former record published at least until `minimumRetainUntil`.
1764
1775
  */
1765
1776
  static rotateDomainDkim(parameters, options) {
1766
1777
  const params = buildClientParams([parameters], [{ args: [{
@@ -1902,7 +1913,7 @@ var Email = class {
1902
1913
  /**
1903
1914
  * Complete a one-click DNS return
1904
1915
  *
1905
- * Consumes the Domain Connect provider's redirect. Validates the signed state and, when the records were applied, kicks verification. Returns applied, cancelled (the customer declined), or invalid (state failed validation).
1916
+ * Consumes the Domain Connect provider's redirect. Validates the signed state and, when the DNS provider reports success, starts checking the domain's records. A DNS provider error is reported separately from a customer cancelling setup.
1906
1917
  */
1907
1918
  static completeDomainConnect(parameters, options) {
1908
1919
  const params = buildClientParams([parameters], [{ args: [
@@ -1917,6 +1928,10 @@ var Email = class {
1917
1928
  {
1918
1929
  in: "body",
1919
1930
  key: "error"
1931
+ },
1932
+ {
1933
+ in: "body",
1934
+ key: "errorDescription"
1920
1935
  }
1921
1936
  ] }]);
1922
1937
  return (options?.client ?? client).post({
@@ -1937,7 +1952,7 @@ var Email = class {
1937
1952
  /**
1938
1953
  * Enable inbound email for a domain
1939
1954
  *
1940
- * Enables inbound receiving for a verified domain by creating a receipt rule, and returns the rule name and its recipient addresses. Set `catchAll` to route every address on the domain; that requires a webhook endpoint, supplied as `endpointId` or already configured on the domain.
1955
+ * Enables inbound receiving for a verified domain and returns the recipient addresses it accepts. Set `catchAll` to route every address on the domain; that requires a webhook endpoint, supplied as `endpointId` or already configured on the domain.
1941
1956
  */
1942
1957
  static enableReceiving(parameters, options) {
1943
1958
  const params = buildClientParams([parameters], [{ args: [
@@ -2048,7 +2063,7 @@ var Email = class {
2048
2063
  /**
2049
2064
  * Update a domain's send-settings config
2050
2065
  *
2051
- * Overrides the domain's open/click tracking, reply-to, and unsubscribe-group defaults for the settings cascade. An omitted field is left unchanged; null clears it back to the organization default. Returns the saved config.
2066
+ * Overrides the domain's open/click tracking, reply-to, unsubscribe-group defaults, and the brand its mail uses for the settings cascade. An omitted field is left unchanged; null clears it back to the organization default. Returns the saved config.
2052
2067
  */
2053
2068
  static updateDomainConfig(parameters, options) {
2054
2069
  const params = buildClientParams([parameters], [{ args: [
@@ -2075,6 +2090,10 @@ var Email = class {
2075
2090
  {
2076
2091
  in: "body",
2077
2092
  key: "footerEnabled"
2093
+ },
2094
+ {
2095
+ in: "body",
2096
+ key: "brandSlug"
2078
2097
  }
2079
2098
  ] }]);
2080
2099
  return (options?.client ?? client).patch({
@@ -2135,7 +2154,7 @@ var Email = class {
2135
2154
  /**
2136
2155
  * Enable a custom tracking domain
2137
2156
  *
2138
- * Provisions a custom tracking domain (default label `track`) for a verified sending domain so open/click links redirect through the customer's own subdomain. Requires the custom_tracking_domain entitlement. Returns the resulting state including the two DNS records the customer must create.
2157
+ * Provisions a custom tracking domain (default label `track`) for a verified sending domain so open/click links redirect through the customer's own subdomain. Requires a plan that includes custom tracking domains. Returns the resulting state including the two DNS records the customer must create.
2139
2158
  */
2140
2159
  static enableCustomTracking(parameters, options) {
2141
2160
  const params = buildClientParams([parameters], [{ args: [{
@@ -2183,7 +2202,7 @@ var Email = class {
2183
2202
  /**
2184
2203
  * Build an automatic Custom Tracking Domain apply URL
2185
2204
  *
2186
- * Builds the signed Domain Connect URL for the current customer-selected tracking host. The server derives the host and Cloudflare DCV UUID; exact manual CNAME records remain available.
2205
+ * Builds the signed Domain Connect URL for the current customer-selected tracking host. Samva fills in the host and the certificate validation record; the manual CNAME records remain available.
2187
2206
  */
2188
2207
  static buildCustomTrackingDomainConnectApplyUrl(parameters, options) {
2189
2208
  const params = buildClientParams([parameters], [{ args: [{
@@ -2203,7 +2222,7 @@ var Email = class {
2203
2222
  /**
2204
2223
  * Complete an automatic Custom Tracking Domain return
2205
2224
  *
2206
- * Validates the purpose- and revision-bound registrar state, then re-kicks the existing readiness reconciliation. The callback never declares the host ready or changes email tracking selection.
2225
+ * Validates the signed state returned by the DNS provider, then checks the tracking host again. Returning here never marks the host ready or changes which tracking host email uses.
2207
2226
  */
2208
2227
  static completeCustomTrackingDomainConnect(parameters, options) {
2209
2228
  const params = buildClientParams([parameters], [{ args: [
@@ -2218,6 +2237,10 @@ var Email = class {
2218
2237
  {
2219
2238
  in: "body",
2220
2239
  key: "error"
2240
+ },
2241
+ {
2242
+ in: "body",
2243
+ key: "errorDescription"
2221
2244
  }
2222
2245
  ] }]);
2223
2246
  return (options?.client ?? client).post({
@@ -2238,7 +2261,7 @@ var Email = class {
2238
2261
  /**
2239
2262
  * List sender identities
2240
2263
  *
2241
- * Returns a paginated list of sender identities, optionally filtered by verification status, active state, or default flag.
2264
+ * Returns a paginated list of sender identities, optionally filtered by verification status, active state, or default flag. Each row carries `deliverability` (bounce and complaint rates over the last 24 hours) and `series`, the last 14 days of daily email sends from the address, oldest first.
2242
2265
  */
2243
2266
  static listSenders(parameters, options) {
2244
2267
  const params = buildClientParams([parameters], [{ args: [
@@ -2276,7 +2299,7 @@ var Email = class {
2276
2299
  /**
2277
2300
  * Add a sender identity
2278
2301
  *
2279
- * Durably creates a sender identity. The required Idempotency-Key replays the original sender for an identical request and conflicts when reused with different input.
2302
+ * Creates a sender identity. The required Idempotency-Key replays the original sender for an identical request and conflicts when reused with different input.
2280
2303
  */
2281
2304
  static addSender(parameters, options) {
2282
2305
  const params = buildClientParams([parameters], [{ args: [
@@ -2339,7 +2362,7 @@ var Email = class {
2339
2362
  /**
2340
2363
  * Remove a sender identity
2341
2364
  *
2342
- * Accepts sender removal, marks it inactive, and retains its deleting lifecycle until provider identity and association cleanup is confirmed.
2365
+ * Accepts sender removal and marks the sender inactive. It reports the `deleting` lifecycle until removal finishes.
2343
2366
  */
2344
2367
  static removeSender(parameters, options) {
2345
2368
  const params = buildClientParams([parameters], [{ args: [{
@@ -2422,7 +2445,7 @@ var Email = class {
2422
2445
  /**
2423
2446
  * Enable catch-all receiving
2424
2447
  *
2425
- * Enables catch-all inbound receiving for a domain by creating a receipt rule, and returns the rule name. `endpointId` is one of the organization's webhook endpoints; every address on the domain delivers `message.received` to it. Responds with 201.
2448
+ * Enables catch-all inbound receiving for a domain. `endpointId` is one of the organization's webhook endpoints; every address on the domain delivers `message.received` to it. Responds with 201.
2426
2449
  */
2427
2450
  static enableCatchAll(parameters, options) {
2428
2451
  const params = buildClientParams([parameters], [{ args: [{
@@ -2553,7 +2576,7 @@ var Email = class {
2553
2576
  /**
2554
2577
  * List suppressed addresses
2555
2578
  *
2556
- * Returns the addresses this workspace will not send to, newest first, optionally filtered by suppression type, active or expired state, and an address substring, with limit and offset paging.
2579
+ * Returns the addresses this organization will not send to, newest first, optionally filtered by suppression type, active or expired state, and an address substring, with limit and offset paging.
2557
2580
  */
2558
2581
  static listSuppressions(parameters, options) {
2559
2582
  const params = buildClientParams([parameters], [{ args: [
@@ -2591,7 +2614,7 @@ var Email = class {
2591
2614
  /**
2592
2615
  * Remove a suppressed address
2593
2616
  *
2594
- * Deletes a suppression so this workspace can send to the address again. When the engine mirrored the address into the sending provider's suppression list, that entry is lifted first, and the deletion fails rather than reporting success if the provider refuses, so the operation stays retryable. The provider entry is left in place when another workspace still reports the same address as bouncing or complaining, because that list is shared with every workspace; the response does not say which case applied. Deliverability caveat: a bounce or complaint suppression records a real delivery failure, and sending to the address again risks the reputation damage the suppression prevented.
2617
+ * Deletes a suppression so this organization can send to the address again. If the deletion cannot complete, it fails rather than reporting success, and it is safe to retry. Deliverability caveat: a bounce or complaint suppression records a real delivery failure, and sending to the address again risks the reputation damage the suppression prevented.
2595
2618
  */
2596
2619
  static removeSuppression(parameters, options) {
2597
2620
  const params = buildClientParams([parameters], [{ args: [{
@@ -3233,7 +3256,7 @@ var Email = class {
3233
3256
  /**
3234
3257
  * Complete domain warming
3235
3258
  *
3236
- * Ends the policy. Campaign runs from the domain are no longer gated by warming windows; the workspace safeguards still apply.
3259
+ * Ends the policy. Campaign runs from the domain are no longer gated by warming windows; the organization safeguards still apply.
3237
3260
  */
3238
3261
  static completeDomainWarming(parameters, options) {
3239
3262
  const params = buildClientParams([parameters], [{ args: [{
@@ -3384,6 +3407,91 @@ var Media = class {
3384
3407
  });
3385
3408
  }
3386
3409
  };
3410
+ var Attachments = class {
3411
+ /**
3412
+ * Delete an attachment
3413
+ *
3414
+ * Deletes an attachment and returns the deleted attachment's ID.
3415
+ */
3416
+ static remove(parameters, options) {
3417
+ const params = buildClientParams([parameters], [{ args: [{
3418
+ in: "path",
3419
+ key: "id"
3420
+ }] }]);
3421
+ return (options?.client ?? client).delete({
3422
+ security: [{
3423
+ name: "x-api-key",
3424
+ type: "apiKey"
3425
+ }],
3426
+ url: "/v1/attachments/{id}",
3427
+ ...options,
3428
+ ...params
3429
+ });
3430
+ }
3431
+ /**
3432
+ * Get an attachment
3433
+ *
3434
+ * Returns metadata for a single attachment, including filename, content type, and size.
3435
+ */
3436
+ static getById(parameters, options) {
3437
+ const params = buildClientParams([parameters], [{ args: [{
3438
+ in: "path",
3439
+ key: "id"
3440
+ }] }]);
3441
+ return (options?.client ?? client).get({
3442
+ security: [{
3443
+ name: "x-api-key",
3444
+ type: "apiKey"
3445
+ }],
3446
+ url: "/v1/attachments/{id}",
3447
+ ...options,
3448
+ ...params
3449
+ });
3450
+ }
3451
+ /**
3452
+ * List message attachments
3453
+ *
3454
+ * Returns all attachments for the given message, along with a total count.
3455
+ */
3456
+ static list(parameters, options) {
3457
+ const params = buildClientParams([parameters], [{ args: [{
3458
+ in: "query",
3459
+ key: "messageId"
3460
+ }] }]);
3461
+ return (options?.client ?? client).get({
3462
+ security: [{
3463
+ name: "x-api-key",
3464
+ type: "apiKey"
3465
+ }],
3466
+ url: "/v1/attachments",
3467
+ ...options,
3468
+ ...params
3469
+ });
3470
+ }
3471
+ /**
3472
+ * Get an attachment download URL
3473
+ *
3474
+ * Generates a presigned, time-limited download URL for the attachment; expiry is configurable via the expiresIn query parameter.
3475
+ */
3476
+ static downloadUrl(parameters, options) {
3477
+ const params = buildClientParams([parameters], [{ args: [{
3478
+ in: "path",
3479
+ key: "id"
3480
+ }, {
3481
+ in: "query",
3482
+ key: "expiresIn"
3483
+ }] }]);
3484
+ return (options?.client ?? client).get({
3485
+ security: [{
3486
+ name: "x-api-key",
3487
+ type: "apiKey"
3488
+ }],
3489
+ url: "/v1/attachments/{id}/download-url",
3490
+ ...options,
3491
+ ...params
3492
+ });
3493
+ }
3494
+ };
3387
3495
  var Conversations = class {
3388
3496
  /**
3389
3497
  * List conversations
@@ -3889,7 +3997,7 @@ var Contacts = class {
3889
3997
  /**
3890
3998
  * Find a contact
3891
3999
  *
3892
- * Samva API operation.
4000
+ * Looks up a single contact by email address or external ID and returns null when no contact matches.
3893
4001
  */
3894
4002
  static find(parameters, options) {
3895
4003
  const params = buildClientParams([parameters], [{ args: [
@@ -4329,11 +4437,11 @@ var Contacts = class {
4329
4437
  });
4330
4438
  }
4331
4439
  };
4332
- var Templates = class {
4440
+ var ContactGroups = class {
4333
4441
  /**
4334
- * List templates
4442
+ * List contact groups
4335
4443
  *
4336
- * Returns a paginated list of the organization's templates, filterable by category, channel, status, and search, with configurable sorting.
4444
+ * Returns a paginated list of contact groups for the organization, filterable by type and active state.
4337
4445
  */
4338
4446
  static list(parameters, options) {
4339
4447
  const params = buildClientParams([parameters], [{ args: [
@@ -4347,27 +4455,11 @@ var Templates = class {
4347
4455
  },
4348
4456
  {
4349
4457
  in: "query",
4350
- key: "category"
4351
- },
4352
- {
4353
- in: "query",
4354
- key: "channel"
4355
- },
4356
- {
4357
- in: "query",
4358
- key: "status"
4359
- },
4360
- {
4361
- in: "query",
4362
- key: "search"
4363
- },
4364
- {
4365
- in: "query",
4366
- key: "sortBy"
4458
+ key: "type"
4367
4459
  },
4368
4460
  {
4369
4461
  in: "query",
4370
- key: "sortOrder"
4462
+ key: "isActive"
4371
4463
  }
4372
4464
  ] }]);
4373
4465
  return (options?.client ?? client).get({
@@ -4375,15 +4467,15 @@ var Templates = class {
4375
4467
  name: "x-api-key",
4376
4468
  type: "apiKey"
4377
4469
  }],
4378
- url: "/v1/templates",
4470
+ url: "/v1/contact-groups",
4379
4471
  ...options,
4380
4472
  ...params
4381
4473
  });
4382
4474
  }
4383
4475
  /**
4384
- * Create a template
4476
+ * Create a contact group
4385
4477
  *
4386
- * Creates an email template project from Samva's canonical TSX starter and returns its template entry with status 201.
4478
+ * Creates a new contact group and returns it with a 201 status.
4387
4479
  */
4388
4480
  static create(parameters, options) {
4389
4481
  const params = buildClientParams([parameters], [{ args: [
@@ -4393,31 +4485,31 @@ var Templates = class {
4393
4485
  },
4394
4486
  {
4395
4487
  in: "body",
4396
- key: "projectName"
4488
+ key: "description"
4397
4489
  },
4398
4490
  {
4399
4491
  in: "body",
4400
- key: "slug"
4492
+ key: "type"
4401
4493
  },
4402
4494
  {
4403
4495
  in: "body",
4404
- key: "galleryTemplateId"
4496
+ key: "criteria"
4405
4497
  },
4406
4498
  {
4407
4499
  in: "body",
4408
- key: "description"
4500
+ key: "color"
4409
4501
  },
4410
4502
  {
4411
4503
  in: "body",
4412
- key: "category"
4504
+ key: "icon"
4413
4505
  },
4414
4506
  {
4415
4507
  in: "body",
4416
- key: "isActive"
4508
+ key: "parentGroupId"
4417
4509
  },
4418
4510
  {
4419
4511
  in: "body",
4420
- key: "idempotencyKey"
4512
+ key: "isActive"
4421
4513
  }
4422
4514
  ] }]);
4423
4515
  return (options?.client ?? client).post({
@@ -4425,7 +4517,7 @@ var Templates = class {
4425
4517
  name: "x-api-key",
4426
4518
  type: "apiKey"
4427
4519
  }],
4428
- url: "/v1/templates",
4520
+ url: "/v1/contact-groups",
4429
4521
  ...options,
4430
4522
  ...params,
4431
4523
  headers: {
@@ -4436,98 +4528,95 @@ var Templates = class {
4436
4528
  });
4437
4529
  }
4438
4530
  /**
4439
- * List templates for the dashboard
4531
+ * Delete a contact group
4440
4532
  *
4441
- * Returns a paginated dashboard view that groups related channel templates into families and leaves standalone templates ungrouped.
4533
+ * Permanently deletes a contact group by its ID.
4442
4534
  */
4443
- static listDashboard(parameters, options) {
4444
- const params = buildClientParams([parameters], [{ args: [
4445
- {
4446
- in: "query",
4447
- key: "page"
4448
- },
4449
- {
4450
- in: "query",
4451
- key: "limit"
4452
- },
4453
- {
4454
- in: "query",
4455
- key: "allowedChannels"
4456
- },
4457
- {
4458
- in: "query",
4459
- key: "category"
4460
- },
4461
- {
4462
- in: "query",
4463
- key: "channel"
4464
- },
4465
- {
4466
- in: "query",
4467
- key: "status"
4468
- },
4469
- {
4470
- in: "query",
4471
- key: "search"
4472
- },
4473
- {
4474
- in: "query",
4475
- key: "sortBy"
4476
- },
4477
- {
4478
- in: "query",
4479
- key: "sortOrder"
4480
- }
4481
- ] }]);
4482
- return (options?.client ?? client).get({
4535
+ static remove(parameters, options) {
4536
+ const params = buildClientParams([parameters], [{ args: [{
4537
+ in: "path",
4538
+ key: "id"
4539
+ }] }]);
4540
+ return (options?.client ?? client).delete({
4483
4541
  security: [{
4484
4542
  name: "x-api-key",
4485
4543
  type: "apiKey"
4486
4544
  }],
4487
- url: "/v1/templates/dashboard",
4545
+ url: "/v1/contact-groups/{id}",
4488
4546
  ...options,
4489
4547
  ...params
4490
4548
  });
4491
4549
  }
4492
4550
  /**
4493
- * List template families
4551
+ * Get a contact group
4494
4552
  *
4495
- * Returns a paginated list of the organization's template families and members.
4553
+ * Returns a single contact group by its ID.
4496
4554
  */
4497
- static listFamilies(parameters, options) {
4555
+ static getById(parameters, options) {
4498
4556
  const params = buildClientParams([parameters], [{ args: [{
4499
- in: "query",
4500
- key: "page"
4501
- }, {
4502
- in: "query",
4503
- key: "limit"
4557
+ in: "path",
4558
+ key: "id"
4504
4559
  }] }]);
4505
4560
  return (options?.client ?? client).get({
4506
4561
  security: [{
4507
4562
  name: "x-api-key",
4508
4563
  type: "apiKey"
4509
4564
  }],
4510
- url: "/v1/templates/families",
4565
+ url: "/v1/contact-groups/{id}",
4511
4566
  ...options,
4512
4567
  ...params
4513
4568
  });
4514
4569
  }
4515
4570
  /**
4516
- * Create a template family
4571
+ * Update a contact group
4517
4572
  *
4518
- * Creates an empty template family with the supplied name and returns it with status 201.
4573
+ * Updates an existing contact group's fields and returns the updated group.
4519
4574
  */
4520
- static createFamily(parameters, options) {
4521
- const params = buildClientParams([parameters], [{ args: [{
4522
- in: "body",
4523
- key: "name"
4524
- }] }]);
4525
- return (options?.client ?? client).post({
4575
+ static update(parameters, options) {
4576
+ const params = buildClientParams([parameters], [{ args: [
4577
+ {
4578
+ in: "path",
4579
+ key: "id"
4580
+ },
4581
+ {
4582
+ in: "body",
4583
+ key: "name"
4584
+ },
4585
+ {
4586
+ in: "body",
4587
+ key: "description"
4588
+ },
4589
+ {
4590
+ in: "body",
4591
+ key: "type"
4592
+ },
4593
+ {
4594
+ in: "body",
4595
+ key: "criteria"
4596
+ },
4597
+ {
4598
+ in: "body",
4599
+ key: "color"
4600
+ },
4601
+ {
4602
+ in: "body",
4603
+ key: "icon"
4604
+ },
4605
+ {
4606
+ in: "body",
4607
+ key: "parentGroupId"
4608
+ },
4609
+ {
4610
+ in: "body",
4611
+ key: "isActive"
4612
+ }
4613
+ ] }]);
4614
+ return (options?.client ?? client).patch({
4526
4615
  security: [{
4527
4616
  name: "x-api-key",
4528
4617
  type: "apiKey"
4529
4618
  }],
4530
- url: "/v1/templates/families",
4619
+ url: "/v1/contact-groups/{id}",
4531
4620
  ...options,
4532
4621
  ...params,
4533
4622
  headers: {
@@ -4538,23 +4627,876 @@ var Templates = class {
4538
4627
  });
4539
4628
  }
4540
4629
  /**
4541
- * Delete a template family
4630
+ * Remove members from a contact group
4542
4631
  *
4543
- * Deletes a template family without deleting its member templates.
4632
+ * Removes one or more contacts from a contact group, returning the count of removed members.
4544
4633
  */
4545
- static deleteFamily(parameters, options) {
4634
+ static removeMembers(parameters, options) {
4546
4635
  const params = buildClientParams([parameters], [{ args: [{
4547
4636
  in: "path",
4548
- key: "familyId"
4637
+ key: "groupId"
4638
+ }, {
4639
+ in: "body",
4640
+ key: "contactIds"
4549
4641
  }] }]);
4550
4642
  return (options?.client ?? client).delete({
4551
4643
  security: [{
4552
4644
  name: "x-api-key",
4553
4645
  type: "apiKey"
4554
4646
  }],
4555
- url: "/v1/templates/families/{familyId}",
4647
+ url: "/v1/contact-groups/{groupId}/members",
4556
4648
  ...options,
4557
- ...params
4649
+ ...params,
4650
+ headers: {
4651
+ "Content-Type": "application/json",
4652
+ ...options?.headers,
4653
+ ...params.headers
4654
+ }
4655
+ });
4656
+ }
4657
+ /**
4658
+ * List members of a contact group
4659
+ *
4660
+ * Returns a paginated list of contacts belonging to a contact group.
4661
+ */
4662
+ static getMembers(parameters, options) {
4663
+ const params = buildClientParams([parameters], [{ args: [
4664
+ {
4665
+ in: "path",
4666
+ key: "groupId"
4667
+ },
4668
+ {
4669
+ in: "query",
4670
+ key: "page"
4671
+ },
4672
+ {
4673
+ in: "query",
4674
+ key: "limit"
4675
+ }
4676
+ ] }]);
4677
+ return (options?.client ?? client).get({
4678
+ security: [{
4679
+ name: "x-api-key",
4680
+ type: "apiKey"
4681
+ }],
4682
+ url: "/v1/contact-groups/{groupId}/members",
4683
+ ...options,
4684
+ ...params
4685
+ });
4686
+ }
4687
+ /**
4688
+ * Add members to a contact group
4689
+ *
4690
+ * Adds one or more contacts to a contact group, returning counts of added and skipped members.
4691
+ */
4692
+ static addMembers(parameters, options) {
4693
+ const params = buildClientParams([parameters], [{ args: [
4694
+ {
4695
+ in: "path",
4696
+ key: "groupId"
4697
+ },
4698
+ {
4699
+ in: "body",
4700
+ key: "contactIds"
4701
+ },
4702
+ {
4703
+ in: "body",
4704
+ key: "role"
4705
+ }
4706
+ ] }]);
4707
+ return (options?.client ?? client).post({
4708
+ security: [{
4709
+ name: "x-api-key",
4710
+ type: "apiKey"
4711
+ }],
4712
+ url: "/v1/contact-groups/{groupId}/members",
4713
+ ...options,
4714
+ ...params,
4715
+ headers: {
4716
+ "Content-Type": "application/json",
4717
+ ...options?.headers,
4718
+ ...params.headers
4719
+ }
4720
+ });
4721
+ }
4722
+ /**
4723
+ * Evaluate a dynamic contact group
4724
+ *
4725
+ * Recomputes a dynamic contact group's membership from its criteria, returning counts of added, removed, and total members.
4726
+ */
4727
+ static evaluateDynamic(parameters, options) {
4728
+ const params = buildClientParams([parameters], [{ args: [{
4729
+ in: "path",
4730
+ key: "groupId"
4731
+ }] }]);
4732
+ return (options?.client ?? client).post({
4733
+ security: [{
4734
+ name: "x-api-key",
4735
+ type: "apiKey"
4736
+ }],
4737
+ url: "/v1/contact-groups/{groupId}/evaluate",
4738
+ ...options,
4739
+ ...params
4740
+ });
4741
+ }
4742
+ /**
4743
+ * Preview contact group criteria
4744
+ *
4745
+ * Evaluates group criteria without persisting, returning the matching contact count and a sample of matches.
4746
+ */
4747
+ static preview(parameters, options) {
4748
+ const params = buildClientParams([parameters], [{ args: [{
4749
+ in: "body",
4750
+ key: "criteria"
4751
+ }] }]);
4752
+ return (options?.client ?? client).post({
4753
+ security: [{
4754
+ name: "x-api-key",
4755
+ type: "apiKey"
4756
+ }],
4757
+ url: "/v1/contact-groups/preview",
4758
+ ...options,
4759
+ ...params,
4760
+ headers: {
4761
+ "Content-Type": "application/json",
4762
+ ...options?.headers,
4763
+ ...params.headers
4764
+ }
4765
+ });
4766
+ }
4767
+ };
4768
+ var CustomFields = class {
4769
+ /**
4770
+ * List custom fields
4771
+ *
4772
+ * Returns a paginated list of custom field definitions for the organization.
4773
+ */
4774
+ static list(parameters, options) {
4775
+ const params = buildClientParams([parameters], [{ args: [{
4776
+ in: "query",
4777
+ key: "page"
4778
+ }, {
4779
+ in: "query",
4780
+ key: "limit"
4781
+ }] }]);
4782
+ return (options?.client ?? client).get({
4783
+ security: [{
4784
+ name: "x-api-key",
4785
+ type: "apiKey"
4786
+ }],
4787
+ url: "/v1/custom-fields",
4788
+ ...options,
4789
+ ...params
4790
+ });
4791
+ }
4792
+ /**
4793
+ * Create a custom field
4794
+ *
4795
+ * Creates a new custom field definition and returns it with a 201 status; the field key must be unique.
4796
+ */
4797
+ static create(parameters, options) {
4798
+ const params = buildClientParams([parameters], [{ args: [
4799
+ {
4800
+ in: "body",
4801
+ key: "key"
4802
+ },
4803
+ {
4804
+ in: "body",
4805
+ key: "label"
4806
+ },
4807
+ {
4808
+ in: "body",
4809
+ key: "type"
4810
+ },
4811
+ {
4812
+ in: "body",
4813
+ key: "options"
4814
+ },
4815
+ {
4816
+ in: "body",
4817
+ key: "defaultValue"
4818
+ },
4819
+ {
4820
+ in: "body",
4821
+ key: "isRequired"
4822
+ },
4823
+ {
4824
+ in: "body",
4825
+ key: "sortOrder"
4826
+ }
4827
+ ] }]);
4828
+ return (options?.client ?? client).post({
4829
+ security: [{
4830
+ name: "x-api-key",
4831
+ type: "apiKey"
4832
+ }],
4833
+ url: "/v1/custom-fields",
4834
+ ...options,
4835
+ ...params,
4836
+ headers: {
4837
+ "Content-Type": "application/json",
4838
+ ...options?.headers,
4839
+ ...params.headers
4840
+ }
4841
+ });
4842
+ }
4843
+ /**
4844
+ * Delete a custom field
4845
+ *
4846
+ * Permanently deletes a custom field definition by its ID.
4847
+ */
4848
+ static remove(parameters, options) {
4849
+ const params = buildClientParams([parameters], [{ args: [{
4850
+ in: "path",
4851
+ key: "id"
4852
+ }] }]);
4853
+ return (options?.client ?? client).delete({
4854
+ security: [{
4855
+ name: "x-api-key",
4856
+ type: "apiKey"
4857
+ }],
4858
+ url: "/v1/custom-fields/{id}",
4859
+ ...options,
4860
+ ...params
4861
+ });
4862
+ }
4863
+ /**
4864
+ * Update a custom field
4865
+ *
4866
+ * Updates an existing custom field definition and returns the updated field.
4867
+ */
4868
+ static update(parameters, options) {
4869
+ const params = buildClientParams([parameters], [{ args: [
4870
+ {
4871
+ in: "path",
4872
+ key: "id"
4873
+ },
4874
+ {
4875
+ in: "body",
4876
+ key: "label"
4877
+ },
4878
+ {
4879
+ in: "body",
4880
+ key: "options"
4881
+ },
4882
+ {
4883
+ in: "body",
4884
+ key: "defaultValue"
4885
+ },
4886
+ {
4887
+ in: "body",
4888
+ key: "isRequired"
4889
+ },
4890
+ {
4891
+ in: "body",
4892
+ key: "sortOrder"
4893
+ }
4894
+ ] }]);
4895
+ return (options?.client ?? client).patch({
4896
+ security: [{
4897
+ name: "x-api-key",
4898
+ type: "apiKey"
4899
+ }],
4900
+ url: "/v1/custom-fields/{id}",
4901
+ ...options,
4902
+ ...params,
4903
+ headers: {
4904
+ "Content-Type": "application/json",
4905
+ ...options?.headers,
4906
+ ...params.headers
4907
+ }
4908
+ });
4909
+ }
4910
+ };
4911
+ var Unsubscribe = class {
4912
+ /**
4913
+ * List unsubscribe groups
4914
+ *
4915
+ * Returns a paginated list of the organization's unsubscribe groups.
4916
+ */
4917
+ static list(parameters, options) {
4918
+ const params = buildClientParams([parameters], [{ args: [{
4919
+ in: "query",
4920
+ key: "page"
4921
+ }, {
4922
+ in: "query",
4923
+ key: "limit"
4924
+ }] }]);
4925
+ return (options?.client ?? client).get({
4926
+ security: [{
4927
+ name: "x-api-key",
4928
+ type: "apiKey"
4929
+ }],
4930
+ url: "/v1/unsubscribe-groups",
4931
+ ...options,
4932
+ ...params
4933
+ });
4934
+ }
4935
+ /**
4936
+ * Create an unsubscribe group
4937
+ *
4938
+ * Creates a new unsubscribe group and returns it with a 201 Created status.
4939
+ */
4940
+ static create(parameters, options) {
4941
+ const params = buildClientParams([parameters], [{ args: [{
4942
+ in: "body",
4943
+ key: "name"
4944
+ }, {
4945
+ in: "body",
4946
+ key: "description"
4947
+ }] }]);
4948
+ return (options?.client ?? client).post({
4949
+ security: [{
4950
+ name: "x-api-key",
4951
+ type: "apiKey"
4952
+ }],
4953
+ url: "/v1/unsubscribe-groups",
4954
+ ...options,
4955
+ ...params,
4956
+ headers: {
4957
+ "Content-Type": "application/json",
4958
+ ...options?.headers,
4959
+ ...params.headers
4960
+ }
4961
+ });
4962
+ }
4963
+ /**
4964
+ * Delete an unsubscribe group
4965
+ *
4966
+ * Permanently deletes an unsubscribe group by its ID.
4967
+ */
4968
+ static remove(parameters, options) {
4969
+ const params = buildClientParams([parameters], [{ args: [{
4970
+ in: "path",
4971
+ key: "id"
4972
+ }] }]);
4973
+ return (options?.client ?? client).delete({
4974
+ security: [{
4975
+ name: "x-api-key",
4976
+ type: "apiKey"
4977
+ }],
4978
+ url: "/v1/unsubscribe-groups/{id}",
4979
+ ...options,
4980
+ ...params
4981
+ });
4982
+ }
4983
+ /**
4984
+ * Update an unsubscribe group
4985
+ *
4986
+ * Updates the name or description of an unsubscribe group.
4987
+ */
4988
+ static update(parameters, options) {
4989
+ const params = buildClientParams([parameters], [{ args: [
4990
+ {
4991
+ in: "path",
4992
+ key: "id"
4993
+ },
4994
+ {
4995
+ in: "body",
4996
+ key: "name"
4997
+ },
4998
+ {
4999
+ in: "body",
5000
+ key: "description"
5001
+ }
5002
+ ] }]);
5003
+ return (options?.client ?? client).patch({
5004
+ security: [{
5005
+ name: "x-api-key",
5006
+ type: "apiKey"
5007
+ }],
5008
+ url: "/v1/unsubscribe-groups/{id}",
5009
+ ...options,
5010
+ ...params,
5011
+ headers: {
5012
+ "Content-Type": "application/json",
5013
+ ...options?.headers,
5014
+ ...params.headers
5015
+ }
5016
+ });
5017
+ }
5018
+ /**
5019
+ * Remove contacts from an unsubscribe group
5020
+ *
5021
+ * Removes one or more email addresses from an unsubscribe group and returns the number removed.
5022
+ */
5023
+ static removeEmails(parameters, options) {
5024
+ const params = buildClientParams([parameters], [{ args: [{
5025
+ in: "path",
5026
+ key: "groupId"
5027
+ }, {
5028
+ in: "body",
5029
+ key: "emails"
5030
+ }] }]);
5031
+ return (options?.client ?? client).delete({
5032
+ security: [{
5033
+ name: "x-api-key",
5034
+ type: "apiKey"
5035
+ }],
5036
+ url: "/v1/unsubscribe-groups/{groupId}/members",
5037
+ ...options,
5038
+ ...params,
5039
+ headers: {
5040
+ "Content-Type": "application/json",
5041
+ ...options?.headers,
5042
+ ...params.headers
5043
+ }
5044
+ });
5045
+ }
5046
+ /**
5047
+ * List unsubscribe group members
5048
+ *
5049
+ * Returns a paginated list of the email addresses in an unsubscribe group.
5050
+ */
5051
+ static listMembers(parameters, options) {
5052
+ const params = buildClientParams([parameters], [{ args: [
5053
+ {
5054
+ in: "path",
5055
+ key: "groupId"
5056
+ },
5057
+ {
5058
+ in: "query",
5059
+ key: "page"
5060
+ },
5061
+ {
5062
+ in: "query",
5063
+ key: "limit"
5064
+ }
5065
+ ] }]);
5066
+ return (options?.client ?? client).get({
5067
+ security: [{
5068
+ name: "x-api-key",
5069
+ type: "apiKey"
5070
+ }],
5071
+ url: "/v1/unsubscribe-groups/{groupId}/members",
5072
+ ...options,
5073
+ ...params
5074
+ });
5075
+ }
5076
+ /**
5077
+ * Add contacts to an unsubscribe group
5078
+ *
5079
+ * Adds one or more email addresses to an unsubscribe group and returns the number added and the number skipped.
5080
+ */
5081
+ static addEmails(parameters, options) {
5082
+ const params = buildClientParams([parameters], [{ args: [
5083
+ {
5084
+ in: "path",
5085
+ key: "groupId"
5086
+ },
5087
+ {
5088
+ in: "body",
5089
+ key: "emails"
5090
+ },
5091
+ {
5092
+ in: "body",
5093
+ key: "source"
5094
+ }
5095
+ ] }]);
5096
+ return (options?.client ?? client).post({
5097
+ security: [{
5098
+ name: "x-api-key",
5099
+ type: "apiKey"
5100
+ }],
5101
+ url: "/v1/unsubscribe-groups/{groupId}/members",
5102
+ ...options,
5103
+ ...params,
5104
+ headers: {
5105
+ "Content-Type": "application/json",
5106
+ ...options?.headers,
5107
+ ...params.headers
5108
+ }
5109
+ });
5110
+ }
5111
+ /**
5112
+ * Check unsubscribe group membership
5113
+ *
5114
+ * Returns the unsubscribe groups that an email address has unsubscribed from, optionally limited to a specified set of groups.
5115
+ */
5116
+ static checkSubscription(parameters, options) {
5117
+ const params = buildClientParams([parameters], [{ args: [{
5118
+ in: "query",
5119
+ key: "email"
5120
+ }, {
5121
+ in: "query",
5122
+ key: "groupIds"
5123
+ }] }]);
5124
+ return (options?.client ?? client).get({
5125
+ security: [{
5126
+ name: "x-api-key",
5127
+ type: "apiKey"
5128
+ }],
5129
+ url: "/v1/unsubscribe-groups/check",
5130
+ ...options,
5131
+ ...params
5132
+ });
5133
+ }
5134
+ };
5135
+ var Analytics = class {
5136
+ /**
5137
+ * Get message volume analytics
5138
+ *
5139
+ * 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.
5140
+ */
5141
+ static getStats(parameters, options) {
5142
+ const params = buildClientParams([parameters], [{ args: [
5143
+ {
5144
+ in: "query",
5145
+ key: "startDate"
5146
+ },
5147
+ {
5148
+ in: "query",
5149
+ key: "endDate"
5150
+ },
5151
+ {
5152
+ in: "query",
5153
+ key: "groupBy"
5154
+ },
5155
+ {
5156
+ in: "query",
5157
+ key: "channel"
5158
+ }
5159
+ ] }]);
5160
+ return (options?.client ?? client).get({
5161
+ security: [{
5162
+ name: "x-api-key",
5163
+ type: "apiKey"
5164
+ }],
5165
+ url: "/v1/analytics/stats",
5166
+ ...options,
5167
+ ...params
5168
+ });
5169
+ }
5170
+ /**
5171
+ * Get channel performance analytics
5172
+ *
5173
+ * 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.
5174
+ */
5175
+ static getChannelStats(parameters, options) {
5176
+ const params = buildClientParams([parameters], [{ args: [{
5177
+ in: "query",
5178
+ key: "startDate"
5179
+ }, {
5180
+ in: "query",
5181
+ key: "endDate"
5182
+ }] }]);
5183
+ return (options?.client ?? client).get({
5184
+ security: [{
5185
+ name: "x-api-key",
5186
+ type: "apiKey"
5187
+ }],
5188
+ url: "/v1/analytics/channel-stats",
5189
+ ...options,
5190
+ ...params
5191
+ });
5192
+ }
5193
+ /**
5194
+ * List top contacts by message volume
5195
+ *
5196
+ * 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.
5197
+ */
5198
+ static getTopContacts(parameters, options) {
5199
+ const params = buildClientParams([parameters], [{ args: [
5200
+ {
5201
+ in: "query",
5202
+ key: "startDate"
5203
+ },
5204
+ {
5205
+ in: "query",
5206
+ key: "endDate"
5207
+ },
5208
+ {
5209
+ in: "query",
5210
+ key: "limit"
5211
+ },
5212
+ {
5213
+ in: "query",
5214
+ key: "sortBy"
5215
+ }
5216
+ ] }]);
5217
+ return (options?.client ?? client).get({
5218
+ security: [{
5219
+ name: "x-api-key",
5220
+ type: "apiKey"
5221
+ }],
5222
+ url: "/v1/analytics/top-contacts",
5223
+ ...options,
5224
+ ...params
5225
+ });
5226
+ }
5227
+ /**
5228
+ * Get hourly message distribution
5229
+ *
5230
+ * 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.
5231
+ */
5232
+ static getHourlyDistribution(parameters, options) {
5233
+ const params = buildClientParams([parameters], [{ args: [{
5234
+ in: "query",
5235
+ key: "startDate"
5236
+ }, {
5237
+ in: "query",
5238
+ key: "endDate"
5239
+ }] }]);
5240
+ return (options?.client ?? client).get({
5241
+ security: [{
5242
+ name: "x-api-key",
5243
+ type: "apiKey"
5244
+ }],
5245
+ url: "/v1/analytics/hourly-distribution",
5246
+ ...options,
5247
+ ...params
5248
+ });
5249
+ }
5250
+ /**
5251
+ * Get message delivery metrics
5252
+ *
5253
+ * 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.
5254
+ */
5255
+ static getDeliveryMetrics(parameters, options) {
5256
+ const params = buildClientParams([parameters], [{ args: [
5257
+ {
5258
+ in: "query",
5259
+ key: "startDate"
5260
+ },
5261
+ {
5262
+ in: "query",
5263
+ key: "endDate"
5264
+ },
5265
+ {
5266
+ in: "query",
5267
+ key: "channel"
5268
+ }
5269
+ ] }]);
5270
+ return (options?.client ?? client).get({
5271
+ security: [{
5272
+ name: "x-api-key",
5273
+ type: "apiKey"
5274
+ }],
5275
+ url: "/v1/analytics/delivery-metrics",
5276
+ ...options,
5277
+ ...params
5278
+ });
5279
+ }
5280
+ /**
5281
+ * Export messaging analytics data
5282
+ *
5283
+ * 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.
5284
+ */
5285
+ static exportData(parameters, options) {
5286
+ const params = buildClientParams([parameters], [{ args: [
5287
+ {
5288
+ in: "body",
5289
+ key: "startDate"
5290
+ },
5291
+ {
5292
+ in: "body",
5293
+ key: "endDate"
5294
+ },
5295
+ {
5296
+ in: "body",
5297
+ key: "format"
5298
+ },
5299
+ {
5300
+ in: "body",
5301
+ key: "includeChannels"
5302
+ }
5303
+ ] }]);
5304
+ return (options?.client ?? client).post({
5305
+ security: [{
5306
+ name: "x-api-key",
5307
+ type: "apiKey"
5308
+ }],
5309
+ url: "/v1/analytics/export",
5310
+ ...options,
5311
+ ...params,
5312
+ headers: {
5313
+ "Content-Type": "application/json",
5314
+ ...options?.headers,
5315
+ ...params.headers
5316
+ }
5317
+ });
5318
+ }
5319
+ };
5320
+ var Templates = class {
5321
+ /**
5322
+ * List templates
5323
+ *
5324
+ * Returns a paginated list of the organization's templates, filterable by category, channel, status, and search, with configurable sorting.
5325
+ */
5326
+ static list(parameters, options) {
5327
+ const params = buildClientParams([parameters], [{ args: [
5328
+ {
5329
+ in: "query",
5330
+ key: "page"
5331
+ },
5332
+ {
5333
+ in: "query",
5334
+ key: "limit"
5335
+ },
5336
+ {
5337
+ in: "query",
5338
+ key: "category"
5339
+ },
5340
+ {
5341
+ in: "query",
5342
+ key: "channel"
5343
+ },
5344
+ {
5345
+ in: "query",
5346
+ key: "status"
5347
+ },
5348
+ {
5349
+ in: "query",
5350
+ key: "search"
5351
+ },
5352
+ {
5353
+ in: "query",
5354
+ key: "projectId"
5355
+ },
5356
+ {
5357
+ in: "query",
5358
+ key: "sortBy"
5359
+ },
5360
+ {
5361
+ in: "query",
5362
+ key: "sortOrder"
5363
+ }
5364
+ ] }]);
5365
+ return (options?.client ?? client).get({
5366
+ security: [{
5367
+ name: "x-api-key",
5368
+ type: "apiKey"
5369
+ }],
5370
+ url: "/v1/templates",
5371
+ ...options,
5372
+ ...params
5373
+ });
5374
+ }
5375
+ /**
5376
+ * Create a template
5377
+ *
5378
+ * Creates an email template project from Samva's canonical TSX starter and returns its template entry with status 201.
5379
+ */
5380
+ static create(parameters, options) {
5381
+ const params = buildClientParams([parameters], [{ args: [
5382
+ {
5383
+ in: "body",
5384
+ key: "name"
5385
+ },
5386
+ {
5387
+ in: "body",
5388
+ key: "projectName"
5389
+ },
5390
+ {
5391
+ in: "body",
5392
+ key: "slug"
5393
+ },
5394
+ {
5395
+ in: "body",
5396
+ key: "galleryTemplateId"
5397
+ },
5398
+ {
5399
+ in: "body",
5400
+ key: "useBrand"
5401
+ },
5402
+ {
5403
+ in: "body",
5404
+ key: "description"
5405
+ },
5406
+ {
5407
+ in: "body",
5408
+ key: "category"
5409
+ },
5410
+ {
5411
+ in: "body",
5412
+ key: "isActive"
5413
+ },
5414
+ {
5415
+ in: "body",
5416
+ key: "idempotencyKey"
5417
+ }
5418
+ ] }]);
5419
+ return (options?.client ?? client).post({
5420
+ security: [{
5421
+ name: "x-api-key",
5422
+ type: "apiKey"
5423
+ }],
5424
+ url: "/v1/templates",
5425
+ ...options,
5426
+ ...params,
5427
+ headers: {
5428
+ "Content-Type": "application/json",
5429
+ ...options?.headers,
5430
+ ...params.headers
5431
+ }
5432
+ });
5433
+ }
5434
+ /**
5435
+ * List template families
5436
+ *
5437
+ * Returns a paginated list of the organization's template families and members.
5438
+ */
5439
+ static listFamilies(parameters, options) {
5440
+ const params = buildClientParams([parameters], [{ args: [{
5441
+ in: "query",
5442
+ key: "page"
5443
+ }, {
5444
+ in: "query",
5445
+ key: "limit"
5446
+ }] }]);
5447
+ return (options?.client ?? client).get({
5448
+ security: [{
5449
+ name: "x-api-key",
5450
+ type: "apiKey"
5451
+ }],
5452
+ url: "/v1/templates/families",
5453
+ ...options,
5454
+ ...params
5455
+ });
5456
+ }
5457
+ /**
5458
+ * Create a template family
5459
+ *
5460
+ * Creates an empty template family with the supplied name and returns it with status 201.
5461
+ */
5462
+ static createFamily(parameters, options) {
5463
+ const params = buildClientParams([parameters], [{ args: [{
5464
+ in: "body",
5465
+ key: "name"
5466
+ }] }]);
5467
+ return (options?.client ?? client).post({
5468
+ security: [{
5469
+ name: "x-api-key",
5470
+ type: "apiKey"
5471
+ }],
5472
+ url: "/v1/templates/families",
5473
+ ...options,
5474
+ ...params,
5475
+ headers: {
5476
+ "Content-Type": "application/json",
5477
+ ...options?.headers,
5478
+ ...params.headers
5479
+ }
5480
+ });
5481
+ }
5482
+ /**
5483
+ * Delete a template family
5484
+ *
5485
+ * Deletes a template family without deleting its member templates.
5486
+ */
5487
+ static deleteFamily(parameters, options) {
5488
+ const params = buildClientParams([parameters], [{ args: [{
5489
+ in: "path",
5490
+ key: "familyId"
5491
+ }] }]);
5492
+ return (options?.client ?? client).delete({
5493
+ security: [{
5494
+ name: "x-api-key",
5495
+ type: "apiKey"
5496
+ }],
5497
+ url: "/v1/templates/families/{familyId}",
5498
+ ...options,
5499
+ ...params
4558
5500
  });
4559
5501
  }
4560
5502
  /**
@@ -4722,7 +5664,7 @@ var Templates = class {
4722
5664
  /**
4723
5665
  * Update a template
4724
5666
  *
4725
- * Updates template metadata. Source changes use the project workspace API.
5667
+ * Updates template metadata. Setting `entryPath` points the template at another file in its project and keeps its id, slug, and publications; move the file in Git separately. Source changes use the project workspace API.
4726
5668
  */
4727
5669
  static update(parameters, options) {
4728
5670
  const params = buildClientParams([parameters], [{ args: [{
@@ -4748,6 +5690,53 @@ var Templates = class {
4748
5690
  });
4749
5691
  }
4750
5692
  /**
5693
+ * Add a template entry
5694
+ *
5695
+ * Registers an `emails*.tsx` file in an existing template project as its own template and returns it with status 201. The file does not need to exist yet; publishing fails until a commit contains it. Repeating the call with the same entry path, name, and slug returns the existing template.
5696
+ */
5697
+ static addEntry(parameters, options) {
5698
+ const params = buildClientParams([parameters], [{ args: [
5699
+ {
5700
+ in: "path",
5701
+ key: "projectId"
5702
+ },
5703
+ {
5704
+ in: "body",
5705
+ key: "entryPath"
5706
+ },
5707
+ {
5708
+ in: "body",
5709
+ key: "name"
5710
+ },
5711
+ {
5712
+ in: "body",
5713
+ key: "slug"
5714
+ },
5715
+ {
5716
+ in: "body",
5717
+ key: "description"
5718
+ },
5719
+ {
5720
+ in: "body",
5721
+ key: "category"
5722
+ }
5723
+ ] }]);
5724
+ return (options?.client ?? client).post({
5725
+ security: [{
5726
+ name: "x-api-key",
5727
+ type: "apiKey"
5728
+ }],
5729
+ url: "/v1/templates/projects/{projectId}/entries",
5730
+ ...options,
5731
+ ...params,
5732
+ headers: {
5733
+ "Content-Type": "application/json",
5734
+ ...options?.headers,
5735
+ ...params.headers
5736
+ }
5737
+ });
5738
+ }
5739
+ /**
4751
5740
  * Patch template project files
4752
5741
  *
4753
5742
  * Applies revision-checked file patches to the shared project workspace overlay.
@@ -4789,7 +5778,7 @@ var Templates = class {
4789
5778
  /**
4790
5779
  * Open a template project workspace
4791
5780
  *
4792
- * Creates or opens the shared project workspace at the current Artifact branch head and returns its effective files.
5781
+ * Creates or opens the shared project workspace at the latest saved version and returns its effective files.
4793
5782
  */
4794
5783
  static openWorkspace(parameters, options) {
4795
5784
  const params = buildClientParams([parameters], [{ args: [{
@@ -4835,9 +5824,56 @@ var Templates = class {
4835
5824
  });
4836
5825
  }
4837
5826
  /**
5827
+ * Put a template project asset
5828
+ *
5829
+ * Writes one image or font (png, jpg, jpeg, gif, webp, or woff2) into the shared project workspace as an unsaved file; Save commits it. The JSON body carries the file as canonical base64 in `contentBase64`, at most 1 MiB decoded, and the bytes must match the extension in `path`. `replace` must be `false` to add a new file and `true` to change an existing one.
5830
+ */
5831
+ static putWorkspaceAsset(parameters, options) {
5832
+ const params = buildClientParams([parameters], [{ args: [
5833
+ {
5834
+ in: "path",
5835
+ key: "id"
5836
+ },
5837
+ {
5838
+ in: "body",
5839
+ key: "expectedRevision"
5840
+ },
5841
+ {
5842
+ in: "body",
5843
+ key: "path"
5844
+ },
5845
+ {
5846
+ in: "body",
5847
+ key: "contentBase64"
5848
+ },
5849
+ {
5850
+ in: "body",
5851
+ key: "replace"
5852
+ },
5853
+ {
5854
+ in: "body",
5855
+ key: "idempotencyKey"
5856
+ }
5857
+ ] }]);
5858
+ return (options?.client ?? client).put({
5859
+ security: [{
5860
+ name: "x-api-key",
5861
+ type: "apiKey"
5862
+ }],
5863
+ url: "/v1/templates/{id}/workspace/assets",
5864
+ ...options,
5865
+ ...params,
5866
+ headers: {
5867
+ "Content-Type": "application/json",
5868
+ ...options?.headers,
5869
+ ...params.headers
5870
+ }
5871
+ });
5872
+ }
5873
+ /**
4838
5874
  * Reconcile a template project workspace
4839
5875
  *
4840
- * Fast-forwards or rebases the workspace onto the current Artifact branch head, retaining file conflicts for explicit resolution.
5876
+ * Fast-forwards or rebases the workspace onto the latest saved version, retaining file conflicts for explicit resolution.
4841
5877
  */
4842
5878
  static reconcileWorkspace(parameters, options) {
4843
5879
  const params = buildClientParams([parameters], [{ args: [
@@ -4923,7 +5959,7 @@ var Templates = class {
4923
5959
  /**
4924
5960
  * Save a template project workspace
4925
5961
  *
4926
- * Validates the effective project tree and creates one normal Git commit on the Artifact default branch.
5962
+ * Validates the effective project tree and saves it as one Git commit on the template repository's default branch.
4927
5963
  */
4928
5964
  static saveWorkspace(parameters, options) {
4929
5965
  const params = buildClientParams([parameters], [{ args: [
@@ -5005,7 +6041,7 @@ var Templates = class {
5005
6041
  /**
5006
6042
  * List template project commit history
5007
6043
  *
5008
- * Returns bounded history from the Artifact repository default branch.
6044
+ * Returns recent history from the template repository's default branch.
5009
6045
  */
5010
6046
  static workspaceHistory(parameters, options) {
5011
6047
  const params = buildClientParams([parameters], [{ args: [{
@@ -5114,6 +6150,10 @@ var Templates = class {
5114
6150
  {
5115
6151
  in: "body",
5116
6152
  key: "expectedWorkspaceRevision"
6153
+ },
6154
+ {
6155
+ in: "body",
6156
+ key: "ifCurrentPublicationId"
5117
6157
  }
5118
6158
  ] }]);
5119
6159
  return (options?.client ?? client).post({
@@ -5220,7 +6260,7 @@ var Templates = class {
5220
6260
  /**
5221
6261
  * Issue a template project Git credential
5222
6262
  *
5223
- * Exchanges the caller's Samva authorization for a one-hour, repository-scoped Artifact Git credential.
6263
+ * Exchanges the caller's Samva authorization for a one-hour Git credential scoped to the template repository.
5224
6264
  */
5225
6265
  static issueGitCredential(parameters, options) {
5226
6266
  const params = buildClientParams([parameters], [{ args: [{
@@ -5246,74 +6286,225 @@ var Templates = class {
5246
6286
  });
5247
6287
  }
5248
6288
  /**
5249
- * Attach a template workspace resource
6289
+ * Attach a template workspace resource
6290
+ *
6291
+ * Adds or replaces one bounded persistent read-only resource and advances the workspace revision.
6292
+ */
6293
+ static attachWorkspaceResource(parameters, options) {
6294
+ const params = buildClientParams([parameters], [{ args: [
6295
+ {
6296
+ in: "path",
6297
+ key: "id"
6298
+ },
6299
+ {
6300
+ in: "body",
6301
+ key: "expectedRevision"
6302
+ },
6303
+ {
6304
+ in: "body",
6305
+ key: "resource"
6306
+ },
6307
+ {
6308
+ in: "body",
6309
+ key: "idempotencyKey"
6310
+ }
6311
+ ] }]);
6312
+ return (options?.client ?? client).post({
6313
+ security: [{
6314
+ name: "x-api-key",
6315
+ type: "apiKey"
6316
+ }],
6317
+ url: "/v1/templates/{id}/workspace/resources",
6318
+ ...options,
6319
+ ...params,
6320
+ headers: {
6321
+ "Content-Type": "application/json",
6322
+ ...options?.headers,
6323
+ ...params.headers
6324
+ }
6325
+ });
6326
+ }
6327
+ /**
6328
+ * Remove a template workspace resource
6329
+ *
6330
+ * Removes one persistent resource from mounted context and advances the workspace revision.
6331
+ */
6332
+ static removeWorkspaceResource(parameters, options) {
6333
+ const params = buildClientParams([parameters], [{ args: [
6334
+ {
6335
+ in: "path",
6336
+ key: "id"
6337
+ },
6338
+ {
6339
+ in: "path",
6340
+ key: "resourceId"
6341
+ },
6342
+ {
6343
+ in: "body",
6344
+ key: "expectedRevision"
6345
+ },
6346
+ {
6347
+ in: "body",
6348
+ key: "idempotencyKey"
6349
+ }
6350
+ ] }]);
6351
+ return (options?.client ?? client).post({
6352
+ security: [{
6353
+ name: "x-api-key",
6354
+ type: "apiKey"
6355
+ }],
6356
+ url: "/v1/templates/{id}/workspace/resources/{resourceId}/remove",
6357
+ ...options,
6358
+ ...params,
6359
+ headers: {
6360
+ "Content-Type": "application/json",
6361
+ ...options?.headers,
6362
+ ...params.headers
6363
+ }
6364
+ });
6365
+ }
6366
+ };
6367
+ var Brands = class {
6368
+ /**
6369
+ * List brands
6370
+ *
6371
+ * Returns the organization's brands, the default brand first.
6372
+ */
6373
+ static list(options) {
6374
+ return (options?.client ?? client).get({
6375
+ security: [{
6376
+ name: "x-api-key",
6377
+ type: "apiKey"
6378
+ }],
6379
+ url: "/v1/brands",
6380
+ ...options
6381
+ });
6382
+ }
6383
+ /**
6384
+ * Create a brand
6385
+ *
6386
+ * Creates a brand. The CSS must parse as a brand theme; a rejected theme answers 422 with located findings under `fields.css`. With `isDefault`, the new brand becomes the default. An organization holds at most 12 brands; creating one more answers 409 with a `ConflictError`.
6387
+ */
6388
+ static create(parameters, options) {
6389
+ const params = buildClientParams([parameters], [{ args: [
6390
+ {
6391
+ in: "body",
6392
+ key: "slug"
6393
+ },
6394
+ {
6395
+ in: "body",
6396
+ key: "name"
6397
+ },
6398
+ {
6399
+ in: "body",
6400
+ key: "css"
6401
+ },
6402
+ {
6403
+ in: "body",
6404
+ key: "assets"
6405
+ },
6406
+ {
6407
+ in: "body",
6408
+ key: "footer"
6409
+ },
6410
+ {
6411
+ in: "body",
6412
+ key: "isDefault"
6413
+ }
6414
+ ] }]);
6415
+ return (options?.client ?? client).post({
6416
+ security: [{
6417
+ name: "x-api-key",
6418
+ type: "apiKey"
6419
+ }],
6420
+ url: "/v1/brands",
6421
+ ...options,
6422
+ ...params,
6423
+ headers: {
6424
+ "Content-Type": "application/json",
6425
+ ...options?.headers,
6426
+ ...params.headers
6427
+ }
6428
+ });
6429
+ }
6430
+ /**
6431
+ * Delete a brand
6432
+ *
6433
+ * Deletes a brand. The default brand cannot be deleted; domains that used the deleted brand fall back to the default.
6434
+ */
6435
+ static remove(parameters, options) {
6436
+ const params = buildClientParams([parameters], [{ args: [{
6437
+ in: "path",
6438
+ key: "slug"
6439
+ }] }]);
6440
+ return (options?.client ?? client).delete({
6441
+ security: [{
6442
+ name: "x-api-key",
6443
+ type: "apiKey"
6444
+ }],
6445
+ url: "/v1/brands/{slug}",
6446
+ ...options,
6447
+ ...params
6448
+ });
6449
+ }
6450
+ /**
6451
+ * Get a brand
6452
+ *
6453
+ * Returns one brand by its slug.
6454
+ */
6455
+ static get(parameters, options) {
6456
+ const params = buildClientParams([parameters], [{ args: [{
6457
+ in: "path",
6458
+ key: "slug"
6459
+ }] }]);
6460
+ return (options?.client ?? client).get({
6461
+ security: [{
6462
+ name: "x-api-key",
6463
+ type: "apiKey"
6464
+ }],
6465
+ url: "/v1/brands/{slug}",
6466
+ ...options,
6467
+ ...params
6468
+ });
6469
+ }
6470
+ /**
6471
+ * Update a brand
5250
6472
  *
5251
- * Adds or replaces one bounded persistent read-only resource and advances the workspace revision.
6473
+ * Updates a brand. Each section given replaces that section whole. Published templates keep the brand they were built against until they are republished.
5252
6474
  */
5253
- static attachWorkspaceResource(parameters, options) {
6475
+ static update(parameters, options) {
5254
6476
  const params = buildClientParams([parameters], [{ args: [
5255
6477
  {
5256
6478
  in: "path",
5257
- key: "id"
6479
+ key: "slug"
5258
6480
  },
5259
6481
  {
5260
6482
  in: "body",
5261
- key: "expectedRevision"
6483
+ key: "newSlug"
5262
6484
  },
5263
6485
  {
5264
6486
  in: "body",
5265
- key: "resource"
6487
+ key: "name"
5266
6488
  },
5267
6489
  {
5268
6490
  in: "body",
5269
- key: "idempotencyKey"
5270
- }
5271
- ] }]);
5272
- return (options?.client ?? client).post({
5273
- security: [{
5274
- name: "x-api-key",
5275
- type: "apiKey"
5276
- }],
5277
- url: "/v1/templates/{id}/workspace/resources",
5278
- ...options,
5279
- ...params,
5280
- headers: {
5281
- "Content-Type": "application/json",
5282
- ...options?.headers,
5283
- ...params.headers
5284
- }
5285
- });
5286
- }
5287
- /**
5288
- * Remove a template workspace resource
5289
- *
5290
- * Removes one persistent resource from mounted context and advances the workspace revision.
5291
- */
5292
- static removeWorkspaceResource(parameters, options) {
5293
- const params = buildClientParams([parameters], [{ args: [
5294
- {
5295
- in: "path",
5296
- key: "id"
5297
- },
5298
- {
5299
- in: "path",
5300
- key: "resourceId"
6491
+ key: "css"
5301
6492
  },
5302
6493
  {
5303
6494
  in: "body",
5304
- key: "expectedRevision"
6495
+ key: "assets"
5305
6496
  },
5306
6497
  {
5307
6498
  in: "body",
5308
- key: "idempotencyKey"
6499
+ key: "footer"
5309
6500
  }
5310
6501
  ] }]);
5311
- return (options?.client ?? client).post({
6502
+ return (options?.client ?? client).patch({
5312
6503
  security: [{
5313
6504
  name: "x-api-key",
5314
6505
  type: "apiKey"
5315
6506
  }],
5316
- url: "/v1/templates/{id}/workspace/resources/{resourceId}/remove",
6507
+ url: "/v1/brands/{slug}",
5317
6508
  ...options,
5318
6509
  ...params,
5319
6510
  headers: {
@@ -5323,46 +6514,24 @@ var Templates = class {
5323
6514
  }
5324
6515
  });
5325
6516
  }
5326
- };
5327
- var Design = class {
5328
- /**
5329
- * Get the organization design
5330
- *
5331
- * Returns the organization's configured email design kit (theme, assets, footer), or null when none is set.
5332
- */
5333
- static get(options) {
5334
- return (options?.client ?? client).get({
5335
- security: [{
5336
- name: "x-api-key",
5337
- type: "apiKey"
5338
- }],
5339
- url: "/v1/design",
5340
- ...options
5341
- });
5342
- }
5343
6517
  /**
5344
- * Update the organization design
6518
+ * Make a brand the default
5345
6519
  *
5346
- * Validates and saves the organization's email design kit; a null body clears the design back to the base design floor.
6520
+ * Makes this brand the organization's default: bare `samva:brand` and domains without a brand resolve to it at their next build or send.
5347
6521
  */
5348
- static update(parameters, options) {
6522
+ static setDefault(parameters, options) {
5349
6523
  const params = buildClientParams([parameters], [{ args: [{
5350
- in: "body",
5351
- key: "design"
6524
+ in: "path",
6525
+ key: "slug"
5352
6526
  }] }]);
5353
- return (options?.client ?? client).put({
6527
+ return (options?.client ?? client).post({
5354
6528
  security: [{
5355
6529
  name: "x-api-key",
5356
6530
  type: "apiKey"
5357
6531
  }],
5358
- url: "/v1/design",
6532
+ url: "/v1/brands/{slug}/default",
5359
6533
  ...options,
5360
- ...params,
5361
- headers: {
5362
- "Content-Type": "application/json",
5363
- ...options?.headers,
5364
- ...params.headers
5365
- }
6534
+ ...params
5366
6535
  });
5367
6536
  }
5368
6537
  };
@@ -5593,7 +6762,7 @@ var Webhooks = class {
5593
6762
  /**
5594
6763
  * Get webhook delivery statistics
5595
6764
  *
5596
- * Returns aggregate pending, delivered, exhausted, and cancelled delivery counts for a webhook endpoint, plus the same counts per workspace-local calendar day over the selected period of 7, 30, or 90 days. Deliveries are retained for 90 days, so 90d is the whole history.
6765
+ * Returns aggregate pending, delivered, exhausted, and cancelled delivery counts for a webhook endpoint, plus the same counts per organization-local calendar day over the selected period of 7, 30, or 90 days. Deliveries are retained for 90 days, so 90d is the whole history.
5597
6766
  */
5598
6767
  static getStats(parameters, options) {
5599
6768
  const params = buildClientParams([parameters], [{ args: [{
@@ -5659,9 +6828,9 @@ var Webhooks = class {
5659
6828
  };
5660
6829
  var Organizations = class {
5661
6830
  /**
5662
- * Create a workspace
6831
+ * Create an organization
5663
6832
  *
5664
- * Creates a new workspace organization under the current billing account and returns it.
6833
+ * Creates a new organization under the current billing account and returns it.
5665
6834
  */
5666
6835
  static create(parameters, options) {
5667
6836
  const params = buildClientParams([parameters], [{ args: [{
@@ -5701,7 +6870,7 @@ var Organizations = class {
5701
6870
  /**
5702
6871
  * Update the current organization
5703
6872
  *
5704
- * Updates the current organization's profile, billing, locale, design, default reply-to, and default unsubscribe-group fields and returns the saved organization.
6873
+ * Updates the current organization's profile, regional defaults, reply-to, and unsubscribe-group defaults and returns the saved organization. `metadata` is merged into the stored value; every other field is replaced.
5705
6874
  */
5706
6875
  static update(parameters, options) {
5707
6876
  const params = buildClientParams([parameters], [{ args: [
@@ -5713,18 +6882,10 @@ var Organizations = class {
5713
6882
  in: "body",
5714
6883
  key: "slug"
5715
6884
  },
5716
- {
5717
- in: "body",
5718
- key: "billingEmail"
5719
- },
5720
6885
  {
5721
6886
  in: "body",
5722
6887
  key: "countryCode"
5723
6888
  },
5724
- {
5725
- in: "body",
5726
- key: "currency"
5727
- },
5728
6889
  {
5729
6890
  in: "body",
5730
6891
  key: "timezone"
@@ -5737,10 +6898,6 @@ var Organizations = class {
5737
6898
  in: "body",
5738
6899
  key: "metadata"
5739
6900
  },
5740
- {
5741
- in: "body",
5742
- key: "design"
5743
- },
5744
6901
  {
5745
6902
  in: "body",
5746
6903
  key: "replyToDefault"
@@ -5790,9 +6947,9 @@ var Organizations = class {
5790
6947
  });
5791
6948
  }
5792
6949
  /**
5793
- * Delete the current workspace
6950
+ * Delete the current organization
5794
6951
  *
5795
- * Starts an owner-authorized durable workspace deletion operation, confirming the workspace name in the request. Repeating the same request with the same Idempotency-Key returns the existing organization-scoped operation.
6952
+ * Starts an owner-authorized organization deletion operation, confirming the organization name in the request. Repeating the same request with the same Idempotency-Key returns the existing organization-scoped operation.
5796
6953
  */
5797
6954
  static delete(parameters, options) {
5798
6955
  const params = buildClientParams([parameters], [{ args: [{
@@ -5817,31 +6974,6 @@ var Organizations = class {
5817
6974
  }
5818
6975
  });
5819
6976
  }
5820
- /**
5821
- * Create the first workspace
5822
- *
5823
- * Creates a replacement first workspace under the signed-in user's billing account when no workspace membership remains.
5824
- */
5825
- static bootstrap(parameters, options) {
5826
- const params = buildClientParams([parameters], [{ args: [{
5827
- in: "body",
5828
- key: "name"
5829
- }] }]);
5830
- return (options?.client ?? client).post({
5831
- security: [{
5832
- name: "x-api-key",
5833
- type: "apiKey"
5834
- }],
5835
- url: "/v1/organizations/bootstrap",
5836
- ...options,
5837
- ...params,
5838
- headers: {
5839
- "Content-Type": "application/json",
5840
- ...options?.headers,
5841
- ...params.headers
5842
- }
5843
- });
5844
- }
5845
6977
  };
5846
6978
  var ApiKeys = class {
5847
6979
  /**
@@ -5899,7 +7031,7 @@ var ApiKeys = class {
5899
7031
  },
5900
7032
  {
5901
7033
  in: "body",
5902
- key: "permissions"
7034
+ key: "access"
5903
7035
  }
5904
7036
  ] }]);
5905
7037
  return (options?.client ?? client).post({
@@ -5940,7 +7072,7 @@ var ApiKeys = class {
5940
7072
  /**
5941
7073
  * Get an API key
5942
7074
  *
5943
- * Returns the API key with the given ID, including its metadata and permissions.
7075
+ * Returns the API key with the given ID, including its metadata and access.
5944
7076
  */
5945
7077
  static get(parameters, options) {
5946
7078
  const params = buildClientParams([parameters], [{ args: [{
@@ -5995,7 +7127,7 @@ var ApiKeys = class {
5995
7127
  /**
5996
7128
  * Rotate an API key
5997
7129
  *
5998
- * Issues a replacement with the same owner, name, and permissions, then deactivates the existing key. Returns the new key, including the plaintext secret.
7130
+ * Issues a replacement with the same owner, name, and access, then deactivates the existing key. Returns the new key, including the plaintext secret.
5999
7131
  */
6000
7132
  static rotate(parameters, options) {
6001
7133
  const params = buildClientParams([parameters], [{ args: [{
@@ -6122,6 +7254,13 @@ const messageOf = (tag, payload) => {
6122
7254
  const message = payload.message;
6123
7255
  return typeof message === "string" ? message : tag;
6124
7256
  };
7257
+ var AnalyticsQueryError = class extends SamvaApiError {
7258
+ _tag = "AnalyticsQueryError";
7259
+ constructor(payload, context = {}) {
7260
+ super(messageOf("AnalyticsQueryError", payload), context);
7261
+ Object.assign(this, payload);
7262
+ }
7263
+ };
6125
7264
  var BillingProviderError = class extends SamvaApiError {
6126
7265
  _tag = "BillingProviderError";
6127
7266
  constructor(payload, context = {}) {
@@ -6129,6 +7268,20 @@ var BillingProviderError = class extends SamvaApiError {
6129
7268
  Object.assign(this, payload);
6130
7269
  }
6131
7270
  };
7271
+ var BrandAddressRequiredError = class extends SamvaApiError {
7272
+ _tag = "BrandAddressRequiredError";
7273
+ constructor(payload, context = {}) {
7274
+ super(messageOf("BrandAddressRequiredError", payload), context);
7275
+ Object.assign(this, payload);
7276
+ }
7277
+ };
7278
+ var CampaignFooterRequiredError = class extends SamvaApiError {
7279
+ _tag = "CampaignFooterRequiredError";
7280
+ constructor(payload, context = {}) {
7281
+ super(messageOf("CampaignFooterRequiredError", payload), context);
7282
+ Object.assign(this, payload);
7283
+ }
7284
+ };
6132
7285
  var ConflictError = class extends SamvaApiError {
6133
7286
  _tag = "ConflictError";
6134
7287
  constructor(payload, context = {}) {
@@ -6136,6 +7289,13 @@ var ConflictError = class extends SamvaApiError {
6136
7289
  Object.assign(this, payload);
6137
7290
  }
6138
7291
  };
7292
+ var DeliveryUnavailableError = class extends SamvaApiError {
7293
+ _tag = "DeliveryUnavailableError";
7294
+ constructor(payload, context = {}) {
7295
+ super(messageOf("DeliveryUnavailableError", payload), context);
7296
+ Object.assign(this, payload);
7297
+ }
7298
+ };
6139
7299
  var EmailChannelError = class extends SamvaApiError {
6140
7300
  _tag = "EmailChannelError";
6141
7301
  constructor(payload, context = {}) {
@@ -6164,6 +7324,13 @@ var ForbiddenError = class extends SamvaApiError {
6164
7324
  Object.assign(this, payload);
6165
7325
  }
6166
7326
  };
7327
+ var GatewayTimeoutError = class extends SamvaApiError {
7328
+ _tag = "GatewayTimeoutError";
7329
+ constructor(payload, context = {}) {
7330
+ super(messageOf("GatewayTimeoutError", payload), context);
7331
+ Object.assign(this, payload);
7332
+ }
7333
+ };
6167
7334
  var InternalError = class extends SamvaApiError {
6168
7335
  _tag = "InternalError";
6169
7336
  constructor(payload, context = {}) {
@@ -6213,30 +7380,39 @@ var ValidationError = class extends SamvaApiError {
6213
7380
  Object.assign(this, payload);
6214
7381
  }
6215
7382
  };
6216
- var WebhookEnqueueError = class extends SamvaApiError {
6217
- _tag = "WebhookEnqueueError";
6218
- constructor(payload, context = {}) {
6219
- super(messageOf("WebhookEnqueueError", payload), context);
6220
- Object.assign(this, payload);
6221
- }
6222
- };
6223
7383
  const constructors = {
7384
+ AnalyticsQueryError,
6224
7385
  BillingProviderError,
7386
+ BrandAddressRequiredError,
7387
+ CampaignFooterRequiredError,
6225
7388
  ConflictError,
7389
+ DeliveryUnavailableError,
6226
7390
  EmailChannelError,
6227
7391
  ExternalServiceError,
6228
7392
  FlagDisabledError,
6229
7393
  ForbiddenError,
7394
+ GatewayTimeoutError,
6230
7395
  InternalError,
6231
7396
  OnboardingReviewRequiredError,
6232
7397
  PaymentRequiredError,
6233
7398
  RateLimitedError,
6234
7399
  ResourceNotFoundError,
6235
7400
  UnauthorizedError,
6236
- ValidationError,
6237
- WebhookEnqueueError
7401
+ ValidationError
6238
7402
  };
6239
7403
  const payloadSchemas = {
7404
+ AnalyticsQueryError: {
7405
+ type: "object",
7406
+ properties: {
7407
+ _tag: {
7408
+ type: "string",
7409
+ enum: ["AnalyticsQueryError"]
7410
+ },
7411
+ message: { type: "string" }
7412
+ },
7413
+ required: ["_tag", "message"],
7414
+ additionalProperties: false
7415
+ },
6240
7416
  BillingProviderError: {
6241
7417
  type: "object",
6242
7418
  properties: {
@@ -6244,18 +7420,42 @@ const payloadSchemas = {
6244
7420
  type: "string",
6245
7421
  enum: ["BillingProviderError"]
6246
7422
  },
6247
- operation: { type: "string" },
6248
7423
  message: { type: "string" }
6249
7424
  },
6250
- required: [
6251
- "_tag",
6252
- "operation",
6253
- "message"
6254
- ],
7425
+ required: ["_tag", "message"],
6255
7426
  additionalProperties: false,
6256
7427
  "x-category": ["transient"],
6257
7428
  "x-retryable": true
6258
7429
  },
7430
+ BrandAddressRequiredError: {
7431
+ type: "object",
7432
+ properties: {
7433
+ _tag: {
7434
+ type: "string",
7435
+ enum: ["BrandAddressRequiredError"]
7436
+ },
7437
+ message: { type: "string" },
7438
+ brand: { anyOf: [{ type: "string" }, { type: "null" }] }
7439
+ },
7440
+ required: [
7441
+ "_tag",
7442
+ "message",
7443
+ "brand"
7444
+ ],
7445
+ additionalProperties: false
7446
+ },
7447
+ CampaignFooterRequiredError: {
7448
+ type: "object",
7449
+ properties: {
7450
+ _tag: {
7451
+ type: "string",
7452
+ enum: ["CampaignFooterRequiredError"]
7453
+ },
7454
+ message: { type: "string" }
7455
+ },
7456
+ required: ["_tag", "message"],
7457
+ additionalProperties: false
7458
+ },
6259
7459
  ConflictError: {
6260
7460
  type: "object",
6261
7461
  properties: {
@@ -6263,14 +7463,12 @@ const payloadSchemas = {
6263
7463
  type: "string",
6264
7464
  enum: ["ConflictError"]
6265
7465
  },
6266
- operation: { type: "string" },
6267
7466
  message: { type: "string" },
6268
7467
  resource: { type: "string" },
6269
7468
  id: { anyOf: [{ type: "string" }, { type: "null" }] }
6270
7469
  },
6271
7470
  required: [
6272
7471
  "_tag",
6273
- "operation",
6274
7472
  "message",
6275
7473
  "resource"
6276
7474
  ],
@@ -6278,6 +7476,25 @@ const payloadSchemas = {
6278
7476
  "x-category": ["conflict"],
6279
7477
  "x-retryable": false
6280
7478
  },
7479
+ DeliveryUnavailableError: {
7480
+ type: "object",
7481
+ properties: {
7482
+ _tag: {
7483
+ type: "string",
7484
+ enum: ["DeliveryUnavailableError"]
7485
+ },
7486
+ message: { type: "string" },
7487
+ retryAfterSeconds: { type: "number" }
7488
+ },
7489
+ required: [
7490
+ "_tag",
7491
+ "message",
7492
+ "retryAfterSeconds"
7493
+ ],
7494
+ additionalProperties: false,
7495
+ "x-category": ["transient"],
7496
+ "x-retryable": true
7497
+ },
6281
7498
  EmailChannelError: {
6282
7499
  type: "object",
6283
7500
  properties: {
@@ -6285,7 +7502,6 @@ const payloadSchemas = {
6285
7502
  type: "string",
6286
7503
  enum: ["EmailChannelError"]
6287
7504
  },
6288
- operation: { type: "string" },
6289
7505
  reason: {
6290
7506
  type: "string",
6291
7507
  enum: [
@@ -6300,7 +7516,6 @@ const payloadSchemas = {
6300
7516
  },
6301
7517
  required: [
6302
7518
  "_tag",
6303
- "operation",
6304
7519
  "reason",
6305
7520
  "message"
6306
7521
  ],
@@ -6313,14 +7528,9 @@ const payloadSchemas = {
6313
7528
  type: "string",
6314
7529
  enum: ["ExternalServiceError"]
6315
7530
  },
6316
- operation: { type: "string" },
6317
7531
  message: { type: "string" }
6318
7532
  },
6319
- required: [
6320
- "_tag",
6321
- "operation",
6322
- "message"
6323
- ],
7533
+ required: ["_tag", "message"],
6324
7534
  additionalProperties: false,
6325
7535
  "x-category": ["transient"],
6326
7536
  "x-retryable": true
@@ -6332,14 +7542,9 @@ const payloadSchemas = {
6332
7542
  type: "string",
6333
7543
  enum: ["FlagDisabledError"]
6334
7544
  },
6335
- operation: { type: "string" },
6336
7545
  flag: { type: "string" }
6337
7546
  },
6338
- required: [
6339
- "_tag",
6340
- "operation",
6341
- "flag"
6342
- ],
7547
+ required: ["_tag", "flag"],
6343
7548
  additionalProperties: false,
6344
7549
  "x-retryable": false
6345
7550
  },
@@ -6350,17 +7555,31 @@ const payloadSchemas = {
6350
7555
  type: "string",
6351
7556
  enum: ["ForbiddenError"]
6352
7557
  },
6353
- operation: { type: "string" },
6354
7558
  message: { type: "string" }
6355
7559
  },
7560
+ required: ["_tag", "message"],
7561
+ additionalProperties: false,
7562
+ "x-category": ["auth"],
7563
+ "x-retryable": false
7564
+ },
7565
+ GatewayTimeoutError: {
7566
+ type: "object",
7567
+ properties: {
7568
+ _tag: {
7569
+ type: "string",
7570
+ enum: ["GatewayTimeoutError"]
7571
+ },
7572
+ message: { type: "string" },
7573
+ retryAfterSeconds: { type: "number" }
7574
+ },
6356
7575
  required: [
6357
7576
  "_tag",
6358
- "operation",
6359
- "message"
7577
+ "message",
7578
+ "retryAfterSeconds"
6360
7579
  ],
6361
7580
  additionalProperties: false,
6362
- "x-category": ["auth"],
6363
- "x-retryable": false
7581
+ "x-category": ["transient"],
7582
+ "x-retryable": true
6364
7583
  },
6365
7584
  InternalError: {
6366
7585
  type: "object",
@@ -6369,14 +7588,9 @@ const payloadSchemas = {
6369
7588
  type: "string",
6370
7589
  enum: ["InternalError"]
6371
7590
  },
6372
- operation: { type: "string" },
6373
7591
  message: { type: "string" }
6374
7592
  },
6375
- required: [
6376
- "_tag",
6377
- "operation",
6378
- "message"
6379
- ],
7593
+ required: ["_tag", "message"],
6380
7594
  additionalProperties: false,
6381
7595
  "x-category": ["transient"],
6382
7596
  "x-retryable": true
@@ -6388,7 +7602,6 @@ const payloadSchemas = {
6388
7602
  type: "string",
6389
7603
  enum: ["OnboardingReviewRequiredError"]
6390
7604
  },
6391
- operation: { type: "string" },
6392
7605
  code: {
6393
7606
  type: "string",
6394
7607
  enum: [
@@ -6406,8 +7619,7 @@ const payloadSchemas = {
6406
7619
  enum: [
6407
7620
  "undecided",
6408
7621
  "approved",
6409
- "rejected",
6410
- "exempt"
7622
+ "rejected"
6411
7623
  ]
6412
7624
  },
6413
7625
  stage: {
@@ -6434,7 +7646,6 @@ const payloadSchemas = {
6434
7646
  },
6435
7647
  required: [
6436
7648
  "_tag",
6437
- "operation",
6438
7649
  "code",
6439
7650
  "decision",
6440
7651
  "stage",
@@ -6451,14 +7662,12 @@ const payloadSchemas = {
6451
7662
  type: "string",
6452
7663
  enum: ["PaymentRequiredError"]
6453
7664
  },
6454
- operation: { type: "string" },
6455
7665
  resource: { type: "string" },
6456
7666
  currentUsage: { type: "number" },
6457
7667
  limit: { type: "number" }
6458
7668
  },
6459
7669
  required: [
6460
7670
  "_tag",
6461
- "operation",
6462
7671
  "resource",
6463
7672
  "currentUsage",
6464
7673
  "limit"
@@ -6474,14 +7683,9 @@ const payloadSchemas = {
6474
7683
  type: "string",
6475
7684
  enum: ["RateLimitedError"]
6476
7685
  },
6477
- operation: { type: "string" },
6478
7686
  retryAfterSeconds: { type: "number" }
6479
7687
  },
6480
- required: [
6481
- "_tag",
6482
- "operation",
6483
- "retryAfterSeconds"
6484
- ],
7688
+ required: ["_tag", "retryAfterSeconds"],
6485
7689
  additionalProperties: false,
6486
7690
  "x-category": ["throttling", "transient"],
6487
7691
  "x-retryable": true
@@ -6493,13 +7697,11 @@ const payloadSchemas = {
6493
7697
  type: "string",
6494
7698
  enum: ["ResourceNotFoundError"]
6495
7699
  },
6496
- operation: { type: "string" },
6497
7700
  resource: { type: "string" },
6498
7701
  id: { type: "string" }
6499
7702
  },
6500
7703
  required: [
6501
7704
  "_tag",
6502
- "operation",
6503
7705
  "resource",
6504
7706
  "id"
6505
7707
  ],
@@ -6514,14 +7716,9 @@ const payloadSchemas = {
6514
7716
  type: "string",
6515
7717
  enum: ["UnauthorizedError"]
6516
7718
  },
6517
- operation: { type: "string" },
6518
7719
  message: { type: "string" }
6519
7720
  },
6520
- required: [
6521
- "_tag",
6522
- "operation",
6523
- "message"
6524
- ],
7721
+ required: ["_tag", "message"],
6525
7722
  additionalProperties: false,
6526
7723
  "x-category": ["auth"],
6527
7724
  "x-retryable": false
@@ -6533,7 +7730,6 @@ const payloadSchemas = {
6533
7730
  type: "string",
6534
7731
  enum: ["ValidationError"]
6535
7732
  },
6536
- operation: { type: "string" },
6537
7733
  message: { type: "string" },
6538
7734
  fields: { anyOf: [{
6539
7735
  type: "object",
@@ -6543,34 +7739,10 @@ const payloadSchemas = {
6543
7739
  }
6544
7740
  }, { type: "null" }] }
6545
7741
  },
6546
- required: [
6547
- "_tag",
6548
- "operation",
6549
- "message"
6550
- ],
7742
+ required: ["_tag", "message"],
6551
7743
  additionalProperties: false,
6552
7744
  "x-category": ["validation"],
6553
7745
  "x-retryable": false
6554
- },
6555
- WebhookEnqueueError: {
6556
- type: "object",
6557
- properties: {
6558
- _tag: {
6559
- type: "string",
6560
- enum: ["WebhookEnqueueError"]
6561
- },
6562
- operation: { type: "string" },
6563
- reason: { type: "string" },
6564
- details: { anyOf: [{ type: "string" }, { type: "null" }] }
6565
- },
6566
- required: [
6567
- "_tag",
6568
- "operation",
6569
- "reason"
6570
- ],
6571
- additionalProperties: false,
6572
- "x-category": ["transient"],
6573
- "x-retryable": true
6574
7746
  }
6575
7747
  };
6576
7748
  const isRecord = (value) => typeof value === "object" && value !== null;
@@ -6615,6 +7787,13 @@ function fromApiError(error, context = {}) {
6615
7787
  const Constructor = constructors[tag];
6616
7788
  return new Constructor(error, context);
6617
7789
  }
7790
+ if (context.response?.status === 504) {
7791
+ const retryAfter = Number(context.response.headers.get("retry-after"));
7792
+ return new GatewayTimeoutError({
7793
+ message: "The request did not finish in time. Retry with the same idempotency key.",
7794
+ retryAfterSeconds: Number.isInteger(retryAfter) && retryAfter > 0 ? retryAfter : 1
7795
+ }, context);
7796
+ }
6618
7797
  return new SamvaTransportError(error, context);
6619
7798
  }
6620
7799
  //#endregion
@@ -6648,6 +7827,19 @@ function fromApiError(error, context = {}) {
6648
7827
  * ```
6649
7828
  */
6650
7829
  const isObject = (value) => typeof value === "object" && value !== null;
7830
+ /**
7831
+ * The key a retry-safe call sends as `idempotency-key`: the `idempotencyKey`
7832
+ * option, else one the caller set in `headers`, else a fresh UUID. The
7833
+ * generated header parameter is applied after request headers, so it must carry
7834
+ * a caller-set header value rather than overwrite it.
7835
+ */
7836
+ function resolveIdempotencyKey(options) {
7837
+ const { idempotencyKey, ...requestOptions } = options ?? {};
7838
+ return {
7839
+ idempotencyKey: idempotencyKey ?? mergeHeaders(requestOptions.headers).get("idempotency-key") ?? crypto.randomUUID(),
7840
+ requestOptions
7841
+ };
7842
+ }
6651
7843
  function createPromiseMessagesTransport(clientInstance) {
6652
7844
  const boundMessages = createBoundService(Messages, clientInstance);
6653
7845
  return {
@@ -6658,10 +7850,16 @@ function createPromiseMessagesTransport(clientInstance) {
6658
7850
  getStatus: boundMessages.getStatus,
6659
7851
  getEvents: boundMessages.getEvents,
6660
7852
  validateEmail: boundMessages.validateEmail,
6661
- send: (input, options) => Messages.send({ emailSendMessagePayload: buildMessagesSendPayload(input) }, {
6662
- ...options,
6663
- client: clientInstance
6664
- })
7853
+ send: (input, options) => {
7854
+ const { idempotencyKey, requestOptions } = resolveIdempotencyKey(options);
7855
+ return Messages.send({
7856
+ "idempotency-key": idempotencyKey,
7857
+ emailSendMessagePayload: buildMessagesSendPayload(input)
7858
+ }, {
7859
+ ...requestOptions,
7860
+ client: clientInstance
7861
+ });
7862
+ }
6665
7863
  };
6666
7864
  }
6667
7865
  function createPromiseEmailTransport(clientInstance) {
@@ -6669,7 +7867,7 @@ function createPromiseEmailTransport(clientInstance) {
6669
7867
  return Object.assign(boundEmail, {
6670
7868
  addSender: (input, options) => {
6671
7869
  const { replyToEmails, ...sender } = input;
6672
- const { idempotencyKey = crypto.randomUUID(), ...requestOptions } = options ?? {};
7870
+ const { idempotencyKey, requestOptions } = resolveIdempotencyKey(options);
6673
7871
  return Email.addSender({
6674
7872
  "idempotency-key": idempotencyKey,
6675
7873
  ...sender,
@@ -6679,10 +7877,16 @@ function createPromiseEmailTransport(clientInstance) {
6679
7877
  client: clientInstance
6680
7878
  });
6681
7879
  },
6682
- send: (input, options) => Messages.send({ emailSendMessagePayload: buildEmailSendPayload(input) }, {
6683
- ...options,
6684
- client: clientInstance
6685
- })
7880
+ send: (input, options) => {
7881
+ const { idempotencyKey, requestOptions } = resolveIdempotencyKey(options);
7882
+ return Messages.send({
7883
+ "idempotency-key": idempotencyKey,
7884
+ emailSendMessagePayload: buildEmailSendPayload(input)
7885
+ }, {
7886
+ ...requestOptions,
7887
+ client: clientInstance
7888
+ });
7889
+ }
6686
7890
  });
6687
7891
  }
6688
7892
  function createPromiseTemplatesTransport(clientInstance) {
@@ -6753,17 +7957,22 @@ function createClient(config) {
6753
7957
  client: clientInstance,
6754
7958
  messages: createBoundService(Messages, clientInstance),
6755
7959
  scheduledMessages: createBoundService(ScheduledMessages, clientInstance),
7960
+ brands: createBoundService(Brands, clientInstance),
6756
7961
  campaigns: createBoundService(Campaigns, clientInstance),
6757
7962
  email: createBoundService(Email, clientInstance),
6758
7963
  media: createBoundService(Media, clientInstance),
6759
7964
  templates: createPromiseTemplatesTransport(clientInstance),
6760
7965
  contacts: createBoundService(Contacts, clientInstance),
6761
7966
  conversations: createBoundService(Conversations, clientInstance),
6762
- design: createBoundService(Design, clientInstance),
6763
7967
  webhooks: createBoundService(Webhooks, clientInstance),
6764
7968
  operations: createBoundService(Operations, clientInstance),
6765
7969
  apiKeys: createBoundService(ApiKeys, clientInstance),
6766
- organizations: createBoundService(Organizations, clientInstance)
7970
+ organizations: createBoundService(Organizations, clientInstance),
7971
+ attachments: createBoundService(Attachments, clientInstance),
7972
+ contactGroups: createBoundService(ContactGroups, clientInstance),
7973
+ customFields: createBoundService(CustomFields, clientInstance),
7974
+ unsubscribeGroups: createBoundService(Unsubscribe, clientInstance),
7975
+ analytics: createBoundService(Analytics, clientInstance)
6767
7976
  };
6768
7977
  const promiseMessages = createPromiseMessagesTransport(clientInstance);
6769
7978
  const promiseEmail = createPromiseEmailTransport(clientInstance);
@@ -6771,20 +7980,25 @@ function createClient(config) {
6771
7980
  raw,
6772
7981
  messages: createDirectService(promiseMessages),
6773
7982
  scheduledMessages: createDirectService(raw.scheduledMessages),
7983
+ brands: createDirectService(raw.brands),
6774
7984
  campaigns: createDirectService(raw.campaigns),
6775
7985
  email: createDirectService(promiseEmail),
6776
7986
  media: createDirectService(raw.media),
6777
7987
  templates: createDirectService(raw.templates),
6778
7988
  contacts: createDirectService(raw.contacts),
6779
7989
  conversations: createDirectService(raw.conversations),
6780
- design: createDirectService(raw.design),
6781
7990
  webhooks: createDirectService(raw.webhooks),
6782
7991
  operations: createDirectService(raw.operations),
6783
7992
  apiKeys: createDirectService(raw.apiKeys),
6784
- organizations: createDirectService(raw.organizations)
7993
+ organizations: createDirectService(raw.organizations),
7994
+ attachments: createDirectService(raw.attachments),
7995
+ contactGroups: createDirectService(raw.contactGroups),
7996
+ customFields: createDirectService(raw.customFields),
7997
+ unsubscribeGroups: createDirectService(raw.unsubscribeGroups),
7998
+ analytics: createDirectService(raw.analytics)
6785
7999
  };
6786
8000
  }
6787
8001
  //#endregion
6788
- export { WebhookEnqueueError as _, ExternalServiceError as a, InternalError as c, RateLimitedError as d, ResourceNotFoundError as f, ValidationError as g, UnauthorizedError as h, EmailChannelError as i, OnboardingReviewRequiredError as l, SamvaTransportError as m, BillingProviderError as n, FlagDisabledError as o, SamvaApiError as p, ConflictError as r, ForbiddenError as s, createClient as t, PaymentRequiredError as u, fromApiError as v };
8002
+ export { fromApiError as S, ResourceNotFoundError as _, CampaignFooterRequiredError as a, UnauthorizedError as b, EmailChannelError as c, ForbiddenError as d, GatewayTimeoutError as f, RateLimitedError as g, PaymentRequiredError as h, BrandAddressRequiredError as i, ExternalServiceError as l, OnboardingReviewRequiredError as m, AnalyticsQueryError as n, ConflictError as o, InternalError as p, BillingProviderError as r, DeliveryUnavailableError as s, createClient as t, FlagDisabledError as u, SamvaApiError as v, ValidationError as x, SamvaTransportError as y };
6789
8003
 
6790
- //# sourceMappingURL=promises-CP_nxUus.js.map
8004
+ //# sourceMappingURL=promises-C2yyw-pf.js.map