agentmail 0.1.6 → 0.1.7
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/README.md +63 -0
- package/dist/cjs/BaseClient.d.ts +14 -1
- package/dist/cjs/BaseClient.js +59 -0
- package/dist/cjs/Client.d.ts +30 -29
- package/dist/cjs/Client.js +12 -53
- package/dist/cjs/api/resources/apiKeys/client/Client.d.ts +12 -12
- package/dist/cjs/api/resources/apiKeys/client/Client.js +29 -31
- package/dist/cjs/api/resources/domains/client/Client.d.ts +19 -19
- package/dist/cjs/api/resources/domains/client/Client.js +60 -53
- package/dist/cjs/api/resources/drafts/client/Client.d.ts +10 -10
- package/dist/cjs/api/resources/drafts/client/Client.js +23 -28
- package/dist/cjs/api/resources/events/types/DomainVerifiedEvent.d.ts +7 -0
- package/dist/cjs/api/resources/{webhooks → events}/types/EventType.d.ts +1 -0
- package/dist/cjs/api/resources/{webhooks → events}/types/EventType.js +1 -0
- package/dist/cjs/api/resources/events/types/EventTypes.d.ts +5 -0
- package/dist/cjs/api/resources/events/types/EventTypes.js +3 -0
- package/dist/cjs/api/resources/events/types/index.d.ts +3 -0
- package/dist/cjs/api/resources/events/types/index.js +3 -0
- package/dist/cjs/api/resources/inboxes/client/Client.d.ts +30 -30
- package/dist/cjs/api/resources/inboxes/client/Client.js +55 -51
- package/dist/cjs/api/resources/inboxes/resources/drafts/client/Client.d.ts +27 -27
- package/dist/cjs/api/resources/inboxes/resources/drafts/client/Client.js +77 -70
- package/dist/cjs/api/resources/inboxes/resources/messages/client/Client.d.ts +25 -25
- package/dist/cjs/api/resources/inboxes/resources/messages/client/Client.js +83 -73
- package/dist/cjs/api/resources/inboxes/resources/metrics/client/Client.d.ts +8 -8
- package/dist/cjs/api/resources/inboxes/resources/metrics/client/Client.js +17 -25
- package/dist/cjs/api/resources/inboxes/resources/threads/client/Client.d.ts +17 -17
- package/dist/cjs/api/resources/inboxes/resources/threads/client/Client.js +51 -50
- package/dist/cjs/api/resources/metrics/client/Client.d.ts +7 -7
- package/dist/cjs/api/resources/metrics/client/Client.js +12 -20
- package/dist/cjs/api/resources/pods/client/Client.d.ts +27 -27
- package/dist/cjs/api/resources/pods/client/Client.js +44 -43
- package/dist/cjs/api/resources/pods/resources/domains/client/Client.d.ts +15 -15
- package/dist/cjs/api/resources/pods/resources/domains/client/Client.js +41 -43
- package/dist/cjs/api/resources/pods/resources/drafts/client/Client.d.ts +12 -12
- package/dist/cjs/api/resources/pods/resources/drafts/client/Client.js +30 -35
- package/dist/cjs/api/resources/pods/resources/inboxes/client/Client.d.ts +19 -19
- package/dist/cjs/api/resources/pods/resources/inboxes/client/Client.js +53 -52
- package/dist/cjs/api/resources/pods/resources/threads/client/Client.d.ts +13 -13
- package/dist/cjs/api/resources/pods/resources/threads/client/Client.js +39 -41
- package/dist/cjs/api/resources/threads/client/Client.d.ts +11 -11
- package/dist/cjs/api/resources/threads/client/Client.js +32 -34
- package/dist/cjs/api/resources/webhooks/client/Client.d.ts +15 -15
- package/dist/cjs/api/resources/webhooks/client/Client.js +40 -39
- package/dist/cjs/api/resources/webhooks/types/CreateWebhookRequest.d.ts +1 -1
- package/dist/cjs/api/resources/webhooks/types/Webhook.d.ts +1 -1
- package/dist/cjs/api/resources/webhooks/types/index.d.ts +0 -2
- package/dist/cjs/api/resources/webhooks/types/index.js +0 -2
- package/dist/cjs/api/resources/websockets/client/Client.d.ts +6 -6
- package/dist/cjs/api/resources/websockets/client/Client.js +8 -19
- package/dist/cjs/api/resources/websockets/client/Socket.d.ts +1 -1
- package/dist/cjs/api/resources/websockets/types/Subscribe.d.ts +5 -1
- package/dist/cjs/api/resources/websockets/types/Subscribed.d.ts +5 -1
- package/dist/cjs/auth/BearerAuthProvider.d.ts +14 -0
- package/dist/cjs/auth/BearerAuthProvider.js +72 -0
- package/dist/cjs/auth/index.d.ts +1 -0
- package/dist/cjs/auth/index.js +5 -0
- package/dist/cjs/core/auth/AuthProvider.d.ts +4 -1
- package/dist/cjs/core/auth/BearerToken.d.ts +3 -1
- package/dist/cjs/core/auth/BearerToken.js +7 -6
- package/dist/cjs/core/auth/NoOpAuthProvider.d.ts +5 -0
- package/dist/cjs/core/auth/NoOpAuthProvider.js +9 -0
- package/dist/cjs/core/auth/index.d.ts +1 -0
- package/dist/cjs/core/auth/index.js +3 -1
- package/dist/cjs/core/exports.d.ts +1 -0
- package/dist/cjs/core/exports.js +1 -0
- package/dist/cjs/core/fetcher/Fetcher.d.ts +4 -1
- package/dist/cjs/core/fetcher/Fetcher.js +202 -9
- package/dist/cjs/core/fetcher/getRequestBody.d.ts +1 -1
- package/dist/cjs/core/fetcher/getRequestBody.js +4 -0
- package/dist/cjs/core/fetcher/makeRequest.d.ts +1 -1
- package/dist/cjs/core/fetcher/makeRequest.js +0 -2
- package/dist/cjs/core/fetcher/requestWithRetries.js +0 -9
- package/dist/cjs/core/fetcher/signals.d.ts +0 -6
- package/dist/cjs/core/fetcher/signals.js +0 -12
- package/dist/cjs/core/headers.js +6 -4
- package/dist/cjs/core/index.d.ts +1 -0
- package/dist/cjs/core/index.js +2 -1
- package/dist/cjs/core/logging/exports.d.ts +18 -0
- package/dist/cjs/core/logging/exports.js +45 -0
- package/dist/cjs/core/logging/index.d.ts +1 -0
- package/dist/cjs/core/logging/index.js +17 -0
- package/dist/cjs/core/logging/logger.d.ts +126 -0
- package/dist/cjs/core/logging/logger.js +144 -0
- package/dist/cjs/core/schemas/Schema.d.ts +1 -0
- package/dist/cjs/core/schemas/Schema.js +1 -0
- package/dist/cjs/core/schemas/builders/primitives/index.d.ts +1 -0
- package/dist/cjs/core/schemas/builders/primitives/index.js +3 -1
- package/dist/cjs/core/schemas/builders/primitives/never.d.ts +2 -0
- package/dist/cjs/core/schemas/builders/primitives/never.js +14 -0
- package/dist/cjs/core/url/join.js +0 -1
- package/dist/cjs/serialization/resources/events/types/DomainVerifiedEvent.d.ts +14 -0
- package/dist/cjs/serialization/resources/events/types/DomainVerifiedEvent.js +46 -0
- package/dist/cjs/serialization/resources/{webhooks → events}/types/EventType.d.ts +2 -2
- package/dist/cjs/serialization/resources/{webhooks → events}/types/EventType.js +1 -0
- package/dist/cjs/serialization/resources/{webhooks → events}/types/EventTypes.d.ts +1 -1
- package/dist/cjs/serialization/resources/events/types/index.d.ts +3 -0
- package/dist/cjs/serialization/resources/events/types/index.js +3 -0
- package/dist/cjs/serialization/resources/webhooks/types/CreateWebhookRequest.d.ts +1 -1
- package/dist/cjs/serialization/resources/webhooks/types/CreateWebhookRequest.js +1 -1
- package/dist/cjs/serialization/resources/webhooks/types/Webhook.d.ts +1 -1
- package/dist/cjs/serialization/resources/webhooks/types/Webhook.js +1 -1
- package/dist/cjs/serialization/resources/webhooks/types/index.d.ts +0 -2
- package/dist/cjs/serialization/resources/webhooks/types/index.js +0 -2
- package/dist/cjs/serialization/resources/websockets/client/socket/WebsocketsSocketResponse.d.ts +3 -2
- package/dist/cjs/serialization/resources/websockets/client/socket/WebsocketsSocketResponse.js +2 -0
- package/dist/cjs/serialization/resources/websockets/types/Subscribe.d.ts +4 -1
- package/dist/cjs/serialization/resources/websockets/types/Subscribe.js +4 -1
- package/dist/cjs/serialization/resources/websockets/types/Subscribed.d.ts +4 -1
- package/dist/cjs/serialization/resources/websockets/types/Subscribed.js +4 -1
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.d.mts +14 -1
- package/dist/esm/BaseClient.mjs +24 -1
- package/dist/esm/Client.d.mts +30 -29
- package/dist/esm/Client.mjs +21 -29
- package/dist/esm/api/resources/apiKeys/client/Client.d.mts +12 -12
- package/dist/esm/api/resources/apiKeys/client/Client.mjs +28 -30
- package/dist/esm/api/resources/domains/client/Client.d.mts +19 -19
- package/dist/esm/api/resources/domains/client/Client.mjs +59 -52
- package/dist/esm/api/resources/drafts/client/Client.d.mts +10 -10
- package/dist/esm/api/resources/drafts/client/Client.mjs +22 -27
- package/dist/esm/api/resources/events/types/DomainVerifiedEvent.d.mts +7 -0
- package/dist/esm/api/resources/{webhooks → events}/types/EventType.d.mts +1 -0
- package/dist/esm/api/resources/{webhooks → events}/types/EventType.mjs +1 -0
- package/dist/esm/api/resources/events/types/EventTypes.d.mts +5 -0
- package/dist/esm/api/resources/events/types/EventTypes.mjs +2 -0
- package/dist/esm/api/resources/events/types/index.d.mts +3 -0
- package/dist/esm/api/resources/events/types/index.mjs +3 -0
- package/dist/esm/api/resources/inboxes/client/Client.d.mts +30 -30
- package/dist/esm/api/resources/inboxes/client/Client.mjs +58 -54
- package/dist/esm/api/resources/inboxes/resources/drafts/client/Client.d.mts +27 -27
- package/dist/esm/api/resources/inboxes/resources/drafts/client/Client.mjs +76 -69
- package/dist/esm/api/resources/inboxes/resources/messages/client/Client.d.mts +25 -25
- package/dist/esm/api/resources/inboxes/resources/messages/client/Client.mjs +82 -72
- package/dist/esm/api/resources/inboxes/resources/metrics/client/Client.d.mts +8 -8
- package/dist/esm/api/resources/inboxes/resources/metrics/client/Client.mjs +16 -24
- package/dist/esm/api/resources/inboxes/resources/threads/client/Client.d.mts +17 -17
- package/dist/esm/api/resources/inboxes/resources/threads/client/Client.mjs +50 -49
- package/dist/esm/api/resources/metrics/client/Client.d.mts +7 -7
- package/dist/esm/api/resources/metrics/client/Client.mjs +11 -19
- package/dist/esm/api/resources/pods/client/Client.d.mts +27 -27
- package/dist/esm/api/resources/pods/client/Client.mjs +47 -46
- package/dist/esm/api/resources/pods/resources/domains/client/Client.d.mts +15 -15
- package/dist/esm/api/resources/pods/resources/domains/client/Client.mjs +40 -42
- package/dist/esm/api/resources/pods/resources/drafts/client/Client.d.mts +12 -12
- package/dist/esm/api/resources/pods/resources/drafts/client/Client.mjs +29 -34
- package/dist/esm/api/resources/pods/resources/inboxes/client/Client.d.mts +19 -19
- package/dist/esm/api/resources/pods/resources/inboxes/client/Client.mjs +52 -51
- package/dist/esm/api/resources/pods/resources/threads/client/Client.d.mts +13 -13
- package/dist/esm/api/resources/pods/resources/threads/client/Client.mjs +38 -40
- package/dist/esm/api/resources/threads/client/Client.d.mts +11 -11
- package/dist/esm/api/resources/threads/client/Client.mjs +31 -33
- package/dist/esm/api/resources/webhooks/client/Client.d.mts +15 -15
- package/dist/esm/api/resources/webhooks/client/Client.mjs +39 -38
- package/dist/esm/api/resources/webhooks/types/CreateWebhookRequest.d.mts +1 -1
- package/dist/esm/api/resources/webhooks/types/Webhook.d.mts +1 -1
- package/dist/esm/api/resources/webhooks/types/index.d.mts +0 -2
- package/dist/esm/api/resources/webhooks/types/index.mjs +0 -2
- package/dist/esm/api/resources/websockets/client/Client.d.mts +6 -6
- package/dist/esm/api/resources/websockets/client/Client.mjs +7 -18
- package/dist/esm/api/resources/websockets/client/Socket.d.mts +1 -1
- package/dist/esm/api/resources/websockets/types/Subscribe.d.mts +5 -1
- package/dist/esm/api/resources/websockets/types/Subscribed.d.mts +5 -1
- package/dist/esm/auth/BearerAuthProvider.d.mts +14 -0
- package/dist/esm/auth/BearerAuthProvider.mjs +35 -0
- package/dist/esm/auth/index.d.mts +1 -0
- package/dist/esm/auth/index.mjs +1 -0
- package/dist/esm/core/auth/AuthProvider.d.mts +4 -1
- package/dist/esm/core/auth/BearerToken.d.mts +3 -1
- package/dist/esm/core/auth/BearerToken.mjs +7 -6
- package/dist/esm/core/auth/NoOpAuthProvider.d.mts +5 -0
- package/dist/esm/core/auth/NoOpAuthProvider.mjs +5 -0
- package/dist/esm/core/auth/index.d.mts +1 -0
- package/dist/esm/core/auth/index.mjs +1 -0
- package/dist/esm/core/exports.d.mts +1 -0
- package/dist/esm/core/exports.mjs +1 -0
- package/dist/esm/core/fetcher/Fetcher.d.mts +4 -1
- package/dist/esm/core/fetcher/Fetcher.mjs +202 -9
- package/dist/esm/core/fetcher/getRequestBody.d.mts +1 -1
- package/dist/esm/core/fetcher/getRequestBody.mjs +4 -0
- package/dist/esm/core/fetcher/makeRequest.d.mts +1 -1
- package/dist/esm/core/fetcher/makeRequest.mjs +0 -2
- package/dist/esm/core/fetcher/requestWithRetries.mjs +0 -9
- package/dist/esm/core/fetcher/signals.d.mts +0 -6
- package/dist/esm/core/fetcher/signals.mjs +0 -12
- package/dist/esm/core/headers.mjs +6 -4
- package/dist/esm/core/index.d.mts +1 -0
- package/dist/esm/core/index.mjs +1 -0
- package/dist/esm/core/logging/exports.d.mts +18 -0
- package/dist/esm/core/logging/exports.mjs +9 -0
- package/dist/esm/core/logging/index.d.mts +1 -0
- package/dist/esm/core/logging/index.mjs +1 -0
- package/dist/esm/core/logging/logger.d.mts +126 -0
- package/dist/esm/core/logging/logger.mjs +138 -0
- package/dist/esm/core/schemas/Schema.d.mts +1 -0
- package/dist/esm/core/schemas/Schema.mjs +1 -0
- package/dist/esm/core/schemas/builders/primitives/index.d.mts +1 -0
- package/dist/esm/core/schemas/builders/primitives/index.mjs +1 -0
- package/dist/esm/core/schemas/builders/primitives/never.d.mts +2 -0
- package/dist/esm/core/schemas/builders/primitives/never.mjs +11 -0
- package/dist/esm/core/url/join.mjs +0 -1
- package/dist/esm/serialization/resources/events/types/DomainVerifiedEvent.d.mts +14 -0
- package/dist/esm/serialization/resources/events/types/DomainVerifiedEvent.mjs +10 -0
- package/dist/esm/serialization/resources/{webhooks → events}/types/EventType.d.mts +2 -2
- package/dist/esm/serialization/resources/{webhooks → events}/types/EventType.mjs +1 -0
- package/dist/esm/serialization/resources/{webhooks → events}/types/EventTypes.d.mts +1 -1
- package/dist/esm/serialization/resources/events/types/index.d.mts +3 -0
- package/dist/esm/serialization/resources/events/types/index.mjs +3 -0
- package/dist/esm/serialization/resources/webhooks/types/CreateWebhookRequest.d.mts +1 -1
- package/dist/esm/serialization/resources/webhooks/types/CreateWebhookRequest.mjs +1 -1
- package/dist/esm/serialization/resources/webhooks/types/Webhook.d.mts +1 -1
- package/dist/esm/serialization/resources/webhooks/types/Webhook.mjs +1 -1
- package/dist/esm/serialization/resources/webhooks/types/index.d.mts +0 -2
- package/dist/esm/serialization/resources/webhooks/types/index.mjs +0 -2
- package/dist/esm/serialization/resources/websockets/client/socket/WebsocketsSocketResponse.d.mts +3 -2
- package/dist/esm/serialization/resources/websockets/client/socket/WebsocketsSocketResponse.mjs +2 -0
- package/dist/esm/serialization/resources/websockets/types/Subscribe.d.mts +4 -1
- package/dist/esm/serialization/resources/websockets/types/Subscribe.mjs +4 -1
- package/dist/esm/serialization/resources/websockets/types/Subscribed.d.mts +4 -1
- package/dist/esm/serialization/resources/websockets/types/Subscribed.mjs +4 -1
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/dist/llms-full.txt +620 -54
- package/dist/llms.txt +6 -1
- package/package.json +1 -1
- package/reference.md +170 -170
- package/dist/cjs/api/resources/webhooks/types/EventTypes.d.ts +0 -5
- package/dist/esm/api/resources/webhooks/types/EventTypes.d.mts +0 -5
- /package/dist/cjs/api/resources/{webhooks/types/EventTypes.js → events/types/DomainVerifiedEvent.js} +0 -0
- /package/dist/cjs/serialization/resources/{webhooks → events}/types/EventTypes.js +0 -0
- /package/dist/esm/api/resources/{webhooks/types/EventTypes.mjs → events/types/DomainVerifiedEvent.mjs} +0 -0
- /package/dist/esm/serialization/resources/{webhooks → events}/types/EventTypes.mjs +0 -0
|
@@ -8,33 +8,34 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
import {
|
|
11
|
+
import { normalizeClientOptionsWithAuth } from "../../../../../../BaseClient.mjs";
|
|
12
|
+
import { mergeHeaders } from "../../../../../../core/headers.mjs";
|
|
12
13
|
import * as core from "../../../../../../core/index.mjs";
|
|
13
14
|
import { toJson } from "../../../../../../core/json.mjs";
|
|
14
15
|
import * as environments from "../../../../../../environments.mjs";
|
|
15
16
|
import * as errors from "../../../../../../errors/index.mjs";
|
|
16
17
|
import * as serializers from "../../../../../../serialization/index.mjs";
|
|
17
18
|
import * as AgentMail from "../../../../../index.mjs";
|
|
18
|
-
export class
|
|
19
|
-
constructor(
|
|
20
|
-
this._options =
|
|
19
|
+
export class ThreadsClient {
|
|
20
|
+
constructor(options = {}) {
|
|
21
|
+
this._options = normalizeClientOptionsWithAuth(options);
|
|
21
22
|
}
|
|
22
23
|
/**
|
|
23
|
-
* @param {AgentMail.inboxes.InboxId}
|
|
24
|
+
* @param {AgentMail.inboxes.InboxId} inbox_id
|
|
24
25
|
* @param {AgentMail.inboxes.ListThreadsRequest} request
|
|
25
|
-
* @param {
|
|
26
|
+
* @param {ThreadsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
26
27
|
*
|
|
27
28
|
* @throws {@link AgentMail.NotFoundError}
|
|
28
29
|
*
|
|
29
30
|
* @example
|
|
30
31
|
* await client.inboxes.threads.list("inbox_id")
|
|
31
32
|
*/
|
|
32
|
-
list(
|
|
33
|
-
return core.HttpResponsePromise.fromPromise(this.__list(
|
|
33
|
+
list(inbox_id, request = {}, requestOptions) {
|
|
34
|
+
return core.HttpResponsePromise.fromPromise(this.__list(inbox_id, request, requestOptions));
|
|
34
35
|
}
|
|
35
|
-
__list(
|
|
36
|
-
return __awaiter(this, arguments, void 0, function* (
|
|
37
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
36
|
+
__list(inbox_id_1) {
|
|
37
|
+
return __awaiter(this, arguments, void 0, function* (inbox_id, request = {}, requestOptions) {
|
|
38
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
38
39
|
const { limit, pageToken, labels, before, after, ascending } = request;
|
|
39
40
|
const _queryParams = {};
|
|
40
41
|
if (limit != null) {
|
|
@@ -60,15 +61,18 @@ export class Threads {
|
|
|
60
61
|
if (ascending != null) {
|
|
61
62
|
_queryParams.ascending = ascending.toString();
|
|
62
63
|
}
|
|
63
|
-
const
|
|
64
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
65
|
+
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);
|
|
64
66
|
const _response = yield core.fetcher({
|
|
65
|
-
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.Production).http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(
|
|
67
|
+
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.Production).http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/threads`),
|
|
66
68
|
method: "GET",
|
|
67
69
|
headers: _headers,
|
|
68
70
|
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
69
71
|
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,
|
|
70
72
|
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,
|
|
71
73
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
74
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
75
|
+
logging: this._options.logging,
|
|
72
76
|
});
|
|
73
77
|
if (_response.ok) {
|
|
74
78
|
return {
|
|
@@ -118,30 +122,33 @@ export class Threads {
|
|
|
118
122
|
});
|
|
119
123
|
}
|
|
120
124
|
/**
|
|
121
|
-
* @param {AgentMail.inboxes.InboxId}
|
|
122
|
-
* @param {AgentMail.ThreadId}
|
|
123
|
-
* @param {
|
|
125
|
+
* @param {AgentMail.inboxes.InboxId} inbox_id
|
|
126
|
+
* @param {AgentMail.ThreadId} thread_id
|
|
127
|
+
* @param {ThreadsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
124
128
|
*
|
|
125
129
|
* @throws {@link AgentMail.NotFoundError}
|
|
126
130
|
*
|
|
127
131
|
* @example
|
|
128
132
|
* await client.inboxes.threads.get("inbox_id", "thread_id")
|
|
129
133
|
*/
|
|
130
|
-
get(
|
|
131
|
-
return core.HttpResponsePromise.fromPromise(this.__get(
|
|
134
|
+
get(inbox_id, thread_id, requestOptions) {
|
|
135
|
+
return core.HttpResponsePromise.fromPromise(this.__get(inbox_id, thread_id, requestOptions));
|
|
132
136
|
}
|
|
133
|
-
__get(
|
|
137
|
+
__get(inbox_id, thread_id, requestOptions) {
|
|
134
138
|
return __awaiter(this, void 0, void 0, function* () {
|
|
135
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
136
|
-
const
|
|
139
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
140
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
141
|
+
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);
|
|
137
142
|
const _response = yield core.fetcher({
|
|
138
|
-
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.Production).http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(
|
|
143
|
+
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.Production).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 }))}`),
|
|
139
144
|
method: "GET",
|
|
140
145
|
headers: _headers,
|
|
141
146
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
142
147
|
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,
|
|
143
148
|
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,
|
|
144
149
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
150
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
151
|
+
logging: this._options.logging,
|
|
145
152
|
});
|
|
146
153
|
if (_response.ok) {
|
|
147
154
|
return {
|
|
@@ -193,15 +200,16 @@ export class Threads {
|
|
|
193
200
|
/**
|
|
194
201
|
* @throws {@link AgentMail.NotFoundError}
|
|
195
202
|
*/
|
|
196
|
-
getAttachment(
|
|
197
|
-
return core.HttpResponsePromise.fromPromise(this.__getAttachment(
|
|
203
|
+
getAttachment(inbox_id, thread_id, attachment_id, requestOptions) {
|
|
204
|
+
return core.HttpResponsePromise.fromPromise(this.__getAttachment(inbox_id, thread_id, attachment_id, requestOptions));
|
|
198
205
|
}
|
|
199
|
-
__getAttachment(
|
|
206
|
+
__getAttachment(inbox_id, thread_id, attachment_id, requestOptions) {
|
|
200
207
|
return __awaiter(this, void 0, void 0, function* () {
|
|
201
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
202
|
-
const
|
|
208
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
209
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
210
|
+
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);
|
|
203
211
|
const _response = yield core.fetcher({
|
|
204
|
-
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.Production).http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(
|
|
212
|
+
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.Production).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 }))}/attachments/${core.url.encodePathParam(serializers.AttachmentId.jsonOrThrow(attachment_id, { omitUndefined: true }))}`),
|
|
205
213
|
method: "GET",
|
|
206
214
|
headers: _headers,
|
|
207
215
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
@@ -209,6 +217,8 @@ export class Threads {
|
|
|
209
217
|
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,
|
|
210
218
|
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,
|
|
211
219
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
220
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
221
|
+
logging: this._options.logging,
|
|
212
222
|
});
|
|
213
223
|
if (_response.ok) {
|
|
214
224
|
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
@@ -249,30 +259,33 @@ export class Threads {
|
|
|
249
259
|
});
|
|
250
260
|
}
|
|
251
261
|
/**
|
|
252
|
-
* @param {AgentMail.inboxes.InboxId}
|
|
253
|
-
* @param {AgentMail.ThreadId}
|
|
254
|
-
* @param {
|
|
262
|
+
* @param {AgentMail.inboxes.InboxId} inbox_id
|
|
263
|
+
* @param {AgentMail.ThreadId} thread_id
|
|
264
|
+
* @param {ThreadsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
255
265
|
*
|
|
256
266
|
* @throws {@link AgentMail.NotFoundError}
|
|
257
267
|
*
|
|
258
268
|
* @example
|
|
259
269
|
* await client.inboxes.threads.delete("inbox_id", "thread_id")
|
|
260
270
|
*/
|
|
261
|
-
delete(
|
|
262
|
-
return core.HttpResponsePromise.fromPromise(this.__delete(
|
|
271
|
+
delete(inbox_id, thread_id, requestOptions) {
|
|
272
|
+
return core.HttpResponsePromise.fromPromise(this.__delete(inbox_id, thread_id, requestOptions));
|
|
263
273
|
}
|
|
264
|
-
__delete(
|
|
274
|
+
__delete(inbox_id, thread_id, requestOptions) {
|
|
265
275
|
return __awaiter(this, void 0, void 0, function* () {
|
|
266
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
267
|
-
const
|
|
276
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
277
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
278
|
+
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);
|
|
268
279
|
const _response = yield core.fetcher({
|
|
269
|
-
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.Production).http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(
|
|
280
|
+
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.Production).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 }))}`),
|
|
270
281
|
method: "DELETE",
|
|
271
282
|
headers: _headers,
|
|
272
283
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
273
284
|
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,
|
|
274
285
|
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,
|
|
275
286
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
287
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
288
|
+
logging: this._options.logging,
|
|
276
289
|
});
|
|
277
290
|
if (_response.ok) {
|
|
278
291
|
return { data: undefined, rawResponse: _response.rawResponse };
|
|
@@ -312,16 +325,4 @@ export class Threads {
|
|
|
312
325
|
}
|
|
313
326
|
});
|
|
314
327
|
}
|
|
315
|
-
_getAuthorizationHeader() {
|
|
316
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
317
|
-
var _a;
|
|
318
|
-
const bearer = (_a = (yield core.Supplier.get(this._options.apiKey))) !== null && _a !== void 0 ? _a : process === null || process === void 0 ? void 0 : process.env.AGENTMAIL_API_KEY;
|
|
319
|
-
if (bearer == null) {
|
|
320
|
-
throw new errors.AgentMailError({
|
|
321
|
-
message: "Please specify a bearer by either passing it in to the constructor or initializing a AGENTMAIL_API_KEY environment variable",
|
|
322
|
-
});
|
|
323
|
-
}
|
|
324
|
-
return `Bearer ${bearer}`;
|
|
325
|
-
});
|
|
326
|
-
}
|
|
327
328
|
}
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.mjs";
|
|
2
|
+
import { type NormalizedClientOptionsWithAuth } from "../../../../BaseClient.mjs";
|
|
2
3
|
import * as core from "../../../../core/index.mjs";
|
|
3
4
|
import * as AgentMail from "../../../index.mjs";
|
|
4
|
-
export declare namespace
|
|
5
|
+
export declare namespace MetricsClient {
|
|
5
6
|
interface Options extends BaseClientOptions {
|
|
6
7
|
}
|
|
7
8
|
interface RequestOptions extends BaseRequestOptions {
|
|
8
9
|
}
|
|
9
10
|
}
|
|
10
|
-
export declare class
|
|
11
|
-
protected readonly _options:
|
|
12
|
-
constructor(
|
|
11
|
+
export declare class MetricsClient {
|
|
12
|
+
protected readonly _options: NormalizedClientOptionsWithAuth<MetricsClient.Options>;
|
|
13
|
+
constructor(options?: MetricsClient.Options);
|
|
13
14
|
/**
|
|
14
15
|
* @param {AgentMail.ListMetricsRequest} request
|
|
15
|
-
* @param {
|
|
16
|
+
* @param {MetricsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
16
17
|
*
|
|
17
18
|
* @throws {@link AgentMail.NotFoundError}
|
|
18
19
|
*
|
|
@@ -22,7 +23,6 @@ export declare class Metrics {
|
|
|
22
23
|
* endTimestamp: new Date("2024-01-15T09:30:00.000Z")
|
|
23
24
|
* })
|
|
24
25
|
*/
|
|
25
|
-
list(request: AgentMail.ListMetricsRequest, requestOptions?:
|
|
26
|
+
list(request: AgentMail.ListMetricsRequest, requestOptions?: MetricsClient.RequestOptions): core.HttpResponsePromise<AgentMail.ListMetricsResponse>;
|
|
26
27
|
private __list;
|
|
27
|
-
protected _getAuthorizationHeader(): Promise<string>;
|
|
28
28
|
}
|
|
@@ -8,20 +8,21 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
import {
|
|
11
|
+
import { normalizeClientOptionsWithAuth } from "../../../../BaseClient.mjs";
|
|
12
|
+
import { mergeHeaders } from "../../../../core/headers.mjs";
|
|
12
13
|
import * as core from "../../../../core/index.mjs";
|
|
13
14
|
import { toJson } from "../../../../core/json.mjs";
|
|
14
15
|
import * as environments from "../../../../environments.mjs";
|
|
15
16
|
import * as errors from "../../../../errors/index.mjs";
|
|
16
17
|
import * as serializers from "../../../../serialization/index.mjs";
|
|
17
18
|
import * as AgentMail from "../../../index.mjs";
|
|
18
|
-
export class
|
|
19
|
-
constructor(
|
|
20
|
-
this._options =
|
|
19
|
+
export class MetricsClient {
|
|
20
|
+
constructor(options = {}) {
|
|
21
|
+
this._options = normalizeClientOptionsWithAuth(options);
|
|
21
22
|
}
|
|
22
23
|
/**
|
|
23
24
|
* @param {AgentMail.ListMetricsRequest} request
|
|
24
|
-
* @param {
|
|
25
|
+
* @param {MetricsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
25
26
|
*
|
|
26
27
|
* @throws {@link AgentMail.NotFoundError}
|
|
27
28
|
*
|
|
@@ -36,7 +37,7 @@ export class Metrics {
|
|
|
36
37
|
}
|
|
37
38
|
__list(request, requestOptions) {
|
|
38
39
|
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
40
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
40
41
|
const { eventTypes, startTimestamp, endTimestamp } = request;
|
|
41
42
|
const _queryParams = {};
|
|
42
43
|
if (eventTypes != null) {
|
|
@@ -49,7 +50,8 @@ export class Metrics {
|
|
|
49
50
|
}
|
|
50
51
|
_queryParams.start_timestamp = startTimestamp.toISOString();
|
|
51
52
|
_queryParams.end_timestamp = endTimestamp.toISOString();
|
|
52
|
-
const
|
|
53
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
54
|
+
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);
|
|
53
55
|
const _response = yield core.fetcher({
|
|
54
56
|
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.Production).http, "/v0/metrics"),
|
|
55
57
|
method: "GET",
|
|
@@ -58,6 +60,8 @@ export class Metrics {
|
|
|
58
60
|
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,
|
|
59
61
|
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,
|
|
60
62
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
63
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
64
|
+
logging: this._options.logging,
|
|
61
65
|
});
|
|
62
66
|
if (_response.ok) {
|
|
63
67
|
return {
|
|
@@ -106,16 +110,4 @@ export class Metrics {
|
|
|
106
110
|
}
|
|
107
111
|
});
|
|
108
112
|
}
|
|
109
|
-
_getAuthorizationHeader() {
|
|
110
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
111
|
-
var _a;
|
|
112
|
-
const bearer = (_a = (yield core.Supplier.get(this._options.apiKey))) !== null && _a !== void 0 ? _a : process === null || process === void 0 ? void 0 : process.env.AGENTMAIL_API_KEY;
|
|
113
|
-
if (bearer == null) {
|
|
114
|
-
throw new errors.AgentMailError({
|
|
115
|
-
message: "Please specify a bearer by either passing it in to the constructor or initializing a AGENTMAIL_API_KEY environment variable",
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
return `Bearer ${bearer}`;
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
113
|
}
|
|
@@ -1,68 +1,68 @@
|
|
|
1
1
|
import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.mjs";
|
|
2
|
+
import { type NormalizedClientOptionsWithAuth } from "../../../../BaseClient.mjs";
|
|
2
3
|
import * as core from "../../../../core/index.mjs";
|
|
3
4
|
import * as AgentMail from "../../../index.mjs";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
export declare namespace
|
|
5
|
+
import { DomainsClient } from "../resources/domains/client/Client.mjs";
|
|
6
|
+
import { DraftsClient } from "../resources/drafts/client/Client.mjs";
|
|
7
|
+
import { InboxesClient } from "../resources/inboxes/client/Client.mjs";
|
|
8
|
+
import { ThreadsClient } from "../resources/threads/client/Client.mjs";
|
|
9
|
+
export declare namespace PodsClient {
|
|
9
10
|
interface Options extends BaseClientOptions {
|
|
10
11
|
}
|
|
11
12
|
interface RequestOptions extends BaseRequestOptions {
|
|
12
13
|
}
|
|
13
14
|
}
|
|
14
|
-
export declare class
|
|
15
|
-
protected readonly _options:
|
|
16
|
-
protected _inboxes:
|
|
17
|
-
protected _threads:
|
|
18
|
-
protected _drafts:
|
|
19
|
-
protected _domains:
|
|
20
|
-
constructor(
|
|
21
|
-
get inboxes():
|
|
22
|
-
get threads():
|
|
23
|
-
get drafts():
|
|
24
|
-
get domains():
|
|
15
|
+
export declare class PodsClient {
|
|
16
|
+
protected readonly _options: NormalizedClientOptionsWithAuth<PodsClient.Options>;
|
|
17
|
+
protected _inboxes: InboxesClient | undefined;
|
|
18
|
+
protected _threads: ThreadsClient | undefined;
|
|
19
|
+
protected _drafts: DraftsClient | undefined;
|
|
20
|
+
protected _domains: DomainsClient | undefined;
|
|
21
|
+
constructor(options?: PodsClient.Options);
|
|
22
|
+
get inboxes(): InboxesClient;
|
|
23
|
+
get threads(): ThreadsClient;
|
|
24
|
+
get drafts(): DraftsClient;
|
|
25
|
+
get domains(): DomainsClient;
|
|
25
26
|
/**
|
|
26
27
|
* @param {AgentMail.pods.ListPodsRequest} request
|
|
27
|
-
* @param {
|
|
28
|
+
* @param {PodsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
28
29
|
*
|
|
29
30
|
* @example
|
|
30
31
|
* await client.pods.list()
|
|
31
32
|
*/
|
|
32
|
-
list(request?: AgentMail.pods.ListPodsRequest, requestOptions?:
|
|
33
|
+
list(request?: AgentMail.pods.ListPodsRequest, requestOptions?: PodsClient.RequestOptions): core.HttpResponsePromise<AgentMail.pods.ListPodsResponse>;
|
|
33
34
|
private __list;
|
|
34
35
|
/**
|
|
35
|
-
* @param {AgentMail.pods.PodId}
|
|
36
|
-
* @param {
|
|
36
|
+
* @param {AgentMail.pods.PodId} pod_id
|
|
37
|
+
* @param {PodsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
37
38
|
*
|
|
38
39
|
* @throws {@link AgentMail.NotFoundError}
|
|
39
40
|
*
|
|
40
41
|
* @example
|
|
41
42
|
* await client.pods.get("pod_id")
|
|
42
43
|
*/
|
|
43
|
-
get(
|
|
44
|
+
get(pod_id: AgentMail.pods.PodId, requestOptions?: PodsClient.RequestOptions): core.HttpResponsePromise<AgentMail.pods.Pod>;
|
|
44
45
|
private __get;
|
|
45
46
|
/**
|
|
46
47
|
* @param {AgentMail.pods.CreatePodRequest} request
|
|
47
|
-
* @param {
|
|
48
|
+
* @param {PodsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
48
49
|
*
|
|
49
50
|
* @throws {@link AgentMail.ValidationError}
|
|
50
51
|
*
|
|
51
52
|
* @example
|
|
52
53
|
* await client.pods.create({})
|
|
53
54
|
*/
|
|
54
|
-
create(request: AgentMail.pods.CreatePodRequest, requestOptions?:
|
|
55
|
+
create(request: AgentMail.pods.CreatePodRequest, requestOptions?: PodsClient.RequestOptions): core.HttpResponsePromise<AgentMail.pods.Pod>;
|
|
55
56
|
private __create;
|
|
56
57
|
/**
|
|
57
|
-
* @param {AgentMail.pods.PodId}
|
|
58
|
-
* @param {
|
|
58
|
+
* @param {AgentMail.pods.PodId} pod_id
|
|
59
|
+
* @param {PodsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
59
60
|
*
|
|
60
61
|
* @throws {@link AgentMail.NotFoundError}
|
|
61
62
|
*
|
|
62
63
|
* @example
|
|
63
64
|
* await client.pods.delete("pod_id")
|
|
64
65
|
*/
|
|
65
|
-
delete(
|
|
66
|
+
delete(pod_id: AgentMail.pods.PodId, requestOptions?: PodsClient.RequestOptions): core.HttpResponsePromise<void>;
|
|
66
67
|
private __delete;
|
|
67
|
-
protected _getAuthorizationHeader(): Promise<string>;
|
|
68
68
|
}
|
|
@@ -8,39 +8,40 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
import {
|
|
11
|
+
import { normalizeClientOptionsWithAuth } from "../../../../BaseClient.mjs";
|
|
12
|
+
import { mergeHeaders } from "../../../../core/headers.mjs";
|
|
12
13
|
import * as core from "../../../../core/index.mjs";
|
|
13
14
|
import * as environments from "../../../../environments.mjs";
|
|
14
15
|
import * as errors from "../../../../errors/index.mjs";
|
|
15
16
|
import * as serializers from "../../../../serialization/index.mjs";
|
|
16
17
|
import * as AgentMail from "../../../index.mjs";
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
export class
|
|
22
|
-
constructor(
|
|
23
|
-
this._options =
|
|
18
|
+
import { DomainsClient } from "../resources/domains/client/Client.mjs";
|
|
19
|
+
import { DraftsClient } from "../resources/drafts/client/Client.mjs";
|
|
20
|
+
import { InboxesClient } from "../resources/inboxes/client/Client.mjs";
|
|
21
|
+
import { ThreadsClient } from "../resources/threads/client/Client.mjs";
|
|
22
|
+
export class PodsClient {
|
|
23
|
+
constructor(options = {}) {
|
|
24
|
+
this._options = normalizeClientOptionsWithAuth(options);
|
|
24
25
|
}
|
|
25
26
|
get inboxes() {
|
|
26
27
|
var _a;
|
|
27
|
-
return ((_a = this._inboxes) !== null && _a !== void 0 ? _a : (this._inboxes = new
|
|
28
|
+
return ((_a = this._inboxes) !== null && _a !== void 0 ? _a : (this._inboxes = new InboxesClient(this._options)));
|
|
28
29
|
}
|
|
29
30
|
get threads() {
|
|
30
31
|
var _a;
|
|
31
|
-
return ((_a = this._threads) !== null && _a !== void 0 ? _a : (this._threads = new
|
|
32
|
+
return ((_a = this._threads) !== null && _a !== void 0 ? _a : (this._threads = new ThreadsClient(this._options)));
|
|
32
33
|
}
|
|
33
34
|
get drafts() {
|
|
34
35
|
var _a;
|
|
35
|
-
return ((_a = this._drafts) !== null && _a !== void 0 ? _a : (this._drafts = new
|
|
36
|
+
return ((_a = this._drafts) !== null && _a !== void 0 ? _a : (this._drafts = new DraftsClient(this._options)));
|
|
36
37
|
}
|
|
37
38
|
get domains() {
|
|
38
39
|
var _a;
|
|
39
|
-
return ((_a = this._domains) !== null && _a !== void 0 ? _a : (this._domains = new
|
|
40
|
+
return ((_a = this._domains) !== null && _a !== void 0 ? _a : (this._domains = new DomainsClient(this._options)));
|
|
40
41
|
}
|
|
41
42
|
/**
|
|
42
43
|
* @param {AgentMail.pods.ListPodsRequest} request
|
|
43
|
-
* @param {
|
|
44
|
+
* @param {PodsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
44
45
|
*
|
|
45
46
|
* @example
|
|
46
47
|
* await client.pods.list()
|
|
@@ -50,7 +51,7 @@ export class Pods {
|
|
|
50
51
|
}
|
|
51
52
|
__list() {
|
|
52
53
|
return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
|
|
53
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
54
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
54
55
|
const { limit, pageToken } = request;
|
|
55
56
|
const _queryParams = {};
|
|
56
57
|
if (limit != null) {
|
|
@@ -59,7 +60,8 @@ export class Pods {
|
|
|
59
60
|
if (pageToken != null) {
|
|
60
61
|
_queryParams.page_token = pageToken;
|
|
61
62
|
}
|
|
62
|
-
const
|
|
63
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
64
|
+
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);
|
|
63
65
|
const _response = yield core.fetcher({
|
|
64
66
|
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.Production).http, "/v0/pods"),
|
|
65
67
|
method: "GET",
|
|
@@ -68,6 +70,8 @@ export class Pods {
|
|
|
68
70
|
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,
|
|
69
71
|
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,
|
|
70
72
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
73
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
74
|
+
logging: this._options.logging,
|
|
71
75
|
});
|
|
72
76
|
if (_response.ok) {
|
|
73
77
|
return {
|
|
@@ -106,29 +110,32 @@ export class Pods {
|
|
|
106
110
|
});
|
|
107
111
|
}
|
|
108
112
|
/**
|
|
109
|
-
* @param {AgentMail.pods.PodId}
|
|
110
|
-
* @param {
|
|
113
|
+
* @param {AgentMail.pods.PodId} pod_id
|
|
114
|
+
* @param {PodsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
111
115
|
*
|
|
112
116
|
* @throws {@link AgentMail.NotFoundError}
|
|
113
117
|
*
|
|
114
118
|
* @example
|
|
115
119
|
* await client.pods.get("pod_id")
|
|
116
120
|
*/
|
|
117
|
-
get(
|
|
118
|
-
return core.HttpResponsePromise.fromPromise(this.__get(
|
|
121
|
+
get(pod_id, requestOptions) {
|
|
122
|
+
return core.HttpResponsePromise.fromPromise(this.__get(pod_id, requestOptions));
|
|
119
123
|
}
|
|
120
|
-
__get(
|
|
124
|
+
__get(pod_id, requestOptions) {
|
|
121
125
|
return __awaiter(this, void 0, void 0, function* () {
|
|
122
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
123
|
-
const
|
|
126
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
127
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
128
|
+
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);
|
|
124
129
|
const _response = yield core.fetcher({
|
|
125
|
-
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.Production).http, `/v0/pods/${core.url.encodePathParam(serializers.pods.PodId.jsonOrThrow(
|
|
130
|
+
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.Production).http, `/v0/pods/${core.url.encodePathParam(serializers.pods.PodId.jsonOrThrow(pod_id, { omitUndefined: true }))}`),
|
|
126
131
|
method: "GET",
|
|
127
132
|
headers: _headers,
|
|
128
133
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
129
134
|
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,
|
|
130
135
|
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,
|
|
131
136
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
137
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
138
|
+
logging: this._options.logging,
|
|
132
139
|
});
|
|
133
140
|
if (_response.ok) {
|
|
134
141
|
return {
|
|
@@ -179,7 +186,7 @@ export class Pods {
|
|
|
179
186
|
}
|
|
180
187
|
/**
|
|
181
188
|
* @param {AgentMail.pods.CreatePodRequest} request
|
|
182
|
-
* @param {
|
|
189
|
+
* @param {PodsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
183
190
|
*
|
|
184
191
|
* @throws {@link AgentMail.ValidationError}
|
|
185
192
|
*
|
|
@@ -191,8 +198,9 @@ export class Pods {
|
|
|
191
198
|
}
|
|
192
199
|
__create(request, requestOptions) {
|
|
193
200
|
return __awaiter(this, void 0, void 0, function* () {
|
|
194
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
195
|
-
const
|
|
201
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
202
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
203
|
+
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);
|
|
196
204
|
const _response = yield core.fetcher({
|
|
197
205
|
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.Production).http, "/v0/pods"),
|
|
198
206
|
method: "POST",
|
|
@@ -209,6 +217,8 @@ export class Pods {
|
|
|
209
217
|
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,
|
|
210
218
|
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,
|
|
211
219
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
220
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
221
|
+
logging: this._options.logging,
|
|
212
222
|
});
|
|
213
223
|
if (_response.ok) {
|
|
214
224
|
return {
|
|
@@ -258,29 +268,32 @@ export class Pods {
|
|
|
258
268
|
});
|
|
259
269
|
}
|
|
260
270
|
/**
|
|
261
|
-
* @param {AgentMail.pods.PodId}
|
|
262
|
-
* @param {
|
|
271
|
+
* @param {AgentMail.pods.PodId} pod_id
|
|
272
|
+
* @param {PodsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
263
273
|
*
|
|
264
274
|
* @throws {@link AgentMail.NotFoundError}
|
|
265
275
|
*
|
|
266
276
|
* @example
|
|
267
277
|
* await client.pods.delete("pod_id")
|
|
268
278
|
*/
|
|
269
|
-
delete(
|
|
270
|
-
return core.HttpResponsePromise.fromPromise(this.__delete(
|
|
279
|
+
delete(pod_id, requestOptions) {
|
|
280
|
+
return core.HttpResponsePromise.fromPromise(this.__delete(pod_id, requestOptions));
|
|
271
281
|
}
|
|
272
|
-
__delete(
|
|
282
|
+
__delete(pod_id, requestOptions) {
|
|
273
283
|
return __awaiter(this, void 0, void 0, function* () {
|
|
274
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
275
|
-
const
|
|
284
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
285
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
286
|
+
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);
|
|
276
287
|
const _response = yield core.fetcher({
|
|
277
|
-
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.Production).http, `/v0/pods/${core.url.encodePathParam(serializers.pods.PodId.jsonOrThrow(
|
|
288
|
+
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.Production).http, `/v0/pods/${core.url.encodePathParam(serializers.pods.PodId.jsonOrThrow(pod_id, { omitUndefined: true }))}`),
|
|
278
289
|
method: "DELETE",
|
|
279
290
|
headers: _headers,
|
|
280
291
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
281
292
|
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,
|
|
282
293
|
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,
|
|
283
294
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
295
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
296
|
+
logging: this._options.logging,
|
|
284
297
|
});
|
|
285
298
|
if (_response.ok) {
|
|
286
299
|
return { data: undefined, rawResponse: _response.rawResponse };
|
|
@@ -320,16 +333,4 @@ export class Pods {
|
|
|
320
333
|
}
|
|
321
334
|
});
|
|
322
335
|
}
|
|
323
|
-
_getAuthorizationHeader() {
|
|
324
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
325
|
-
var _a;
|
|
326
|
-
const bearer = (_a = (yield core.Supplier.get(this._options.apiKey))) !== null && _a !== void 0 ? _a : process === null || process === void 0 ? void 0 : process.env.AGENTMAIL_API_KEY;
|
|
327
|
-
if (bearer == null) {
|
|
328
|
-
throw new errors.AgentMailError({
|
|
329
|
-
message: "Please specify a bearer by either passing it in to the constructor or initializing a AGENTMAIL_API_KEY environment variable",
|
|
330
|
-
});
|
|
331
|
-
}
|
|
332
|
-
return `Bearer ${bearer}`;
|
|
333
|
-
});
|
|
334
|
-
}
|
|
335
336
|
}
|