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.
- package/dist/cjs/BaseClient.js +2 -2
- package/dist/cjs/api/resources/apiKeys/types/ApiKey.d.ts +2 -0
- package/dist/cjs/api/resources/apiKeys/types/CreateApiKeyResponse.d.ts +2 -0
- package/dist/cjs/api/resources/inboxes/resources/threads/client/Client.d.ts +4 -1
- package/dist/cjs/api/resources/inboxes/resources/threads/client/Client.js +12 -5
- package/dist/cjs/api/resources/inboxes/resources/threads/client/requests/DeleteThreadRequest.d.ts +8 -0
- package/dist/cjs/api/resources/inboxes/resources/threads/client/requests/DeleteThreadRequest.js +3 -0
- package/dist/cjs/api/resources/inboxes/resources/threads/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/resources/pods/client/Client.d.ts +3 -0
- package/dist/cjs/api/resources/pods/client/Client.js +15 -10
- package/dist/cjs/api/resources/pods/resources/apiKeys/client/Client.d.ts +52 -0
- package/dist/cjs/api/resources/pods/resources/apiKeys/client/Client.js +262 -0
- package/dist/cjs/api/resources/pods/resources/apiKeys/client/index.d.ts +1 -0
- package/dist/cjs/api/resources/pods/resources/apiKeys/client/index.js +17 -0
- package/dist/cjs/api/resources/pods/resources/apiKeys/client/requests/ListApiKeysRequest.d.ts +9 -0
- package/dist/cjs/api/resources/pods/resources/apiKeys/client/requests/ListApiKeysRequest.js +3 -0
- package/dist/cjs/api/resources/pods/resources/apiKeys/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/resources/pods/resources/apiKeys/client/requests/index.js +2 -0
- package/dist/cjs/api/resources/pods/resources/apiKeys/index.d.ts +1 -0
- package/dist/cjs/api/resources/pods/resources/apiKeys/index.js +17 -0
- package/dist/cjs/api/resources/pods/resources/index.d.ts +2 -0
- package/dist/cjs/api/resources/pods/resources/index.js +3 -1
- package/dist/cjs/api/resources/threads/client/Client.js +2 -1
- package/dist/cjs/api/resources/threads/client/requests/ListThreadsRequest.d.ts +1 -0
- package/dist/cjs/serialization/resources/apiKeys/types/ApiKey.d.ts +1 -0
- package/dist/cjs/serialization/resources/apiKeys/types/ApiKey.js +1 -0
- package/dist/cjs/serialization/resources/apiKeys/types/CreateApiKeyResponse.d.ts +1 -0
- package/dist/cjs/serialization/resources/apiKeys/types/CreateApiKeyResponse.js +1 -0
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.mjs +2 -2
- package/dist/esm/api/resources/apiKeys/types/ApiKey.d.mts +2 -0
- package/dist/esm/api/resources/apiKeys/types/CreateApiKeyResponse.d.mts +2 -0
- package/dist/esm/api/resources/inboxes/resources/threads/client/Client.d.mts +4 -1
- package/dist/esm/api/resources/inboxes/resources/threads/client/Client.mjs +12 -5
- package/dist/esm/api/resources/inboxes/resources/threads/client/requests/DeleteThreadRequest.d.mts +8 -0
- package/dist/esm/api/resources/inboxes/resources/threads/client/requests/DeleteThreadRequest.mjs +2 -0
- package/dist/esm/api/resources/inboxes/resources/threads/client/requests/index.d.mts +1 -0
- package/dist/esm/api/resources/pods/client/Client.d.mts +3 -0
- package/dist/esm/api/resources/pods/client/Client.mjs +5 -0
- package/dist/esm/api/resources/pods/resources/apiKeys/client/Client.d.mts +52 -0
- package/dist/esm/api/resources/pods/resources/apiKeys/client/Client.mjs +225 -0
- package/dist/esm/api/resources/pods/resources/apiKeys/client/index.d.mts +1 -0
- package/dist/esm/api/resources/pods/resources/apiKeys/client/index.mjs +1 -0
- package/dist/esm/api/resources/pods/resources/apiKeys/client/requests/ListApiKeysRequest.d.mts +9 -0
- package/dist/esm/api/resources/pods/resources/apiKeys/client/requests/ListApiKeysRequest.mjs +2 -0
- package/dist/esm/api/resources/pods/resources/apiKeys/client/requests/index.d.mts +1 -0
- package/dist/esm/api/resources/pods/resources/apiKeys/client/requests/index.mjs +1 -0
- package/dist/esm/api/resources/pods/resources/apiKeys/index.d.mts +1 -0
- package/dist/esm/api/resources/pods/resources/apiKeys/index.mjs +1 -0
- package/dist/esm/api/resources/pods/resources/index.d.mts +2 -0
- package/dist/esm/api/resources/pods/resources/index.mjs +2 -0
- package/dist/esm/api/resources/threads/client/Client.mjs +2 -1
- package/dist/esm/api/resources/threads/client/requests/ListThreadsRequest.d.mts +1 -0
- package/dist/esm/serialization/resources/apiKeys/types/ApiKey.d.mts +1 -0
- package/dist/esm/serialization/resources/apiKeys/types/ApiKey.mjs +1 -0
- package/dist/esm/serialization/resources/apiKeys/types/CreateApiKeyResponse.d.mts +1 -0
- package/dist/esm/serialization/resources/apiKeys/types/CreateApiKeyResponse.mjs +1 -0
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/dist/llms-full.txt +2275 -97
- package/dist/llms.txt +6 -2
- package/package.json +1 -1
- package/reference.md +197 -1
package/dist/cjs/BaseClient.js
CHANGED
|
@@ -43,8 +43,8 @@ function normalizeClientOptions(options) {
|
|
|
43
43
|
const headers = (0, headers_js_1.mergeHeaders)({
|
|
44
44
|
"X-Fern-Language": "JavaScript",
|
|
45
45
|
"X-Fern-SDK-Name": "agentmail",
|
|
46
|
-
"X-Fern-SDK-Version": "0.4.
|
|
47
|
-
"User-Agent": "agentmail/0.4.
|
|
46
|
+
"X-Fern-SDK-Version": "0.4.2",
|
|
47
|
+
"User-Agent": "agentmail/0.4.2",
|
|
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);
|
|
@@ -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;
|
|
@@ -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
|
}
|
|
@@ -269,8 +269,11 @@ class ThreadsClient {
|
|
|
269
269
|
});
|
|
270
270
|
}
|
|
271
271
|
/**
|
|
272
|
+
* 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.
|
|
273
|
+
*
|
|
272
274
|
* @param {AgentMail.inboxes.InboxId} inbox_id
|
|
273
275
|
* @param {AgentMail.ThreadId} thread_id
|
|
276
|
+
* @param {AgentMail.inboxes.DeleteThreadRequest} request
|
|
274
277
|
* @param {ThreadsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
275
278
|
*
|
|
276
279
|
* @throws {@link AgentMail.NotFoundError}
|
|
@@ -278,12 +281,16 @@ class ThreadsClient {
|
|
|
278
281
|
* @example
|
|
279
282
|
* await client.inboxes.threads.delete("inbox_id", "thread_id")
|
|
280
283
|
*/
|
|
281
|
-
delete(inbox_id, thread_id, requestOptions) {
|
|
282
|
-
return core.HttpResponsePromise.fromPromise(this.__delete(inbox_id, thread_id, requestOptions));
|
|
284
|
+
delete(inbox_id, thread_id, request = {}, requestOptions) {
|
|
285
|
+
return core.HttpResponsePromise.fromPromise(this.__delete(inbox_id, thread_id, request, requestOptions));
|
|
283
286
|
}
|
|
284
|
-
__delete(
|
|
285
|
-
return __awaiter(this,
|
|
287
|
+
__delete(inbox_id_1, thread_id_1) {
|
|
288
|
+
return __awaiter(this, arguments, void 0, function* (inbox_id, thread_id, request = {}, requestOptions) {
|
|
286
289
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
290
|
+
const { permanent } = request;
|
|
291
|
+
const _queryParams = {
|
|
292
|
+
permanent,
|
|
293
|
+
};
|
|
287
294
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
288
295
|
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);
|
|
289
296
|
const _response = yield core.fetcher({
|
|
@@ -291,7 +298,7 @@ class ThreadsClient {
|
|
|
291
298
|
.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 }))}`),
|
|
292
299
|
method: "DELETE",
|
|
293
300
|
headers: _headers,
|
|
294
|
-
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
301
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
295
302
|
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,
|
|
296
303
|
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,
|
|
297
304
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
@@ -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/
|
|
56
|
-
const Client_js_2 = require("../resources/
|
|
57
|
-
const Client_js_3 = require("../resources/
|
|
58
|
-
const Client_js_4 = require("../resources/
|
|
59
|
-
const Client_js_5 = require("../resources/
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
@@ -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 @@
|
|
|
1
|
+
export type { ListApiKeysRequest } from "./ListApiKeysRequest.js";
|
|
@@ -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);
|
|
@@ -36,7 +36,9 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
36
36
|
};
|
|
37
37
|
})();
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.threads = exports.lists = exports.inboxes = exports.drafts = exports.domains = void 0;
|
|
39
|
+
exports.threads = exports.lists = exports.inboxes = exports.drafts = exports.domains = exports.apiKeys = void 0;
|
|
40
|
+
__exportStar(require("./apiKeys/client/requests/index.js"), exports);
|
|
41
|
+
exports.apiKeys = __importStar(require("./apiKeys/index.js"));
|
|
40
42
|
__exportStar(require("./domains/client/requests/index.js"), exports);
|
|
41
43
|
exports.domains = __importStar(require("./domains/index.js"));
|
|
42
44
|
__exportStar(require("./drafts/client/requests/index.js"), exports);
|
|
@@ -72,7 +72,7 @@ class ThreadsClient {
|
|
|
72
72
|
__list() {
|
|
73
73
|
return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
|
|
74
74
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
75
|
-
const { limit, pageToken, labels, before, after, ascending, includeSpam, includeBlocked } = request;
|
|
75
|
+
const { limit, pageToken, labels, before, after, ascending, includeSpam, includeBlocked, includeTrash } = request;
|
|
76
76
|
const _queryParams = {
|
|
77
77
|
limit,
|
|
78
78
|
page_token: pageToken,
|
|
@@ -91,6 +91,7 @@ class ThreadsClient {
|
|
|
91
91
|
ascending,
|
|
92
92
|
include_spam: includeSpam,
|
|
93
93
|
include_blocked: includeBlocked,
|
|
94
|
+
include_trash: includeTrash,
|
|
94
95
|
};
|
|
95
96
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
96
97
|
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);
|
|
@@ -44,6 +44,7 @@ exports.ApiKey = core.serialization.object({
|
|
|
44
44
|
apiKeyId: core.serialization.property("api_key_id", ApiKeyId_js_1.ApiKeyId),
|
|
45
45
|
prefix: Prefix_js_1.Prefix,
|
|
46
46
|
name: Name_js_1.Name,
|
|
47
|
+
podId: core.serialization.property("pod_id", core.serialization.string().optional()),
|
|
47
48
|
usedAt: core.serialization.property("used_at", core.serialization.date().optional()),
|
|
48
49
|
createdAt: core.serialization.property("created_at", CreatedAt_js_1.CreatedAt),
|
|
49
50
|
});
|