agentmail 0.3.9 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/dist/cjs/BaseClient.js +2 -2
  2. package/dist/cjs/api/resources/apiKeys/client/Client.js +2 -1
  3. package/dist/cjs/api/resources/apiKeys/client/requests/ListApiKeysRequest.d.ts +1 -0
  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/client/Client.js +2 -1
  7. package/dist/cjs/api/resources/domains/client/requests/ListDomainsRequest.d.ts +1 -0
  8. package/dist/cjs/api/resources/inboxes/client/Client.js +2 -1
  9. package/dist/cjs/api/resources/inboxes/client/requests/ListInboxesRequest.d.ts +1 -0
  10. package/dist/cjs/api/resources/inboxes/types/InboxId.d.ts +1 -1
  11. package/dist/cjs/api/resources/pods/client/Client.d.ts +3 -0
  12. package/dist/cjs/api/resources/pods/client/Client.js +17 -11
  13. package/dist/cjs/api/resources/pods/client/requests/ListPodsRequest.d.ts +1 -0
  14. package/dist/cjs/api/resources/pods/resources/apiKeys/client/Client.d.ts +52 -0
  15. package/dist/cjs/api/resources/pods/resources/apiKeys/client/Client.js +262 -0
  16. package/dist/cjs/api/resources/pods/resources/apiKeys/client/index.d.ts +1 -0
  17. package/dist/cjs/api/resources/pods/resources/apiKeys/client/index.js +17 -0
  18. package/dist/cjs/api/resources/pods/resources/apiKeys/client/requests/ListApiKeysRequest.d.ts +9 -0
  19. package/dist/cjs/api/resources/pods/resources/apiKeys/client/requests/ListApiKeysRequest.js +3 -0
  20. package/dist/cjs/api/resources/pods/resources/apiKeys/client/requests/index.d.ts +1 -0
  21. package/dist/cjs/api/resources/pods/resources/apiKeys/client/requests/index.js +2 -0
  22. package/dist/cjs/api/resources/pods/resources/apiKeys/index.d.ts +1 -0
  23. package/dist/cjs/api/resources/pods/resources/apiKeys/index.js +17 -0
  24. package/dist/cjs/api/resources/pods/resources/domains/client/Client.js +2 -1
  25. package/dist/cjs/api/resources/pods/resources/domains/client/requests/ListDomainsRequest.d.ts +1 -0
  26. package/dist/cjs/api/resources/pods/resources/inboxes/client/Client.js +2 -1
  27. package/dist/cjs/api/resources/pods/resources/inboxes/client/requests/ListInboxesRequest.d.ts +1 -0
  28. package/dist/cjs/api/resources/pods/resources/index.d.ts +2 -0
  29. package/dist/cjs/api/resources/pods/resources/index.js +3 -1
  30. package/dist/cjs/api/resources/webhooks/client/Client.js +2 -1
  31. package/dist/cjs/api/resources/webhooks/client/requests/ListWebhooksRequest.d.ts +1 -0
  32. package/dist/cjs/serialization/resources/apiKeys/types/ApiKey.d.ts +1 -0
  33. package/dist/cjs/serialization/resources/apiKeys/types/ApiKey.js +1 -0
  34. package/dist/cjs/serialization/resources/apiKeys/types/CreateApiKeyResponse.d.ts +1 -0
  35. package/dist/cjs/serialization/resources/apiKeys/types/CreateApiKeyResponse.js +1 -0
  36. package/dist/cjs/version.d.ts +1 -1
  37. package/dist/cjs/version.js +1 -1
  38. package/dist/esm/BaseClient.mjs +2 -2
  39. package/dist/esm/api/resources/apiKeys/client/Client.mjs +2 -1
  40. package/dist/esm/api/resources/apiKeys/client/requests/ListApiKeysRequest.d.mts +1 -0
  41. package/dist/esm/api/resources/apiKeys/types/ApiKey.d.mts +2 -0
  42. package/dist/esm/api/resources/apiKeys/types/CreateApiKeyResponse.d.mts +2 -0
  43. package/dist/esm/api/resources/domains/client/Client.mjs +2 -1
  44. package/dist/esm/api/resources/domains/client/requests/ListDomainsRequest.d.mts +1 -0
  45. package/dist/esm/api/resources/inboxes/client/Client.mjs +2 -1
  46. package/dist/esm/api/resources/inboxes/client/requests/ListInboxesRequest.d.mts +1 -0
  47. package/dist/esm/api/resources/inboxes/types/InboxId.d.mts +1 -1
  48. package/dist/esm/api/resources/pods/client/Client.d.mts +3 -0
  49. package/dist/esm/api/resources/pods/client/Client.mjs +7 -1
  50. package/dist/esm/api/resources/pods/client/requests/ListPodsRequest.d.mts +1 -0
  51. package/dist/esm/api/resources/pods/resources/apiKeys/client/Client.d.mts +52 -0
  52. package/dist/esm/api/resources/pods/resources/apiKeys/client/Client.mjs +225 -0
  53. package/dist/esm/api/resources/pods/resources/apiKeys/client/index.d.mts +1 -0
  54. package/dist/esm/api/resources/pods/resources/apiKeys/client/index.mjs +1 -0
  55. package/dist/esm/api/resources/pods/resources/apiKeys/client/requests/ListApiKeysRequest.d.mts +9 -0
  56. package/dist/esm/api/resources/pods/resources/apiKeys/client/requests/ListApiKeysRequest.mjs +2 -0
  57. package/dist/esm/api/resources/pods/resources/apiKeys/client/requests/index.d.mts +1 -0
  58. package/dist/esm/api/resources/pods/resources/apiKeys/client/requests/index.mjs +1 -0
  59. package/dist/esm/api/resources/pods/resources/apiKeys/index.d.mts +1 -0
  60. package/dist/esm/api/resources/pods/resources/apiKeys/index.mjs +1 -0
  61. package/dist/esm/api/resources/pods/resources/domains/client/Client.mjs +2 -1
  62. package/dist/esm/api/resources/pods/resources/domains/client/requests/ListDomainsRequest.d.mts +1 -0
  63. package/dist/esm/api/resources/pods/resources/inboxes/client/Client.mjs +2 -1
  64. package/dist/esm/api/resources/pods/resources/inboxes/client/requests/ListInboxesRequest.d.mts +1 -0
  65. package/dist/esm/api/resources/pods/resources/index.d.mts +2 -0
  66. package/dist/esm/api/resources/pods/resources/index.mjs +2 -0
  67. package/dist/esm/api/resources/webhooks/client/Client.mjs +2 -1
  68. package/dist/esm/api/resources/webhooks/client/requests/ListWebhooksRequest.d.mts +1 -0
  69. package/dist/esm/serialization/resources/apiKeys/types/ApiKey.d.mts +1 -0
  70. package/dist/esm/serialization/resources/apiKeys/types/ApiKey.mjs +1 -0
  71. package/dist/esm/serialization/resources/apiKeys/types/CreateApiKeyResponse.d.mts +1 -0
  72. package/dist/esm/serialization/resources/apiKeys/types/CreateApiKeyResponse.mjs +1 -0
  73. package/dist/esm/version.d.mts +1 -1
  74. package/dist/esm/version.mjs +1 -1
  75. package/dist/llms-full.txt +1770 -73
  76. package/dist/llms.txt +4 -2
  77. package/package.json +1 -1
  78. 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.3.9",
47
- "User-Agent": "agentmail/0.3.9",
46
+ "X-Fern-SDK-Version": "0.4.1",
47
+ "User-Agent": "agentmail/0.4.1",
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);
@@ -69,10 +69,11 @@ class ApiKeysClient {
69
69
  __list() {
70
70
  return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
71
71
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
72
- const { limit, pageToken } = request;
72
+ const { limit, pageToken, ascending } = request;
73
73
  const _queryParams = {
74
74
  limit,
75
75
  page_token: pageToken,
76
+ ascending,
76
77
  };
77
78
  const _authRequest = yield this._options.authProvider.getAuthRequest();
78
79
  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);
@@ -6,4 +6,5 @@ import type * as AgentMail from "../../../../index.js";
6
6
  export interface ListApiKeysRequest {
7
7
  limit?: AgentMail.Limit;
8
8
  pageToken?: AgentMail.PageToken;
9
+ ascending?: AgentMail.Ascending;
9
10
  }
@@ -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
  }
@@ -69,10 +69,11 @@ class DomainsClient {
69
69
  __list() {
70
70
  return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
71
71
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
72
- const { limit, pageToken } = request;
72
+ const { limit, pageToken, ascending } = request;
73
73
  const _queryParams = {
74
74
  limit,
75
75
  page_token: pageToken,
76
+ ascending,
76
77
  };
77
78
  const _authRequest = yield this._options.authProvider.getAuthRequest();
78
79
  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);
@@ -6,4 +6,5 @@ import type * as AgentMail from "../../../../index.js";
6
6
  export interface ListDomainsRequest {
7
7
  limit?: AgentMail.Limit;
8
8
  pageToken?: AgentMail.PageToken;
9
+ ascending?: AgentMail.Ascending;
9
10
  }
@@ -89,10 +89,11 @@ class InboxesClient {
89
89
  __list() {
90
90
  return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
91
91
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
92
- const { limit, pageToken } = request;
92
+ const { limit, pageToken, ascending } = request;
93
93
  const _queryParams = {
94
94
  limit,
95
95
  page_token: pageToken,
96
+ ascending,
96
97
  };
97
98
  const _authRequest = yield this._options.authProvider.getAuthRequest();
98
99
  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);
@@ -6,4 +6,5 @@ import type * as AgentMail from "../../../../index.js";
6
6
  export interface ListInboxesRequest {
7
7
  limit?: AgentMail.Limit;
8
8
  pageToken?: AgentMail.PageToken;
9
+ ascending?: AgentMail.Ascending;
9
10
  }
@@ -1,4 +1,4 @@
1
1
  /**
2
- * ID of inbox.
2
+ * The ID of the inbox.
3
3
  */
4
4
  export type InboxId = string;
@@ -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 { DomainsClient } from "../resources/domains/client/Client.js";
6
7
  import { DraftsClient } from "../resources/drafts/client/Client.js";
7
8
  import { InboxesClient } from "../resources/inboxes/client/Client.js";
@@ -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.
@@ -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/domains/client/Client.js");
56
- const Client_js_2 = require("../resources/drafts/client/Client.js");
57
- const Client_js_3 = require("../resources/inboxes/client/Client.js");
58
- const Client_js_4 = require("../resources/lists/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/domains/client/Client.js");
57
+ const Client_js_3 = require("../resources/drafts/client/Client.js");
58
+ const Client_js_4 = require("../resources/inboxes/client/Client.js");
59
+ const Client_js_5 = require("../resources/lists/client/Client.js");
60
+ const Client_js_6 = require("../resources/threads/client/Client.js");
60
61
  class PodsClient {
61
62
  constructor(options = {}) {
62
63
  this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
63
64
  }
64
65
  get inboxes() {
65
66
  var _a;
66
- return ((_a = this._inboxes) !== null && _a !== void 0 ? _a : (this._inboxes = new Client_js_3.InboxesClient(this._options)));
67
+ return ((_a = this._inboxes) !== null && _a !== void 0 ? _a : (this._inboxes = new Client_js_4.InboxesClient(this._options)));
67
68
  }
68
69
  get threads() {
69
70
  var _a;
70
- return ((_a = this._threads) !== null && _a !== void 0 ? _a : (this._threads = new Client_js_5.ThreadsClient(this._options)));
71
+ return ((_a = this._threads) !== null && _a !== void 0 ? _a : (this._threads = new Client_js_6.ThreadsClient(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_2.DraftsClient(this._options)));
75
+ return ((_a = this._drafts) !== null && _a !== void 0 ? _a : (this._drafts = new Client_js_3.DraftsClient(this._options)));
75
76
  }
76
77
  get domains() {
77
78
  var _a;
78
- return ((_a = this._domains) !== null && _a !== void 0 ? _a : (this._domains = new Client_js_1.DomainsClient(this._options)));
79
+ return ((_a = this._domains) !== null && _a !== void 0 ? _a : (this._domains = new Client_js_2.DomainsClient(this._options)));
79
80
  }
80
81
  get lists() {
81
82
  var _a;
82
- return ((_a = this._lists) !== null && _a !== void 0 ? _a : (this._lists = new Client_js_4.ListsClient(this._options)));
83
+ return ((_a = this._lists) !== null && _a !== void 0 ? _a : (this._lists = new Client_js_5.ListsClient(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.pods.ListPodsRequest} request
@@ -94,10 +99,11 @@ class PodsClient {
94
99
  __list() {
95
100
  return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
96
101
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
97
- const { limit, pageToken } = request;
102
+ const { limit, pageToken, ascending } = request;
98
103
  const _queryParams = {
99
104
  limit,
100
105
  page_token: pageToken,
106
+ ascending,
101
107
  };
102
108
  const _authRequest = yield this._options.authProvider.getAuthRequest();
103
109
  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);
@@ -6,4 +6,5 @@ import type * as AgentMail from "../../../../index.js";
6
6
  export interface ListPodsRequest {
7
7
  limit?: AgentMail.Limit;
8
8
  pageToken?: AgentMail.PageToken;
9
+ ascending?: AgentMail.Ascending;
9
10
  }
@@ -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.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,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.pods.PodId} pod_id
61
+ * @param {AgentMail.CreateApiKeyRequest} request
62
+ * @param {ApiKeysClient.RequestOptions} requestOptions - Request-specific configuration.
63
+ *
64
+ * @throws {@link AgentMail.NotFoundError}
65
+ * @throws {@link AgentMail.ValidationError}
66
+ *
67
+ * @example
68
+ * await client.pods.apiKeys.create("pod_id", {
69
+ * name: "name"
70
+ * })
71
+ */
72
+ create(pod_id, request, requestOptions) {
73
+ return core.HttpResponsePromise.fromPromise(this.__create(pod_id, request, requestOptions));
74
+ }
75
+ __create(pod_id, request, requestOptions) {
76
+ return __awaiter(this, void 0, void 0, function* () {
77
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
78
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
79
+ 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);
80
+ const _response = yield core.fetcher({
81
+ 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)
82
+ .http, `/v0/pods/${core.url.encodePathParam(serializers.pods.PodId.jsonOrThrow(pod_id, { omitUndefined: true }))}/api-keys`),
83
+ method: "POST",
84
+ headers: _headers,
85
+ contentType: "application/json",
86
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
87
+ requestType: "json",
88
+ body: serializers.CreateApiKeyRequest.jsonOrThrow(request, {
89
+ unrecognizedObjectKeys: "strip",
90
+ omitUndefined: true,
91
+ }),
92
+ 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,
93
+ 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,
94
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
95
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
96
+ logging: this._options.logging,
97
+ });
98
+ if (_response.ok) {
99
+ return {
100
+ data: serializers.CreateApiKeyResponse.parseOrThrow(_response.body, {
101
+ unrecognizedObjectKeys: "passthrough",
102
+ allowUnrecognizedUnionMembers: true,
103
+ allowUnrecognizedEnumValues: true,
104
+ skipValidation: true,
105
+ breadcrumbsPrefix: ["response"],
106
+ }),
107
+ rawResponse: _response.rawResponse,
108
+ };
109
+ }
110
+ if (_response.error.reason === "status-code") {
111
+ switch (_response.error.statusCode) {
112
+ case 404:
113
+ throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
114
+ unrecognizedObjectKeys: "passthrough",
115
+ allowUnrecognizedUnionMembers: true,
116
+ allowUnrecognizedEnumValues: true,
117
+ skipValidation: true,
118
+ breadcrumbsPrefix: ["response"],
119
+ }), _response.rawResponse);
120
+ case 400:
121
+ throw new AgentMail.ValidationError(serializers.ValidationErrorResponse.parseOrThrow(_response.error.body, {
122
+ unrecognizedObjectKeys: "passthrough",
123
+ allowUnrecognizedUnionMembers: true,
124
+ allowUnrecognizedEnumValues: true,
125
+ skipValidation: true,
126
+ breadcrumbsPrefix: ["response"],
127
+ }), _response.rawResponse);
128
+ default:
129
+ throw new errors.AgentMailError({
130
+ statusCode: _response.error.statusCode,
131
+ body: _response.error.body,
132
+ rawResponse: _response.rawResponse,
133
+ });
134
+ }
135
+ }
136
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v0/pods/{pod_id}/api-keys");
137
+ });
138
+ }
139
+ /**
140
+ * @param {AgentMail.pods.PodId} pod_id
141
+ * @param {AgentMail.pods.ListApiKeysRequest} request
142
+ * @param {ApiKeysClient.RequestOptions} requestOptions - Request-specific configuration.
143
+ *
144
+ * @throws {@link AgentMail.NotFoundError}
145
+ *
146
+ * @example
147
+ * await client.pods.apiKeys.list("pod_id")
148
+ */
149
+ list(pod_id, request = {}, requestOptions) {
150
+ return core.HttpResponsePromise.fromPromise(this.__list(pod_id, request, requestOptions));
151
+ }
152
+ __list(pod_id_1) {
153
+ return __awaiter(this, arguments, void 0, function* (pod_id, request = {}, requestOptions) {
154
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
155
+ const { limit, pageToken } = request;
156
+ const _queryParams = {
157
+ limit,
158
+ page_token: pageToken,
159
+ };
160
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
161
+ 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);
162
+ const _response = yield core.fetcher({
163
+ 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)
164
+ .http, `/v0/pods/${core.url.encodePathParam(serializers.pods.PodId.jsonOrThrow(pod_id, { omitUndefined: true }))}/api-keys`),
165
+ method: "GET",
166
+ headers: _headers,
167
+ queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
168
+ 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,
169
+ 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,
170
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
171
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
172
+ logging: this._options.logging,
173
+ });
174
+ if (_response.ok) {
175
+ return {
176
+ data: serializers.ListApiKeysResponse.parseOrThrow(_response.body, {
177
+ unrecognizedObjectKeys: "passthrough",
178
+ allowUnrecognizedUnionMembers: true,
179
+ allowUnrecognizedEnumValues: true,
180
+ skipValidation: true,
181
+ breadcrumbsPrefix: ["response"],
182
+ }),
183
+ rawResponse: _response.rawResponse,
184
+ };
185
+ }
186
+ if (_response.error.reason === "status-code") {
187
+ switch (_response.error.statusCode) {
188
+ case 404:
189
+ throw new AgentMail.NotFoundError(serializers.ErrorResponse.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, "GET", "/v0/pods/{pod_id}/api-keys");
205
+ });
206
+ }
207
+ /**
208
+ * @param {AgentMail.pods.PodId} pod_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.pods.apiKeys.delete("pod_id", "api_key")
216
+ */
217
+ delete(pod_id, api_key, requestOptions) {
218
+ return core.HttpResponsePromise.fromPromise(this.__delete(pod_id, api_key, requestOptions));
219
+ }
220
+ __delete(pod_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/pods/${core.url.encodePathParam(serializers.pods.PodId.jsonOrThrow(pod_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/pods/{pod_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);
@@ -72,10 +72,11 @@ class DomainsClient {
72
72
  __list(pod_id_1) {
73
73
  return __awaiter(this, arguments, void 0, function* (pod_id, request = {}, requestOptions) {
74
74
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
75
- const { limit, pageToken } = request;
75
+ const { limit, pageToken, ascending } = request;
76
76
  const _queryParams = {
77
77
  limit,
78
78
  page_token: pageToken,
79
+ ascending,
79
80
  };
80
81
  const _authRequest = yield this._options.authProvider.getAuthRequest();
81
82
  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);
@@ -6,4 +6,5 @@ import type * as AgentMail from "../../../../../../index.js";
6
6
  export interface ListDomainsRequest {
7
7
  limit?: AgentMail.Limit;
8
8
  pageToken?: AgentMail.PageToken;
9
+ ascending?: AgentMail.Ascending;
9
10
  }
@@ -72,10 +72,11 @@ class InboxesClient {
72
72
  __list(pod_id_1) {
73
73
  return __awaiter(this, arguments, void 0, function* (pod_id, request = {}, requestOptions) {
74
74
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
75
- const { limit, pageToken } = request;
75
+ const { limit, pageToken, ascending } = request;
76
76
  const _queryParams = {
77
77
  limit,
78
78
  page_token: pageToken,
79
+ ascending,
79
80
  };
80
81
  const _authRequest = yield this._options.authProvider.getAuthRequest();
81
82
  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);
@@ -6,4 +6,5 @@ import type * as AgentMail from "../../../../../../index.js";
6
6
  export interface ListInboxesRequest {
7
7
  limit?: AgentMail.Limit;
8
8
  pageToken?: AgentMail.PageToken;
9
+ ascending?: AgentMail.Ascending;
9
10
  }
@@ -1,3 +1,5 @@
1
+ export * from "./apiKeys/client/requests/index.js";
2
+ export * as apiKeys from "./apiKeys/index.js";
1
3
  export * from "./domains/client/requests/index.js";
2
4
  export * as domains from "./domains/index.js";
3
5
  export * from "./drafts/client/requests/index.js";