agentmail 0.4.0 → 0.4.2

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 (64) 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/resources/threads/client/Client.d.ts +4 -1
  5. package/dist/cjs/api/resources/inboxes/resources/threads/client/Client.js +12 -5
  6. package/dist/cjs/api/resources/inboxes/resources/threads/client/requests/DeleteThreadRequest.d.ts +8 -0
  7. package/dist/cjs/api/resources/inboxes/resources/threads/client/requests/DeleteThreadRequest.js +3 -0
  8. package/dist/cjs/api/resources/inboxes/resources/threads/client/requests/index.d.ts +1 -0
  9. package/dist/cjs/api/resources/pods/client/Client.d.ts +3 -0
  10. package/dist/cjs/api/resources/pods/client/Client.js +15 -10
  11. package/dist/cjs/api/resources/pods/resources/apiKeys/client/Client.d.ts +52 -0
  12. package/dist/cjs/api/resources/pods/resources/apiKeys/client/Client.js +262 -0
  13. package/dist/cjs/api/resources/pods/resources/apiKeys/client/index.d.ts +1 -0
  14. package/dist/cjs/api/resources/pods/resources/apiKeys/client/index.js +17 -0
  15. package/dist/cjs/api/resources/pods/resources/apiKeys/client/requests/ListApiKeysRequest.d.ts +9 -0
  16. package/dist/cjs/api/resources/pods/resources/apiKeys/client/requests/ListApiKeysRequest.js +3 -0
  17. package/dist/cjs/api/resources/pods/resources/apiKeys/client/requests/index.d.ts +1 -0
  18. package/dist/cjs/api/resources/pods/resources/apiKeys/client/requests/index.js +2 -0
  19. package/dist/cjs/api/resources/pods/resources/apiKeys/index.d.ts +1 -0
  20. package/dist/cjs/api/resources/pods/resources/apiKeys/index.js +17 -0
  21. package/dist/cjs/api/resources/pods/resources/index.d.ts +2 -0
  22. package/dist/cjs/api/resources/pods/resources/index.js +3 -1
  23. package/dist/cjs/api/resources/threads/client/Client.js +2 -1
  24. package/dist/cjs/api/resources/threads/client/requests/ListThreadsRequest.d.ts +1 -0
  25. package/dist/cjs/serialization/resources/apiKeys/types/ApiKey.d.ts +1 -0
  26. package/dist/cjs/serialization/resources/apiKeys/types/ApiKey.js +1 -0
  27. package/dist/cjs/serialization/resources/apiKeys/types/CreateApiKeyResponse.d.ts +1 -0
  28. package/dist/cjs/serialization/resources/apiKeys/types/CreateApiKeyResponse.js +1 -0
  29. package/dist/cjs/version.d.ts +1 -1
  30. package/dist/cjs/version.js +1 -1
  31. package/dist/esm/BaseClient.mjs +2 -2
  32. package/dist/esm/api/resources/apiKeys/types/ApiKey.d.mts +2 -0
  33. package/dist/esm/api/resources/apiKeys/types/CreateApiKeyResponse.d.mts +2 -0
  34. package/dist/esm/api/resources/inboxes/resources/threads/client/Client.d.mts +4 -1
  35. package/dist/esm/api/resources/inboxes/resources/threads/client/Client.mjs +12 -5
  36. package/dist/esm/api/resources/inboxes/resources/threads/client/requests/DeleteThreadRequest.d.mts +8 -0
  37. package/dist/esm/api/resources/inboxes/resources/threads/client/requests/DeleteThreadRequest.mjs +2 -0
  38. package/dist/esm/api/resources/inboxes/resources/threads/client/requests/index.d.mts +1 -0
  39. package/dist/esm/api/resources/pods/client/Client.d.mts +3 -0
  40. package/dist/esm/api/resources/pods/client/Client.mjs +5 -0
  41. package/dist/esm/api/resources/pods/resources/apiKeys/client/Client.d.mts +52 -0
  42. package/dist/esm/api/resources/pods/resources/apiKeys/client/Client.mjs +225 -0
  43. package/dist/esm/api/resources/pods/resources/apiKeys/client/index.d.mts +1 -0
  44. package/dist/esm/api/resources/pods/resources/apiKeys/client/index.mjs +1 -0
  45. package/dist/esm/api/resources/pods/resources/apiKeys/client/requests/ListApiKeysRequest.d.mts +9 -0
  46. package/dist/esm/api/resources/pods/resources/apiKeys/client/requests/ListApiKeysRequest.mjs +2 -0
  47. package/dist/esm/api/resources/pods/resources/apiKeys/client/requests/index.d.mts +1 -0
  48. package/dist/esm/api/resources/pods/resources/apiKeys/client/requests/index.mjs +1 -0
  49. package/dist/esm/api/resources/pods/resources/apiKeys/index.d.mts +1 -0
  50. package/dist/esm/api/resources/pods/resources/apiKeys/index.mjs +1 -0
  51. package/dist/esm/api/resources/pods/resources/index.d.mts +2 -0
  52. package/dist/esm/api/resources/pods/resources/index.mjs +2 -0
  53. package/dist/esm/api/resources/threads/client/Client.mjs +2 -1
  54. package/dist/esm/api/resources/threads/client/requests/ListThreadsRequest.d.mts +1 -0
  55. package/dist/esm/serialization/resources/apiKeys/types/ApiKey.d.mts +1 -0
  56. package/dist/esm/serialization/resources/apiKeys/types/ApiKey.mjs +1 -0
  57. package/dist/esm/serialization/resources/apiKeys/types/CreateApiKeyResponse.d.mts +1 -0
  58. package/dist/esm/serialization/resources/apiKeys/types/CreateApiKeyResponse.mjs +1 -0
  59. package/dist/esm/version.d.mts +1 -1
  60. package/dist/esm/version.mjs +1 -1
  61. package/dist/llms-full.txt +2275 -97
  62. package/dist/llms.txt +6 -2
  63. package/package.json +1 -1
  64. package/reference.md +197 -1
@@ -12,6 +12,7 @@ export declare namespace CreateApiKeyResponse {
12
12
  api_key: string;
13
13
  prefix: Prefix.Raw;
14
14
  name: Name.Raw;
15
+ pod_id?: string | null;
15
16
  created_at: CreatedAt.Raw;
16
17
  }
17
18
  }
@@ -45,5 +45,6 @@ exports.CreateApiKeyResponse = core.serialization.object({
45
45
  apiKey: core.serialization.property("api_key", core.serialization.string()),
46
46
  prefix: Prefix_js_1.Prefix,
47
47
  name: Name_js_1.Name,
48
+ podId: core.serialization.property("pod_id", core.serialization.string().optional()),
48
49
  createdAt: core.serialization.property("created_at", CreatedAt_js_1.CreatedAt),
49
50
  });
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.4.0";
1
+ export declare const SDK_VERSION = "0.4.2";
@@ -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.0";
4
+ exports.SDK_VERSION = "0.4.2";
@@ -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.0",
10
- "User-Agent": "agentmail/0.4.0",
9
+ "X-Fern-SDK-Version": "0.4.2",
10
+ "User-Agent": "agentmail/0.4.2",
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);
@@ -3,6 +3,8 @@ export interface ApiKey {
3
3
  apiKeyId: AgentMail.ApiKeyId;
4
4
  prefix: AgentMail.Prefix;
5
5
  name: AgentMail.Name;
6
+ /** Pod ID the api key is scoped to. If set, the key can only access resources within this pod. */
7
+ podId?: string;
6
8
  /** Time at which api key was last used. */
7
9
  usedAt?: Date;
8
10
  createdAt: AgentMail.CreatedAt;
@@ -5,5 +5,7 @@ export interface CreateApiKeyResponse {
5
5
  apiKey: string;
6
6
  prefix: AgentMail.Prefix;
7
7
  name: AgentMail.Name;
8
+ /** Pod ID the api key is scoped to. */
9
+ podId?: string;
8
10
  createdAt: AgentMail.CreatedAt;
9
11
  }
@@ -48,8 +48,11 @@ export declare class ThreadsClient {
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
50
  /**
51
+ * 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
+ *
51
53
  * @param {AgentMail.inboxes.InboxId} inbox_id
52
54
  * @param {AgentMail.ThreadId} thread_id
55
+ * @param {AgentMail.inboxes.DeleteThreadRequest} request
53
56
  * @param {ThreadsClient.RequestOptions} requestOptions - Request-specific configuration.
54
57
  *
55
58
  * @throws {@link AgentMail.NotFoundError}
@@ -57,6 +60,6 @@ export declare class ThreadsClient {
57
60
  * @example
58
61
  * await client.inboxes.threads.delete("inbox_id", "thread_id")
59
62
  */
60
- delete(inbox_id: AgentMail.inboxes.InboxId, thread_id: AgentMail.ThreadId, requestOptions?: ThreadsClient.RequestOptions): core.HttpResponsePromise<void>;
63
+ delete(inbox_id: AgentMail.inboxes.InboxId, thread_id: AgentMail.ThreadId, request?: AgentMail.inboxes.DeleteThreadRequest, requestOptions?: ThreadsClient.RequestOptions): core.HttpResponsePromise<void>;
61
64
  private __delete;
62
65
  }
@@ -233,8 +233,11 @@ export class ThreadsClient {
233
233
  });
234
234
  }
235
235
  /**
236
+ * 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.
237
+ *
236
238
  * @param {AgentMail.inboxes.InboxId} inbox_id
237
239
  * @param {AgentMail.ThreadId} thread_id
240
+ * @param {AgentMail.inboxes.DeleteThreadRequest} request
238
241
  * @param {ThreadsClient.RequestOptions} requestOptions - Request-specific configuration.
239
242
  *
240
243
  * @throws {@link AgentMail.NotFoundError}
@@ -242,12 +245,16 @@ export class ThreadsClient {
242
245
  * @example
243
246
  * await client.inboxes.threads.delete("inbox_id", "thread_id")
244
247
  */
245
- delete(inbox_id, thread_id, requestOptions) {
246
- return core.HttpResponsePromise.fromPromise(this.__delete(inbox_id, thread_id, requestOptions));
248
+ delete(inbox_id, thread_id, request = {}, requestOptions) {
249
+ return core.HttpResponsePromise.fromPromise(this.__delete(inbox_id, thread_id, request, requestOptions));
247
250
  }
248
- __delete(inbox_id, thread_id, requestOptions) {
249
- return __awaiter(this, void 0, void 0, function* () {
251
+ __delete(inbox_id_1, thread_id_1) {
252
+ return __awaiter(this, arguments, void 0, function* (inbox_id, thread_id, request = {}, requestOptions) {
250
253
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
254
+ const { permanent } = request;
255
+ const _queryParams = {
256
+ permanent,
257
+ };
251
258
  const _authRequest = yield this._options.authProvider.getAuthRequest();
252
259
  const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
253
260
  const _response = yield core.fetcher({
@@ -255,7 +262,7 @@ export class ThreadsClient {
255
262
  .http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/threads/${core.url.encodePathParam(serializers.ThreadId.jsonOrThrow(thread_id, { omitUndefined: true }))}`),
256
263
  method: "DELETE",
257
264
  headers: _headers,
258
- queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
265
+ queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
259
266
  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,
260
267
  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,
261
268
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @example
3
+ * {}
4
+ */
5
+ export interface DeleteThreadRequest {
6
+ /** If true, permanently delete the thread instead of moving to trash. */
7
+ permanent?: boolean;
8
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -1 +1,2 @@
1
+ export type { DeleteThreadRequest } from "./DeleteThreadRequest.mjs";
1
2
  export type { ListThreadsRequest } from "./ListThreadsRequest.mjs";
@@ -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 { DomainsClient } from "../resources/domains/client/Client.mjs";
6
7
  import { DraftsClient } from "../resources/drafts/client/Client.mjs";
7
8
  import { InboxesClient } from "../resources/inboxes/client/Client.mjs";
@@ -19,12 +20,14 @@ export declare class PodsClient {
19
20
  protected _drafts: DraftsClient | undefined;
20
21
  protected _domains: DomainsClient | undefined;
21
22
  protected _lists: ListsClient | undefined;
23
+ protected _apiKeys: ApiKeysClient | undefined;
22
24
  constructor(options?: PodsClient.Options);
23
25
  get inboxes(): InboxesClient;
24
26
  get threads(): ThreadsClient;
25
27
  get drafts(): DraftsClient;
26
28
  get domains(): DomainsClient;
27
29
  get lists(): ListsClient;
30
+ get apiKeys(): ApiKeysClient;
28
31
  /**
29
32
  * @param {AgentMail.pods.ListPodsRequest} request
30
33
  * @param {PodsClient.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 { DomainsClient } from "../resources/domains/client/Client.mjs";
20
21
  import { DraftsClient } from "../resources/drafts/client/Client.mjs";
21
22
  import { InboxesClient } from "../resources/inboxes/client/Client.mjs";
@@ -45,6 +46,10 @@ export class PodsClient {
45
46
  var _a;
46
47
  return ((_a = this._lists) !== null && _a !== void 0 ? _a : (this._lists = new ListsClient(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.pods.ListPodsRequest} request
50
55
  * @param {PodsClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -0,0 +1,52 @@
1
+ import type { BaseClientOptions, BaseRequestOptions } from "../../../../../../BaseClient.mjs";
2
+ import { type NormalizedClientOptionsWithAuth } from "../../../../../../BaseClient.mjs";
3
+ import * as core from "../../../../../../core/index.mjs";
4
+ import * as AgentMail from "../../../../../index.mjs";
5
+ export declare namespace 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.pods.PodId} pod_id
15
+ * @param {AgentMail.CreateApiKeyRequest} request
16
+ * @param {ApiKeysClient.RequestOptions} requestOptions - Request-specific configuration.
17
+ *
18
+ * @throws {@link AgentMail.NotFoundError}
19
+ * @throws {@link AgentMail.ValidationError}
20
+ *
21
+ * @example
22
+ * await client.pods.apiKeys.create("pod_id", {
23
+ * name: "name"
24
+ * })
25
+ */
26
+ create(pod_id: AgentMail.pods.PodId, request: AgentMail.CreateApiKeyRequest, requestOptions?: ApiKeysClient.RequestOptions): core.HttpResponsePromise<AgentMail.CreateApiKeyResponse>;
27
+ private __create;
28
+ /**
29
+ * @param {AgentMail.pods.PodId} pod_id
30
+ * @param {AgentMail.pods.ListApiKeysRequest} request
31
+ * @param {ApiKeysClient.RequestOptions} requestOptions - Request-specific configuration.
32
+ *
33
+ * @throws {@link AgentMail.NotFoundError}
34
+ *
35
+ * @example
36
+ * await client.pods.apiKeys.list("pod_id")
37
+ */
38
+ list(pod_id: AgentMail.pods.PodId, request?: AgentMail.pods.ListApiKeysRequest, requestOptions?: ApiKeysClient.RequestOptions): core.HttpResponsePromise<AgentMail.ListApiKeysResponse>;
39
+ private __list;
40
+ /**
41
+ * @param {AgentMail.pods.PodId} pod_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.pods.apiKeys.delete("pod_id", "api_key")
49
+ */
50
+ delete(pod_id: AgentMail.pods.PodId, api_key: AgentMail.ApiKeyId, requestOptions?: ApiKeysClient.RequestOptions): core.HttpResponsePromise<void>;
51
+ private __delete;
52
+ }
@@ -0,0 +1,225 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ import { normalizeClientOptionsWithAuth } from "../../../../../../BaseClient.mjs";
12
+ import { mergeHeaders } from "../../../../../../core/headers.mjs";
13
+ import * as core from "../../../../../../core/index.mjs";
14
+ import * as environments from "../../../../../../environments.mjs";
15
+ import { handleNonStatusCodeError } from "../../../../../../errors/handleNonStatusCodeError.mjs";
16
+ import * as errors from "../../../../../../errors/index.mjs";
17
+ import * as serializers from "../../../../../../serialization/index.mjs";
18
+ import * as AgentMail from "../../../../../index.mjs";
19
+ export class ApiKeysClient {
20
+ constructor(options = {}) {
21
+ this._options = normalizeClientOptionsWithAuth(options);
22
+ }
23
+ /**
24
+ * @param {AgentMail.pods.PodId} pod_id
25
+ * @param {AgentMail.CreateApiKeyRequest} request
26
+ * @param {ApiKeysClient.RequestOptions} requestOptions - Request-specific configuration.
27
+ *
28
+ * @throws {@link AgentMail.NotFoundError}
29
+ * @throws {@link AgentMail.ValidationError}
30
+ *
31
+ * @example
32
+ * await client.pods.apiKeys.create("pod_id", {
33
+ * name: "name"
34
+ * })
35
+ */
36
+ create(pod_id, request, requestOptions) {
37
+ return core.HttpResponsePromise.fromPromise(this.__create(pod_id, request, requestOptions));
38
+ }
39
+ __create(pod_id, request, requestOptions) {
40
+ return __awaiter(this, void 0, void 0, function* () {
41
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
42
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
43
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
44
+ const _response = yield core.fetcher({
45
+ 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)
46
+ .http, `/v0/pods/${core.url.encodePathParam(serializers.pods.PodId.jsonOrThrow(pod_id, { omitUndefined: true }))}/api-keys`),
47
+ method: "POST",
48
+ headers: _headers,
49
+ contentType: "application/json",
50
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
51
+ requestType: "json",
52
+ body: serializers.CreateApiKeyRequest.jsonOrThrow(request, {
53
+ unrecognizedObjectKeys: "strip",
54
+ omitUndefined: true,
55
+ }),
56
+ 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,
57
+ 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,
58
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
59
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
60
+ logging: this._options.logging,
61
+ });
62
+ if (_response.ok) {
63
+ return {
64
+ data: serializers.CreateApiKeyResponse.parseOrThrow(_response.body, {
65
+ unrecognizedObjectKeys: "passthrough",
66
+ allowUnrecognizedUnionMembers: true,
67
+ allowUnrecognizedEnumValues: true,
68
+ skipValidation: true,
69
+ breadcrumbsPrefix: ["response"],
70
+ }),
71
+ rawResponse: _response.rawResponse,
72
+ };
73
+ }
74
+ if (_response.error.reason === "status-code") {
75
+ switch (_response.error.statusCode) {
76
+ case 404:
77
+ throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
78
+ unrecognizedObjectKeys: "passthrough",
79
+ allowUnrecognizedUnionMembers: true,
80
+ allowUnrecognizedEnumValues: true,
81
+ skipValidation: true,
82
+ breadcrumbsPrefix: ["response"],
83
+ }), _response.rawResponse);
84
+ case 400:
85
+ throw new AgentMail.ValidationError(serializers.ValidationErrorResponse.parseOrThrow(_response.error.body, {
86
+ unrecognizedObjectKeys: "passthrough",
87
+ allowUnrecognizedUnionMembers: true,
88
+ allowUnrecognizedEnumValues: true,
89
+ skipValidation: true,
90
+ breadcrumbsPrefix: ["response"],
91
+ }), _response.rawResponse);
92
+ default:
93
+ throw new errors.AgentMailError({
94
+ statusCode: _response.error.statusCode,
95
+ body: _response.error.body,
96
+ rawResponse: _response.rawResponse,
97
+ });
98
+ }
99
+ }
100
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v0/pods/{pod_id}/api-keys");
101
+ });
102
+ }
103
+ /**
104
+ * @param {AgentMail.pods.PodId} pod_id
105
+ * @param {AgentMail.pods.ListApiKeysRequest} request
106
+ * @param {ApiKeysClient.RequestOptions} requestOptions - Request-specific configuration.
107
+ *
108
+ * @throws {@link AgentMail.NotFoundError}
109
+ *
110
+ * @example
111
+ * await client.pods.apiKeys.list("pod_id")
112
+ */
113
+ list(pod_id, request = {}, requestOptions) {
114
+ return core.HttpResponsePromise.fromPromise(this.__list(pod_id, request, requestOptions));
115
+ }
116
+ __list(pod_id_1) {
117
+ return __awaiter(this, arguments, void 0, function* (pod_id, request = {}, requestOptions) {
118
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
119
+ const { limit, pageToken } = request;
120
+ const _queryParams = {
121
+ limit,
122
+ page_token: pageToken,
123
+ };
124
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
125
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
126
+ const _response = yield core.fetcher({
127
+ 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)
128
+ .http, `/v0/pods/${core.url.encodePathParam(serializers.pods.PodId.jsonOrThrow(pod_id, { omitUndefined: true }))}/api-keys`),
129
+ method: "GET",
130
+ headers: _headers,
131
+ queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
132
+ 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,
133
+ 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,
134
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
135
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
136
+ logging: this._options.logging,
137
+ });
138
+ if (_response.ok) {
139
+ return {
140
+ data: serializers.ListApiKeysResponse.parseOrThrow(_response.body, {
141
+ unrecognizedObjectKeys: "passthrough",
142
+ allowUnrecognizedUnionMembers: true,
143
+ allowUnrecognizedEnumValues: true,
144
+ skipValidation: true,
145
+ breadcrumbsPrefix: ["response"],
146
+ }),
147
+ rawResponse: _response.rawResponse,
148
+ };
149
+ }
150
+ if (_response.error.reason === "status-code") {
151
+ switch (_response.error.statusCode) {
152
+ case 404:
153
+ throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
154
+ unrecognizedObjectKeys: "passthrough",
155
+ allowUnrecognizedUnionMembers: true,
156
+ allowUnrecognizedEnumValues: true,
157
+ skipValidation: true,
158
+ breadcrumbsPrefix: ["response"],
159
+ }), _response.rawResponse);
160
+ default:
161
+ throw new errors.AgentMailError({
162
+ statusCode: _response.error.statusCode,
163
+ body: _response.error.body,
164
+ rawResponse: _response.rawResponse,
165
+ });
166
+ }
167
+ }
168
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v0/pods/{pod_id}/api-keys");
169
+ });
170
+ }
171
+ /**
172
+ * @param {AgentMail.pods.PodId} pod_id
173
+ * @param {AgentMail.ApiKeyId} api_key
174
+ * @param {ApiKeysClient.RequestOptions} requestOptions - Request-specific configuration.
175
+ *
176
+ * @throws {@link AgentMail.NotFoundError}
177
+ *
178
+ * @example
179
+ * await client.pods.apiKeys.delete("pod_id", "api_key")
180
+ */
181
+ delete(pod_id, api_key, requestOptions) {
182
+ return core.HttpResponsePromise.fromPromise(this.__delete(pod_id, api_key, requestOptions));
183
+ }
184
+ __delete(pod_id, api_key, requestOptions) {
185
+ return __awaiter(this, void 0, void 0, function* () {
186
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
187
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
188
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
189
+ const _response = yield core.fetcher({
190
+ 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)
191
+ .http, `/v0/pods/${core.url.encodePathParam(serializers.pods.PodId.jsonOrThrow(pod_id, { omitUndefined: true }))}/api-keys/${core.url.encodePathParam(serializers.ApiKeyId.jsonOrThrow(api_key, { omitUndefined: true }))}`),
192
+ method: "DELETE",
193
+ headers: _headers,
194
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
195
+ 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,
196
+ 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,
197
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
198
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
199
+ logging: this._options.logging,
200
+ });
201
+ if (_response.ok) {
202
+ return { data: undefined, rawResponse: _response.rawResponse };
203
+ }
204
+ if (_response.error.reason === "status-code") {
205
+ switch (_response.error.statusCode) {
206
+ case 404:
207
+ throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
208
+ unrecognizedObjectKeys: "passthrough",
209
+ allowUnrecognizedUnionMembers: true,
210
+ allowUnrecognizedEnumValues: true,
211
+ skipValidation: true,
212
+ breadcrumbsPrefix: ["response"],
213
+ }), _response.rawResponse);
214
+ default:
215
+ throw new errors.AgentMailError({
216
+ statusCode: _response.error.statusCode,
217
+ body: _response.error.body,
218
+ rawResponse: _response.rawResponse,
219
+ });
220
+ }
221
+ }
222
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v0/pods/{pod_id}/api-keys/{api_key}");
223
+ });
224
+ }
225
+ }
@@ -0,0 +1 @@
1
+ export * from "./requests/index.mjs";
@@ -0,0 +1 @@
1
+ export * from "./requests/index.mjs";
@@ -0,0 +1,9 @@
1
+ import type * as AgentMail from "../../../../../../index.mjs";
2
+ /**
3
+ * @example
4
+ * {}
5
+ */
6
+ export interface ListApiKeysRequest {
7
+ limit?: AgentMail.Limit;
8
+ pageToken?: AgentMail.PageToken;
9
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1 @@
1
+ export type { ListApiKeysRequest } from "./ListApiKeysRequest.mjs";
@@ -0,0 +1 @@
1
+ export * from "./client/index.mjs";
@@ -0,0 +1 @@
1
+ export * from "./client/index.mjs";
@@ -1,3 +1,5 @@
1
+ export * from "./apiKeys/client/requests/index.mjs";
2
+ export * as apiKeys from "./apiKeys/index.mjs";
1
3
  export * from "./domains/client/requests/index.mjs";
2
4
  export * as domains from "./domains/index.mjs";
3
5
  export * from "./drafts/client/requests/index.mjs";
@@ -1,3 +1,5 @@
1
+ export * from "./apiKeys/client/requests/index.mjs";
2
+ export * as apiKeys from "./apiKeys/index.mjs";
1
3
  export * from "./domains/client/requests/index.mjs";
2
4
  export * as domains from "./domains/index.mjs";
3
5
  export * from "./drafts/client/requests/index.mjs";
@@ -36,7 +36,7 @@ export class ThreadsClient {
36
36
  __list() {
37
37
  return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
38
38
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
39
- const { limit, pageToken, labels, before, after, ascending, includeSpam, includeBlocked } = request;
39
+ const { limit, pageToken, labels, before, after, ascending, includeSpam, includeBlocked, includeTrash } = request;
40
40
  const _queryParams = {
41
41
  limit,
42
42
  page_token: pageToken,
@@ -55,6 +55,7 @@ export class ThreadsClient {
55
55
  ascending,
56
56
  include_spam: includeSpam,
57
57
  include_blocked: includeBlocked,
58
+ include_trash: includeTrash,
58
59
  };
59
60
  const _authRequest = yield this._options.authProvider.getAuthRequest();
60
61
  const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
@@ -12,4 +12,5 @@ export interface ListThreadsRequest {
12
12
  ascending?: AgentMail.Ascending;
13
13
  includeSpam?: AgentMail.IncludeSpam;
14
14
  includeBlocked?: AgentMail.IncludeBlocked;
15
+ includeTrash?: AgentMail.IncludeTrash;
15
16
  }
@@ -11,6 +11,7 @@ export declare namespace ApiKey {
11
11
  api_key_id: ApiKeyId.Raw;
12
12
  prefix: Prefix.Raw;
13
13
  name: Name.Raw;
14
+ pod_id?: string | null;
14
15
  used_at?: string | null;
15
16
  created_at: CreatedAt.Raw;
16
17
  }
@@ -8,6 +8,7 @@ export const ApiKey = core.serialization.object({
8
8
  apiKeyId: core.serialization.property("api_key_id", ApiKeyId),
9
9
  prefix: Prefix,
10
10
  name: Name,
11
+ podId: core.serialization.property("pod_id", core.serialization.string().optional()),
11
12
  usedAt: core.serialization.property("used_at", core.serialization.date().optional()),
12
13
  createdAt: core.serialization.property("created_at", CreatedAt),
13
14
  });
@@ -12,6 +12,7 @@ export declare namespace CreateApiKeyResponse {
12
12
  api_key: string;
13
13
  prefix: Prefix.Raw;
14
14
  name: Name.Raw;
15
+ pod_id?: string | null;
15
16
  created_at: CreatedAt.Raw;
16
17
  }
17
18
  }
@@ -9,5 +9,6 @@ export const CreateApiKeyResponse = core.serialization.object({
9
9
  apiKey: core.serialization.property("api_key", core.serialization.string()),
10
10
  prefix: Prefix,
11
11
  name: Name,
12
+ podId: core.serialization.property("pod_id", core.serialization.string().optional()),
12
13
  createdAt: core.serialization.property("created_at", CreatedAt),
13
14
  });
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.4.0";
1
+ export declare const SDK_VERSION = "0.4.2";
@@ -1 +1 @@
1
- export const SDK_VERSION = "0.4.0";
1
+ export const SDK_VERSION = "0.4.2";