agentmail 0.4.8 → 0.4.9

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 (50) hide show
  1. package/dist/cjs/BaseClient.js +2 -2
  2. package/dist/cjs/api/resources/apiKeys/types/ApiKey.d.ts +2 -0
  3. package/dist/cjs/api/resources/apiKeys/types/CreateApiKeyResponse.d.ts +2 -0
  4. package/dist/cjs/api/resources/inboxes/client/Client.d.ts +3 -0
  5. package/dist/cjs/api/resources/inboxes/client/Client.js +15 -10
  6. package/dist/cjs/api/resources/inboxes/resources/apiKeys/client/Client.d.ts +52 -0
  7. package/dist/cjs/api/resources/inboxes/resources/apiKeys/client/Client.js +262 -0
  8. package/dist/cjs/api/resources/inboxes/resources/apiKeys/client/index.d.ts +1 -0
  9. package/dist/cjs/api/resources/inboxes/resources/apiKeys/client/index.js +17 -0
  10. package/dist/cjs/api/resources/inboxes/resources/apiKeys/client/requests/ListApiKeysRequest.d.ts +9 -0
  11. package/dist/cjs/api/resources/inboxes/resources/apiKeys/client/requests/ListApiKeysRequest.js +3 -0
  12. package/dist/cjs/api/resources/inboxes/resources/apiKeys/client/requests/index.d.ts +1 -0
  13. package/dist/cjs/api/resources/inboxes/resources/apiKeys/client/requests/index.js +2 -0
  14. package/dist/cjs/api/resources/inboxes/resources/apiKeys/index.d.ts +1 -0
  15. package/dist/cjs/api/resources/inboxes/resources/apiKeys/index.js +17 -0
  16. package/dist/cjs/api/resources/inboxes/resources/index.d.ts +2 -0
  17. package/dist/cjs/api/resources/inboxes/resources/index.js +3 -1
  18. package/dist/cjs/serialization/resources/apiKeys/types/ApiKey.d.ts +1 -0
  19. package/dist/cjs/serialization/resources/apiKeys/types/ApiKey.js +1 -0
  20. package/dist/cjs/serialization/resources/apiKeys/types/CreateApiKeyResponse.d.ts +1 -0
  21. package/dist/cjs/serialization/resources/apiKeys/types/CreateApiKeyResponse.js +1 -0
  22. package/dist/cjs/version.d.ts +1 -1
  23. package/dist/cjs/version.js +1 -1
  24. package/dist/esm/BaseClient.mjs +2 -2
  25. package/dist/esm/api/resources/apiKeys/types/ApiKey.d.mts +2 -0
  26. package/dist/esm/api/resources/apiKeys/types/CreateApiKeyResponse.d.mts +2 -0
  27. package/dist/esm/api/resources/inboxes/client/Client.d.mts +3 -0
  28. package/dist/esm/api/resources/inboxes/client/Client.mjs +5 -0
  29. package/dist/esm/api/resources/inboxes/resources/apiKeys/client/Client.d.mts +52 -0
  30. package/dist/esm/api/resources/inboxes/resources/apiKeys/client/Client.mjs +225 -0
  31. package/dist/esm/api/resources/inboxes/resources/apiKeys/client/index.d.mts +1 -0
  32. package/dist/esm/api/resources/inboxes/resources/apiKeys/client/index.mjs +1 -0
  33. package/dist/esm/api/resources/inboxes/resources/apiKeys/client/requests/ListApiKeysRequest.d.mts +9 -0
  34. package/dist/esm/api/resources/inboxes/resources/apiKeys/client/requests/ListApiKeysRequest.mjs +2 -0
  35. package/dist/esm/api/resources/inboxes/resources/apiKeys/client/requests/index.d.mts +1 -0
  36. package/dist/esm/api/resources/inboxes/resources/apiKeys/client/requests/index.mjs +1 -0
  37. package/dist/esm/api/resources/inboxes/resources/apiKeys/index.d.mts +1 -0
  38. package/dist/esm/api/resources/inboxes/resources/apiKeys/index.mjs +1 -0
  39. package/dist/esm/api/resources/inboxes/resources/index.d.mts +2 -0
  40. package/dist/esm/api/resources/inboxes/resources/index.mjs +2 -0
  41. package/dist/esm/serialization/resources/apiKeys/types/ApiKey.d.mts +1 -0
  42. package/dist/esm/serialization/resources/apiKeys/types/ApiKey.mjs +1 -0
  43. package/dist/esm/serialization/resources/apiKeys/types/CreateApiKeyResponse.d.mts +1 -0
  44. package/dist/esm/serialization/resources/apiKeys/types/CreateApiKeyResponse.mjs +1 -0
  45. package/dist/esm/version.d.mts +1 -1
  46. package/dist/esm/version.mjs +1 -1
  47. package/dist/llms-full.txt +21 -25
  48. package/dist/llms.txt +1 -1
  49. package/package.json +1 -1
  50. package/reference.md +174 -0
@@ -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.9",
47
+ "User-Agent": "agentmail/0.4.9",
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);
@@ -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,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
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")
49
+ */
50
+ delete(inbox_id: AgentMail.inboxes.InboxId, api_key: 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
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")
216
+ */
217
+ delete(inbox_id, api_key, requestOptions) {
218
+ return core.HttpResponsePromise.fromPromise(this.__delete(inbox_id, api_key, requestOptions));
219
+ }
220
+ __delete(inbox_id, api_key, 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, { 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}");
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);
@@ -12,6 +12,7 @@ export declare namespace ApiKey {
12
12
  prefix: Prefix.Raw;
13
13
  name: Name.Raw;
14
14
  pod_id?: string | null;
15
+ inbox_id?: string | null;
15
16
  used_at?: string | null;
16
17
  created_at: CreatedAt.Raw;
17
18
  }
@@ -45,6 +45,7 @@ exports.ApiKey = core.serialization.object({
45
45
  prefix: Prefix_js_1.Prefix,
46
46
  name: Name_js_1.Name,
47
47
  podId: core.serialization.property("pod_id", core.serialization.string().optional()),
48
+ inboxId: core.serialization.property("inbox_id", core.serialization.string().optional()),
48
49
  usedAt: core.serialization.property("used_at", core.serialization.date().optional()),
49
50
  createdAt: core.serialization.property("created_at", CreatedAt_js_1.CreatedAt),
50
51
  });
@@ -13,6 +13,7 @@ export declare namespace CreateApiKeyResponse {
13
13
  prefix: Prefix.Raw;
14
14
  name: Name.Raw;
15
15
  pod_id?: string | null;
16
+ inbox_id?: string | null;
16
17
  created_at: CreatedAt.Raw;
17
18
  }
18
19
  }
@@ -46,5 +46,6 @@ exports.CreateApiKeyResponse = core.serialization.object({
46
46
  prefix: Prefix_js_1.Prefix,
47
47
  name: Name_js_1.Name,
48
48
  podId: core.serialization.property("pod_id", core.serialization.string().optional()),
49
+ inboxId: core.serialization.property("inbox_id", core.serialization.string().optional()),
49
50
  createdAt: core.serialization.property("created_at", CreatedAt_js_1.CreatedAt),
50
51
  });
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.4.8";
1
+ export declare const SDK_VERSION = "0.4.9";
@@ -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.8";
4
+ exports.SDK_VERSION = "0.4.9";
@@ -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.8",
10
- "User-Agent": "agentmail/0.4.8",
9
+ "X-Fern-SDK-Version": "0.4.9",
10
+ "User-Agent": "agentmail/0.4.9",
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);
@@ -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,6 +2,7 @@ import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClie
2
2
  import { type NormalizedClientOptionsWithAuth } from "../../../../BaseClient.mjs";
3
3
  import * as core from "../../../../core/index.mjs";
4
4
  import * as AgentMail from "../../../index.mjs";
5
+ import { ApiKeysClient } from "../resources/apiKeys/client/Client.mjs";
5
6
  import { DraftsClient } from "../resources/drafts/client/Client.mjs";
6
7
  import { ListsClient } from "../resources/lists/client/Client.mjs";
7
8
  import { MessagesClient } from "../resources/messages/client/Client.mjs";
@@ -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.
@@ -16,6 +16,7 @@ import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCode
16
16
  import * as errors from "../../../../errors/index.mjs";
17
17
  import * as serializers from "../../../../serialization/index.mjs";
18
18
  import * as AgentMail from "../../../index.mjs";
19
+ import { ApiKeysClient } from "../resources/apiKeys/client/Client.mjs";
19
20
  import { DraftsClient } from "../resources/drafts/client/Client.mjs";
20
21
  import { ListsClient } from "../resources/lists/client/Client.mjs";
21
22
  import { MessagesClient } from "../resources/messages/client/Client.mjs";
@@ -45,6 +46,10 @@ export class InboxesClient {
45
46
  var _a;
46
47
  return ((_a = this._metrics) !== null && _a !== void 0 ? _a : (this._metrics = new MetricsClient(this._options)));
47
48
  }
49
+ get apiKeys() {
50
+ var _a;
51
+ return ((_a = this._apiKeys) !== null && _a !== void 0 ? _a : (this._apiKeys = new ApiKeysClient(this._options)));
52
+ }
48
53
  /**
49
54
  * @param {AgentMail.inboxes.ListInboxesRequest} request
50
55
  * @param {InboxesClient.RequestOptions} requestOptions - Request-specific configuration.