agentmail 0.5.7 → 0.5.8

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/Client.d.ts +3 -0
  3. package/dist/cjs/Client.js +25 -20
  4. package/dist/cjs/api/resources/auth/client/Client.d.ts +28 -0
  5. package/dist/cjs/api/resources/auth/client/Client.js +114 -0
  6. package/dist/cjs/api/resources/auth/client/index.d.ts +1 -0
  7. package/dist/cjs/api/resources/auth/client/index.js +2 -0
  8. package/dist/cjs/api/resources/auth/exports.d.ts +2 -0
  9. package/dist/cjs/api/resources/auth/exports.js +21 -0
  10. package/dist/cjs/api/resources/auth/index.d.ts +2 -0
  11. package/dist/cjs/api/resources/auth/index.js +18 -0
  12. package/dist/cjs/api/resources/auth/types/Identity.d.ts +19 -0
  13. package/dist/cjs/api/resources/auth/types/Identity.js +3 -0
  14. package/dist/cjs/api/resources/auth/types/ScopeType.d.ts +7 -0
  15. package/dist/cjs/api/resources/auth/types/ScopeType.js +10 -0
  16. package/dist/cjs/api/resources/auth/types/index.d.ts +2 -0
  17. package/dist/cjs/api/resources/auth/types/index.js +18 -0
  18. package/dist/cjs/api/resources/index.d.ts +2 -0
  19. package/dist/cjs/api/resources/index.js +3 -1
  20. package/dist/cjs/serialization/resources/auth/index.d.ts +1 -0
  21. package/dist/cjs/serialization/resources/auth/index.js +17 -0
  22. package/dist/cjs/serialization/resources/auth/types/Identity.d.ts +16 -0
  23. package/dist/cjs/serialization/resources/auth/types/Identity.js +48 -0
  24. package/dist/cjs/serialization/resources/auth/types/ScopeType.d.ts +7 -0
  25. package/dist/cjs/serialization/resources/auth/types/ScopeType.js +39 -0
  26. package/dist/cjs/serialization/resources/auth/types/index.d.ts +2 -0
  27. package/dist/cjs/serialization/resources/auth/types/index.js +18 -0
  28. package/dist/cjs/serialization/resources/index.d.ts +2 -0
  29. package/dist/cjs/serialization/resources/index.js +3 -1
  30. package/dist/cjs/version.d.ts +1 -1
  31. package/dist/cjs/version.js +1 -1
  32. package/dist/esm/BaseClient.mjs +2 -2
  33. package/dist/esm/Client.d.mts +3 -0
  34. package/dist/esm/Client.mjs +5 -0
  35. package/dist/esm/api/resources/auth/client/Client.d.mts +28 -0
  36. package/dist/esm/api/resources/auth/client/Client.mjs +77 -0
  37. package/dist/esm/api/resources/auth/client/index.d.mts +1 -0
  38. package/dist/esm/api/resources/auth/client/index.mjs +1 -0
  39. package/dist/esm/api/resources/auth/exports.d.mts +2 -0
  40. package/dist/esm/api/resources/auth/exports.mjs +3 -0
  41. package/dist/esm/api/resources/auth/index.d.mts +2 -0
  42. package/dist/esm/api/resources/auth/index.mjs +2 -0
  43. package/dist/esm/api/resources/auth/types/Identity.d.mts +19 -0
  44. package/dist/esm/api/resources/auth/types/Identity.mjs +2 -0
  45. package/dist/esm/api/resources/auth/types/ScopeType.d.mts +7 -0
  46. package/dist/esm/api/resources/auth/types/ScopeType.mjs +7 -0
  47. package/dist/esm/api/resources/auth/types/index.d.mts +2 -0
  48. package/dist/esm/api/resources/auth/types/index.mjs +2 -0
  49. package/dist/esm/api/resources/index.d.mts +2 -0
  50. package/dist/esm/api/resources/index.mjs +2 -0
  51. package/dist/esm/serialization/resources/auth/index.d.mts +1 -0
  52. package/dist/esm/serialization/resources/auth/index.mjs +1 -0
  53. package/dist/esm/serialization/resources/auth/types/Identity.d.mts +16 -0
  54. package/dist/esm/serialization/resources/auth/types/Identity.mjs +12 -0
  55. package/dist/esm/serialization/resources/auth/types/ScopeType.d.mts +7 -0
  56. package/dist/esm/serialization/resources/auth/types/ScopeType.mjs +3 -0
  57. package/dist/esm/serialization/resources/auth/types/index.d.mts +2 -0
  58. package/dist/esm/serialization/resources/auth/types/index.mjs +2 -0
  59. package/dist/esm/serialization/resources/index.d.mts +2 -0
  60. package/dist/esm/serialization/resources/index.mjs +2 -0
  61. package/dist/esm/version.d.mts +1 -1
  62. package/dist/esm/version.mjs +1 -1
  63. package/package.json +12 -1
  64. package/reference.md +61 -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.5.7",
47
- "User-Agent": "agentmail/0.5.7",
46
+ "X-Fern-SDK-Version": "0.5.8",
47
+ "User-Agent": "agentmail/0.5.8",
48
48
  "X-Fern-Runtime": core.RUNTIME.type,
49
49
  "X-Fern-Runtime-Version": core.RUNTIME.version,
50
50
  }, options === null || options === void 0 ? void 0 : options.headers);
@@ -1,5 +1,6 @@
1
1
  import { AgentClient } from "./api/resources/agent/client/Client.js";
2
2
  import { ApiKeysClient } from "./api/resources/apiKeys/client/Client.js";
3
+ import { AuthClient } from "./api/resources/auth/client/Client.js";
3
4
  import { DomainsClient } from "./api/resources/domains/client/Client.js";
4
5
  import { DraftsClient } from "./api/resources/drafts/client/Client.js";
5
6
  import { InboxesClient } from "./api/resources/inboxes/client/Client.js";
@@ -25,6 +26,7 @@ export declare class AgentMailClient {
25
26
  protected _webhooks: WebhooksClient | undefined;
26
27
  protected _agent: AgentClient | undefined;
27
28
  protected _apiKeys: ApiKeysClient | undefined;
29
+ protected _auth: AuthClient | undefined;
28
30
  protected _domains: DomainsClient | undefined;
29
31
  protected _drafts: DraftsClient | undefined;
30
32
  protected _lists: ListsClient | undefined;
@@ -38,6 +40,7 @@ export declare class AgentMailClient {
38
40
  get webhooks(): WebhooksClient;
39
41
  get agent(): AgentClient;
40
42
  get apiKeys(): ApiKeysClient;
43
+ get auth(): AuthClient;
41
44
  get domains(): DomainsClient;
42
45
  get drafts(): DraftsClient;
43
46
  get lists(): ListsClient;
@@ -46,16 +46,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
46
46
  exports.AgentMailClient = void 0;
47
47
  const Client_js_1 = require("./api/resources/agent/client/Client.js");
48
48
  const Client_js_2 = require("./api/resources/apiKeys/client/Client.js");
49
- const Client_js_3 = require("./api/resources/domains/client/Client.js");
50
- const Client_js_4 = require("./api/resources/drafts/client/Client.js");
51
- const Client_js_5 = require("./api/resources/inboxes/client/Client.js");
52
- const Client_js_6 = require("./api/resources/lists/client/Client.js");
53
- const Client_js_7 = require("./api/resources/metrics/client/Client.js");
54
- const Client_js_8 = require("./api/resources/organizations/client/Client.js");
55
- const Client_js_9 = require("./api/resources/pods/client/Client.js");
56
- const Client_js_10 = require("./api/resources/threads/client/Client.js");
57
- const Client_js_11 = require("./api/resources/webhooks/client/Client.js");
58
- const Client_js_12 = require("./api/resources/websockets/client/Client.js");
49
+ const Client_js_3 = require("./api/resources/auth/client/Client.js");
50
+ const Client_js_4 = require("./api/resources/domains/client/Client.js");
51
+ const Client_js_5 = require("./api/resources/drafts/client/Client.js");
52
+ const Client_js_6 = require("./api/resources/inboxes/client/Client.js");
53
+ const Client_js_7 = require("./api/resources/lists/client/Client.js");
54
+ const Client_js_8 = require("./api/resources/metrics/client/Client.js");
55
+ const Client_js_9 = require("./api/resources/organizations/client/Client.js");
56
+ const Client_js_10 = require("./api/resources/pods/client/Client.js");
57
+ const Client_js_11 = require("./api/resources/threads/client/Client.js");
58
+ const Client_js_12 = require("./api/resources/webhooks/client/Client.js");
59
+ const Client_js_13 = require("./api/resources/websockets/client/Client.js");
59
60
  const BaseClient_js_1 = require("./BaseClient.js");
60
61
  const core = __importStar(require("./core/index.js"));
61
62
  const environments = __importStar(require("./environments.js"));
@@ -65,15 +66,15 @@ class AgentMailClient {
65
66
  }
66
67
  get inboxes() {
67
68
  var _a;
68
- return ((_a = this._inboxes) !== null && _a !== void 0 ? _a : (this._inboxes = new Client_js_5.InboxesClient(this._options)));
69
+ return ((_a = this._inboxes) !== null && _a !== void 0 ? _a : (this._inboxes = new Client_js_6.InboxesClient(this._options)));
69
70
  }
70
71
  get pods() {
71
72
  var _a;
72
- return ((_a = this._pods) !== null && _a !== void 0 ? _a : (this._pods = new Client_js_9.PodsClient(this._options)));
73
+ return ((_a = this._pods) !== null && _a !== void 0 ? _a : (this._pods = new Client_js_10.PodsClient(this._options)));
73
74
  }
74
75
  get webhooks() {
75
76
  var _a;
76
- return ((_a = this._webhooks) !== null && _a !== void 0 ? _a : (this._webhooks = new Client_js_11.WebhooksClient(this._options)));
77
+ return ((_a = this._webhooks) !== null && _a !== void 0 ? _a : (this._webhooks = new Client_js_12.WebhooksClient(this._options)));
77
78
  }
78
79
  get agent() {
79
80
  var _a;
@@ -83,33 +84,37 @@ class AgentMailClient {
83
84
  var _a;
84
85
  return ((_a = this._apiKeys) !== null && _a !== void 0 ? _a : (this._apiKeys = new Client_js_2.ApiKeysClient(this._options)));
85
86
  }
87
+ get auth() {
88
+ var _a;
89
+ return ((_a = this._auth) !== null && _a !== void 0 ? _a : (this._auth = new Client_js_3.AuthClient(this._options)));
90
+ }
86
91
  get domains() {
87
92
  var _a;
88
- return ((_a = this._domains) !== null && _a !== void 0 ? _a : (this._domains = new Client_js_3.DomainsClient(this._options)));
93
+ return ((_a = this._domains) !== null && _a !== void 0 ? _a : (this._domains = new Client_js_4.DomainsClient(this._options)));
89
94
  }
90
95
  get drafts() {
91
96
  var _a;
92
- return ((_a = this._drafts) !== null && _a !== void 0 ? _a : (this._drafts = new Client_js_4.DraftsClient(this._options)));
97
+ return ((_a = this._drafts) !== null && _a !== void 0 ? _a : (this._drafts = new Client_js_5.DraftsClient(this._options)));
93
98
  }
94
99
  get lists() {
95
100
  var _a;
96
- return ((_a = this._lists) !== null && _a !== void 0 ? _a : (this._lists = new Client_js_6.ListsClient(this._options)));
101
+ return ((_a = this._lists) !== null && _a !== void 0 ? _a : (this._lists = new Client_js_7.ListsClient(this._options)));
97
102
  }
98
103
  get metrics() {
99
104
  var _a;
100
- return ((_a = this._metrics) !== null && _a !== void 0 ? _a : (this._metrics = new Client_js_7.MetricsClient(this._options)));
105
+ return ((_a = this._metrics) !== null && _a !== void 0 ? _a : (this._metrics = new Client_js_8.MetricsClient(this._options)));
101
106
  }
102
107
  get organizations() {
103
108
  var _a;
104
- return ((_a = this._organizations) !== null && _a !== void 0 ? _a : (this._organizations = new Client_js_8.OrganizationsClient(this._options)));
109
+ return ((_a = this._organizations) !== null && _a !== void 0 ? _a : (this._organizations = new Client_js_9.OrganizationsClient(this._options)));
105
110
  }
106
111
  get threads() {
107
112
  var _a;
108
- return ((_a = this._threads) !== null && _a !== void 0 ? _a : (this._threads = new Client_js_10.ThreadsClient(this._options)));
113
+ return ((_a = this._threads) !== null && _a !== void 0 ? _a : (this._threads = new Client_js_11.ThreadsClient(this._options)));
109
114
  }
110
115
  get websockets() {
111
116
  var _a;
112
- return ((_a = this._websockets) !== null && _a !== void 0 ? _a : (this._websockets = new Client_js_12.WebsocketsClient(this._options)));
117
+ return ((_a = this._websockets) !== null && _a !== void 0 ? _a : (this._websockets = new Client_js_13.WebsocketsClient(this._options)));
113
118
  }
114
119
  /**
115
120
  * Make a passthrough request using the SDK's configured auth, retry, logging, etc.
@@ -0,0 +1,28 @@
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 type * as AgentMail from "../../../index.js";
5
+ export declare namespace AuthClient {
6
+ type Options = BaseClientOptions;
7
+ interface RequestOptions extends BaseRequestOptions {
8
+ }
9
+ }
10
+ export declare class AuthClient {
11
+ protected readonly _options: NormalizedClientOptionsWithAuth<AuthClient.Options>;
12
+ constructor(options?: AuthClient.Options);
13
+ /**
14
+ * Returns the identity and scope of the authenticated credential. Useful when a client holds a pod-scoped or inbox-scoped API key and needs to discover the parent organization, pod, or inbox without prior knowledge.
15
+ *
16
+ * **CLI:**
17
+ * ```bash
18
+ * agentmail auth me
19
+ * ```
20
+ *
21
+ * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
22
+ *
23
+ * @example
24
+ * await client.auth.me()
25
+ */
26
+ me(requestOptions?: AuthClient.RequestOptions): core.HttpResponsePromise<AgentMail.Identity>;
27
+ private __me;
28
+ }
@@ -0,0 +1,114 @@
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.AuthClient = 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
+ class AuthClient {
55
+ constructor(options = {}) {
56
+ this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
57
+ }
58
+ /**
59
+ * Returns the identity and scope of the authenticated credential. Useful when a client holds a pod-scoped or inbox-scoped API key and needs to discover the parent organization, pod, or inbox without prior knowledge.
60
+ *
61
+ * **CLI:**
62
+ * ```bash
63
+ * agentmail auth me
64
+ * ```
65
+ *
66
+ * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
67
+ *
68
+ * @example
69
+ * await client.auth.me()
70
+ */
71
+ me(requestOptions) {
72
+ return core.HttpResponsePromise.fromPromise(this.__me(requestOptions));
73
+ }
74
+ __me(requestOptions) {
75
+ return __awaiter(this, void 0, void 0, function* () {
76
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
77
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
78
+ 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);
79
+ const _response = yield core.fetcher({
80
+ 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)
81
+ .http, "/v0/auth/me"),
82
+ method: "GET",
83
+ headers: _headers,
84
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
85
+ 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,
86
+ 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,
87
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
88
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
89
+ logging: this._options.logging,
90
+ });
91
+ if (_response.ok) {
92
+ return {
93
+ data: serializers.Identity.parseOrThrow(_response.body, {
94
+ unrecognizedObjectKeys: "passthrough",
95
+ allowUnrecognizedUnionMembers: true,
96
+ allowUnrecognizedEnumValues: true,
97
+ skipValidation: true,
98
+ breadcrumbsPrefix: ["response"],
99
+ }),
100
+ rawResponse: _response.rawResponse,
101
+ };
102
+ }
103
+ if (_response.error.reason === "status-code") {
104
+ throw new errors.AgentMailError({
105
+ statusCode: _response.error.statusCode,
106
+ body: _response.error.body,
107
+ rawResponse: _response.rawResponse,
108
+ });
109
+ }
110
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v0/auth/me");
111
+ });
112
+ }
113
+ }
114
+ exports.AuthClient = AuthClient;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ export { AuthClient } from "./client/Client.js";
2
+ export * from "./client/index.js";
@@ -0,0 +1,21 @@
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
15
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
16
+ };
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.AuthClient = void 0;
19
+ var Client_js_1 = require("./client/Client.js");
20
+ Object.defineProperty(exports, "AuthClient", { enumerable: true, get: function () { return Client_js_1.AuthClient; } });
21
+ __exportStar(require("./client/index.js"), exports);
@@ -0,0 +1,2 @@
1
+ export * from "./client/index.js";
2
+ export * from "./types/index.js";
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./client/index.js"), exports);
18
+ __exportStar(require("./types/index.js"), exports);
@@ -0,0 +1,19 @@
1
+ import type * as AgentMail from "../../../index.js";
2
+ /**
3
+ * Identity and scope of the authenticated credential.
4
+ */
5
+ export interface Identity {
6
+ scopeType: AgentMail.ScopeType;
7
+ /**
8
+ * ID of the most specific scope the credential is bound to.
9
+ * Equals inbox_id when scope_type is inbox, pod_id when pod, organization_id when organization.
10
+ */
11
+ scopeId: string;
12
+ organizationId: AgentMail.OrganizationId;
13
+ /** ID of the pod the credential is scoped to. Present when scope_type is pod or inbox. */
14
+ podId?: string;
15
+ /** ID of the inbox the credential is scoped to. Present when scope_type is inbox. */
16
+ inboxId?: string;
17
+ /** ID of the API key used to authenticate. Absent for JWT and proxy credentials. */
18
+ apiKeyId?: string;
19
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,7 @@
1
+ /** The scope tier the authenticated credential is bound to. */
2
+ export declare const ScopeType: {
3
+ readonly Organization: "organization";
4
+ readonly Pod: "pod";
5
+ readonly Inbox: "inbox";
6
+ };
7
+ export type ScopeType = (typeof ScopeType)[keyof typeof ScopeType];
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.ScopeType = void 0;
5
+ /** The scope tier the authenticated credential is bound to. */
6
+ exports.ScopeType = {
7
+ Organization: "organization",
8
+ Pod: "pod",
9
+ Inbox: "inbox",
10
+ };
@@ -0,0 +1,2 @@
1
+ export * from "./Identity.js";
2
+ export * from "./ScopeType.js";
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./Identity.js"), exports);
18
+ __exportStar(require("./ScopeType.js"), exports);
@@ -5,6 +5,8 @@ export * as apiKeys from "./apiKeys/index.js";
5
5
  export * from "./apiKeys/types/index.js";
6
6
  export * as attachments from "./attachments/index.js";
7
7
  export * from "./attachments/types/index.js";
8
+ export * as auth from "./auth/index.js";
9
+ export * from "./auth/types/index.js";
8
10
  export * from "./domains/client/requests/index.js";
9
11
  export * as domains from "./domains/index.js";
10
12
  export * from "./domains/types/index.js";
@@ -36,7 +36,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
36
36
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.websockets = exports.webhooks = exports.threads = exports.pods = exports.organizations = exports.metrics = exports.messages = exports.lists = exports.inboxes = exports.inboxEvents = exports.events = exports.drafts = exports.domains = exports.attachments = exports.apiKeys = exports.agent = void 0;
39
+ exports.websockets = exports.webhooks = exports.threads = exports.pods = exports.organizations = exports.metrics = exports.messages = exports.lists = exports.inboxes = exports.inboxEvents = exports.events = exports.drafts = exports.domains = exports.auth = exports.attachments = exports.apiKeys = exports.agent = void 0;
40
40
  exports.agent = __importStar(require("./agent/index.js"));
41
41
  __exportStar(require("./agent/types/index.js"), exports);
42
42
  __exportStar(require("./apiKeys/client/requests/index.js"), exports);
@@ -44,6 +44,8 @@ exports.apiKeys = __importStar(require("./apiKeys/index.js"));
44
44
  __exportStar(require("./apiKeys/types/index.js"), exports);
45
45
  exports.attachments = __importStar(require("./attachments/index.js"));
46
46
  __exportStar(require("./attachments/types/index.js"), exports);
47
+ exports.auth = __importStar(require("./auth/index.js"));
48
+ __exportStar(require("./auth/types/index.js"), exports);
47
49
  __exportStar(require("./domains/client/requests/index.js"), exports);
48
50
  exports.domains = __importStar(require("./domains/index.js"));
49
51
  __exportStar(require("./domains/types/index.js"), exports);
@@ -0,0 +1 @@
1
+ export * from "./types/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("./types/index.js"), exports);
@@ -0,0 +1,16 @@
1
+ import type * as AgentMail from "../../../../api/index.js";
2
+ import * as core from "../../../../core/index.js";
3
+ import type * as serializers from "../../../index.js";
4
+ import { OrganizationId } from "../../../types/OrganizationId.js";
5
+ import { ScopeType } from "./ScopeType.js";
6
+ export declare const Identity: core.serialization.ObjectSchema<serializers.Identity.Raw, AgentMail.Identity>;
7
+ export declare namespace Identity {
8
+ interface Raw {
9
+ scope_type: ScopeType.Raw;
10
+ scope_id: string;
11
+ organization_id: OrganizationId.Raw;
12
+ pod_id?: string | null;
13
+ inbox_id?: string | null;
14
+ api_key_id?: string | null;
15
+ }
16
+ }
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.Identity = void 0;
38
+ const core = __importStar(require("../../../../core/index.js"));
39
+ const OrganizationId_js_1 = require("../../../types/OrganizationId.js");
40
+ const ScopeType_js_1 = require("./ScopeType.js");
41
+ exports.Identity = core.serialization.object({
42
+ scopeType: core.serialization.property("scope_type", ScopeType_js_1.ScopeType),
43
+ scopeId: core.serialization.property("scope_id", core.serialization.string()),
44
+ organizationId: core.serialization.property("organization_id", OrganizationId_js_1.OrganizationId),
45
+ podId: core.serialization.property("pod_id", core.serialization.string().optional()),
46
+ inboxId: core.serialization.property("inbox_id", core.serialization.string().optional()),
47
+ apiKeyId: core.serialization.property("api_key_id", core.serialization.string().optional()),
48
+ });
@@ -0,0 +1,7 @@
1
+ import type * as AgentMail from "../../../../api/index.js";
2
+ import * as core from "../../../../core/index.js";
3
+ import type * as serializers from "../../../index.js";
4
+ export declare const ScopeType: core.serialization.Schema<serializers.ScopeType.Raw, AgentMail.ScopeType>;
5
+ export declare namespace ScopeType {
6
+ type Raw = "organization" | "pod" | "inbox";
7
+ }
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.ScopeType = void 0;
38
+ const core = __importStar(require("../../../../core/index.js"));
39
+ exports.ScopeType = core.serialization.enum_(["organization", "pod", "inbox"]);
@@ -0,0 +1,2 @@
1
+ export * from "./Identity.js";
2
+ export * from "./ScopeType.js";
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./Identity.js"), exports);
18
+ __exportStar(require("./ScopeType.js"), exports);
@@ -4,6 +4,8 @@ export * as apiKeys from "./apiKeys/index.js";
4
4
  export * from "./apiKeys/types/index.js";
5
5
  export * as attachments from "./attachments/index.js";
6
6
  export * from "./attachments/types/index.js";
7
+ export * as auth from "./auth/index.js";
8
+ export * from "./auth/types/index.js";
7
9
  export * as domains from "./domains/index.js";
8
10
  export * from "./domains/types/index.js";
9
11
  export * as drafts from "./drafts/index.js";
@@ -36,13 +36,15 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
36
36
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.websockets = exports.webhooks = exports.threads = exports.pods = exports.organizations = exports.metrics = exports.messages = exports.lists = exports.inboxes = exports.inboxEvents = exports.events = exports.drafts = exports.domains = exports.attachments = exports.apiKeys = exports.agent = void 0;
39
+ exports.websockets = exports.webhooks = exports.threads = exports.pods = exports.organizations = exports.metrics = exports.messages = exports.lists = exports.inboxes = exports.inboxEvents = exports.events = exports.drafts = exports.domains = exports.auth = exports.attachments = exports.apiKeys = exports.agent = void 0;
40
40
  exports.agent = __importStar(require("./agent/index.js"));
41
41
  __exportStar(require("./agent/types/index.js"), exports);
42
42
  exports.apiKeys = __importStar(require("./apiKeys/index.js"));
43
43
  __exportStar(require("./apiKeys/types/index.js"), exports);
44
44
  exports.attachments = __importStar(require("./attachments/index.js"));
45
45
  __exportStar(require("./attachments/types/index.js"), exports);
46
+ exports.auth = __importStar(require("./auth/index.js"));
47
+ __exportStar(require("./auth/types/index.js"), exports);
46
48
  exports.domains = __importStar(require("./domains/index.js"));
47
49
  __exportStar(require("./domains/types/index.js"), exports);
48
50
  exports.drafts = __importStar(require("./drafts/index.js"));
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.5.7";
1
+ export declare const SDK_VERSION = "0.5.8";
@@ -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.5.7";
4
+ exports.SDK_VERSION = "0.5.8";
@@ -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.5.7",
10
- "User-Agent": "agentmail/0.5.7",
9
+ "X-Fern-SDK-Version": "0.5.8",
10
+ "User-Agent": "agentmail/0.5.8",
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);
@@ -1,5 +1,6 @@
1
1
  import { AgentClient } from "./api/resources/agent/client/Client.mjs";
2
2
  import { ApiKeysClient } from "./api/resources/apiKeys/client/Client.mjs";
3
+ import { AuthClient } from "./api/resources/auth/client/Client.mjs";
3
4
  import { DomainsClient } from "./api/resources/domains/client/Client.mjs";
4
5
  import { DraftsClient } from "./api/resources/drafts/client/Client.mjs";
5
6
  import { InboxesClient } from "./api/resources/inboxes/client/Client.mjs";
@@ -25,6 +26,7 @@ export declare class AgentMailClient {
25
26
  protected _webhooks: WebhooksClient | undefined;
26
27
  protected _agent: AgentClient | undefined;
27
28
  protected _apiKeys: ApiKeysClient | undefined;
29
+ protected _auth: AuthClient | undefined;
28
30
  protected _domains: DomainsClient | undefined;
29
31
  protected _drafts: DraftsClient | undefined;
30
32
  protected _lists: ListsClient | undefined;
@@ -38,6 +40,7 @@ export declare class AgentMailClient {
38
40
  get webhooks(): WebhooksClient;
39
41
  get agent(): AgentClient;
40
42
  get apiKeys(): ApiKeysClient;
43
+ get auth(): AuthClient;
41
44
  get domains(): DomainsClient;
42
45
  get drafts(): DraftsClient;
43
46
  get lists(): ListsClient;
@@ -10,6 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  import { AgentClient } from "./api/resources/agent/client/Client.mjs";
12
12
  import { ApiKeysClient } from "./api/resources/apiKeys/client/Client.mjs";
13
+ import { AuthClient } from "./api/resources/auth/client/Client.mjs";
13
14
  import { DomainsClient } from "./api/resources/domains/client/Client.mjs";
14
15
  import { DraftsClient } from "./api/resources/drafts/client/Client.mjs";
15
16
  import { InboxesClient } from "./api/resources/inboxes/client/Client.mjs";
@@ -47,6 +48,10 @@ export class AgentMailClient {
47
48
  var _a;
48
49
  return ((_a = this._apiKeys) !== null && _a !== void 0 ? _a : (this._apiKeys = new ApiKeysClient(this._options)));
49
50
  }
51
+ get auth() {
52
+ var _a;
53
+ return ((_a = this._auth) !== null && _a !== void 0 ? _a : (this._auth = new AuthClient(this._options)));
54
+ }
50
55
  get domains() {
51
56
  var _a;
52
57
  return ((_a = this._domains) !== null && _a !== void 0 ? _a : (this._domains = new DomainsClient(this._options)));
@@ -0,0 +1,28 @@
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 type * as AgentMail from "../../../index.mjs";
5
+ export declare namespace AuthClient {
6
+ type Options = BaseClientOptions;
7
+ interface RequestOptions extends BaseRequestOptions {
8
+ }
9
+ }
10
+ export declare class AuthClient {
11
+ protected readonly _options: NormalizedClientOptionsWithAuth<AuthClient.Options>;
12
+ constructor(options?: AuthClient.Options);
13
+ /**
14
+ * Returns the identity and scope of the authenticated credential. Useful when a client holds a pod-scoped or inbox-scoped API key and needs to discover the parent organization, pod, or inbox without prior knowledge.
15
+ *
16
+ * **CLI:**
17
+ * ```bash
18
+ * agentmail auth me
19
+ * ```
20
+ *
21
+ * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
22
+ *
23
+ * @example
24
+ * await client.auth.me()
25
+ */
26
+ me(requestOptions?: AuthClient.RequestOptions): core.HttpResponsePromise<AgentMail.Identity>;
27
+ private __me;
28
+ }
@@ -0,0 +1,77 @@
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
+ export class AuthClient {
19
+ constructor(options = {}) {
20
+ this._options = normalizeClientOptionsWithAuth(options);
21
+ }
22
+ /**
23
+ * Returns the identity and scope of the authenticated credential. Useful when a client holds a pod-scoped or inbox-scoped API key and needs to discover the parent organization, pod, or inbox without prior knowledge.
24
+ *
25
+ * **CLI:**
26
+ * ```bash
27
+ * agentmail auth me
28
+ * ```
29
+ *
30
+ * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
31
+ *
32
+ * @example
33
+ * await client.auth.me()
34
+ */
35
+ me(requestOptions) {
36
+ return core.HttpResponsePromise.fromPromise(this.__me(requestOptions));
37
+ }
38
+ __me(requestOptions) {
39
+ return __awaiter(this, void 0, void 0, function* () {
40
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
41
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
42
+ 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);
43
+ const _response = yield core.fetcher({
44
+ 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)
45
+ .http, "/v0/auth/me"),
46
+ method: "GET",
47
+ headers: _headers,
48
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
49
+ 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,
50
+ 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,
51
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
52
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
53
+ logging: this._options.logging,
54
+ });
55
+ if (_response.ok) {
56
+ return {
57
+ data: serializers.Identity.parseOrThrow(_response.body, {
58
+ unrecognizedObjectKeys: "passthrough",
59
+ allowUnrecognizedUnionMembers: true,
60
+ allowUnrecognizedEnumValues: true,
61
+ skipValidation: true,
62
+ breadcrumbsPrefix: ["response"],
63
+ }),
64
+ rawResponse: _response.rawResponse,
65
+ };
66
+ }
67
+ if (_response.error.reason === "status-code") {
68
+ throw new errors.AgentMailError({
69
+ statusCode: _response.error.statusCode,
70
+ body: _response.error.body,
71
+ rawResponse: _response.rawResponse,
72
+ });
73
+ }
74
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v0/auth/me");
75
+ });
76
+ }
77
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ export { AuthClient } from "./client/Client.mjs";
2
+ export * from "./client/index.mjs";
@@ -0,0 +1,3 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export { AuthClient } from "./client/Client.mjs";
3
+ export * from "./client/index.mjs";
@@ -0,0 +1,2 @@
1
+ export * from "./client/index.mjs";
2
+ export * from "./types/index.mjs";
@@ -0,0 +1,2 @@
1
+ export * from "./client/index.mjs";
2
+ export * from "./types/index.mjs";
@@ -0,0 +1,19 @@
1
+ import type * as AgentMail from "../../../index.mjs";
2
+ /**
3
+ * Identity and scope of the authenticated credential.
4
+ */
5
+ export interface Identity {
6
+ scopeType: AgentMail.ScopeType;
7
+ /**
8
+ * ID of the most specific scope the credential is bound to.
9
+ * Equals inbox_id when scope_type is inbox, pod_id when pod, organization_id when organization.
10
+ */
11
+ scopeId: string;
12
+ organizationId: AgentMail.OrganizationId;
13
+ /** ID of the pod the credential is scoped to. Present when scope_type is pod or inbox. */
14
+ podId?: string;
15
+ /** ID of the inbox the credential is scoped to. Present when scope_type is inbox. */
16
+ inboxId?: string;
17
+ /** ID of the API key used to authenticate. Absent for JWT and proxy credentials. */
18
+ apiKeyId?: string;
19
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,7 @@
1
+ /** The scope tier the authenticated credential is bound to. */
2
+ export declare const ScopeType: {
3
+ readonly Organization: "organization";
4
+ readonly Pod: "pod";
5
+ readonly Inbox: "inbox";
6
+ };
7
+ export type ScopeType = (typeof ScopeType)[keyof typeof ScopeType];
@@ -0,0 +1,7 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ /** The scope tier the authenticated credential is bound to. */
3
+ export const ScopeType = {
4
+ Organization: "organization",
5
+ Pod: "pod",
6
+ Inbox: "inbox",
7
+ };
@@ -0,0 +1,2 @@
1
+ export * from "./Identity.mjs";
2
+ export * from "./ScopeType.mjs";
@@ -0,0 +1,2 @@
1
+ export * from "./Identity.mjs";
2
+ export * from "./ScopeType.mjs";
@@ -5,6 +5,8 @@ export * as apiKeys from "./apiKeys/index.mjs";
5
5
  export * from "./apiKeys/types/index.mjs";
6
6
  export * as attachments from "./attachments/index.mjs";
7
7
  export * from "./attachments/types/index.mjs";
8
+ export * as auth from "./auth/index.mjs";
9
+ export * from "./auth/types/index.mjs";
8
10
  export * from "./domains/client/requests/index.mjs";
9
11
  export * as domains from "./domains/index.mjs";
10
12
  export * from "./domains/types/index.mjs";
@@ -5,6 +5,8 @@ export * as apiKeys from "./apiKeys/index.mjs";
5
5
  export * from "./apiKeys/types/index.mjs";
6
6
  export * as attachments from "./attachments/index.mjs";
7
7
  export * from "./attachments/types/index.mjs";
8
+ export * as auth from "./auth/index.mjs";
9
+ export * from "./auth/types/index.mjs";
8
10
  export * from "./domains/client/requests/index.mjs";
9
11
  export * as domains from "./domains/index.mjs";
10
12
  export * from "./domains/types/index.mjs";
@@ -0,0 +1 @@
1
+ export * from "./types/index.mjs";
@@ -0,0 +1 @@
1
+ export * from "./types/index.mjs";
@@ -0,0 +1,16 @@
1
+ import type * as AgentMail from "../../../../api/index.mjs";
2
+ import * as core from "../../../../core/index.mjs";
3
+ import type * as serializers from "../../../index.mjs";
4
+ import { OrganizationId } from "../../../types/OrganizationId.mjs";
5
+ import { ScopeType } from "./ScopeType.mjs";
6
+ export declare const Identity: core.serialization.ObjectSchema<serializers.Identity.Raw, AgentMail.Identity>;
7
+ export declare namespace Identity {
8
+ interface Raw {
9
+ scope_type: ScopeType.Raw;
10
+ scope_id: string;
11
+ organization_id: OrganizationId.Raw;
12
+ pod_id?: string | null;
13
+ inbox_id?: string | null;
14
+ api_key_id?: string | null;
15
+ }
16
+ }
@@ -0,0 +1,12 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ import * as core from "../../../../core/index.mjs";
3
+ import { OrganizationId } from "../../../types/OrganizationId.mjs";
4
+ import { ScopeType } from "./ScopeType.mjs";
5
+ export const Identity = core.serialization.object({
6
+ scopeType: core.serialization.property("scope_type", ScopeType),
7
+ scopeId: core.serialization.property("scope_id", core.serialization.string()),
8
+ organizationId: core.serialization.property("organization_id", OrganizationId),
9
+ podId: core.serialization.property("pod_id", core.serialization.string().optional()),
10
+ inboxId: core.serialization.property("inbox_id", core.serialization.string().optional()),
11
+ apiKeyId: core.serialization.property("api_key_id", core.serialization.string().optional()),
12
+ });
@@ -0,0 +1,7 @@
1
+ import type * as AgentMail from "../../../../api/index.mjs";
2
+ import * as core from "../../../../core/index.mjs";
3
+ import type * as serializers from "../../../index.mjs";
4
+ export declare const ScopeType: core.serialization.Schema<serializers.ScopeType.Raw, AgentMail.ScopeType>;
5
+ export declare namespace ScopeType {
6
+ type Raw = "organization" | "pod" | "inbox";
7
+ }
@@ -0,0 +1,3 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ import * as core from "../../../../core/index.mjs";
3
+ export const ScopeType = core.serialization.enum_(["organization", "pod", "inbox"]);
@@ -0,0 +1,2 @@
1
+ export * from "./Identity.mjs";
2
+ export * from "./ScopeType.mjs";
@@ -0,0 +1,2 @@
1
+ export * from "./Identity.mjs";
2
+ export * from "./ScopeType.mjs";
@@ -4,6 +4,8 @@ export * as apiKeys from "./apiKeys/index.mjs";
4
4
  export * from "./apiKeys/types/index.mjs";
5
5
  export * as attachments from "./attachments/index.mjs";
6
6
  export * from "./attachments/types/index.mjs";
7
+ export * as auth from "./auth/index.mjs";
8
+ export * from "./auth/types/index.mjs";
7
9
  export * as domains from "./domains/index.mjs";
8
10
  export * from "./domains/types/index.mjs";
9
11
  export * as drafts from "./drafts/index.mjs";
@@ -4,6 +4,8 @@ export * as apiKeys from "./apiKeys/index.mjs";
4
4
  export * from "./apiKeys/types/index.mjs";
5
5
  export * as attachments from "./attachments/index.mjs";
6
6
  export * from "./attachments/types/index.mjs";
7
+ export * as auth from "./auth/index.mjs";
8
+ export * from "./auth/types/index.mjs";
7
9
  export * as domains from "./domains/index.mjs";
8
10
  export * from "./domains/types/index.mjs";
9
11
  export * as drafts from "./drafts/index.mjs";
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.5.7";
1
+ export declare const SDK_VERSION = "0.5.8";
@@ -1 +1 @@
1
- export const SDK_VERSION = "0.5.7";
1
+ export const SDK_VERSION = "0.5.8";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentmail",
3
- "version": "0.5.7",
3
+ "version": "0.5.8",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
@@ -88,6 +88,17 @@
88
88
  },
89
89
  "default": "./dist/cjs/api/resources/apiKeys/exports.js"
90
90
  },
91
+ "./auth": {
92
+ "import": {
93
+ "types": "./dist/esm/api/resources/auth/exports.d.mts",
94
+ "default": "./dist/esm/api/resources/auth/exports.mjs"
95
+ },
96
+ "require": {
97
+ "types": "./dist/cjs/api/resources/auth/exports.d.ts",
98
+ "default": "./dist/cjs/api/resources/auth/exports.js"
99
+ },
100
+ "default": "./dist/cjs/api/resources/auth/exports.js"
101
+ },
91
102
  "./domains": {
92
103
  "import": {
93
104
  "types": "./dist/esm/api/resources/domains/exports.d.mts",
package/reference.md CHANGED
@@ -1295,6 +1295,67 @@ await client.apiKeys.delete("api_key_id");
1295
1295
  </dl>
1296
1296
 
1297
1297
 
1298
+ </dd>
1299
+ </dl>
1300
+ </details>
1301
+
1302
+ ## Auth
1303
+ <details><summary><code>client.auth.<a href="/src/api/resources/auth/client/Client.ts">me</a>() -> AgentMail.Identity</code></summary>
1304
+ <dl>
1305
+ <dd>
1306
+
1307
+ #### 📝 Description
1308
+
1309
+ <dl>
1310
+ <dd>
1311
+
1312
+ <dl>
1313
+ <dd>
1314
+
1315
+ Returns the identity and scope of the authenticated credential. Useful when a client holds a pod-scoped or inbox-scoped API key and needs to discover the parent organization, pod, or inbox without prior knowledge.
1316
+
1317
+ **CLI:**
1318
+ ```bash
1319
+ agentmail auth me
1320
+ ```
1321
+ </dd>
1322
+ </dl>
1323
+ </dd>
1324
+ </dl>
1325
+
1326
+ #### 🔌 Usage
1327
+
1328
+ <dl>
1329
+ <dd>
1330
+
1331
+ <dl>
1332
+ <dd>
1333
+
1334
+ ```typescript
1335
+ await client.auth.me();
1336
+
1337
+ ```
1338
+ </dd>
1339
+ </dl>
1340
+ </dd>
1341
+ </dl>
1342
+
1343
+ #### ⚙️ Parameters
1344
+
1345
+ <dl>
1346
+ <dd>
1347
+
1348
+ <dl>
1349
+ <dd>
1350
+
1351
+ **requestOptions:** `AuthClient.RequestOptions`
1352
+
1353
+ </dd>
1354
+ </dl>
1355
+ </dd>
1356
+ </dl>
1357
+
1358
+
1298
1359
  </dd>
1299
1360
  </dl>
1300
1361
  </details>