agentmail 0.4.12 → 0.4.13

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 (78) 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 +27 -22
  4. package/dist/cjs/api/resources/agent/client/Client.d.ts +50 -0
  5. package/dist/cjs/api/resources/agent/client/Client.js +199 -0
  6. package/dist/cjs/api/resources/agent/client/index.d.ts +1 -0
  7. package/dist/cjs/api/resources/agent/client/index.js +2 -0
  8. package/dist/cjs/api/resources/agent/index.d.ts +2 -0
  9. package/dist/cjs/api/resources/agent/index.js +18 -0
  10. package/dist/cjs/api/resources/agent/types/AgentSignupRequest.d.ts +9 -0
  11. package/dist/cjs/api/resources/agent/types/AgentSignupRequest.js +3 -0
  12. package/dist/cjs/api/resources/agent/types/AgentSignupResponse.d.ts +11 -0
  13. package/dist/cjs/api/resources/agent/types/AgentSignupResponse.js +3 -0
  14. package/dist/cjs/api/resources/agent/types/AgentVerifyRequest.d.ts +7 -0
  15. package/dist/cjs/api/resources/agent/types/AgentVerifyRequest.js +3 -0
  16. package/dist/cjs/api/resources/agent/types/AgentVerifyResponse.d.ts +7 -0
  17. package/dist/cjs/api/resources/agent/types/AgentVerifyResponse.js +3 -0
  18. package/dist/cjs/api/resources/agent/types/index.d.ts +4 -0
  19. package/dist/cjs/api/resources/agent/types/index.js +20 -0
  20. package/dist/cjs/api/resources/index.d.ts +2 -0
  21. package/dist/cjs/api/resources/index.js +6 -4
  22. package/dist/cjs/serialization/resources/agent/index.d.ts +1 -0
  23. package/dist/cjs/serialization/resources/agent/index.js +17 -0
  24. package/dist/cjs/serialization/resources/agent/types/AgentSignupRequest.d.ts +10 -0
  25. package/dist/cjs/serialization/resources/agent/types/AgentSignupRequest.js +42 -0
  26. package/dist/cjs/serialization/resources/agent/types/AgentSignupResponse.d.ts +11 -0
  27. package/dist/cjs/serialization/resources/agent/types/AgentSignupResponse.js +43 -0
  28. package/dist/cjs/serialization/resources/agent/types/AgentVerifyRequest.d.ts +9 -0
  29. package/dist/cjs/serialization/resources/agent/types/AgentVerifyRequest.js +41 -0
  30. package/dist/cjs/serialization/resources/agent/types/AgentVerifyResponse.d.ts +9 -0
  31. package/dist/cjs/serialization/resources/agent/types/AgentVerifyResponse.js +41 -0
  32. package/dist/cjs/serialization/resources/agent/types/index.d.ts +4 -0
  33. package/dist/cjs/serialization/resources/agent/types/index.js +20 -0
  34. package/dist/cjs/serialization/resources/index.d.ts +2 -0
  35. package/dist/cjs/serialization/resources/index.js +3 -1
  36. package/dist/cjs/version.d.ts +1 -1
  37. package/dist/cjs/version.js +1 -1
  38. package/dist/esm/BaseClient.mjs +2 -2
  39. package/dist/esm/Client.d.mts +3 -0
  40. package/dist/esm/Client.mjs +5 -0
  41. package/dist/esm/api/resources/agent/client/Client.d.mts +50 -0
  42. package/dist/esm/api/resources/agent/client/Client.mjs +162 -0
  43. package/dist/esm/api/resources/agent/client/index.d.mts +1 -0
  44. package/dist/esm/api/resources/agent/client/index.mjs +1 -0
  45. package/dist/esm/api/resources/agent/index.d.mts +2 -0
  46. package/dist/esm/api/resources/agent/index.mjs +2 -0
  47. package/dist/esm/api/resources/agent/types/AgentSignupRequest.d.mts +9 -0
  48. package/dist/esm/api/resources/agent/types/AgentSignupRequest.mjs +2 -0
  49. package/dist/esm/api/resources/agent/types/AgentSignupResponse.d.mts +11 -0
  50. package/dist/esm/api/resources/agent/types/AgentSignupResponse.mjs +2 -0
  51. package/dist/esm/api/resources/agent/types/AgentVerifyRequest.d.mts +7 -0
  52. package/dist/esm/api/resources/agent/types/AgentVerifyRequest.mjs +2 -0
  53. package/dist/esm/api/resources/agent/types/AgentVerifyResponse.d.mts +7 -0
  54. package/dist/esm/api/resources/agent/types/AgentVerifyResponse.mjs +2 -0
  55. package/dist/esm/api/resources/agent/types/index.d.mts +4 -0
  56. package/dist/esm/api/resources/agent/types/index.mjs +4 -0
  57. package/dist/esm/api/resources/index.d.mts +2 -0
  58. package/dist/esm/api/resources/index.mjs +2 -0
  59. package/dist/esm/serialization/resources/agent/index.d.mts +1 -0
  60. package/dist/esm/serialization/resources/agent/index.mjs +1 -0
  61. package/dist/esm/serialization/resources/agent/types/AgentSignupRequest.d.mts +10 -0
  62. package/dist/esm/serialization/resources/agent/types/AgentSignupRequest.mjs +6 -0
  63. package/dist/esm/serialization/resources/agent/types/AgentSignupResponse.d.mts +11 -0
  64. package/dist/esm/serialization/resources/agent/types/AgentSignupResponse.mjs +7 -0
  65. package/dist/esm/serialization/resources/agent/types/AgentVerifyRequest.d.mts +9 -0
  66. package/dist/esm/serialization/resources/agent/types/AgentVerifyRequest.mjs +5 -0
  67. package/dist/esm/serialization/resources/agent/types/AgentVerifyResponse.d.mts +9 -0
  68. package/dist/esm/serialization/resources/agent/types/AgentVerifyResponse.mjs +5 -0
  69. package/dist/esm/serialization/resources/agent/types/index.d.mts +4 -0
  70. package/dist/esm/serialization/resources/agent/types/index.mjs +4 -0
  71. package/dist/esm/serialization/resources/index.d.mts +2 -0
  72. package/dist/esm/serialization/resources/index.mjs +2 -0
  73. package/dist/esm/version.d.mts +1 -1
  74. package/dist/esm/version.mjs +1 -1
  75. package/dist/llms-full.txt +1000 -374
  76. package/dist/llms.txt +3 -0
  77. package/package.json +1 -1
  78. package/reference.md +140 -0
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.AgentSignupResponse = void 0;
38
+ const core = __importStar(require("../../../../core/index.js"));
39
+ exports.AgentSignupResponse = core.serialization.object({
40
+ organizationId: core.serialization.property("organization_id", core.serialization.string()),
41
+ inboxId: core.serialization.property("inbox_id", core.serialization.string()),
42
+ apiKey: core.serialization.property("api_key", core.serialization.string()),
43
+ });
@@ -0,0 +1,9 @@
1
+ import type * as AgentMail from "../../../../api/index.js";
2
+ import * as core from "../../../../core/index.js";
3
+ import type * as serializers from "../../../index.js";
4
+ export declare const AgentVerifyRequest: core.serialization.ObjectSchema<serializers.AgentVerifyRequest.Raw, AgentMail.AgentVerifyRequest>;
5
+ export declare namespace AgentVerifyRequest {
6
+ interface Raw {
7
+ otp_code: string;
8
+ }
9
+ }
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.AgentVerifyRequest = void 0;
38
+ const core = __importStar(require("../../../../core/index.js"));
39
+ exports.AgentVerifyRequest = core.serialization.object({
40
+ otpCode: core.serialization.property("otp_code", core.serialization.string()),
41
+ });
@@ -0,0 +1,9 @@
1
+ import type * as AgentMail from "../../../../api/index.js";
2
+ import * as core from "../../../../core/index.js";
3
+ import type * as serializers from "../../../index.js";
4
+ export declare const AgentVerifyResponse: core.serialization.ObjectSchema<serializers.AgentVerifyResponse.Raw, AgentMail.AgentVerifyResponse>;
5
+ export declare namespace AgentVerifyResponse {
6
+ interface Raw {
7
+ verified: boolean;
8
+ }
9
+ }
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.AgentVerifyResponse = void 0;
38
+ const core = __importStar(require("../../../../core/index.js"));
39
+ exports.AgentVerifyResponse = core.serialization.object({
40
+ verified: core.serialization.boolean(),
41
+ });
@@ -0,0 +1,4 @@
1
+ export * from "./AgentSignupRequest.js";
2
+ export * from "./AgentSignupResponse.js";
3
+ export * from "./AgentVerifyRequest.js";
4
+ export * from "./AgentVerifyResponse.js";
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./AgentSignupRequest.js"), exports);
18
+ __exportStar(require("./AgentSignupResponse.js"), exports);
19
+ __exportStar(require("./AgentVerifyRequest.js"), exports);
20
+ __exportStar(require("./AgentVerifyResponse.js"), exports);
@@ -1,3 +1,5 @@
1
+ export * as agent from "./agent/index.js";
2
+ export * from "./agent/types/index.js";
1
3
  export * as apiKeys from "./apiKeys/index.js";
2
4
  export * from "./apiKeys/types/index.js";
3
5
  export * as attachments from "./attachments/index.js";
@@ -36,7 +36,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
36
36
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.websockets = exports.webhooks = exports.threads = exports.pods = exports.organizations = exports.metrics = exports.messages = exports.lists = exports.inboxes = exports.events = exports.drafts = exports.domains = exports.attachments = exports.apiKeys = void 0;
39
+ exports.websockets = exports.webhooks = exports.threads = exports.pods = exports.organizations = exports.metrics = exports.messages = exports.lists = exports.inboxes = exports.events = exports.drafts = exports.domains = exports.attachments = exports.apiKeys = exports.agent = void 0;
40
+ exports.agent = __importStar(require("./agent/index.js"));
41
+ __exportStar(require("./agent/types/index.js"), exports);
40
42
  exports.apiKeys = __importStar(require("./apiKeys/index.js"));
41
43
  __exportStar(require("./apiKeys/types/index.js"), exports);
42
44
  exports.attachments = __importStar(require("./attachments/index.js"));
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.4.12";
1
+ export declare const SDK_VERSION = "0.4.13";
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SDK_VERSION = void 0;
4
- exports.SDK_VERSION = "0.4.12";
4
+ exports.SDK_VERSION = "0.4.13";
@@ -6,8 +6,8 @@ export function normalizeClientOptions(options) {
6
6
  const headers = mergeHeaders({
7
7
  "X-Fern-Language": "JavaScript",
8
8
  "X-Fern-SDK-Name": "agentmail",
9
- "X-Fern-SDK-Version": "0.4.12",
10
- "User-Agent": "agentmail/0.4.12",
9
+ "X-Fern-SDK-Version": "0.4.13",
10
+ "User-Agent": "agentmail/0.4.13",
11
11
  "X-Fern-Runtime": core.RUNTIME.type,
12
12
  "X-Fern-Runtime-Version": core.RUNTIME.version,
13
13
  }, options === null || options === void 0 ? void 0 : options.headers);
@@ -1,3 +1,4 @@
1
+ import { AgentClient } from "./api/resources/agent/client/Client.mjs";
1
2
  import { ApiKeysClient } from "./api/resources/apiKeys/client/Client.mjs";
2
3
  import { DomainsClient } from "./api/resources/domains/client/Client.mjs";
3
4
  import { DraftsClient } from "./api/resources/drafts/client/Client.mjs";
@@ -21,6 +22,7 @@ export declare class AgentMailClient {
21
22
  protected _inboxes: InboxesClient | undefined;
22
23
  protected _pods: PodsClient | undefined;
23
24
  protected _webhooks: WebhooksClient | undefined;
25
+ protected _agent: AgentClient | undefined;
24
26
  protected _apiKeys: ApiKeysClient | undefined;
25
27
  protected _domains: DomainsClient | undefined;
26
28
  protected _drafts: DraftsClient | undefined;
@@ -33,6 +35,7 @@ export declare class AgentMailClient {
33
35
  get inboxes(): InboxesClient;
34
36
  get pods(): PodsClient;
35
37
  get webhooks(): WebhooksClient;
38
+ get agent(): AgentClient;
36
39
  get apiKeys(): ApiKeysClient;
37
40
  get domains(): DomainsClient;
38
41
  get drafts(): DraftsClient;
@@ -1,4 +1,5 @@
1
1
  // This file was auto-generated by Fern from our API Definition.
2
+ import { AgentClient } from "./api/resources/agent/client/Client.mjs";
2
3
  import { ApiKeysClient } from "./api/resources/apiKeys/client/Client.mjs";
3
4
  import { DomainsClient } from "./api/resources/domains/client/Client.mjs";
4
5
  import { DraftsClient } from "./api/resources/drafts/client/Client.mjs";
@@ -27,6 +28,10 @@ export class AgentMailClient {
27
28
  var _a;
28
29
  return ((_a = this._webhooks) !== null && _a !== void 0 ? _a : (this._webhooks = new WebhooksClient(this._options)));
29
30
  }
31
+ get agent() {
32
+ var _a;
33
+ return ((_a = this._agent) !== null && _a !== void 0 ? _a : (this._agent = new AgentClient(this._options)));
34
+ }
30
35
  get apiKeys() {
31
36
  var _a;
32
37
  return ((_a = this._apiKeys) !== null && _a !== void 0 ? _a : (this._apiKeys = new ApiKeysClient(this._options)));
@@ -0,0 +1,50 @@
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 AgentClient {
6
+ type Options = BaseClientOptions;
7
+ interface RequestOptions extends BaseRequestOptions {
8
+ }
9
+ }
10
+ export declare class AgentClient {
11
+ protected readonly _options: NormalizedClientOptionsWithAuth<AgentClient.Options>;
12
+ constructor(options?: AgentClient.Options);
13
+ /**
14
+ * Create a new agent organization with an inbox and API key. A 6-digit OTP is sent to the human's email for verification.
15
+ *
16
+ * This endpoint is idempotent. Calling it again with the same `human_email` will rotate the API key and resend the OTP if expired.
17
+ *
18
+ * The returned API key has limited permissions until the organization is verified via the verify endpoint.
19
+ *
20
+ * @param {AgentMail.AgentSignupRequest} request
21
+ * @param {AgentClient.RequestOptions} requestOptions - Request-specific configuration.
22
+ *
23
+ * @throws {@link AgentMail.ValidationError}
24
+ *
25
+ * @example
26
+ * await client.agent.signUp({
27
+ * humanEmail: "human_email",
28
+ * username: "username"
29
+ * })
30
+ */
31
+ signUp(request: AgentMail.AgentSignupRequest, requestOptions?: AgentClient.RequestOptions): core.HttpResponsePromise<AgentMail.AgentSignupResponse>;
32
+ private __signUp;
33
+ /**
34
+ * Verify an agent organization using the 6-digit OTP sent to the human's email during sign-up.
35
+ *
36
+ * On success, the organization is upgraded from `agent_unverified` to `agent_verified`, the send allowlist is removed, and free plan entitlements are applied.
37
+ *
38
+ * The OTP expires after 24 hours and allows a maximum of 10 attempts.
39
+ *
40
+ * @param {AgentMail.AgentVerifyRequest} request
41
+ * @param {AgentClient.RequestOptions} requestOptions - Request-specific configuration.
42
+ *
43
+ * @example
44
+ * await client.agent.verify({
45
+ * otpCode: "otp_code"
46
+ * })
47
+ */
48
+ verify(request: AgentMail.AgentVerifyRequest, requestOptions?: AgentClient.RequestOptions): core.HttpResponsePromise<AgentMail.AgentVerifyResponse>;
49
+ private __verify;
50
+ }
@@ -0,0 +1,162 @@
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 AgentClient {
20
+ constructor(options = {}) {
21
+ this._options = normalizeClientOptionsWithAuth(options);
22
+ }
23
+ /**
24
+ * Create a new agent organization with an inbox and API key. A 6-digit OTP is sent to the human's email for verification.
25
+ *
26
+ * This endpoint is idempotent. Calling it again with the same `human_email` will rotate the API key and resend the OTP if expired.
27
+ *
28
+ * The returned API key has limited permissions until the organization is verified via the verify endpoint.
29
+ *
30
+ * @param {AgentMail.AgentSignupRequest} request
31
+ * @param {AgentClient.RequestOptions} requestOptions - Request-specific configuration.
32
+ *
33
+ * @throws {@link AgentMail.ValidationError}
34
+ *
35
+ * @example
36
+ * await client.agent.signUp({
37
+ * humanEmail: "human_email",
38
+ * username: "username"
39
+ * })
40
+ */
41
+ signUp(request, requestOptions) {
42
+ return core.HttpResponsePromise.fromPromise(this.__signUp(request, requestOptions));
43
+ }
44
+ __signUp(request, requestOptions) {
45
+ return __awaiter(this, void 0, void 0, function* () {
46
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
47
+ const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
48
+ const _response = yield core.fetcher({
49
+ 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)
50
+ .http, "/v0/agent/sign-up"),
51
+ method: "POST",
52
+ headers: _headers,
53
+ contentType: "application/json",
54
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
55
+ requestType: "json",
56
+ body: serializers.AgentSignupRequest.jsonOrThrow(request, {
57
+ unrecognizedObjectKeys: "strip",
58
+ omitUndefined: true,
59
+ }),
60
+ 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,
61
+ 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,
62
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
63
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
64
+ logging: this._options.logging,
65
+ });
66
+ if (_response.ok) {
67
+ return {
68
+ data: serializers.AgentSignupResponse.parseOrThrow(_response.body, {
69
+ unrecognizedObjectKeys: "passthrough",
70
+ allowUnrecognizedUnionMembers: true,
71
+ allowUnrecognizedEnumValues: true,
72
+ skipValidation: true,
73
+ breadcrumbsPrefix: ["response"],
74
+ }),
75
+ rawResponse: _response.rawResponse,
76
+ };
77
+ }
78
+ if (_response.error.reason === "status-code") {
79
+ switch (_response.error.statusCode) {
80
+ case 400:
81
+ throw new AgentMail.ValidationError(serializers.ValidationErrorResponse.parseOrThrow(_response.error.body, {
82
+ unrecognizedObjectKeys: "passthrough",
83
+ allowUnrecognizedUnionMembers: true,
84
+ allowUnrecognizedEnumValues: true,
85
+ skipValidation: true,
86
+ breadcrumbsPrefix: ["response"],
87
+ }), _response.rawResponse);
88
+ default:
89
+ throw new errors.AgentMailError({
90
+ statusCode: _response.error.statusCode,
91
+ body: _response.error.body,
92
+ rawResponse: _response.rawResponse,
93
+ });
94
+ }
95
+ }
96
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v0/agent/sign-up");
97
+ });
98
+ }
99
+ /**
100
+ * Verify an agent organization using the 6-digit OTP sent to the human's email during sign-up.
101
+ *
102
+ * On success, the organization is upgraded from `agent_unverified` to `agent_verified`, the send allowlist is removed, and free plan entitlements are applied.
103
+ *
104
+ * The OTP expires after 24 hours and allows a maximum of 10 attempts.
105
+ *
106
+ * @param {AgentMail.AgentVerifyRequest} request
107
+ * @param {AgentClient.RequestOptions} requestOptions - Request-specific configuration.
108
+ *
109
+ * @example
110
+ * await client.agent.verify({
111
+ * otpCode: "otp_code"
112
+ * })
113
+ */
114
+ verify(request, requestOptions) {
115
+ return core.HttpResponsePromise.fromPromise(this.__verify(request, requestOptions));
116
+ }
117
+ __verify(request, requestOptions) {
118
+ return __awaiter(this, void 0, void 0, function* () {
119
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
120
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
121
+ 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);
122
+ const _response = yield core.fetcher({
123
+ 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)
124
+ .http, "/v0/agent/verify"),
125
+ method: "POST",
126
+ headers: _headers,
127
+ contentType: "application/json",
128
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
129
+ requestType: "json",
130
+ body: serializers.AgentVerifyRequest.jsonOrThrow(request, {
131
+ unrecognizedObjectKeys: "strip",
132
+ omitUndefined: true,
133
+ }),
134
+ 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,
135
+ 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,
136
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
137
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
138
+ logging: this._options.logging,
139
+ });
140
+ if (_response.ok) {
141
+ return {
142
+ data: serializers.AgentVerifyResponse.parseOrThrow(_response.body, {
143
+ unrecognizedObjectKeys: "passthrough",
144
+ allowUnrecognizedUnionMembers: true,
145
+ allowUnrecognizedEnumValues: true,
146
+ skipValidation: true,
147
+ breadcrumbsPrefix: ["response"],
148
+ }),
149
+ rawResponse: _response.rawResponse,
150
+ };
151
+ }
152
+ if (_response.error.reason === "status-code") {
153
+ throw new errors.AgentMailError({
154
+ statusCode: _response.error.statusCode,
155
+ body: _response.error.body,
156
+ rawResponse: _response.rawResponse,
157
+ });
158
+ }
159
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v0/agent/verify");
160
+ });
161
+ }
162
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ export * from "./client/index.mjs";
2
+ export * from "./types/index.mjs";
@@ -0,0 +1,2 @@
1
+ export * from "./client/index.mjs";
2
+ export * from "./types/index.mjs";
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Request body to sign up an agent.
3
+ */
4
+ export interface AgentSignupRequest {
5
+ /** Email address of the human who owns the agent. A 6-digit OTP will be sent to this address. */
6
+ humanEmail: string;
7
+ /** Username for the auto-created inbox (e.g. "my-agent" creates my-agent@agentmail.to). */
8
+ username: string;
9
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Response after successful agent sign-up.
3
+ */
4
+ export interface AgentSignupResponse {
5
+ /** ID of the created organization. */
6
+ organizationId: string;
7
+ /** ID of the auto-created inbox. */
8
+ inboxId: string;
9
+ /** API key for authenticating subsequent requests. Store this securely, it cannot be retrieved again. */
10
+ apiKey: string;
11
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Request body to verify an agent with an OTP code.
3
+ */
4
+ export interface AgentVerifyRequest {
5
+ /** 6-digit verification code sent to the human's email address. */
6
+ otpCode: string;
7
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Response after successful agent verification.
3
+ */
4
+ export interface AgentVerifyResponse {
5
+ /** Whether the organization was verified. */
6
+ verified: boolean;
7
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,4 @@
1
+ export * from "./AgentSignupRequest.mjs";
2
+ export * from "./AgentSignupResponse.mjs";
3
+ export * from "./AgentVerifyRequest.mjs";
4
+ export * from "./AgentVerifyResponse.mjs";
@@ -0,0 +1,4 @@
1
+ export * from "./AgentSignupRequest.mjs";
2
+ export * from "./AgentSignupResponse.mjs";
3
+ export * from "./AgentVerifyRequest.mjs";
4
+ export * from "./AgentVerifyResponse.mjs";
@@ -1,3 +1,5 @@
1
+ export * as agent from "./agent/index.mjs";
2
+ export * from "./agent/types/index.mjs";
1
3
  export * from "./apiKeys/client/requests/index.mjs";
2
4
  export * as apiKeys from "./apiKeys/index.mjs";
3
5
  export * from "./apiKeys/types/index.mjs";
@@ -1,3 +1,5 @@
1
+ export * as agent from "./agent/index.mjs";
2
+ export * from "./agent/types/index.mjs";
1
3
  export * from "./apiKeys/client/requests/index.mjs";
2
4
  export * as apiKeys from "./apiKeys/index.mjs";
3
5
  export * from "./apiKeys/types/index.mjs";
@@ -0,0 +1 @@
1
+ export * from "./types/index.mjs";
@@ -0,0 +1 @@
1
+ export * from "./types/index.mjs";
@@ -0,0 +1,10 @@
1
+ import type * as AgentMail from "../../../../api/index.mjs";
2
+ import * as core from "../../../../core/index.mjs";
3
+ import type * as serializers from "../../../index.mjs";
4
+ export declare const AgentSignupRequest: core.serialization.ObjectSchema<serializers.AgentSignupRequest.Raw, AgentMail.AgentSignupRequest>;
5
+ export declare namespace AgentSignupRequest {
6
+ interface Raw {
7
+ human_email: string;
8
+ username: string;
9
+ }
10
+ }
@@ -0,0 +1,6 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ import * as core from "../../../../core/index.mjs";
3
+ export const AgentSignupRequest = core.serialization.object({
4
+ humanEmail: core.serialization.property("human_email", core.serialization.string()),
5
+ username: core.serialization.string(),
6
+ });
@@ -0,0 +1,11 @@
1
+ import type * as AgentMail from "../../../../api/index.mjs";
2
+ import * as core from "../../../../core/index.mjs";
3
+ import type * as serializers from "../../../index.mjs";
4
+ export declare const AgentSignupResponse: core.serialization.ObjectSchema<serializers.AgentSignupResponse.Raw, AgentMail.AgentSignupResponse>;
5
+ export declare namespace AgentSignupResponse {
6
+ interface Raw {
7
+ organization_id: string;
8
+ inbox_id: string;
9
+ api_key: string;
10
+ }
11
+ }
@@ -0,0 +1,7 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ import * as core from "../../../../core/index.mjs";
3
+ export const AgentSignupResponse = core.serialization.object({
4
+ organizationId: core.serialization.property("organization_id", core.serialization.string()),
5
+ inboxId: core.serialization.property("inbox_id", core.serialization.string()),
6
+ apiKey: core.serialization.property("api_key", core.serialization.string()),
7
+ });
@@ -0,0 +1,9 @@
1
+ import type * as AgentMail from "../../../../api/index.mjs";
2
+ import * as core from "../../../../core/index.mjs";
3
+ import type * as serializers from "../../../index.mjs";
4
+ export declare const AgentVerifyRequest: core.serialization.ObjectSchema<serializers.AgentVerifyRequest.Raw, AgentMail.AgentVerifyRequest>;
5
+ export declare namespace AgentVerifyRequest {
6
+ interface Raw {
7
+ otp_code: string;
8
+ }
9
+ }