agentmail 0.5.49 → 0.5.51

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 (211) hide show
  1. package/dist/cjs/BaseClient.js +2 -2
  2. package/dist/cjs/Client.d.ts +3 -0
  3. package/dist/cjs/Client.js +21 -16
  4. package/dist/cjs/api/resources/forwarding/client/Client.d.ts +127 -0
  5. package/dist/cjs/api/resources/forwarding/client/Client.js +503 -0
  6. package/dist/cjs/api/resources/forwarding/client/index.d.ts +1 -0
  7. package/dist/cjs/api/resources/forwarding/client/index.js +2 -0
  8. package/dist/cjs/api/resources/forwarding/errors/ForwardingForbiddenError.d.ts +6 -0
  9. package/dist/cjs/api/resources/forwarding/errors/ForwardingForbiddenError.js +54 -0
  10. package/dist/cjs/api/resources/forwarding/errors/ForwardingRateLimitError.d.ts +6 -0
  11. package/dist/cjs/api/resources/forwarding/errors/ForwardingRateLimitError.js +54 -0
  12. package/dist/cjs/api/resources/forwarding/errors/index.d.ts +2 -0
  13. package/dist/cjs/api/resources/forwarding/errors/index.js +18 -0
  14. package/dist/cjs/api/resources/forwarding/exports.d.ts +2 -0
  15. package/dist/cjs/api/resources/forwarding/exports.js +21 -0
  16. package/dist/cjs/api/resources/forwarding/index.d.ts +3 -0
  17. package/dist/cjs/api/resources/forwarding/index.js +19 -0
  18. package/dist/cjs/api/resources/forwarding/types/ConfirmForwardingVerificationRequest.d.ts +10 -0
  19. package/dist/cjs/api/resources/forwarding/types/ConfirmForwardingVerificationRequest.js +3 -0
  20. package/dist/cjs/api/resources/forwarding/types/Forwarding.d.ts +15 -0
  21. package/dist/cjs/api/resources/forwarding/types/Forwarding.js +3 -0
  22. package/dist/cjs/api/resources/forwarding/types/ForwardingDestination.d.ts +5 -0
  23. package/dist/cjs/api/resources/forwarding/types/ForwardingDestination.js +3 -0
  24. package/dist/cjs/api/resources/forwarding/types/ForwardingVerificationConfirmed.d.ts +4 -0
  25. package/dist/cjs/api/resources/forwarding/types/ForwardingVerificationConfirmed.js +3 -0
  26. package/dist/cjs/api/resources/forwarding/types/ForwardingVerificationStarted.d.ts +4 -0
  27. package/dist/cjs/api/resources/forwarding/types/ForwardingVerificationStarted.js +3 -0
  28. package/dist/cjs/api/resources/forwarding/types/StartForwardingVerificationRequest.d.ts +5 -0
  29. package/dist/cjs/api/resources/forwarding/types/StartForwardingVerificationRequest.js +3 -0
  30. package/dist/cjs/api/resources/forwarding/types/UpdateForwardingRequest.d.ts +9 -0
  31. package/dist/cjs/api/resources/forwarding/types/UpdateForwardingRequest.js +3 -0
  32. package/dist/cjs/api/resources/forwarding/types/UpdateForwardingResponse.d.ts +8 -0
  33. package/dist/cjs/api/resources/forwarding/types/UpdateForwardingResponse.js +3 -0
  34. package/dist/cjs/api/resources/forwarding/types/index.d.ts +8 -0
  35. package/dist/cjs/api/resources/forwarding/types/index.js +24 -0
  36. package/dist/cjs/api/resources/inboxes/client/Client.d.ts +7 -1
  37. package/dist/cjs/api/resources/inboxes/client/Client.js +27 -11
  38. package/dist/cjs/api/resources/inboxes/resources/forwarding/client/Client.d.ts +79 -0
  39. package/dist/cjs/api/resources/inboxes/resources/forwarding/client/Client.js +317 -0
  40. package/dist/cjs/api/resources/inboxes/resources/forwarding/client/index.d.ts +1 -0
  41. package/dist/cjs/api/resources/inboxes/resources/forwarding/client/index.js +2 -0
  42. package/dist/cjs/api/resources/inboxes/resources/forwarding/exports.d.ts +2 -0
  43. package/dist/cjs/api/resources/inboxes/resources/forwarding/exports.js +21 -0
  44. package/dist/cjs/api/resources/inboxes/resources/forwarding/index.d.ts +1 -0
  45. package/dist/cjs/api/resources/inboxes/resources/forwarding/index.js +17 -0
  46. package/dist/cjs/api/resources/inboxes/resources/index.d.ts +1 -0
  47. package/dist/cjs/api/resources/inboxes/resources/index.js +2 -1
  48. package/dist/cjs/api/resources/index.d.ts +3 -0
  49. package/dist/cjs/api/resources/index.js +4 -1
  50. package/dist/cjs/api/resources/messages/types/Message.d.ts +2 -0
  51. package/dist/cjs/api/resources/messages/types/MessageItem.d.ts +2 -0
  52. package/dist/cjs/api/resources/messages/types/MessageOpenedAt.d.ts +6 -0
  53. package/dist/cjs/api/resources/messages/types/MessageOpenedAt.js +3 -0
  54. package/dist/cjs/api/resources/messages/types/MessageTrackOpens.d.ts +5 -0
  55. package/dist/cjs/api/resources/messages/types/MessageTrackOpens.js +3 -0
  56. package/dist/cjs/api/resources/messages/types/TrackOpens.d.ts +4 -3
  57. package/dist/cjs/api/resources/messages/types/index.d.ts +2 -0
  58. package/dist/cjs/api/resources/messages/types/index.js +2 -0
  59. package/dist/cjs/api/resources/pods/client/Client.d.ts +3 -0
  60. package/dist/cjs/api/resources/pods/client/Client.js +15 -10
  61. package/dist/cjs/api/resources/pods/resources/forwarding/client/Client.d.ts +80 -0
  62. package/dist/cjs/api/resources/pods/resources/forwarding/client/Client.js +318 -0
  63. package/dist/cjs/api/resources/pods/resources/forwarding/client/index.d.ts +1 -0
  64. package/dist/cjs/api/resources/pods/resources/forwarding/client/index.js +2 -0
  65. package/dist/cjs/api/resources/pods/resources/forwarding/exports.d.ts +2 -0
  66. package/dist/cjs/api/resources/pods/resources/forwarding/exports.js +21 -0
  67. package/dist/cjs/api/resources/pods/resources/forwarding/index.d.ts +1 -0
  68. package/dist/cjs/api/resources/pods/resources/forwarding/index.js +17 -0
  69. package/dist/cjs/api/resources/pods/resources/index.d.ts +1 -0
  70. package/dist/cjs/api/resources/pods/resources/index.js +2 -1
  71. package/dist/cjs/serialization/resources/forwarding/index.d.ts +1 -0
  72. package/dist/cjs/serialization/resources/forwarding/index.js +17 -0
  73. package/dist/cjs/serialization/resources/forwarding/types/ConfirmForwardingVerificationRequest.d.ts +11 -0
  74. package/dist/cjs/serialization/resources/forwarding/types/ConfirmForwardingVerificationRequest.js +43 -0
  75. package/dist/cjs/serialization/resources/forwarding/types/Forwarding.d.ts +11 -0
  76. package/dist/cjs/serialization/resources/forwarding/types/Forwarding.js +43 -0
  77. package/dist/cjs/serialization/resources/forwarding/types/ForwardingDestination.d.ts +7 -0
  78. package/dist/cjs/serialization/resources/forwarding/types/ForwardingDestination.js +39 -0
  79. package/dist/cjs/serialization/resources/forwarding/types/ForwardingVerificationConfirmed.d.ts +9 -0
  80. package/dist/cjs/serialization/resources/forwarding/types/ForwardingVerificationConfirmed.js +41 -0
  81. package/dist/cjs/serialization/resources/forwarding/types/ForwardingVerificationStarted.d.ts +9 -0
  82. package/dist/cjs/serialization/resources/forwarding/types/ForwardingVerificationStarted.js +41 -0
  83. package/dist/cjs/serialization/resources/forwarding/types/StartForwardingVerificationRequest.d.ts +10 -0
  84. package/dist/cjs/serialization/resources/forwarding/types/StartForwardingVerificationRequest.js +42 -0
  85. package/dist/cjs/serialization/resources/forwarding/types/UpdateForwardingRequest.d.ts +10 -0
  86. package/dist/cjs/serialization/resources/forwarding/types/UpdateForwardingRequest.js +42 -0
  87. package/dist/cjs/serialization/resources/forwarding/types/UpdateForwardingResponse.d.ts +10 -0
  88. package/dist/cjs/serialization/resources/forwarding/types/UpdateForwardingResponse.js +42 -0
  89. package/dist/cjs/serialization/resources/forwarding/types/index.d.ts +8 -0
  90. package/dist/cjs/serialization/resources/forwarding/types/index.js +24 -0
  91. package/dist/cjs/serialization/resources/index.d.ts +2 -0
  92. package/dist/cjs/serialization/resources/index.js +3 -1
  93. package/dist/cjs/serialization/resources/messages/types/Message.d.ts +4 -0
  94. package/dist/cjs/serialization/resources/messages/types/Message.js +4 -0
  95. package/dist/cjs/serialization/resources/messages/types/MessageItem.d.ts +4 -0
  96. package/dist/cjs/serialization/resources/messages/types/MessageItem.js +4 -0
  97. package/dist/cjs/serialization/resources/messages/types/MessageOpenedAt.d.ts +7 -0
  98. package/dist/cjs/serialization/resources/messages/types/MessageOpenedAt.js +39 -0
  99. package/dist/cjs/serialization/resources/messages/types/MessageTrackOpens.d.ts +7 -0
  100. package/dist/cjs/serialization/resources/messages/types/MessageTrackOpens.js +39 -0
  101. package/dist/cjs/serialization/resources/messages/types/index.d.ts +2 -0
  102. package/dist/cjs/serialization/resources/messages/types/index.js +2 -0
  103. package/dist/cjs/version.d.ts +1 -1
  104. package/dist/cjs/version.js +1 -1
  105. package/dist/esm/BaseClient.mjs +2 -2
  106. package/dist/esm/Client.d.mts +3 -0
  107. package/dist/esm/Client.mjs +5 -0
  108. package/dist/esm/api/resources/forwarding/client/Client.d.mts +127 -0
  109. package/dist/esm/api/resources/forwarding/client/Client.mjs +466 -0
  110. package/dist/esm/api/resources/forwarding/client/index.d.mts +1 -0
  111. package/dist/esm/api/resources/forwarding/client/index.mjs +1 -0
  112. package/dist/esm/api/resources/forwarding/errors/ForwardingForbiddenError.d.mts +6 -0
  113. package/dist/esm/api/resources/forwarding/errors/ForwardingForbiddenError.mjs +17 -0
  114. package/dist/esm/api/resources/forwarding/errors/ForwardingRateLimitError.d.mts +6 -0
  115. package/dist/esm/api/resources/forwarding/errors/ForwardingRateLimitError.mjs +17 -0
  116. package/dist/esm/api/resources/forwarding/errors/index.d.mts +2 -0
  117. package/dist/esm/api/resources/forwarding/errors/index.mjs +2 -0
  118. package/dist/esm/api/resources/forwarding/exports.d.mts +2 -0
  119. package/dist/esm/api/resources/forwarding/exports.mjs +3 -0
  120. package/dist/esm/api/resources/forwarding/index.d.mts +3 -0
  121. package/dist/esm/api/resources/forwarding/index.mjs +3 -0
  122. package/dist/esm/api/resources/forwarding/types/ConfirmForwardingVerificationRequest.d.mts +10 -0
  123. package/dist/esm/api/resources/forwarding/types/ConfirmForwardingVerificationRequest.mjs +2 -0
  124. package/dist/esm/api/resources/forwarding/types/Forwarding.d.mts +15 -0
  125. package/dist/esm/api/resources/forwarding/types/Forwarding.mjs +2 -0
  126. package/dist/esm/api/resources/forwarding/types/ForwardingDestination.d.mts +5 -0
  127. package/dist/esm/api/resources/forwarding/types/ForwardingDestination.mjs +2 -0
  128. package/dist/esm/api/resources/forwarding/types/ForwardingVerificationConfirmed.d.mts +4 -0
  129. package/dist/esm/api/resources/forwarding/types/ForwardingVerificationConfirmed.mjs +2 -0
  130. package/dist/esm/api/resources/forwarding/types/ForwardingVerificationStarted.d.mts +4 -0
  131. package/dist/esm/api/resources/forwarding/types/ForwardingVerificationStarted.mjs +2 -0
  132. package/dist/esm/api/resources/forwarding/types/StartForwardingVerificationRequest.d.mts +5 -0
  133. package/dist/esm/api/resources/forwarding/types/StartForwardingVerificationRequest.mjs +2 -0
  134. package/dist/esm/api/resources/forwarding/types/UpdateForwardingRequest.d.mts +9 -0
  135. package/dist/esm/api/resources/forwarding/types/UpdateForwardingRequest.mjs +2 -0
  136. package/dist/esm/api/resources/forwarding/types/UpdateForwardingResponse.d.mts +8 -0
  137. package/dist/esm/api/resources/forwarding/types/UpdateForwardingResponse.mjs +2 -0
  138. package/dist/esm/api/resources/forwarding/types/index.d.mts +8 -0
  139. package/dist/esm/api/resources/forwarding/types/index.mjs +8 -0
  140. package/dist/esm/api/resources/inboxes/client/Client.d.mts +7 -1
  141. package/dist/esm/api/resources/inboxes/client/Client.mjs +17 -1
  142. package/dist/esm/api/resources/inboxes/resources/forwarding/client/Client.d.mts +79 -0
  143. package/dist/esm/api/resources/inboxes/resources/forwarding/client/Client.mjs +280 -0
  144. package/dist/esm/api/resources/inboxes/resources/forwarding/client/index.d.mts +1 -0
  145. package/dist/esm/api/resources/inboxes/resources/forwarding/client/index.mjs +1 -0
  146. package/dist/esm/api/resources/inboxes/resources/forwarding/exports.d.mts +2 -0
  147. package/dist/esm/api/resources/inboxes/resources/forwarding/exports.mjs +3 -0
  148. package/dist/esm/api/resources/inboxes/resources/forwarding/index.d.mts +1 -0
  149. package/dist/esm/api/resources/inboxes/resources/forwarding/index.mjs +1 -0
  150. package/dist/esm/api/resources/inboxes/resources/index.d.mts +1 -0
  151. package/dist/esm/api/resources/inboxes/resources/index.mjs +1 -0
  152. package/dist/esm/api/resources/index.d.mts +3 -0
  153. package/dist/esm/api/resources/index.mjs +3 -0
  154. package/dist/esm/api/resources/messages/types/Message.d.mts +2 -0
  155. package/dist/esm/api/resources/messages/types/MessageItem.d.mts +2 -0
  156. package/dist/esm/api/resources/messages/types/MessageOpenedAt.d.mts +6 -0
  157. package/dist/esm/api/resources/messages/types/MessageOpenedAt.mjs +2 -0
  158. package/dist/esm/api/resources/messages/types/MessageTrackOpens.d.mts +5 -0
  159. package/dist/esm/api/resources/messages/types/MessageTrackOpens.mjs +2 -0
  160. package/dist/esm/api/resources/messages/types/TrackOpens.d.mts +4 -3
  161. package/dist/esm/api/resources/messages/types/index.d.mts +2 -0
  162. package/dist/esm/api/resources/messages/types/index.mjs +2 -0
  163. package/dist/esm/api/resources/pods/client/Client.d.mts +3 -0
  164. package/dist/esm/api/resources/pods/client/Client.mjs +5 -0
  165. package/dist/esm/api/resources/pods/resources/forwarding/client/Client.d.mts +80 -0
  166. package/dist/esm/api/resources/pods/resources/forwarding/client/Client.mjs +281 -0
  167. package/dist/esm/api/resources/pods/resources/forwarding/client/index.d.mts +1 -0
  168. package/dist/esm/api/resources/pods/resources/forwarding/client/index.mjs +1 -0
  169. package/dist/esm/api/resources/pods/resources/forwarding/exports.d.mts +2 -0
  170. package/dist/esm/api/resources/pods/resources/forwarding/exports.mjs +3 -0
  171. package/dist/esm/api/resources/pods/resources/forwarding/index.d.mts +1 -0
  172. package/dist/esm/api/resources/pods/resources/forwarding/index.mjs +1 -0
  173. package/dist/esm/api/resources/pods/resources/index.d.mts +1 -0
  174. package/dist/esm/api/resources/pods/resources/index.mjs +1 -0
  175. package/dist/esm/serialization/resources/forwarding/index.d.mts +1 -0
  176. package/dist/esm/serialization/resources/forwarding/index.mjs +1 -0
  177. package/dist/esm/serialization/resources/forwarding/types/ConfirmForwardingVerificationRequest.d.mts +11 -0
  178. package/dist/esm/serialization/resources/forwarding/types/ConfirmForwardingVerificationRequest.mjs +7 -0
  179. package/dist/esm/serialization/resources/forwarding/types/Forwarding.d.mts +11 -0
  180. package/dist/esm/serialization/resources/forwarding/types/Forwarding.mjs +7 -0
  181. package/dist/esm/serialization/resources/forwarding/types/ForwardingDestination.d.mts +7 -0
  182. package/dist/esm/serialization/resources/forwarding/types/ForwardingDestination.mjs +3 -0
  183. package/dist/esm/serialization/resources/forwarding/types/ForwardingVerificationConfirmed.d.mts +9 -0
  184. package/dist/esm/serialization/resources/forwarding/types/ForwardingVerificationConfirmed.mjs +5 -0
  185. package/dist/esm/serialization/resources/forwarding/types/ForwardingVerificationStarted.d.mts +9 -0
  186. package/dist/esm/serialization/resources/forwarding/types/ForwardingVerificationStarted.mjs +5 -0
  187. package/dist/esm/serialization/resources/forwarding/types/StartForwardingVerificationRequest.d.mts +10 -0
  188. package/dist/esm/serialization/resources/forwarding/types/StartForwardingVerificationRequest.mjs +6 -0
  189. package/dist/esm/serialization/resources/forwarding/types/UpdateForwardingRequest.d.mts +10 -0
  190. package/dist/esm/serialization/resources/forwarding/types/UpdateForwardingRequest.mjs +6 -0
  191. package/dist/esm/serialization/resources/forwarding/types/UpdateForwardingResponse.d.mts +10 -0
  192. package/dist/esm/serialization/resources/forwarding/types/UpdateForwardingResponse.mjs +6 -0
  193. package/dist/esm/serialization/resources/forwarding/types/index.d.mts +8 -0
  194. package/dist/esm/serialization/resources/forwarding/types/index.mjs +8 -0
  195. package/dist/esm/serialization/resources/index.d.mts +2 -0
  196. package/dist/esm/serialization/resources/index.mjs +2 -0
  197. package/dist/esm/serialization/resources/messages/types/Message.d.mts +4 -0
  198. package/dist/esm/serialization/resources/messages/types/Message.mjs +4 -0
  199. package/dist/esm/serialization/resources/messages/types/MessageItem.d.mts +4 -0
  200. package/dist/esm/serialization/resources/messages/types/MessageItem.mjs +4 -0
  201. package/dist/esm/serialization/resources/messages/types/MessageOpenedAt.d.mts +7 -0
  202. package/dist/esm/serialization/resources/messages/types/MessageOpenedAt.mjs +3 -0
  203. package/dist/esm/serialization/resources/messages/types/MessageTrackOpens.d.mts +7 -0
  204. package/dist/esm/serialization/resources/messages/types/MessageTrackOpens.mjs +3 -0
  205. package/dist/esm/serialization/resources/messages/types/index.d.mts +2 -0
  206. package/dist/esm/serialization/resources/messages/types/index.mjs +2 -0
  207. package/dist/esm/version.d.mts +1 -1
  208. package/dist/esm/version.mjs +1 -1
  209. package/dist/llms.txt +3 -1
  210. package/package.json +34 -1
  211. package/reference.md +1026 -239
@@ -5,6 +5,7 @@ import { AppsClient } from "./api/resources/apps/client/Client.mjs";
5
5
  import { AuthClient } from "./api/resources/auth/client/Client.mjs";
6
6
  import { DomainsClient } from "./api/resources/domains/client/Client.mjs";
7
7
  import { DraftsClient } from "./api/resources/drafts/client/Client.mjs";
8
+ import { ForwardingClient } from "./api/resources/forwarding/client/Client.mjs";
8
9
  import { InboxesClient } from "./api/resources/inboxes/client/Client.mjs";
9
10
  import { ListsClient } from "./api/resources/lists/client/Client.mjs";
10
11
  import { MetricsClient } from "./api/resources/metrics/client/Client.mjs";
@@ -33,6 +34,7 @@ export declare class AgentMailClient {
33
34
  protected _auth: AuthClient | undefined;
34
35
  protected _domains: DomainsClient | undefined;
35
36
  protected _drafts: DraftsClient | undefined;
37
+ protected _forwarding: ForwardingClient | undefined;
36
38
  protected _lists: ListsClient | undefined;
37
39
  protected _metrics: MetricsClient | undefined;
38
40
  protected _organizations: OrganizationsClient | undefined;
@@ -49,6 +51,7 @@ export declare class AgentMailClient {
49
51
  get auth(): AuthClient;
50
52
  get domains(): DomainsClient;
51
53
  get drafts(): DraftsClient;
54
+ get forwarding(): ForwardingClient;
52
55
  get lists(): ListsClient;
53
56
  get metrics(): MetricsClient;
54
57
  get organizations(): OrganizationsClient;
@@ -15,6 +15,7 @@ import { AppsClient } from "./api/resources/apps/client/Client.mjs";
15
15
  import { AuthClient } from "./api/resources/auth/client/Client.mjs";
16
16
  import { DomainsClient } from "./api/resources/domains/client/Client.mjs";
17
17
  import { DraftsClient } from "./api/resources/drafts/client/Client.mjs";
18
+ import { ForwardingClient } from "./api/resources/forwarding/client/Client.mjs";
18
19
  import { InboxesClient } from "./api/resources/inboxes/client/Client.mjs";
19
20
  import { ListsClient } from "./api/resources/lists/client/Client.mjs";
20
21
  import { MetricsClient } from "./api/resources/metrics/client/Client.mjs";
@@ -70,6 +71,10 @@ export class AgentMailClient {
70
71
  var _a;
71
72
  return ((_a = this._drafts) !== null && _a !== void 0 ? _a : (this._drafts = new DraftsClient(this._options)));
72
73
  }
74
+ get forwarding() {
75
+ var _a;
76
+ return ((_a = this._forwarding) !== null && _a !== void 0 ? _a : (this._forwarding = new ForwardingClient(this._options)));
77
+ }
73
78
  get lists() {
74
79
  var _a;
75
80
  return ((_a = this._lists) !== null && _a !== void 0 ? _a : (this._lists = new ListsClient(this._options)));
@@ -0,0 +1,127 @@
1
+ import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.mjs";
2
+ import { type NormalizedClientOptionsWithAuth } from "../../../../BaseClient.mjs";
3
+ import * as core from "../../../../core/index.mjs";
4
+ import * as AgentMail from "../../../index.mjs";
5
+ export declare namespace ForwardingClient {
6
+ type Options = BaseClientOptions;
7
+ interface RequestOptions extends BaseRequestOptions {
8
+ }
9
+ }
10
+ export declare class ForwardingClient {
11
+ protected readonly _options: NormalizedClientOptionsWithAuth<ForwardingClient.Options>;
12
+ constructor(options?: ForwardingClient.Options);
13
+ /**
14
+ * Get the forwarding the organization sets. Pods and inboxes that set no forwarding of their own
15
+ * use this list. Needs an organization-scoped API key.
16
+ *
17
+ * **CLI:**
18
+ * ```bash
19
+ * agentmail forwarding get
20
+ * ```
21
+ *
22
+ * @param {ForwardingClient.RequestOptions} requestOptions - Request-specific configuration.
23
+ *
24
+ * @throws {@link AgentMail.ForwardingForbiddenError}
25
+ *
26
+ * @example
27
+ * await client.forwarding.get()
28
+ */
29
+ get(requestOptions?: ForwardingClient.RequestOptions): core.HttpResponsePromise<AgentMail.Forwarding>;
30
+ private __get;
31
+ /**
32
+ * Set the addresses the organization forwards to. The list replaces the current one. An address
33
+ * that is not verified is saved but receives nothing until it is verified. Needs an
34
+ * organization-scoped API key in an organization that has completed agent verification.
35
+ *
36
+ * **CLI:**
37
+ * ```bash
38
+ * agentmail forwarding update --destinations ops@example.com --destinations archive@example.com
39
+ * ```
40
+ *
41
+ * @param {AgentMail.UpdateForwardingRequest} request
42
+ * @param {ForwardingClient.RequestOptions} requestOptions - Request-specific configuration.
43
+ *
44
+ * @throws {@link AgentMail.ValidationError}
45
+ * @throws {@link AgentMail.ForwardingForbiddenError}
46
+ *
47
+ * @example
48
+ * await client.forwarding.update({
49
+ * destinations: ["destinations", "destinations"]
50
+ * })
51
+ */
52
+ update(request: AgentMail.UpdateForwardingRequest, requestOptions?: ForwardingClient.RequestOptions): core.HttpResponsePromise<AgentMail.UpdateForwardingResponse>;
53
+ private __update;
54
+ /**
55
+ * Remove the organization's forwarding, so its inboxes stop forwarding unless their pod or the
56
+ * inbox sets its own. Verified addresses stay verified, so adding one again needs no new code.
57
+ * Returns `not_found` when the organization sets no forwarding.
58
+ *
59
+ * **CLI:**
60
+ * ```bash
61
+ * agentmail forwarding delete
62
+ * ```
63
+ *
64
+ * @param {ForwardingClient.RequestOptions} requestOptions - Request-specific configuration.
65
+ *
66
+ * @throws {@link AgentMail.NotFoundError}
67
+ * @throws {@link AgentMail.ForwardingForbiddenError}
68
+ *
69
+ * @example
70
+ * await client.forwarding.delete()
71
+ */
72
+ delete(requestOptions?: ForwardingClient.RequestOptions): core.HttpResponsePromise<AgentMail.Forwarding>;
73
+ private __delete;
74
+ /**
75
+ * Email a confirmation code to an address, so it can receive forwarded mail once confirmed.
76
+ * Verification belongs to the organization: once verified, the address can be used at the
77
+ * organization, any pod and any inbox. Starting again replaces any code already sent to the
78
+ * address. Needs an organization- or pod-scoped API key in an organization that has completed
79
+ * agent verification.
80
+ *
81
+ * **CLI:**
82
+ * ```bash
83
+ * agentmail forwarding start-verification --destination ops@example.com
84
+ * ```
85
+ *
86
+ * @param {AgentMail.StartForwardingVerificationRequest} request
87
+ * @param {ForwardingClient.RequestOptions} requestOptions - Request-specific configuration.
88
+ *
89
+ * @throws {@link AgentMail.ValidationError}
90
+ * @throws {@link AgentMail.ForwardingForbiddenError}
91
+ * @throws {@link AgentMail.UnprocessableError}
92
+ * @throws {@link AgentMail.ForwardingRateLimitError}
93
+ *
94
+ * @example
95
+ * await client.forwarding.startVerification({
96
+ * destination: "destination"
97
+ * })
98
+ */
99
+ startVerification(request: AgentMail.StartForwardingVerificationRequest, requestOptions?: ForwardingClient.RequestOptions): core.HttpResponsePromise<AgentMail.ForwardingVerificationStarted>;
100
+ private __startVerification;
101
+ /**
102
+ * Submit the code emailed by Start Verification to verify the address. A code allows 10 wrong
103
+ * attempts, then stops working even with the right code, and Start Verification sends a new one.
104
+ * Needs an organization- or pod-scoped API key in an organization that has completed agent
105
+ * verification.
106
+ *
107
+ * **CLI:**
108
+ * ```bash
109
+ * agentmail forwarding confirm-verification --destination ops@example.com --code 7KQ2M-XW9PD
110
+ * ```
111
+ *
112
+ * @param {AgentMail.ConfirmForwardingVerificationRequest} request
113
+ * @param {ForwardingClient.RequestOptions} requestOptions - Request-specific configuration.
114
+ *
115
+ * @throws {@link AgentMail.ValidationError}
116
+ * @throws {@link AgentMail.ForwardingForbiddenError}
117
+ * @throws {@link AgentMail.ConflictError}
118
+ *
119
+ * @example
120
+ * await client.forwarding.confirmVerification({
121
+ * destination: "destination",
122
+ * code: "code"
123
+ * })
124
+ */
125
+ confirmVerification(request: AgentMail.ConfirmForwardingVerificationRequest, requestOptions?: ForwardingClient.RequestOptions): core.HttpResponsePromise<AgentMail.ForwardingVerificationConfirmed>;
126
+ private __confirmVerification;
127
+ }
@@ -0,0 +1,466 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ import { normalizeClientOptionsWithAuth } from "../../../../BaseClient.mjs";
12
+ import { mergeHeaders } from "../../../../core/headers.mjs";
13
+ import * as core from "../../../../core/index.mjs";
14
+ import * as environments from "../../../../environments.mjs";
15
+ import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.mjs";
16
+ import * as errors from "../../../../errors/index.mjs";
17
+ import * as serializers from "../../../../serialization/index.mjs";
18
+ import * as AgentMail from "../../../index.mjs";
19
+ export class ForwardingClient {
20
+ constructor(options = {}) {
21
+ this._options = normalizeClientOptionsWithAuth(options);
22
+ }
23
+ /**
24
+ * Get the forwarding the organization sets. Pods and inboxes that set no forwarding of their own
25
+ * use this list. Needs an organization-scoped API key.
26
+ *
27
+ * **CLI:**
28
+ * ```bash
29
+ * agentmail forwarding get
30
+ * ```
31
+ *
32
+ * @param {ForwardingClient.RequestOptions} requestOptions - Request-specific configuration.
33
+ *
34
+ * @throws {@link AgentMail.ForwardingForbiddenError}
35
+ *
36
+ * @example
37
+ * await client.forwarding.get()
38
+ */
39
+ get(requestOptions) {
40
+ return core.HttpResponsePromise.fromPromise(this.__get(requestOptions));
41
+ }
42
+ __get(requestOptions) {
43
+ return __awaiter(this, void 0, void 0, function* () {
44
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
45
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
46
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
47
+ const _response = yield core.fetcher({
48
+ url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : ((_c = (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentMailEnvironment.Prod)
49
+ .http, "/v0/forwarding"),
50
+ method: "GET",
51
+ headers: _headers,
52
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
53
+ timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
54
+ maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
55
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
56
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
57
+ logging: this._options.logging,
58
+ });
59
+ if (_response.ok) {
60
+ return {
61
+ data: serializers.Forwarding.parseOrThrow(_response.body, {
62
+ unrecognizedObjectKeys: "passthrough",
63
+ allowUnrecognizedUnionMembers: true,
64
+ allowUnrecognizedEnumValues: true,
65
+ skipValidation: true,
66
+ breadcrumbsPrefix: ["response"],
67
+ }),
68
+ rawResponse: _response.rawResponse,
69
+ };
70
+ }
71
+ if (_response.error.reason === "status-code") {
72
+ switch (_response.error.statusCode) {
73
+ case 403:
74
+ throw new AgentMail.ForwardingForbiddenError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
75
+ unrecognizedObjectKeys: "passthrough",
76
+ allowUnrecognizedUnionMembers: true,
77
+ allowUnrecognizedEnumValues: true,
78
+ skipValidation: true,
79
+ breadcrumbsPrefix: ["response"],
80
+ }), _response.rawResponse);
81
+ default:
82
+ throw new errors.AgentMailError({
83
+ statusCode: _response.error.statusCode,
84
+ body: _response.error.body,
85
+ rawResponse: _response.rawResponse,
86
+ });
87
+ }
88
+ }
89
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v0/forwarding");
90
+ });
91
+ }
92
+ /**
93
+ * Set the addresses the organization forwards to. The list replaces the current one. An address
94
+ * that is not verified is saved but receives nothing until it is verified. Needs an
95
+ * organization-scoped API key in an organization that has completed agent verification.
96
+ *
97
+ * **CLI:**
98
+ * ```bash
99
+ * agentmail forwarding update --destinations ops@example.com --destinations archive@example.com
100
+ * ```
101
+ *
102
+ * @param {AgentMail.UpdateForwardingRequest} request
103
+ * @param {ForwardingClient.RequestOptions} requestOptions - Request-specific configuration.
104
+ *
105
+ * @throws {@link AgentMail.ValidationError}
106
+ * @throws {@link AgentMail.ForwardingForbiddenError}
107
+ *
108
+ * @example
109
+ * await client.forwarding.update({
110
+ * destinations: ["destinations", "destinations"]
111
+ * })
112
+ */
113
+ update(request, requestOptions) {
114
+ return core.HttpResponsePromise.fromPromise(this.__update(request, requestOptions));
115
+ }
116
+ __update(request, requestOptions) {
117
+ return __awaiter(this, void 0, void 0, function* () {
118
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
119
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
120
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
121
+ const _response = yield core.fetcher({
122
+ url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : ((_c = (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentMailEnvironment.Prod)
123
+ .http, "/v0/forwarding"),
124
+ method: "PUT",
125
+ headers: _headers,
126
+ contentType: "application/json",
127
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
128
+ requestType: "json",
129
+ body: serializers.UpdateForwardingRequest.jsonOrThrow(request, {
130
+ unrecognizedObjectKeys: "strip",
131
+ omitUndefined: true,
132
+ }),
133
+ timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
134
+ maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
135
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
136
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
137
+ logging: this._options.logging,
138
+ });
139
+ if (_response.ok) {
140
+ return {
141
+ data: serializers.UpdateForwardingResponse.parseOrThrow(_response.body, {
142
+ unrecognizedObjectKeys: "passthrough",
143
+ allowUnrecognizedUnionMembers: true,
144
+ allowUnrecognizedEnumValues: true,
145
+ skipValidation: true,
146
+ breadcrumbsPrefix: ["response"],
147
+ }),
148
+ rawResponse: _response.rawResponse,
149
+ };
150
+ }
151
+ if (_response.error.reason === "status-code") {
152
+ switch (_response.error.statusCode) {
153
+ case 400:
154
+ throw new AgentMail.ValidationError(serializers.ValidationErrorResponse.parseOrThrow(_response.error.body, {
155
+ unrecognizedObjectKeys: "passthrough",
156
+ allowUnrecognizedUnionMembers: true,
157
+ allowUnrecognizedEnumValues: true,
158
+ skipValidation: true,
159
+ breadcrumbsPrefix: ["response"],
160
+ }), _response.rawResponse);
161
+ case 403:
162
+ throw new AgentMail.ForwardingForbiddenError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
163
+ unrecognizedObjectKeys: "passthrough",
164
+ allowUnrecognizedUnionMembers: true,
165
+ allowUnrecognizedEnumValues: true,
166
+ skipValidation: true,
167
+ breadcrumbsPrefix: ["response"],
168
+ }), _response.rawResponse);
169
+ default:
170
+ throw new errors.AgentMailError({
171
+ statusCode: _response.error.statusCode,
172
+ body: _response.error.body,
173
+ rawResponse: _response.rawResponse,
174
+ });
175
+ }
176
+ }
177
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v0/forwarding");
178
+ });
179
+ }
180
+ /**
181
+ * Remove the organization's forwarding, so its inboxes stop forwarding unless their pod or the
182
+ * inbox sets its own. Verified addresses stay verified, so adding one again needs no new code.
183
+ * Returns `not_found` when the organization sets no forwarding.
184
+ *
185
+ * **CLI:**
186
+ * ```bash
187
+ * agentmail forwarding delete
188
+ * ```
189
+ *
190
+ * @param {ForwardingClient.RequestOptions} requestOptions - Request-specific configuration.
191
+ *
192
+ * @throws {@link AgentMail.NotFoundError}
193
+ * @throws {@link AgentMail.ForwardingForbiddenError}
194
+ *
195
+ * @example
196
+ * await client.forwarding.delete()
197
+ */
198
+ delete(requestOptions) {
199
+ return core.HttpResponsePromise.fromPromise(this.__delete(requestOptions));
200
+ }
201
+ __delete(requestOptions) {
202
+ return __awaiter(this, void 0, void 0, function* () {
203
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
204
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
205
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
206
+ const _response = yield core.fetcher({
207
+ url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : ((_c = (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentMailEnvironment.Prod)
208
+ .http, "/v0/forwarding"),
209
+ method: "DELETE",
210
+ headers: _headers,
211
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
212
+ timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
213
+ maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
214
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
215
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
216
+ logging: this._options.logging,
217
+ });
218
+ if (_response.ok) {
219
+ return {
220
+ data: serializers.Forwarding.parseOrThrow(_response.body, {
221
+ unrecognizedObjectKeys: "passthrough",
222
+ allowUnrecognizedUnionMembers: true,
223
+ allowUnrecognizedEnumValues: true,
224
+ skipValidation: true,
225
+ breadcrumbsPrefix: ["response"],
226
+ }),
227
+ rawResponse: _response.rawResponse,
228
+ };
229
+ }
230
+ if (_response.error.reason === "status-code") {
231
+ switch (_response.error.statusCode) {
232
+ case 404:
233
+ throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
234
+ unrecognizedObjectKeys: "passthrough",
235
+ allowUnrecognizedUnionMembers: true,
236
+ allowUnrecognizedEnumValues: true,
237
+ skipValidation: true,
238
+ breadcrumbsPrefix: ["response"],
239
+ }), _response.rawResponse);
240
+ case 403:
241
+ throw new AgentMail.ForwardingForbiddenError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
242
+ unrecognizedObjectKeys: "passthrough",
243
+ allowUnrecognizedUnionMembers: true,
244
+ allowUnrecognizedEnumValues: true,
245
+ skipValidation: true,
246
+ breadcrumbsPrefix: ["response"],
247
+ }), _response.rawResponse);
248
+ default:
249
+ throw new errors.AgentMailError({
250
+ statusCode: _response.error.statusCode,
251
+ body: _response.error.body,
252
+ rawResponse: _response.rawResponse,
253
+ });
254
+ }
255
+ }
256
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v0/forwarding");
257
+ });
258
+ }
259
+ /**
260
+ * Email a confirmation code to an address, so it can receive forwarded mail once confirmed.
261
+ * Verification belongs to the organization: once verified, the address can be used at the
262
+ * organization, any pod and any inbox. Starting again replaces any code already sent to the
263
+ * address. Needs an organization- or pod-scoped API key in an organization that has completed
264
+ * agent verification.
265
+ *
266
+ * **CLI:**
267
+ * ```bash
268
+ * agentmail forwarding start-verification --destination ops@example.com
269
+ * ```
270
+ *
271
+ * @param {AgentMail.StartForwardingVerificationRequest} request
272
+ * @param {ForwardingClient.RequestOptions} requestOptions - Request-specific configuration.
273
+ *
274
+ * @throws {@link AgentMail.ValidationError}
275
+ * @throws {@link AgentMail.ForwardingForbiddenError}
276
+ * @throws {@link AgentMail.UnprocessableError}
277
+ * @throws {@link AgentMail.ForwardingRateLimitError}
278
+ *
279
+ * @example
280
+ * await client.forwarding.startVerification({
281
+ * destination: "destination"
282
+ * })
283
+ */
284
+ startVerification(request, requestOptions) {
285
+ return core.HttpResponsePromise.fromPromise(this.__startVerification(request, requestOptions));
286
+ }
287
+ __startVerification(request, requestOptions) {
288
+ return __awaiter(this, void 0, void 0, function* () {
289
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
290
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
291
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
292
+ const _response = yield core.fetcher({
293
+ url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : ((_c = (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentMailEnvironment.Prod)
294
+ .http, "/v0/forwarding/verifications"),
295
+ method: "POST",
296
+ headers: _headers,
297
+ contentType: "application/json",
298
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
299
+ requestType: "json",
300
+ body: serializers.StartForwardingVerificationRequest.jsonOrThrow(request, {
301
+ unrecognizedObjectKeys: "strip",
302
+ omitUndefined: true,
303
+ }),
304
+ timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
305
+ maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
306
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
307
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
308
+ logging: this._options.logging,
309
+ });
310
+ if (_response.ok) {
311
+ return {
312
+ data: serializers.ForwardingVerificationStarted.parseOrThrow(_response.body, {
313
+ unrecognizedObjectKeys: "passthrough",
314
+ allowUnrecognizedUnionMembers: true,
315
+ allowUnrecognizedEnumValues: true,
316
+ skipValidation: true,
317
+ breadcrumbsPrefix: ["response"],
318
+ }),
319
+ rawResponse: _response.rawResponse,
320
+ };
321
+ }
322
+ if (_response.error.reason === "status-code") {
323
+ switch (_response.error.statusCode) {
324
+ case 400:
325
+ throw new AgentMail.ValidationError(serializers.ValidationErrorResponse.parseOrThrow(_response.error.body, {
326
+ unrecognizedObjectKeys: "passthrough",
327
+ allowUnrecognizedUnionMembers: true,
328
+ allowUnrecognizedEnumValues: true,
329
+ skipValidation: true,
330
+ breadcrumbsPrefix: ["response"],
331
+ }), _response.rawResponse);
332
+ case 403:
333
+ throw new AgentMail.ForwardingForbiddenError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
334
+ unrecognizedObjectKeys: "passthrough",
335
+ allowUnrecognizedUnionMembers: true,
336
+ allowUnrecognizedEnumValues: true,
337
+ skipValidation: true,
338
+ breadcrumbsPrefix: ["response"],
339
+ }), _response.rawResponse);
340
+ case 422:
341
+ throw new AgentMail.UnprocessableError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
342
+ unrecognizedObjectKeys: "passthrough",
343
+ allowUnrecognizedUnionMembers: true,
344
+ allowUnrecognizedEnumValues: true,
345
+ skipValidation: true,
346
+ breadcrumbsPrefix: ["response"],
347
+ }), _response.rawResponse);
348
+ case 429:
349
+ throw new AgentMail.ForwardingRateLimitError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
350
+ unrecognizedObjectKeys: "passthrough",
351
+ allowUnrecognizedUnionMembers: true,
352
+ allowUnrecognizedEnumValues: true,
353
+ skipValidation: true,
354
+ breadcrumbsPrefix: ["response"],
355
+ }), _response.rawResponse);
356
+ default:
357
+ throw new errors.AgentMailError({
358
+ statusCode: _response.error.statusCode,
359
+ body: _response.error.body,
360
+ rawResponse: _response.rawResponse,
361
+ });
362
+ }
363
+ }
364
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v0/forwarding/verifications");
365
+ });
366
+ }
367
+ /**
368
+ * Submit the code emailed by Start Verification to verify the address. A code allows 10 wrong
369
+ * attempts, then stops working even with the right code, and Start Verification sends a new one.
370
+ * Needs an organization- or pod-scoped API key in an organization that has completed agent
371
+ * verification.
372
+ *
373
+ * **CLI:**
374
+ * ```bash
375
+ * agentmail forwarding confirm-verification --destination ops@example.com --code 7KQ2M-XW9PD
376
+ * ```
377
+ *
378
+ * @param {AgentMail.ConfirmForwardingVerificationRequest} request
379
+ * @param {ForwardingClient.RequestOptions} requestOptions - Request-specific configuration.
380
+ *
381
+ * @throws {@link AgentMail.ValidationError}
382
+ * @throws {@link AgentMail.ForwardingForbiddenError}
383
+ * @throws {@link AgentMail.ConflictError}
384
+ *
385
+ * @example
386
+ * await client.forwarding.confirmVerification({
387
+ * destination: "destination",
388
+ * code: "code"
389
+ * })
390
+ */
391
+ confirmVerification(request, requestOptions) {
392
+ return core.HttpResponsePromise.fromPromise(this.__confirmVerification(request, requestOptions));
393
+ }
394
+ __confirmVerification(request, requestOptions) {
395
+ return __awaiter(this, void 0, void 0, function* () {
396
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
397
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
398
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
399
+ const _response = yield core.fetcher({
400
+ url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : ((_c = (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentMailEnvironment.Prod)
401
+ .http, "/v0/forwarding/verifications/confirm"),
402
+ method: "POST",
403
+ headers: _headers,
404
+ contentType: "application/json",
405
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
406
+ requestType: "json",
407
+ body: serializers.ConfirmForwardingVerificationRequest.jsonOrThrow(request, {
408
+ unrecognizedObjectKeys: "strip",
409
+ omitUndefined: true,
410
+ }),
411
+ timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
412
+ maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
413
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
414
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
415
+ logging: this._options.logging,
416
+ });
417
+ if (_response.ok) {
418
+ return {
419
+ data: serializers.ForwardingVerificationConfirmed.parseOrThrow(_response.body, {
420
+ unrecognizedObjectKeys: "passthrough",
421
+ allowUnrecognizedUnionMembers: true,
422
+ allowUnrecognizedEnumValues: true,
423
+ skipValidation: true,
424
+ breadcrumbsPrefix: ["response"],
425
+ }),
426
+ rawResponse: _response.rawResponse,
427
+ };
428
+ }
429
+ if (_response.error.reason === "status-code") {
430
+ switch (_response.error.statusCode) {
431
+ case 400:
432
+ throw new AgentMail.ValidationError(serializers.ValidationErrorResponse.parseOrThrow(_response.error.body, {
433
+ unrecognizedObjectKeys: "passthrough",
434
+ allowUnrecognizedUnionMembers: true,
435
+ allowUnrecognizedEnumValues: true,
436
+ skipValidation: true,
437
+ breadcrumbsPrefix: ["response"],
438
+ }), _response.rawResponse);
439
+ case 403:
440
+ throw new AgentMail.ForwardingForbiddenError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
441
+ unrecognizedObjectKeys: "passthrough",
442
+ allowUnrecognizedUnionMembers: true,
443
+ allowUnrecognizedEnumValues: true,
444
+ skipValidation: true,
445
+ breadcrumbsPrefix: ["response"],
446
+ }), _response.rawResponse);
447
+ case 409:
448
+ throw new AgentMail.ConflictError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
449
+ unrecognizedObjectKeys: "passthrough",
450
+ allowUnrecognizedUnionMembers: true,
451
+ allowUnrecognizedEnumValues: true,
452
+ skipValidation: true,
453
+ breadcrumbsPrefix: ["response"],
454
+ }), _response.rawResponse);
455
+ default:
456
+ throw new errors.AgentMailError({
457
+ statusCode: _response.error.statusCode,
458
+ body: _response.error.body,
459
+ rawResponse: _response.rawResponse,
460
+ });
461
+ }
462
+ }
463
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v0/forwarding/verifications/confirm");
464
+ });
465
+ }
466
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ import type * as core from "../../../../core/index.mjs";
2
+ import * as errors from "../../../../errors/index.mjs";
3
+ import type * as AgentMail from "../../../index.mjs";
4
+ export declare class ForwardingForbiddenError extends errors.AgentMailError {
5
+ constructor(body: AgentMail.ErrorResponse, rawResponse?: core.RawResponse);
6
+ }