agentmail 0.4.8 → 0.4.10

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 (112) hide show
  1. package/dist/cjs/BaseClient.js +2 -2
  2. package/dist/cjs/api/resources/apiKeys/client/Client.d.ts +3 -3
  3. package/dist/cjs/api/resources/apiKeys/client/Client.js +7 -7
  4. package/dist/cjs/api/resources/apiKeys/types/ApiKey.d.ts +2 -0
  5. package/dist/cjs/api/resources/apiKeys/types/CreateApiKeyResponse.d.ts +2 -0
  6. package/dist/cjs/api/resources/domains/types/Domain.d.ts +2 -2
  7. package/dist/cjs/api/resources/domains/types/DomainId.d.ts +1 -1
  8. package/dist/cjs/api/resources/domains/types/DomainItem.d.ts +2 -0
  9. package/dist/cjs/api/resources/domains/types/DomainName.d.ts +1 -1
  10. package/dist/cjs/api/resources/domains/types/Status.d.ts +5 -0
  11. package/dist/cjs/api/resources/domains/types/Status.js +3 -0
  12. package/dist/cjs/api/resources/domains/types/index.d.ts +1 -0
  13. package/dist/cjs/api/resources/domains/types/index.js +1 -0
  14. package/dist/cjs/api/resources/inboxes/client/Client.d.ts +3 -0
  15. package/dist/cjs/api/resources/inboxes/client/Client.js +15 -10
  16. package/dist/cjs/api/resources/inboxes/resources/apiKeys/client/Client.d.ts +52 -0
  17. package/dist/cjs/api/resources/inboxes/resources/apiKeys/client/Client.js +262 -0
  18. package/dist/cjs/api/resources/inboxes/resources/apiKeys/client/index.d.ts +1 -0
  19. package/dist/cjs/api/resources/inboxes/resources/apiKeys/client/index.js +17 -0
  20. package/dist/cjs/api/resources/inboxes/resources/apiKeys/client/requests/ListApiKeysRequest.d.ts +9 -0
  21. package/dist/cjs/api/resources/inboxes/resources/apiKeys/client/requests/ListApiKeysRequest.js +3 -0
  22. package/dist/cjs/api/resources/inboxes/resources/apiKeys/client/requests/index.d.ts +1 -0
  23. package/dist/cjs/api/resources/inboxes/resources/apiKeys/client/requests/index.js +2 -0
  24. package/dist/cjs/api/resources/inboxes/resources/apiKeys/index.d.ts +1 -0
  25. package/dist/cjs/api/resources/inboxes/resources/apiKeys/index.js +17 -0
  26. package/dist/cjs/api/resources/inboxes/resources/index.d.ts +2 -0
  27. package/dist/cjs/api/resources/inboxes/resources/index.js +3 -1
  28. package/dist/cjs/api/resources/inboxes/types/Email.d.ts +4 -0
  29. package/dist/cjs/api/resources/inboxes/types/Email.js +3 -0
  30. package/dist/cjs/api/resources/inboxes/types/Inbox.d.ts +1 -0
  31. package/dist/cjs/api/resources/inboxes/types/index.d.ts +1 -0
  32. package/dist/cjs/api/resources/inboxes/types/index.js +1 -0
  33. package/dist/cjs/api/resources/pods/resources/apiKeys/client/Client.d.ts +3 -3
  34. package/dist/cjs/api/resources/pods/resources/apiKeys/client/Client.js +7 -7
  35. package/dist/cjs/serialization/resources/apiKeys/types/ApiKey.d.ts +1 -0
  36. package/dist/cjs/serialization/resources/apiKeys/types/ApiKey.js +1 -0
  37. package/dist/cjs/serialization/resources/apiKeys/types/CreateApiKeyResponse.d.ts +1 -0
  38. package/dist/cjs/serialization/resources/apiKeys/types/CreateApiKeyResponse.js +1 -0
  39. package/dist/cjs/serialization/resources/domains/types/Domain.d.ts +4 -2
  40. package/dist/cjs/serialization/resources/domains/types/Domain.js +4 -2
  41. package/dist/cjs/serialization/resources/domains/types/DomainItem.d.ts +4 -0
  42. package/dist/cjs/serialization/resources/domains/types/DomainItem.js +4 -0
  43. package/dist/cjs/serialization/resources/domains/types/Status.d.ts +8 -0
  44. package/dist/cjs/serialization/resources/domains/types/Status.js +6 -0
  45. package/dist/cjs/serialization/resources/domains/types/index.d.ts +1 -0
  46. package/dist/cjs/serialization/resources/domains/types/index.js +1 -0
  47. package/dist/cjs/serialization/resources/inboxes/types/Email.d.ts +7 -0
  48. package/dist/cjs/serialization/resources/inboxes/types/Email.js +39 -0
  49. package/dist/cjs/serialization/resources/inboxes/types/Inbox.d.ts +2 -0
  50. package/dist/cjs/serialization/resources/inboxes/types/Inbox.js +2 -0
  51. package/dist/cjs/serialization/resources/inboxes/types/index.d.ts +1 -0
  52. package/dist/cjs/serialization/resources/inboxes/types/index.js +1 -0
  53. package/dist/cjs/version.d.ts +1 -1
  54. package/dist/cjs/version.js +1 -1
  55. package/dist/esm/BaseClient.mjs +2 -2
  56. package/dist/esm/api/resources/apiKeys/client/Client.d.mts +3 -3
  57. package/dist/esm/api/resources/apiKeys/client/Client.mjs +7 -7
  58. package/dist/esm/api/resources/apiKeys/types/ApiKey.d.mts +2 -0
  59. package/dist/esm/api/resources/apiKeys/types/CreateApiKeyResponse.d.mts +2 -0
  60. package/dist/esm/api/resources/domains/types/Domain.d.mts +2 -2
  61. package/dist/esm/api/resources/domains/types/DomainId.d.mts +1 -1
  62. package/dist/esm/api/resources/domains/types/DomainItem.d.mts +2 -0
  63. package/dist/esm/api/resources/domains/types/DomainName.d.mts +1 -1
  64. package/dist/esm/api/resources/domains/types/Status.d.mts +5 -0
  65. package/dist/esm/api/resources/domains/types/Status.mjs +2 -0
  66. package/dist/esm/api/resources/domains/types/index.d.mts +1 -0
  67. package/dist/esm/api/resources/domains/types/index.mjs +1 -0
  68. package/dist/esm/api/resources/inboxes/client/Client.d.mts +3 -0
  69. package/dist/esm/api/resources/inboxes/client/Client.mjs +5 -0
  70. package/dist/esm/api/resources/inboxes/resources/apiKeys/client/Client.d.mts +52 -0
  71. package/dist/esm/api/resources/inboxes/resources/apiKeys/client/Client.mjs +225 -0
  72. package/dist/esm/api/resources/inboxes/resources/apiKeys/client/index.d.mts +1 -0
  73. package/dist/esm/api/resources/inboxes/resources/apiKeys/client/index.mjs +1 -0
  74. package/dist/esm/api/resources/inboxes/resources/apiKeys/client/requests/ListApiKeysRequest.d.mts +9 -0
  75. package/dist/esm/api/resources/inboxes/resources/apiKeys/client/requests/ListApiKeysRequest.mjs +2 -0
  76. package/dist/esm/api/resources/inboxes/resources/apiKeys/client/requests/index.d.mts +1 -0
  77. package/dist/esm/api/resources/inboxes/resources/apiKeys/client/requests/index.mjs +1 -0
  78. package/dist/esm/api/resources/inboxes/resources/apiKeys/index.d.mts +1 -0
  79. package/dist/esm/api/resources/inboxes/resources/apiKeys/index.mjs +1 -0
  80. package/dist/esm/api/resources/inboxes/resources/index.d.mts +2 -0
  81. package/dist/esm/api/resources/inboxes/resources/index.mjs +2 -0
  82. package/dist/esm/api/resources/inboxes/types/Email.d.mts +4 -0
  83. package/dist/esm/api/resources/inboxes/types/Email.mjs +2 -0
  84. package/dist/esm/api/resources/inboxes/types/Inbox.d.mts +1 -0
  85. package/dist/esm/api/resources/inboxes/types/index.d.mts +1 -0
  86. package/dist/esm/api/resources/inboxes/types/index.mjs +1 -0
  87. package/dist/esm/api/resources/pods/resources/apiKeys/client/Client.d.mts +3 -3
  88. package/dist/esm/api/resources/pods/resources/apiKeys/client/Client.mjs +7 -7
  89. package/dist/esm/serialization/resources/apiKeys/types/ApiKey.d.mts +1 -0
  90. package/dist/esm/serialization/resources/apiKeys/types/ApiKey.mjs +1 -0
  91. package/dist/esm/serialization/resources/apiKeys/types/CreateApiKeyResponse.d.mts +1 -0
  92. package/dist/esm/serialization/resources/apiKeys/types/CreateApiKeyResponse.mjs +1 -0
  93. package/dist/esm/serialization/resources/domains/types/Domain.d.mts +4 -2
  94. package/dist/esm/serialization/resources/domains/types/Domain.mjs +4 -2
  95. package/dist/esm/serialization/resources/domains/types/DomainItem.d.mts +4 -0
  96. package/dist/esm/serialization/resources/domains/types/DomainItem.mjs +4 -0
  97. package/dist/esm/serialization/resources/domains/types/Status.d.mts +8 -0
  98. package/dist/esm/serialization/resources/domains/types/Status.mjs +3 -0
  99. package/dist/esm/serialization/resources/domains/types/index.d.mts +1 -0
  100. package/dist/esm/serialization/resources/domains/types/index.mjs +1 -0
  101. package/dist/esm/serialization/resources/inboxes/types/Email.d.mts +7 -0
  102. package/dist/esm/serialization/resources/inboxes/types/Email.mjs +3 -0
  103. package/dist/esm/serialization/resources/inboxes/types/Inbox.d.mts +2 -0
  104. package/dist/esm/serialization/resources/inboxes/types/Inbox.mjs +2 -0
  105. package/dist/esm/serialization/resources/inboxes/types/index.d.mts +1 -0
  106. package/dist/esm/serialization/resources/inboxes/types/index.mjs +1 -0
  107. package/dist/esm/version.d.mts +1 -1
  108. package/dist/esm/version.mjs +1 -1
  109. package/dist/llms-full.txt +1257 -335
  110. package/dist/llms.txt +5 -1
  111. package/package.json +1 -1
  112. package/reference.md +180 -6
@@ -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.8",
47
- "User-Agent": "agentmail/0.4.8",
46
+ "X-Fern-SDK-Version": "0.4.10",
47
+ "User-Agent": "agentmail/0.4.10",
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);
@@ -33,14 +33,14 @@ export declare class ApiKeysClient {
33
33
  create(request: AgentMail.CreateApiKeyRequest, requestOptions?: ApiKeysClient.RequestOptions): core.HttpResponsePromise<AgentMail.CreateApiKeyResponse>;
34
34
  private __create;
35
35
  /**
36
- * @param {AgentMail.ApiKeyId} api_key
36
+ * @param {AgentMail.ApiKeyId} api_key_id
37
37
  * @param {ApiKeysClient.RequestOptions} requestOptions - Request-specific configuration.
38
38
  *
39
39
  * @throws {@link AgentMail.NotFoundError}
40
40
  *
41
41
  * @example
42
- * await client.apiKeys.delete("api_key")
42
+ * await client.apiKeys.delete("api_key_id")
43
43
  */
44
- delete(api_key: AgentMail.ApiKeyId, requestOptions?: ApiKeysClient.RequestOptions): core.HttpResponsePromise<void>;
44
+ delete(api_key_id: AgentMail.ApiKeyId, requestOptions?: ApiKeysClient.RequestOptions): core.HttpResponsePromise<void>;
45
45
  private __delete;
46
46
  }
@@ -182,25 +182,25 @@ class ApiKeysClient {
182
182
  });
183
183
  }
184
184
  /**
185
- * @param {AgentMail.ApiKeyId} api_key
185
+ * @param {AgentMail.ApiKeyId} api_key_id
186
186
  * @param {ApiKeysClient.RequestOptions} requestOptions - Request-specific configuration.
187
187
  *
188
188
  * @throws {@link AgentMail.NotFoundError}
189
189
  *
190
190
  * @example
191
- * await client.apiKeys.delete("api_key")
191
+ * await client.apiKeys.delete("api_key_id")
192
192
  */
193
- delete(api_key, requestOptions) {
194
- return core.HttpResponsePromise.fromPromise(this.__delete(api_key, requestOptions));
193
+ delete(api_key_id, requestOptions) {
194
+ return core.HttpResponsePromise.fromPromise(this.__delete(api_key_id, requestOptions));
195
195
  }
196
- __delete(api_key, requestOptions) {
196
+ __delete(api_key_id, requestOptions) {
197
197
  return __awaiter(this, void 0, void 0, function* () {
198
198
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
199
199
  const _authRequest = yield this._options.authProvider.getAuthRequest();
200
200
  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);
201
201
  const _response = yield core.fetcher({
202
202
  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)
203
- .http, `/v0/api-keys/${core.url.encodePathParam(serializers.ApiKeyId.jsonOrThrow(api_key, { omitUndefined: true }))}`),
203
+ .http, `/v0/api-keys/${core.url.encodePathParam(serializers.ApiKeyId.jsonOrThrow(api_key_id, { omitUndefined: true }))}`),
204
204
  method: "DELETE",
205
205
  headers: _headers,
206
206
  queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
@@ -231,7 +231,7 @@ class ApiKeysClient {
231
231
  });
232
232
  }
233
233
  }
234
- return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "DELETE", "/v0/api-keys/{api_key}");
234
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "DELETE", "/v0/api-keys/{api_key_id}");
235
235
  });
236
236
  }
237
237
  }
@@ -5,6 +5,8 @@ export interface ApiKey {
5
5
  name: AgentMail.Name;
6
6
  /** Pod ID the api key is scoped to. If set, the key can only access resources within this pod. */
7
7
  podId?: string;
8
+ /** Inbox ID the api key is scoped to. If set, the key can only access resources within this inbox. */
9
+ inboxId?: string;
8
10
  /** Time at which api key was last used. */
9
11
  usedAt?: Date;
10
12
  createdAt: AgentMail.CreatedAt;
@@ -7,5 +7,7 @@ export interface CreateApiKeyResponse {
7
7
  name: AgentMail.Name;
8
8
  /** Pod ID the api key is scoped to. */
9
9
  podId?: string;
10
+ /** Inbox ID the api key is scoped to. */
11
+ inboxId?: string;
10
12
  createdAt: AgentMail.CreatedAt;
11
13
  }
@@ -2,8 +2,8 @@ import type * as AgentMail from "../../../index.js";
2
2
  export interface Domain {
3
3
  podId?: AgentMail.pods.PodId;
4
4
  domainId: AgentMail.DomainId;
5
- /** The verification status of the domain. */
6
- status: AgentMail.VerificationStatus;
5
+ domain: AgentMail.DomainName;
6
+ status: AgentMail.Status;
7
7
  feedbackEnabled: AgentMail.FeedbackEnabled;
8
8
  /** A list of DNS records required to verify the domain. */
9
9
  records: AgentMail.VerificationRecord[];
@@ -1,4 +1,4 @@
1
1
  /**
2
- * The name of the domain. (e.g., " your-domain.com")
2
+ * The ID of the domain.
3
3
  */
4
4
  export type DomainId = string;
@@ -2,6 +2,8 @@ import type * as AgentMail from "../../../index.js";
2
2
  export interface DomainItem {
3
3
  podId?: AgentMail.pods.PodId;
4
4
  domainId: AgentMail.DomainId;
5
+ domain: AgentMail.DomainName;
6
+ status: AgentMail.Status;
5
7
  feedbackEnabled: AgentMail.FeedbackEnabled;
6
8
  clientId?: AgentMail.ClientId;
7
9
  /** Time at which the domain was last updated. */
@@ -1,4 +1,4 @@
1
1
  /**
2
- * The name of the domain. (e.g., "example.com")
2
+ * The name of the domain (e.g., `example.com`).
3
3
  */
4
4
  export type DomainName = string;
@@ -0,0 +1,5 @@
1
+ import type * as AgentMail from "../../../index.js";
2
+ /**
3
+ * The verification status of the domain.
4
+ */
5
+ export type Status = AgentMail.VerificationStatus;
@@ -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 });
@@ -8,6 +8,7 @@ export * from "./FeedbackEnabled.js";
8
8
  export * from "./ListDomainsResponse.js";
9
9
  export * from "./RecordStatus.js";
10
10
  export * from "./RecordType.js";
11
+ export * from "./Status.js";
11
12
  export * from "./UpdateDomainRequest.js";
12
13
  export * from "./VerificationRecord.js";
13
14
  export * from "./VerificationStatus.js";
@@ -24,6 +24,7 @@ __exportStar(require("./FeedbackEnabled.js"), exports);
24
24
  __exportStar(require("./ListDomainsResponse.js"), exports);
25
25
  __exportStar(require("./RecordStatus.js"), exports);
26
26
  __exportStar(require("./RecordType.js"), exports);
27
+ __exportStar(require("./Status.js"), exports);
27
28
  __exportStar(require("./UpdateDomainRequest.js"), exports);
28
29
  __exportStar(require("./VerificationRecord.js"), exports);
29
30
  __exportStar(require("./VerificationStatus.js"), exports);
@@ -2,6 +2,7 @@ import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClie
2
2
  import { type NormalizedClientOptionsWithAuth } from "../../../../BaseClient.js";
3
3
  import * as core from "../../../../core/index.js";
4
4
  import * as AgentMail from "../../../index.js";
5
+ import { ApiKeysClient } from "../resources/apiKeys/client/Client.js";
5
6
  import { DraftsClient } from "../resources/drafts/client/Client.js";
6
7
  import { ListsClient } from "../resources/lists/client/Client.js";
7
8
  import { MessagesClient } from "../resources/messages/client/Client.js";
@@ -19,12 +20,14 @@ export declare class InboxesClient {
19
20
  protected _drafts: DraftsClient | undefined;
20
21
  protected _lists: ListsClient | undefined;
21
22
  protected _metrics: MetricsClient | undefined;
23
+ protected _apiKeys: ApiKeysClient | undefined;
22
24
  constructor(options?: InboxesClient.Options);
23
25
  get threads(): ThreadsClient;
24
26
  get messages(): MessagesClient;
25
27
  get drafts(): DraftsClient;
26
28
  get lists(): ListsClient;
27
29
  get metrics(): MetricsClient;
30
+ get apiKeys(): ApiKeysClient;
28
31
  /**
29
32
  * @param {AgentMail.inboxes.ListInboxesRequest} request
30
33
  * @param {InboxesClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -52,34 +52,39 @@ const handleNonStatusCodeError_js_1 = require("../../../../errors/handleNonStatu
52
52
  const errors = __importStar(require("../../../../errors/index.js"));
53
53
  const serializers = __importStar(require("../../../../serialization/index.js"));
54
54
  const AgentMail = __importStar(require("../../../index.js"));
55
- const Client_js_1 = require("../resources/drafts/client/Client.js");
56
- const Client_js_2 = require("../resources/lists/client/Client.js");
57
- const Client_js_3 = require("../resources/messages/client/Client.js");
58
- const Client_js_4 = require("../resources/metrics/client/Client.js");
59
- const Client_js_5 = require("../resources/threads/client/Client.js");
55
+ const Client_js_1 = require("../resources/apiKeys/client/Client.js");
56
+ const Client_js_2 = require("../resources/drafts/client/Client.js");
57
+ const Client_js_3 = require("../resources/lists/client/Client.js");
58
+ const Client_js_4 = require("../resources/messages/client/Client.js");
59
+ const Client_js_5 = require("../resources/metrics/client/Client.js");
60
+ const Client_js_6 = require("../resources/threads/client/Client.js");
60
61
  class InboxesClient {
61
62
  constructor(options = {}) {
62
63
  this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
63
64
  }
64
65
  get threads() {
65
66
  var _a;
66
- return ((_a = this._threads) !== null && _a !== void 0 ? _a : (this._threads = new Client_js_5.ThreadsClient(this._options)));
67
+ return ((_a = this._threads) !== null && _a !== void 0 ? _a : (this._threads = new Client_js_6.ThreadsClient(this._options)));
67
68
  }
68
69
  get messages() {
69
70
  var _a;
70
- return ((_a = this._messages) !== null && _a !== void 0 ? _a : (this._messages = new Client_js_3.MessagesClient(this._options)));
71
+ return ((_a = this._messages) !== null && _a !== void 0 ? _a : (this._messages = new Client_js_4.MessagesClient(this._options)));
71
72
  }
72
73
  get drafts() {
73
74
  var _a;
74
- return ((_a = this._drafts) !== null && _a !== void 0 ? _a : (this._drafts = new Client_js_1.DraftsClient(this._options)));
75
+ return ((_a = this._drafts) !== null && _a !== void 0 ? _a : (this._drafts = new Client_js_2.DraftsClient(this._options)));
75
76
  }
76
77
  get lists() {
77
78
  var _a;
78
- return ((_a = this._lists) !== null && _a !== void 0 ? _a : (this._lists = new Client_js_2.ListsClient(this._options)));
79
+ return ((_a = this._lists) !== null && _a !== void 0 ? _a : (this._lists = new Client_js_3.ListsClient(this._options)));
79
80
  }
80
81
  get metrics() {
81
82
  var _a;
82
- return ((_a = this._metrics) !== null && _a !== void 0 ? _a : (this._metrics = new Client_js_4.MetricsClient(this._options)));
83
+ return ((_a = this._metrics) !== null && _a !== void 0 ? _a : (this._metrics = new Client_js_5.MetricsClient(this._options)));
84
+ }
85
+ get apiKeys() {
86
+ var _a;
87
+ return ((_a = this._apiKeys) !== null && _a !== void 0 ? _a : (this._apiKeys = new Client_js_1.ApiKeysClient(this._options)));
83
88
  }
84
89
  /**
85
90
  * @param {AgentMail.inboxes.ListInboxesRequest} request
@@ -0,0 +1,52 @@
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 ApiKeysClient {
6
+ type Options = BaseClientOptions;
7
+ interface RequestOptions extends BaseRequestOptions {
8
+ }
9
+ }
10
+ export declare class ApiKeysClient {
11
+ protected readonly _options: NormalizedClientOptionsWithAuth<ApiKeysClient.Options>;
12
+ constructor(options?: ApiKeysClient.Options);
13
+ /**
14
+ * @param {AgentMail.inboxes.InboxId} inbox_id
15
+ * @param {AgentMail.inboxes.ListApiKeysRequest} request
16
+ * @param {ApiKeysClient.RequestOptions} requestOptions - Request-specific configuration.
17
+ *
18
+ * @throws {@link AgentMail.NotFoundError}
19
+ *
20
+ * @example
21
+ * await client.inboxes.apiKeys.list("inbox_id")
22
+ */
23
+ list(inbox_id: AgentMail.inboxes.InboxId, request?: AgentMail.inboxes.ListApiKeysRequest, requestOptions?: ApiKeysClient.RequestOptions): core.HttpResponsePromise<AgentMail.ListApiKeysResponse>;
24
+ private __list;
25
+ /**
26
+ * @param {AgentMail.inboxes.InboxId} inbox_id
27
+ * @param {AgentMail.CreateApiKeyRequest} request
28
+ * @param {ApiKeysClient.RequestOptions} requestOptions - Request-specific configuration.
29
+ *
30
+ * @throws {@link AgentMail.NotFoundError}
31
+ * @throws {@link AgentMail.ValidationError}
32
+ *
33
+ * @example
34
+ * await client.inboxes.apiKeys.create("inbox_id", {
35
+ * name: "name"
36
+ * })
37
+ */
38
+ create(inbox_id: AgentMail.inboxes.InboxId, request: AgentMail.CreateApiKeyRequest, requestOptions?: ApiKeysClient.RequestOptions): core.HttpResponsePromise<AgentMail.CreateApiKeyResponse>;
39
+ private __create;
40
+ /**
41
+ * @param {AgentMail.inboxes.InboxId} inbox_id
42
+ * @param {AgentMail.ApiKeyId} api_key_id
43
+ * @param {ApiKeysClient.RequestOptions} requestOptions - Request-specific configuration.
44
+ *
45
+ * @throws {@link AgentMail.NotFoundError}
46
+ *
47
+ * @example
48
+ * await client.inboxes.apiKeys.delete("inbox_id", "api_key_id")
49
+ */
50
+ delete(inbox_id: AgentMail.inboxes.InboxId, api_key_id: AgentMail.ApiKeyId, requestOptions?: ApiKeysClient.RequestOptions): core.HttpResponsePromise<void>;
51
+ private __delete;
52
+ }
@@ -0,0 +1,262 @@
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.ApiKeysClient = 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 ApiKeysClient {
56
+ constructor(options = {}) {
57
+ this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
58
+ }
59
+ /**
60
+ * @param {AgentMail.inboxes.InboxId} inbox_id
61
+ * @param {AgentMail.inboxes.ListApiKeysRequest} request
62
+ * @param {ApiKeysClient.RequestOptions} requestOptions - Request-specific configuration.
63
+ *
64
+ * @throws {@link AgentMail.NotFoundError}
65
+ *
66
+ * @example
67
+ * await client.inboxes.apiKeys.list("inbox_id")
68
+ */
69
+ list(inbox_id, request = {}, requestOptions) {
70
+ return core.HttpResponsePromise.fromPromise(this.__list(inbox_id, request, requestOptions));
71
+ }
72
+ __list(inbox_id_1) {
73
+ return __awaiter(this, arguments, void 0, function* (inbox_id, request = {}, requestOptions) {
74
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
75
+ const { limit, pageToken } = request;
76
+ const _queryParams = {
77
+ limit,
78
+ page_token: pageToken,
79
+ };
80
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
81
+ 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);
82
+ const _response = yield core.fetcher({
83
+ 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)
84
+ .http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/api-keys`),
85
+ method: "GET",
86
+ headers: _headers,
87
+ queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
88
+ 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,
89
+ 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,
90
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
91
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
92
+ logging: this._options.logging,
93
+ });
94
+ if (_response.ok) {
95
+ return {
96
+ data: serializers.ListApiKeysResponse.parseOrThrow(_response.body, {
97
+ unrecognizedObjectKeys: "passthrough",
98
+ allowUnrecognizedUnionMembers: true,
99
+ allowUnrecognizedEnumValues: true,
100
+ skipValidation: true,
101
+ breadcrumbsPrefix: ["response"],
102
+ }),
103
+ rawResponse: _response.rawResponse,
104
+ };
105
+ }
106
+ if (_response.error.reason === "status-code") {
107
+ switch (_response.error.statusCode) {
108
+ case 404:
109
+ throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
110
+ unrecognizedObjectKeys: "passthrough",
111
+ allowUnrecognizedUnionMembers: true,
112
+ allowUnrecognizedEnumValues: true,
113
+ skipValidation: true,
114
+ breadcrumbsPrefix: ["response"],
115
+ }), _response.rawResponse);
116
+ default:
117
+ throw new errors.AgentMailError({
118
+ statusCode: _response.error.statusCode,
119
+ body: _response.error.body,
120
+ rawResponse: _response.rawResponse,
121
+ });
122
+ }
123
+ }
124
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v0/inboxes/{inbox_id}/api-keys");
125
+ });
126
+ }
127
+ /**
128
+ * @param {AgentMail.inboxes.InboxId} inbox_id
129
+ * @param {AgentMail.CreateApiKeyRequest} request
130
+ * @param {ApiKeysClient.RequestOptions} requestOptions - Request-specific configuration.
131
+ *
132
+ * @throws {@link AgentMail.NotFoundError}
133
+ * @throws {@link AgentMail.ValidationError}
134
+ *
135
+ * @example
136
+ * await client.inboxes.apiKeys.create("inbox_id", {
137
+ * name: "name"
138
+ * })
139
+ */
140
+ create(inbox_id, request, requestOptions) {
141
+ return core.HttpResponsePromise.fromPromise(this.__create(inbox_id, request, requestOptions));
142
+ }
143
+ __create(inbox_id, request, requestOptions) {
144
+ return __awaiter(this, void 0, void 0, function* () {
145
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
146
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
147
+ 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);
148
+ const _response = yield core.fetcher({
149
+ 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)
150
+ .http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/api-keys`),
151
+ method: "POST",
152
+ headers: _headers,
153
+ contentType: "application/json",
154
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
155
+ requestType: "json",
156
+ body: serializers.CreateApiKeyRequest.jsonOrThrow(request, {
157
+ unrecognizedObjectKeys: "strip",
158
+ omitUndefined: true,
159
+ }),
160
+ 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,
161
+ 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,
162
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
163
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
164
+ logging: this._options.logging,
165
+ });
166
+ if (_response.ok) {
167
+ return {
168
+ data: serializers.CreateApiKeyResponse.parseOrThrow(_response.body, {
169
+ unrecognizedObjectKeys: "passthrough",
170
+ allowUnrecognizedUnionMembers: true,
171
+ allowUnrecognizedEnumValues: true,
172
+ skipValidation: true,
173
+ breadcrumbsPrefix: ["response"],
174
+ }),
175
+ rawResponse: _response.rawResponse,
176
+ };
177
+ }
178
+ if (_response.error.reason === "status-code") {
179
+ switch (_response.error.statusCode) {
180
+ case 404:
181
+ throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
182
+ unrecognizedObjectKeys: "passthrough",
183
+ allowUnrecognizedUnionMembers: true,
184
+ allowUnrecognizedEnumValues: true,
185
+ skipValidation: true,
186
+ breadcrumbsPrefix: ["response"],
187
+ }), _response.rawResponse);
188
+ case 400:
189
+ throw new AgentMail.ValidationError(serializers.ValidationErrorResponse.parseOrThrow(_response.error.body, {
190
+ unrecognizedObjectKeys: "passthrough",
191
+ allowUnrecognizedUnionMembers: true,
192
+ allowUnrecognizedEnumValues: true,
193
+ skipValidation: true,
194
+ breadcrumbsPrefix: ["response"],
195
+ }), _response.rawResponse);
196
+ default:
197
+ throw new errors.AgentMailError({
198
+ statusCode: _response.error.statusCode,
199
+ body: _response.error.body,
200
+ rawResponse: _response.rawResponse,
201
+ });
202
+ }
203
+ }
204
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v0/inboxes/{inbox_id}/api-keys");
205
+ });
206
+ }
207
+ /**
208
+ * @param {AgentMail.inboxes.InboxId} inbox_id
209
+ * @param {AgentMail.ApiKeyId} api_key_id
210
+ * @param {ApiKeysClient.RequestOptions} requestOptions - Request-specific configuration.
211
+ *
212
+ * @throws {@link AgentMail.NotFoundError}
213
+ *
214
+ * @example
215
+ * await client.inboxes.apiKeys.delete("inbox_id", "api_key_id")
216
+ */
217
+ delete(inbox_id, api_key_id, requestOptions) {
218
+ return core.HttpResponsePromise.fromPromise(this.__delete(inbox_id, api_key_id, requestOptions));
219
+ }
220
+ __delete(inbox_id, api_key_id, requestOptions) {
221
+ return __awaiter(this, void 0, void 0, function* () {
222
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
223
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
224
+ 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);
225
+ const _response = yield core.fetcher({
226
+ 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)
227
+ .http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/api-keys/${core.url.encodePathParam(serializers.ApiKeyId.jsonOrThrow(api_key_id, { omitUndefined: true }))}`),
228
+ method: "DELETE",
229
+ headers: _headers,
230
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
231
+ 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,
232
+ 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,
233
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
234
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
235
+ logging: this._options.logging,
236
+ });
237
+ if (_response.ok) {
238
+ return { data: undefined, rawResponse: _response.rawResponse };
239
+ }
240
+ if (_response.error.reason === "status-code") {
241
+ switch (_response.error.statusCode) {
242
+ case 404:
243
+ throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
244
+ unrecognizedObjectKeys: "passthrough",
245
+ allowUnrecognizedUnionMembers: true,
246
+ allowUnrecognizedEnumValues: true,
247
+ skipValidation: true,
248
+ breadcrumbsPrefix: ["response"],
249
+ }), _response.rawResponse);
250
+ default:
251
+ throw new errors.AgentMailError({
252
+ statusCode: _response.error.statusCode,
253
+ body: _response.error.body,
254
+ rawResponse: _response.rawResponse,
255
+ });
256
+ }
257
+ }
258
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "DELETE", "/v0/inboxes/{inbox_id}/api-keys/{api_key_id}");
259
+ });
260
+ }
261
+ }
262
+ exports.ApiKeysClient = ApiKeysClient;
@@ -0,0 +1 @@
1
+ export * from "./requests/index.js";
@@ -0,0 +1,17 @@
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("./requests/index.js"), exports);
@@ -0,0 +1,9 @@
1
+ import type * as AgentMail from "../../../../../../index.js";
2
+ /**
3
+ * @example
4
+ * {}
5
+ */
6
+ export interface ListApiKeysRequest {
7
+ limit?: AgentMail.Limit;
8
+ pageToken?: AgentMail.PageToken;
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 @@
1
+ export type { ListApiKeysRequest } from "./ListApiKeysRequest.js";
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1 @@
1
+ export * from "./client/index.js";
@@ -0,0 +1,17 @@
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);
@@ -1,3 +1,5 @@
1
+ export * from "./apiKeys/client/requests/index.js";
2
+ export * as apiKeys from "./apiKeys/index.js";
1
3
  export * from "./drafts/client/requests/index.js";
2
4
  export * as drafts from "./drafts/index.js";
3
5
  export * from "./lists/client/requests/index.js";
@@ -36,7 +36,9 @@ var __importStar = (this && this.__importStar) || (function () {
36
36
  };
37
37
  })();
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.threads = exports.metrics = exports.messages = exports.lists = exports.drafts = void 0;
39
+ exports.threads = exports.metrics = exports.messages = exports.lists = exports.drafts = exports.apiKeys = void 0;
40
+ __exportStar(require("./apiKeys/client/requests/index.js"), exports);
41
+ exports.apiKeys = __importStar(require("./apiKeys/index.js"));
40
42
  __exportStar(require("./drafts/client/requests/index.js"), exports);
41
43
  exports.drafts = __importStar(require("./drafts/index.js"));
42
44
  __exportStar(require("./lists/client/requests/index.js"), exports);