agentmail 0.4.12 → 0.4.14

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 (142) 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/errors/UnprocessableError.d.ts +6 -0
  5. package/dist/cjs/api/errors/UnprocessableError.js +54 -0
  6. package/dist/cjs/api/errors/index.d.ts +1 -0
  7. package/dist/cjs/api/errors/index.js +1 -0
  8. package/dist/cjs/api/resources/agent/client/Client.d.ts +50 -0
  9. package/dist/cjs/api/resources/agent/client/Client.js +199 -0
  10. package/dist/cjs/api/resources/agent/client/index.d.ts +1 -0
  11. package/dist/cjs/api/resources/agent/client/index.js +2 -0
  12. package/dist/cjs/api/resources/agent/index.d.ts +2 -0
  13. package/dist/cjs/api/resources/agent/index.js +18 -0
  14. package/dist/cjs/api/resources/agent/types/AgentSignupRequest.d.ts +9 -0
  15. package/dist/cjs/api/resources/agent/types/AgentSignupRequest.js +3 -0
  16. package/dist/cjs/api/resources/agent/types/AgentSignupResponse.d.ts +11 -0
  17. package/dist/cjs/api/resources/agent/types/AgentSignupResponse.js +3 -0
  18. package/dist/cjs/api/resources/agent/types/AgentVerifyRequest.d.ts +7 -0
  19. package/dist/cjs/api/resources/agent/types/AgentVerifyRequest.js +3 -0
  20. package/dist/cjs/api/resources/agent/types/AgentVerifyResponse.d.ts +7 -0
  21. package/dist/cjs/api/resources/agent/types/AgentVerifyResponse.js +3 -0
  22. package/dist/cjs/api/resources/agent/types/index.d.ts +4 -0
  23. package/dist/cjs/api/resources/agent/types/index.js +20 -0
  24. package/dist/cjs/api/resources/inboxes/resources/messages/client/Client.d.ts +1 -1
  25. package/dist/cjs/api/resources/inboxes/resources/messages/client/Client.js +1 -1
  26. package/dist/cjs/api/resources/inboxes/resources/threads/client/Client.d.ts +17 -0
  27. package/dist/cjs/api/resources/inboxes/resources/threads/client/Client.js +90 -0
  28. package/dist/cjs/api/resources/index.d.ts +2 -0
  29. package/dist/cjs/api/resources/index.js +6 -4
  30. package/dist/cjs/api/resources/messages/types/UpdateMessageResponse.d.ts +5 -0
  31. package/dist/cjs/api/resources/messages/types/UpdateMessageResponse.js +3 -0
  32. package/dist/cjs/api/resources/messages/types/index.d.ts +1 -0
  33. package/dist/cjs/api/resources/messages/types/index.js +1 -0
  34. package/dist/cjs/api/resources/pods/resources/threads/client/Client.d.ts +17 -0
  35. package/dist/cjs/api/resources/pods/resources/threads/client/Client.js +90 -0
  36. package/dist/cjs/api/resources/threads/client/Client.d.ts +16 -0
  37. package/dist/cjs/api/resources/threads/client/Client.js +89 -0
  38. package/dist/cjs/api/resources/threads/types/UpdateThreadRequest.d.ts +6 -0
  39. package/dist/cjs/api/resources/threads/types/UpdateThreadRequest.js +3 -0
  40. package/dist/cjs/api/resources/threads/types/UpdateThreadResponse.d.ts +5 -0
  41. package/dist/cjs/api/resources/threads/types/UpdateThreadResponse.js +3 -0
  42. package/dist/cjs/api/resources/threads/types/index.d.ts +2 -0
  43. package/dist/cjs/api/resources/threads/types/index.js +2 -0
  44. package/dist/cjs/serialization/resources/agent/index.d.ts +1 -0
  45. package/dist/cjs/serialization/resources/agent/index.js +17 -0
  46. package/dist/cjs/serialization/resources/agent/types/AgentSignupRequest.d.ts +10 -0
  47. package/dist/cjs/serialization/resources/agent/types/AgentSignupRequest.js +42 -0
  48. package/dist/cjs/serialization/resources/agent/types/AgentSignupResponse.d.ts +11 -0
  49. package/dist/cjs/serialization/resources/agent/types/AgentSignupResponse.js +43 -0
  50. package/dist/cjs/serialization/resources/agent/types/AgentVerifyRequest.d.ts +9 -0
  51. package/dist/cjs/serialization/resources/agent/types/AgentVerifyRequest.js +41 -0
  52. package/dist/cjs/serialization/resources/agent/types/AgentVerifyResponse.d.ts +9 -0
  53. package/dist/cjs/serialization/resources/agent/types/AgentVerifyResponse.js +41 -0
  54. package/dist/cjs/serialization/resources/agent/types/index.d.ts +4 -0
  55. package/dist/cjs/serialization/resources/agent/types/index.js +20 -0
  56. package/dist/cjs/serialization/resources/index.d.ts +2 -0
  57. package/dist/cjs/serialization/resources/index.js +3 -1
  58. package/dist/cjs/serialization/resources/messages/types/UpdateMessageResponse.d.ts +12 -0
  59. package/dist/cjs/serialization/resources/messages/types/UpdateMessageResponse.js +44 -0
  60. package/dist/cjs/serialization/resources/messages/types/index.d.ts +1 -0
  61. package/dist/cjs/serialization/resources/messages/types/index.js +1 -0
  62. package/dist/cjs/serialization/resources/threads/types/UpdateThreadRequest.d.ts +10 -0
  63. package/dist/cjs/serialization/resources/threads/types/UpdateThreadRequest.js +42 -0
  64. package/dist/cjs/serialization/resources/threads/types/UpdateThreadResponse.d.ts +12 -0
  65. package/dist/cjs/serialization/resources/threads/types/UpdateThreadResponse.js +44 -0
  66. package/dist/cjs/serialization/resources/threads/types/index.d.ts +2 -0
  67. package/dist/cjs/serialization/resources/threads/types/index.js +2 -0
  68. package/dist/cjs/version.d.ts +1 -1
  69. package/dist/cjs/version.js +1 -1
  70. package/dist/esm/BaseClient.mjs +2 -2
  71. package/dist/esm/Client.d.mts +3 -0
  72. package/dist/esm/Client.mjs +5 -0
  73. package/dist/esm/api/errors/UnprocessableError.d.mts +6 -0
  74. package/dist/esm/api/errors/UnprocessableError.mjs +17 -0
  75. package/dist/esm/api/errors/index.d.mts +1 -0
  76. package/dist/esm/api/errors/index.mjs +1 -0
  77. package/dist/esm/api/resources/agent/client/Client.d.mts +50 -0
  78. package/dist/esm/api/resources/agent/client/Client.mjs +162 -0
  79. package/dist/esm/api/resources/agent/client/index.d.mts +1 -0
  80. package/dist/esm/api/resources/agent/client/index.mjs +1 -0
  81. package/dist/esm/api/resources/agent/index.d.mts +2 -0
  82. package/dist/esm/api/resources/agent/index.mjs +2 -0
  83. package/dist/esm/api/resources/agent/types/AgentSignupRequest.d.mts +9 -0
  84. package/dist/esm/api/resources/agent/types/AgentSignupRequest.mjs +2 -0
  85. package/dist/esm/api/resources/agent/types/AgentSignupResponse.d.mts +11 -0
  86. package/dist/esm/api/resources/agent/types/AgentSignupResponse.mjs +2 -0
  87. package/dist/esm/api/resources/agent/types/AgentVerifyRequest.d.mts +7 -0
  88. package/dist/esm/api/resources/agent/types/AgentVerifyRequest.mjs +2 -0
  89. package/dist/esm/api/resources/agent/types/AgentVerifyResponse.d.mts +7 -0
  90. package/dist/esm/api/resources/agent/types/AgentVerifyResponse.mjs +2 -0
  91. package/dist/esm/api/resources/agent/types/index.d.mts +4 -0
  92. package/dist/esm/api/resources/agent/types/index.mjs +4 -0
  93. package/dist/esm/api/resources/inboxes/resources/messages/client/Client.d.mts +1 -1
  94. package/dist/esm/api/resources/inboxes/resources/messages/client/Client.mjs +1 -1
  95. package/dist/esm/api/resources/inboxes/resources/threads/client/Client.d.mts +17 -0
  96. package/dist/esm/api/resources/inboxes/resources/threads/client/Client.mjs +90 -0
  97. package/dist/esm/api/resources/index.d.mts +2 -0
  98. package/dist/esm/api/resources/index.mjs +2 -0
  99. package/dist/esm/api/resources/messages/types/UpdateMessageResponse.d.mts +5 -0
  100. package/dist/esm/api/resources/messages/types/UpdateMessageResponse.mjs +2 -0
  101. package/dist/esm/api/resources/messages/types/index.d.mts +1 -0
  102. package/dist/esm/api/resources/messages/types/index.mjs +1 -0
  103. package/dist/esm/api/resources/pods/resources/threads/client/Client.d.mts +17 -0
  104. package/dist/esm/api/resources/pods/resources/threads/client/Client.mjs +90 -0
  105. package/dist/esm/api/resources/threads/client/Client.d.mts +16 -0
  106. package/dist/esm/api/resources/threads/client/Client.mjs +89 -0
  107. package/dist/esm/api/resources/threads/types/UpdateThreadRequest.d.mts +6 -0
  108. package/dist/esm/api/resources/threads/types/UpdateThreadRequest.mjs +2 -0
  109. package/dist/esm/api/resources/threads/types/UpdateThreadResponse.d.mts +5 -0
  110. package/dist/esm/api/resources/threads/types/UpdateThreadResponse.mjs +2 -0
  111. package/dist/esm/api/resources/threads/types/index.d.mts +2 -0
  112. package/dist/esm/api/resources/threads/types/index.mjs +2 -0
  113. package/dist/esm/serialization/resources/agent/index.d.mts +1 -0
  114. package/dist/esm/serialization/resources/agent/index.mjs +1 -0
  115. package/dist/esm/serialization/resources/agent/types/AgentSignupRequest.d.mts +10 -0
  116. package/dist/esm/serialization/resources/agent/types/AgentSignupRequest.mjs +6 -0
  117. package/dist/esm/serialization/resources/agent/types/AgentSignupResponse.d.mts +11 -0
  118. package/dist/esm/serialization/resources/agent/types/AgentSignupResponse.mjs +7 -0
  119. package/dist/esm/serialization/resources/agent/types/AgentVerifyRequest.d.mts +9 -0
  120. package/dist/esm/serialization/resources/agent/types/AgentVerifyRequest.mjs +5 -0
  121. package/dist/esm/serialization/resources/agent/types/AgentVerifyResponse.d.mts +9 -0
  122. package/dist/esm/serialization/resources/agent/types/AgentVerifyResponse.mjs +5 -0
  123. package/dist/esm/serialization/resources/agent/types/index.d.mts +4 -0
  124. package/dist/esm/serialization/resources/agent/types/index.mjs +4 -0
  125. package/dist/esm/serialization/resources/index.d.mts +2 -0
  126. package/dist/esm/serialization/resources/index.mjs +2 -0
  127. package/dist/esm/serialization/resources/messages/types/UpdateMessageResponse.d.mts +12 -0
  128. package/dist/esm/serialization/resources/messages/types/UpdateMessageResponse.mjs +8 -0
  129. package/dist/esm/serialization/resources/messages/types/index.d.mts +1 -0
  130. package/dist/esm/serialization/resources/messages/types/index.mjs +1 -0
  131. package/dist/esm/serialization/resources/threads/types/UpdateThreadRequest.d.mts +10 -0
  132. package/dist/esm/serialization/resources/threads/types/UpdateThreadRequest.mjs +6 -0
  133. package/dist/esm/serialization/resources/threads/types/UpdateThreadResponse.d.mts +12 -0
  134. package/dist/esm/serialization/resources/threads/types/UpdateThreadResponse.mjs +8 -0
  135. package/dist/esm/serialization/resources/threads/types/index.d.mts +2 -0
  136. package/dist/esm/serialization/resources/threads/types/index.mjs +2 -0
  137. package/dist/esm/version.d.mts +1 -1
  138. package/dist/esm/version.mjs +1 -1
  139. package/dist/llms-full.txt +1000 -374
  140. package/dist/llms.txt +3 -0
  141. package/package.json +20 -2
  142. package/reference.md +370 -1
@@ -43,8 +43,8 @@ function normalizeClientOptions(options) {
43
43
  const headers = (0, headers_js_1.mergeHeaders)({
44
44
  "X-Fern-Language": "JavaScript",
45
45
  "X-Fern-SDK-Name": "agentmail",
46
- "X-Fern-SDK-Version": "0.4.12",
47
- "User-Agent": "agentmail/0.4.12",
46
+ "X-Fern-SDK-Version": "0.4.14",
47
+ "User-Agent": "agentmail/0.4.14",
48
48
  "X-Fern-Runtime": core.RUNTIME.type,
49
49
  "X-Fern-Runtime-Version": core.RUNTIME.version,
50
50
  }, options === null || options === void 0 ? void 0 : options.headers);
@@ -1,3 +1,4 @@
1
+ import { AgentClient } from "./api/resources/agent/client/Client.js";
1
2
  import { ApiKeysClient } from "./api/resources/apiKeys/client/Client.js";
2
3
  import { DomainsClient } from "./api/resources/domains/client/Client.js";
3
4
  import { DraftsClient } from "./api/resources/drafts/client/Client.js";
@@ -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;
@@ -2,17 +2,18 @@
2
2
  // This file was auto-generated by Fern from our API Definition.
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.AgentMailClient = void 0;
5
- const Client_js_1 = require("./api/resources/apiKeys/client/Client.js");
6
- const Client_js_2 = require("./api/resources/domains/client/Client.js");
7
- const Client_js_3 = require("./api/resources/drafts/client/Client.js");
8
- const Client_js_4 = require("./api/resources/inboxes/client/Client.js");
9
- const Client_js_5 = require("./api/resources/lists/client/Client.js");
10
- const Client_js_6 = require("./api/resources/metrics/client/Client.js");
11
- const Client_js_7 = require("./api/resources/organizations/client/Client.js");
12
- const Client_js_8 = require("./api/resources/pods/client/Client.js");
13
- const Client_js_9 = require("./api/resources/threads/client/Client.js");
14
- const Client_js_10 = require("./api/resources/webhooks/client/Client.js");
15
- const Client_js_11 = require("./api/resources/websockets/client/Client.js");
5
+ const Client_js_1 = require("./api/resources/agent/client/Client.js");
6
+ const Client_js_2 = require("./api/resources/apiKeys/client/Client.js");
7
+ const Client_js_3 = require("./api/resources/domains/client/Client.js");
8
+ const Client_js_4 = require("./api/resources/drafts/client/Client.js");
9
+ const Client_js_5 = require("./api/resources/inboxes/client/Client.js");
10
+ const Client_js_6 = require("./api/resources/lists/client/Client.js");
11
+ const Client_js_7 = require("./api/resources/metrics/client/Client.js");
12
+ const Client_js_8 = require("./api/resources/organizations/client/Client.js");
13
+ const Client_js_9 = require("./api/resources/pods/client/Client.js");
14
+ const Client_js_10 = require("./api/resources/threads/client/Client.js");
15
+ const Client_js_11 = require("./api/resources/webhooks/client/Client.js");
16
+ const Client_js_12 = require("./api/resources/websockets/client/Client.js");
16
17
  const BaseClient_js_1 = require("./BaseClient.js");
17
18
  class AgentMailClient {
18
19
  constructor(options = {}) {
@@ -20,47 +21,51 @@ class AgentMailClient {
20
21
  }
21
22
  get inboxes() {
22
23
  var _a;
23
- return ((_a = this._inboxes) !== null && _a !== void 0 ? _a : (this._inboxes = new Client_js_4.InboxesClient(this._options)));
24
+ return ((_a = this._inboxes) !== null && _a !== void 0 ? _a : (this._inboxes = new Client_js_5.InboxesClient(this._options)));
24
25
  }
25
26
  get pods() {
26
27
  var _a;
27
- return ((_a = this._pods) !== null && _a !== void 0 ? _a : (this._pods = new Client_js_8.PodsClient(this._options)));
28
+ return ((_a = this._pods) !== null && _a !== void 0 ? _a : (this._pods = new Client_js_9.PodsClient(this._options)));
28
29
  }
29
30
  get webhooks() {
30
31
  var _a;
31
- return ((_a = this._webhooks) !== null && _a !== void 0 ? _a : (this._webhooks = new Client_js_10.WebhooksClient(this._options)));
32
+ return ((_a = this._webhooks) !== null && _a !== void 0 ? _a : (this._webhooks = new Client_js_11.WebhooksClient(this._options)));
33
+ }
34
+ get agent() {
35
+ var _a;
36
+ return ((_a = this._agent) !== null && _a !== void 0 ? _a : (this._agent = new Client_js_1.AgentClient(this._options)));
32
37
  }
33
38
  get apiKeys() {
34
39
  var _a;
35
- return ((_a = this._apiKeys) !== null && _a !== void 0 ? _a : (this._apiKeys = new Client_js_1.ApiKeysClient(this._options)));
40
+ return ((_a = this._apiKeys) !== null && _a !== void 0 ? _a : (this._apiKeys = new Client_js_2.ApiKeysClient(this._options)));
36
41
  }
37
42
  get domains() {
38
43
  var _a;
39
- return ((_a = this._domains) !== null && _a !== void 0 ? _a : (this._domains = new Client_js_2.DomainsClient(this._options)));
44
+ return ((_a = this._domains) !== null && _a !== void 0 ? _a : (this._domains = new Client_js_3.DomainsClient(this._options)));
40
45
  }
41
46
  get drafts() {
42
47
  var _a;
43
- return ((_a = this._drafts) !== null && _a !== void 0 ? _a : (this._drafts = new Client_js_3.DraftsClient(this._options)));
48
+ return ((_a = this._drafts) !== null && _a !== void 0 ? _a : (this._drafts = new Client_js_4.DraftsClient(this._options)));
44
49
  }
45
50
  get lists() {
46
51
  var _a;
47
- return ((_a = this._lists) !== null && _a !== void 0 ? _a : (this._lists = new Client_js_5.ListsClient(this._options)));
52
+ return ((_a = this._lists) !== null && _a !== void 0 ? _a : (this._lists = new Client_js_6.ListsClient(this._options)));
48
53
  }
49
54
  get metrics() {
50
55
  var _a;
51
- return ((_a = this._metrics) !== null && _a !== void 0 ? _a : (this._metrics = new Client_js_6.MetricsClient(this._options)));
56
+ return ((_a = this._metrics) !== null && _a !== void 0 ? _a : (this._metrics = new Client_js_7.MetricsClient(this._options)));
52
57
  }
53
58
  get organizations() {
54
59
  var _a;
55
- return ((_a = this._organizations) !== null && _a !== void 0 ? _a : (this._organizations = new Client_js_7.OrganizationsClient(this._options)));
60
+ return ((_a = this._organizations) !== null && _a !== void 0 ? _a : (this._organizations = new Client_js_8.OrganizationsClient(this._options)));
56
61
  }
57
62
  get threads() {
58
63
  var _a;
59
- return ((_a = this._threads) !== null && _a !== void 0 ? _a : (this._threads = new Client_js_9.ThreadsClient(this._options)));
64
+ return ((_a = this._threads) !== null && _a !== void 0 ? _a : (this._threads = new Client_js_10.ThreadsClient(this._options)));
60
65
  }
61
66
  get websockets() {
62
67
  var _a;
63
- return ((_a = this._websockets) !== null && _a !== void 0 ? _a : (this._websockets = new Client_js_11.WebsocketsClient(this._options)));
68
+ return ((_a = this._websockets) !== null && _a !== void 0 ? _a : (this._websockets = new Client_js_12.WebsocketsClient(this._options)));
64
69
  }
65
70
  }
66
71
  exports.AgentMailClient = AgentMailClient;
@@ -0,0 +1,6 @@
1
+ import type * as core from "../../core/index.js";
2
+ import * as errors from "../../errors/index.js";
3
+ import type * as AgentMail from "../index.js";
4
+ export declare class UnprocessableError extends errors.AgentMailError {
5
+ constructor(body: AgentMail.ErrorResponse, rawResponse?: core.RawResponse);
6
+ }
@@ -0,0 +1,54 @@
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.UnprocessableError = void 0;
38
+ const errors = __importStar(require("../../errors/index.js"));
39
+ class UnprocessableError extends errors.AgentMailError {
40
+ constructor(body, rawResponse) {
41
+ super({
42
+ message: "UnprocessableError",
43
+ statusCode: 422,
44
+ body: body,
45
+ rawResponse: rawResponse,
46
+ });
47
+ Object.setPrototypeOf(this, new.target.prototype);
48
+ if (Error.captureStackTrace) {
49
+ Error.captureStackTrace(this, this.constructor);
50
+ }
51
+ this.name = this.constructor.name;
52
+ }
53
+ }
54
+ exports.UnprocessableError = UnprocessableError;
@@ -1,3 +1,4 @@
1
1
  export * from "./IsTakenError.js";
2
2
  export * from "./NotFoundError.js";
3
+ export * from "./UnprocessableError.js";
3
4
  export * from "./ValidationError.js";
@@ -16,4 +16,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./IsTakenError.js"), exports);
18
18
  __exportStar(require("./NotFoundError.js"), exports);
19
+ __exportStar(require("./UnprocessableError.js"), exports);
19
20
  __exportStar(require("./ValidationError.js"), exports);
@@ -0,0 +1,50 @@
1
+ import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js";
2
+ import { type NormalizedClientOptionsWithAuth } from "../../../../BaseClient.js";
3
+ import * as core from "../../../../core/index.js";
4
+ import * as AgentMail from "../../../index.js";
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,199 @@
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
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
37
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
38
+ return new (P || (P = Promise))(function (resolve, reject) {
39
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
40
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
41
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
42
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
43
+ });
44
+ };
45
+ Object.defineProperty(exports, "__esModule", { value: true });
46
+ exports.AgentClient = void 0;
47
+ const BaseClient_js_1 = require("../../../../BaseClient.js");
48
+ const headers_js_1 = require("../../../../core/headers.js");
49
+ const core = __importStar(require("../../../../core/index.js"));
50
+ const environments = __importStar(require("../../../../environments.js"));
51
+ const handleNonStatusCodeError_js_1 = require("../../../../errors/handleNonStatusCodeError.js");
52
+ const errors = __importStar(require("../../../../errors/index.js"));
53
+ const serializers = __importStar(require("../../../../serialization/index.js"));
54
+ const AgentMail = __importStar(require("../../../index.js"));
55
+ class AgentClient {
56
+ constructor(options = {}) {
57
+ this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
58
+ }
59
+ /**
60
+ * Create a new agent organization with an inbox and API key. A 6-digit OTP is sent to the human's email for verification.
61
+ *
62
+ * This endpoint is idempotent. Calling it again with the same `human_email` will rotate the API key and resend the OTP if expired.
63
+ *
64
+ * The returned API key has limited permissions until the organization is verified via the verify endpoint.
65
+ *
66
+ * @param {AgentMail.AgentSignupRequest} request
67
+ * @param {AgentClient.RequestOptions} requestOptions - Request-specific configuration.
68
+ *
69
+ * @throws {@link AgentMail.ValidationError}
70
+ *
71
+ * @example
72
+ * await client.agent.signUp({
73
+ * humanEmail: "human_email",
74
+ * username: "username"
75
+ * })
76
+ */
77
+ signUp(request, requestOptions) {
78
+ return core.HttpResponsePromise.fromPromise(this.__signUp(request, requestOptions));
79
+ }
80
+ __signUp(request, requestOptions) {
81
+ return __awaiter(this, void 0, void 0, function* () {
82
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
83
+ const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
84
+ const _response = yield core.fetcher({
85
+ 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)
86
+ .http, "/v0/agent/sign-up"),
87
+ method: "POST",
88
+ headers: _headers,
89
+ contentType: "application/json",
90
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
91
+ requestType: "json",
92
+ body: serializers.AgentSignupRequest.jsonOrThrow(request, {
93
+ unrecognizedObjectKeys: "strip",
94
+ omitUndefined: true,
95
+ }),
96
+ 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,
97
+ 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,
98
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
99
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
100
+ logging: this._options.logging,
101
+ });
102
+ if (_response.ok) {
103
+ return {
104
+ data: serializers.AgentSignupResponse.parseOrThrow(_response.body, {
105
+ unrecognizedObjectKeys: "passthrough",
106
+ allowUnrecognizedUnionMembers: true,
107
+ allowUnrecognizedEnumValues: true,
108
+ skipValidation: true,
109
+ breadcrumbsPrefix: ["response"],
110
+ }),
111
+ rawResponse: _response.rawResponse,
112
+ };
113
+ }
114
+ if (_response.error.reason === "status-code") {
115
+ switch (_response.error.statusCode) {
116
+ case 400:
117
+ throw new AgentMail.ValidationError(serializers.ValidationErrorResponse.parseOrThrow(_response.error.body, {
118
+ unrecognizedObjectKeys: "passthrough",
119
+ allowUnrecognizedUnionMembers: true,
120
+ allowUnrecognizedEnumValues: true,
121
+ skipValidation: true,
122
+ breadcrumbsPrefix: ["response"],
123
+ }), _response.rawResponse);
124
+ default:
125
+ throw new errors.AgentMailError({
126
+ statusCode: _response.error.statusCode,
127
+ body: _response.error.body,
128
+ rawResponse: _response.rawResponse,
129
+ });
130
+ }
131
+ }
132
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v0/agent/sign-up");
133
+ });
134
+ }
135
+ /**
136
+ * Verify an agent organization using the 6-digit OTP sent to the human's email during sign-up.
137
+ *
138
+ * On success, the organization is upgraded from `agent_unverified` to `agent_verified`, the send allowlist is removed, and free plan entitlements are applied.
139
+ *
140
+ * The OTP expires after 24 hours and allows a maximum of 10 attempts.
141
+ *
142
+ * @param {AgentMail.AgentVerifyRequest} request
143
+ * @param {AgentClient.RequestOptions} requestOptions - Request-specific configuration.
144
+ *
145
+ * @example
146
+ * await client.agent.verify({
147
+ * otpCode: "otp_code"
148
+ * })
149
+ */
150
+ verify(request, requestOptions) {
151
+ return core.HttpResponsePromise.fromPromise(this.__verify(request, requestOptions));
152
+ }
153
+ __verify(request, requestOptions) {
154
+ return __awaiter(this, void 0, void 0, function* () {
155
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
156
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
157
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
158
+ const _response = yield core.fetcher({
159
+ 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)
160
+ .http, "/v0/agent/verify"),
161
+ method: "POST",
162
+ headers: _headers,
163
+ contentType: "application/json",
164
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
165
+ requestType: "json",
166
+ body: serializers.AgentVerifyRequest.jsonOrThrow(request, {
167
+ unrecognizedObjectKeys: "strip",
168
+ omitUndefined: true,
169
+ }),
170
+ 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,
171
+ 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,
172
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
173
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
174
+ logging: this._options.logging,
175
+ });
176
+ if (_response.ok) {
177
+ return {
178
+ data: serializers.AgentVerifyResponse.parseOrThrow(_response.body, {
179
+ unrecognizedObjectKeys: "passthrough",
180
+ allowUnrecognizedUnionMembers: true,
181
+ allowUnrecognizedEnumValues: true,
182
+ skipValidation: true,
183
+ breadcrumbsPrefix: ["response"],
184
+ }),
185
+ rawResponse: _response.rawResponse,
186
+ };
187
+ }
188
+ if (_response.error.reason === "status-code") {
189
+ throw new errors.AgentMailError({
190
+ statusCode: _response.error.statusCode,
191
+ body: _response.error.body,
192
+ rawResponse: _response.rawResponse,
193
+ });
194
+ }
195
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v0/agent/verify");
196
+ });
197
+ }
198
+ }
199
+ exports.AgentClient = AgentClient;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ export * from "./client/index.js";
2
+ export * from "./types/index.js";
@@ -0,0 +1,18 @@
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("./client/index.js"), exports);
18
+ __exportStar(require("./types/index.js"), exports);
@@ -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,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -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,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -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,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -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,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -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);
@@ -71,7 +71,7 @@ export declare class MessagesClient {
71
71
  * @example
72
72
  * await client.inboxes.messages.update("inbox_id", "message_id", {})
73
73
  */
74
- update(inbox_id: AgentMail.inboxes.InboxId, message_id: AgentMail.MessageId, request: AgentMail.UpdateMessageRequest, requestOptions?: MessagesClient.RequestOptions): core.HttpResponsePromise<AgentMail.Message>;
74
+ update(inbox_id: AgentMail.inboxes.InboxId, message_id: AgentMail.MessageId, request: AgentMail.UpdateMessageRequest, requestOptions?: MessagesClient.RequestOptions): core.HttpResponsePromise<AgentMail.UpdateMessageResponse>;
75
75
  private __update;
76
76
  /**
77
77
  * @param {AgentMail.inboxes.InboxId} inbox_id
@@ -371,7 +371,7 @@ class MessagesClient {
371
371
  });
372
372
  if (_response.ok) {
373
373
  return {
374
- data: serializers.Message.parseOrThrow(_response.body, {
374
+ data: serializers.UpdateMessageResponse.parseOrThrow(_response.body, {
375
375
  unrecognizedObjectKeys: "passthrough",
376
376
  allowUnrecognizedUnionMembers: true,
377
377
  allowUnrecognizedEnumValues: true,
@@ -47,6 +47,23 @@ export declare class ThreadsClient {
47
47
  */
48
48
  getAttachment(inbox_id: AgentMail.inboxes.InboxId, thread_id: AgentMail.ThreadId, attachment_id: AgentMail.AttachmentId, requestOptions?: ThreadsClient.RequestOptions): core.HttpResponsePromise<AgentMail.AttachmentResponse>;
49
49
  private __getAttachment;
50
+ /**
51
+ * Updates thread labels. Cannot add or remove system labels (sent, received, bounced, etc.). Rejects requests with a `422` for threads with 100 or more messages.
52
+ *
53
+ * @param {AgentMail.inboxes.InboxId} inbox_id
54
+ * @param {AgentMail.ThreadId} thread_id
55
+ * @param {AgentMail.UpdateThreadRequest} request
56
+ * @param {ThreadsClient.RequestOptions} requestOptions - Request-specific configuration.
57
+ *
58
+ * @throws {@link AgentMail.ValidationError}
59
+ * @throws {@link AgentMail.NotFoundError}
60
+ * @throws {@link AgentMail.UnprocessableError}
61
+ *
62
+ * @example
63
+ * await client.inboxes.threads.update("inbox_id", "thread_id", {})
64
+ */
65
+ update(inbox_id: AgentMail.inboxes.InboxId, thread_id: AgentMail.ThreadId, request: AgentMail.UpdateThreadRequest, requestOptions?: ThreadsClient.RequestOptions): core.HttpResponsePromise<AgentMail.UpdateThreadResponse>;
66
+ private __update;
50
67
  /**
51
68
  * Moves the thread to trash by adding a trash label to all messages. If the thread is already in trash, it will be permanently deleted. Use `permanent=true` to force permanent deletion.
52
69
  *