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,19 +8,20 @@ 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
|
-
export class
|
|
18
|
-
constructor(
|
|
19
|
-
this._options =
|
|
18
|
+
export class DomainsClient {
|
|
19
|
+
constructor(options = {}) {
|
|
20
|
+
this._options = normalizeClientOptionsWithAuth(options);
|
|
20
21
|
}
|
|
21
22
|
/**
|
|
22
23
|
* @param {AgentMail.ListDomainsRequest} request
|
|
23
|
-
* @param {
|
|
24
|
+
* @param {DomainsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
24
25
|
*
|
|
25
26
|
* @example
|
|
26
27
|
* await client.domains.list()
|
|
@@ -30,7 +31,7 @@ export class Domains {
|
|
|
30
31
|
}
|
|
31
32
|
__list() {
|
|
32
33
|
return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
|
|
33
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
34
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
34
35
|
const { limit, pageToken } = request;
|
|
35
36
|
const _queryParams = {};
|
|
36
37
|
if (limit != null) {
|
|
@@ -39,7 +40,8 @@ export class Domains {
|
|
|
39
40
|
if (pageToken != null) {
|
|
40
41
|
_queryParams.page_token = pageToken;
|
|
41
42
|
}
|
|
42
|
-
const
|
|
43
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
44
|
+
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
43
45
|
const _response = yield core.fetcher({
|
|
44
46
|
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/domains"),
|
|
45
47
|
method: "GET",
|
|
@@ -48,6 +50,8 @@ export class Domains {
|
|
|
48
50
|
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,
|
|
49
51
|
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,
|
|
50
52
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
53
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
54
|
+
logging: this._options.logging,
|
|
51
55
|
});
|
|
52
56
|
if (_response.ok) {
|
|
53
57
|
return {
|
|
@@ -86,29 +90,32 @@ export class Domains {
|
|
|
86
90
|
});
|
|
87
91
|
}
|
|
88
92
|
/**
|
|
89
|
-
* @param {AgentMail.DomainId}
|
|
90
|
-
* @param {
|
|
93
|
+
* @param {AgentMail.DomainId} domain_id
|
|
94
|
+
* @param {DomainsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
91
95
|
*
|
|
92
96
|
* @throws {@link AgentMail.NotFoundError}
|
|
93
97
|
*
|
|
94
98
|
* @example
|
|
95
99
|
* await client.domains.get("domain_id")
|
|
96
100
|
*/
|
|
97
|
-
get(
|
|
98
|
-
return core.HttpResponsePromise.fromPromise(this.__get(
|
|
101
|
+
get(domain_id, requestOptions) {
|
|
102
|
+
return core.HttpResponsePromise.fromPromise(this.__get(domain_id, requestOptions));
|
|
99
103
|
}
|
|
100
|
-
__get(
|
|
104
|
+
__get(domain_id, requestOptions) {
|
|
101
105
|
return __awaiter(this, void 0, void 0, function* () {
|
|
102
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
103
|
-
const
|
|
106
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
107
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
108
|
+
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);
|
|
104
109
|
const _response = yield core.fetcher({
|
|
105
|
-
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/domains/${core.url.encodePathParam(serializers.DomainId.jsonOrThrow(
|
|
110
|
+
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/domains/${core.url.encodePathParam(serializers.DomainId.jsonOrThrow(domain_id, { omitUndefined: true }))}`),
|
|
106
111
|
method: "GET",
|
|
107
112
|
headers: _headers,
|
|
108
113
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
109
114
|
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,
|
|
110
115
|
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,
|
|
111
116
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
117
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
118
|
+
logging: this._options.logging,
|
|
112
119
|
});
|
|
113
120
|
if (_response.ok) {
|
|
114
121
|
return {
|
|
@@ -160,15 +167,16 @@ export class Domains {
|
|
|
160
167
|
/**
|
|
161
168
|
* @throws {@link AgentMail.NotFoundError}
|
|
162
169
|
*/
|
|
163
|
-
getZoneFile(
|
|
164
|
-
return core.HttpResponsePromise.fromPromise(this.__getZoneFile(
|
|
170
|
+
getZoneFile(domain_id, requestOptions) {
|
|
171
|
+
return core.HttpResponsePromise.fromPromise(this.__getZoneFile(domain_id, requestOptions));
|
|
165
172
|
}
|
|
166
|
-
__getZoneFile(
|
|
173
|
+
__getZoneFile(domain_id, requestOptions) {
|
|
167
174
|
return __awaiter(this, void 0, void 0, function* () {
|
|
168
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
169
|
-
const
|
|
175
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
176
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
177
|
+
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);
|
|
170
178
|
const _response = yield core.fetcher({
|
|
171
|
-
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/domains/${core.url.encodePathParam(serializers.DomainId.jsonOrThrow(
|
|
179
|
+
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/domains/${core.url.encodePathParam(serializers.DomainId.jsonOrThrow(domain_id, { omitUndefined: true }))}/zone-file`),
|
|
172
180
|
method: "GET",
|
|
173
181
|
headers: _headers,
|
|
174
182
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
@@ -176,6 +184,8 @@ export class Domains {
|
|
|
176
184
|
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,
|
|
177
185
|
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,
|
|
178
186
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
187
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
188
|
+
logging: this._options.logging,
|
|
179
189
|
});
|
|
180
190
|
if (_response.ok) {
|
|
181
191
|
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
@@ -217,7 +227,7 @@ export class Domains {
|
|
|
217
227
|
}
|
|
218
228
|
/**
|
|
219
229
|
* @param {AgentMail.CreateDomainRequest} request
|
|
220
|
-
* @param {
|
|
230
|
+
* @param {DomainsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
221
231
|
*
|
|
222
232
|
* @throws {@link AgentMail.ValidationError}
|
|
223
233
|
*
|
|
@@ -232,8 +242,9 @@ export class Domains {
|
|
|
232
242
|
}
|
|
233
243
|
__create(request, requestOptions) {
|
|
234
244
|
return __awaiter(this, void 0, void 0, function* () {
|
|
235
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
236
|
-
const
|
|
245
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
246
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
247
|
+
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);
|
|
237
248
|
const _response = yield core.fetcher({
|
|
238
249
|
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/domains"),
|
|
239
250
|
method: "POST",
|
|
@@ -250,6 +261,8 @@ export class Domains {
|
|
|
250
261
|
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,
|
|
251
262
|
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,
|
|
252
263
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
264
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
265
|
+
logging: this._options.logging,
|
|
253
266
|
});
|
|
254
267
|
if (_response.ok) {
|
|
255
268
|
return {
|
|
@@ -299,29 +312,32 @@ export class Domains {
|
|
|
299
312
|
});
|
|
300
313
|
}
|
|
301
314
|
/**
|
|
302
|
-
* @param {AgentMail.DomainId}
|
|
303
|
-
* @param {
|
|
315
|
+
* @param {AgentMail.DomainId} domain_id
|
|
316
|
+
* @param {DomainsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
304
317
|
*
|
|
305
318
|
* @throws {@link AgentMail.NotFoundError}
|
|
306
319
|
*
|
|
307
320
|
* @example
|
|
308
321
|
* await client.domains.delete("domain_id")
|
|
309
322
|
*/
|
|
310
|
-
delete(
|
|
311
|
-
return core.HttpResponsePromise.fromPromise(this.__delete(
|
|
323
|
+
delete(domain_id, requestOptions) {
|
|
324
|
+
return core.HttpResponsePromise.fromPromise(this.__delete(domain_id, requestOptions));
|
|
312
325
|
}
|
|
313
|
-
__delete(
|
|
326
|
+
__delete(domain_id, requestOptions) {
|
|
314
327
|
return __awaiter(this, void 0, void 0, function* () {
|
|
315
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
316
|
-
const
|
|
328
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
329
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
330
|
+
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);
|
|
317
331
|
const _response = yield core.fetcher({
|
|
318
|
-
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/domains/${core.url.encodePathParam(serializers.DomainId.jsonOrThrow(
|
|
332
|
+
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/domains/${core.url.encodePathParam(serializers.DomainId.jsonOrThrow(domain_id, { omitUndefined: true }))}`),
|
|
319
333
|
method: "DELETE",
|
|
320
334
|
headers: _headers,
|
|
321
335
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
322
336
|
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,
|
|
323
337
|
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,
|
|
324
338
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
339
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
340
|
+
logging: this._options.logging,
|
|
325
341
|
});
|
|
326
342
|
if (_response.ok) {
|
|
327
343
|
return { data: undefined, rawResponse: _response.rawResponse };
|
|
@@ -362,29 +378,32 @@ export class Domains {
|
|
|
362
378
|
});
|
|
363
379
|
}
|
|
364
380
|
/**
|
|
365
|
-
* @param {AgentMail.DomainId}
|
|
366
|
-
* @param {
|
|
381
|
+
* @param {AgentMail.DomainId} domain_id
|
|
382
|
+
* @param {DomainsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
367
383
|
*
|
|
368
384
|
* @throws {@link AgentMail.NotFoundError}
|
|
369
385
|
*
|
|
370
386
|
* @example
|
|
371
387
|
* await client.domains.verify("domain_id")
|
|
372
388
|
*/
|
|
373
|
-
verify(
|
|
374
|
-
return core.HttpResponsePromise.fromPromise(this.__verify(
|
|
389
|
+
verify(domain_id, requestOptions) {
|
|
390
|
+
return core.HttpResponsePromise.fromPromise(this.__verify(domain_id, requestOptions));
|
|
375
391
|
}
|
|
376
|
-
__verify(
|
|
392
|
+
__verify(domain_id, requestOptions) {
|
|
377
393
|
return __awaiter(this, void 0, void 0, function* () {
|
|
378
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
379
|
-
const
|
|
394
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
395
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
396
|
+
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);
|
|
380
397
|
const _response = yield core.fetcher({
|
|
381
|
-
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/domains/${core.url.encodePathParam(serializers.DomainId.jsonOrThrow(
|
|
398
|
+
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/domains/${core.url.encodePathParam(serializers.DomainId.jsonOrThrow(domain_id, { omitUndefined: true }))}/verify`),
|
|
382
399
|
method: "POST",
|
|
383
400
|
headers: _headers,
|
|
384
401
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
385
402
|
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,
|
|
386
403
|
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,
|
|
387
404
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
405
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
406
|
+
logging: this._options.logging,
|
|
388
407
|
});
|
|
389
408
|
if (_response.ok) {
|
|
390
409
|
return { data: undefined, rawResponse: _response.rawResponse };
|
|
@@ -424,16 +443,4 @@ export class Domains {
|
|
|
424
443
|
}
|
|
425
444
|
});
|
|
426
445
|
}
|
|
427
|
-
_getAuthorizationHeader() {
|
|
428
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
429
|
-
var _a;
|
|
430
|
-
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;
|
|
431
|
-
if (bearer == null) {
|
|
432
|
-
throw new errors.AgentMailError({
|
|
433
|
-
message: "Please specify a bearer by either passing it in to the constructor or initializing a AGENTMAIL_API_KEY environment variable",
|
|
434
|
-
});
|
|
435
|
-
}
|
|
436
|
-
return `Bearer ${bearer}`;
|
|
437
|
-
});
|
|
438
|
-
}
|
|
439
446
|
}
|
|
@@ -1,36 +1,36 @@
|
|
|
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 DraftsClient {
|
|
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 DraftsClient {
|
|
12
|
+
protected readonly _options: NormalizedClientOptionsWithAuth<DraftsClient.Options>;
|
|
13
|
+
constructor(options?: DraftsClient.Options);
|
|
13
14
|
/**
|
|
14
15
|
* @param {AgentMail.ListDraftsRequest} request
|
|
15
|
-
* @param {
|
|
16
|
+
* @param {DraftsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
16
17
|
*
|
|
17
18
|
* @throws {@link AgentMail.NotFoundError}
|
|
18
19
|
*
|
|
19
20
|
* @example
|
|
20
21
|
* await client.drafts.list()
|
|
21
22
|
*/
|
|
22
|
-
list(request?: AgentMail.ListDraftsRequest, requestOptions?:
|
|
23
|
+
list(request?: AgentMail.ListDraftsRequest, requestOptions?: DraftsClient.RequestOptions): core.HttpResponsePromise<AgentMail.ListDraftsResponse>;
|
|
23
24
|
private __list;
|
|
24
25
|
/**
|
|
25
|
-
* @param {AgentMail.DraftId}
|
|
26
|
-
* @param {
|
|
26
|
+
* @param {AgentMail.DraftId} draft_id
|
|
27
|
+
* @param {DraftsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
27
28
|
*
|
|
28
29
|
* @throws {@link AgentMail.NotFoundError}
|
|
29
30
|
*
|
|
30
31
|
* @example
|
|
31
32
|
* await client.drafts.get("draft_id")
|
|
32
33
|
*/
|
|
33
|
-
get(
|
|
34
|
+
get(draft_id: AgentMail.DraftId, requestOptions?: DraftsClient.RequestOptions): core.HttpResponsePromise<AgentMail.Draft>;
|
|
34
35
|
private __get;
|
|
35
|
-
protected _getAuthorizationHeader(): Promise<string>;
|
|
36
36
|
}
|
|
@@ -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 DraftsClient {
|
|
20
|
+
constructor(options = {}) {
|
|
21
|
+
this._options = normalizeClientOptionsWithAuth(options);
|
|
21
22
|
}
|
|
22
23
|
/**
|
|
23
24
|
* @param {AgentMail.ListDraftsRequest} request
|
|
24
|
-
* @param {
|
|
25
|
+
* @param {DraftsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
25
26
|
*
|
|
26
27
|
* @throws {@link AgentMail.NotFoundError}
|
|
27
28
|
*
|
|
@@ -33,7 +34,7 @@ export class Drafts {
|
|
|
33
34
|
}
|
|
34
35
|
__list() {
|
|
35
36
|
return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
|
|
36
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
37
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
37
38
|
const { limit, pageToken, labels, before, after, ascending } = request;
|
|
38
39
|
const _queryParams = {};
|
|
39
40
|
if (limit != null) {
|
|
@@ -59,7 +60,8 @@ export class Drafts {
|
|
|
59
60
|
if (ascending != null) {
|
|
60
61
|
_queryParams.ascending = ascending.toString();
|
|
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/drafts"),
|
|
65
67
|
method: "GET",
|
|
@@ -68,6 +70,8 @@ export class Drafts {
|
|
|
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 {
|
|
@@ -117,29 +121,32 @@ export class Drafts {
|
|
|
117
121
|
});
|
|
118
122
|
}
|
|
119
123
|
/**
|
|
120
|
-
* @param {AgentMail.DraftId}
|
|
121
|
-
* @param {
|
|
124
|
+
* @param {AgentMail.DraftId} draft_id
|
|
125
|
+
* @param {DraftsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
122
126
|
*
|
|
123
127
|
* @throws {@link AgentMail.NotFoundError}
|
|
124
128
|
*
|
|
125
129
|
* @example
|
|
126
130
|
* await client.drafts.get("draft_id")
|
|
127
131
|
*/
|
|
128
|
-
get(
|
|
129
|
-
return core.HttpResponsePromise.fromPromise(this.__get(
|
|
132
|
+
get(draft_id, requestOptions) {
|
|
133
|
+
return core.HttpResponsePromise.fromPromise(this.__get(draft_id, requestOptions));
|
|
130
134
|
}
|
|
131
|
-
__get(
|
|
135
|
+
__get(draft_id, requestOptions) {
|
|
132
136
|
return __awaiter(this, void 0, void 0, function* () {
|
|
133
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
134
|
-
const
|
|
137
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
138
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
139
|
+
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);
|
|
135
140
|
const _response = yield core.fetcher({
|
|
136
|
-
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/drafts/${core.url.encodePathParam(serializers.DraftId.jsonOrThrow(
|
|
141
|
+
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/drafts/${core.url.encodePathParam(serializers.DraftId.jsonOrThrow(draft_id, { omitUndefined: true }))}`),
|
|
137
142
|
method: "GET",
|
|
138
143
|
headers: _headers,
|
|
139
144
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
140
145
|
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,
|
|
141
146
|
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,
|
|
142
147
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
148
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
149
|
+
logging: this._options.logging,
|
|
143
150
|
});
|
|
144
151
|
if (_response.ok) {
|
|
145
152
|
return {
|
|
@@ -188,16 +195,4 @@ export class Drafts {
|
|
|
188
195
|
}
|
|
189
196
|
});
|
|
190
197
|
}
|
|
191
|
-
_getAuthorizationHeader() {
|
|
192
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
193
|
-
var _a;
|
|
194
|
-
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;
|
|
195
|
-
if (bearer == null) {
|
|
196
|
-
throw new errors.AgentMailError({
|
|
197
|
-
message: "Please specify a bearer by either passing it in to the constructor or initializing a AGENTMAIL_API_KEY environment variable",
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
return `Bearer ${bearer}`;
|
|
201
|
-
});
|
|
202
|
-
}
|
|
203
198
|
}
|
|
@@ -5,5 +5,6 @@ export declare const EventType: {
|
|
|
5
5
|
readonly MessageBounced: "message.bounced";
|
|
6
6
|
readonly MessageComplained: "message.complained";
|
|
7
7
|
readonly MessageRejected: "message.rejected";
|
|
8
|
+
readonly DomainVerified: "domain.verified";
|
|
8
9
|
};
|
|
9
10
|
export type EventType = (typeof EventType)[keyof typeof EventType];
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
export * from "./Bounce.mjs";
|
|
2
2
|
export * from "./Complaint.mjs";
|
|
3
3
|
export * from "./Delivery.mjs";
|
|
4
|
+
export * from "./DomainVerifiedEvent.mjs";
|
|
4
5
|
export * from "./EventId.mjs";
|
|
6
|
+
export * from "./EventType.mjs";
|
|
7
|
+
export * from "./EventTypes.mjs";
|
|
5
8
|
export * from "./MessageBouncedEvent.mjs";
|
|
6
9
|
export * from "./MessageComplainedEvent.mjs";
|
|
7
10
|
export * from "./MessageDeliveredEvent.mjs";
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
export * from "./Bounce.mjs";
|
|
2
2
|
export * from "./Complaint.mjs";
|
|
3
3
|
export * from "./Delivery.mjs";
|
|
4
|
+
export * from "./DomainVerifiedEvent.mjs";
|
|
4
5
|
export * from "./EventId.mjs";
|
|
6
|
+
export * from "./EventType.mjs";
|
|
7
|
+
export * from "./EventTypes.mjs";
|
|
5
8
|
export * from "./MessageBouncedEvent.mjs";
|
|
6
9
|
export * from "./MessageComplainedEvent.mjs";
|
|
7
10
|
export * from "./MessageDeliveredEvent.mjs";
|
|
@@ -1,62 +1,63 @@
|
|
|
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 { DraftsClient } from "../resources/drafts/client/Client.mjs";
|
|
6
|
+
import { MessagesClient } from "../resources/messages/client/Client.mjs";
|
|
7
|
+
import { MetricsClient } from "../resources/metrics/client/Client.mjs";
|
|
8
|
+
import { ThreadsClient } from "../resources/threads/client/Client.mjs";
|
|
9
|
+
export declare namespace InboxesClient {
|
|
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 _threads:
|
|
17
|
-
protected _messages:
|
|
18
|
-
protected _drafts:
|
|
19
|
-
protected _metrics:
|
|
20
|
-
constructor(
|
|
21
|
-
get threads():
|
|
22
|
-
get messages():
|
|
23
|
-
get drafts():
|
|
24
|
-
get metrics():
|
|
15
|
+
export declare class InboxesClient {
|
|
16
|
+
protected readonly _options: NormalizedClientOptionsWithAuth<InboxesClient.Options>;
|
|
17
|
+
protected _threads: ThreadsClient | undefined;
|
|
18
|
+
protected _messages: MessagesClient | undefined;
|
|
19
|
+
protected _drafts: DraftsClient | undefined;
|
|
20
|
+
protected _metrics: MetricsClient | undefined;
|
|
21
|
+
constructor(options?: InboxesClient.Options);
|
|
22
|
+
get threads(): ThreadsClient;
|
|
23
|
+
get messages(): MessagesClient;
|
|
24
|
+
get drafts(): DraftsClient;
|
|
25
|
+
get metrics(): MetricsClient;
|
|
25
26
|
/**
|
|
26
27
|
* @param {AgentMail.inboxes.ListInboxesRequest} request
|
|
27
|
-
* @param {
|
|
28
|
+
* @param {InboxesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
28
29
|
*
|
|
29
30
|
* @example
|
|
30
31
|
* await client.inboxes.list()
|
|
31
32
|
*/
|
|
32
|
-
list(request?: AgentMail.inboxes.ListInboxesRequest, requestOptions?:
|
|
33
|
+
list(request?: AgentMail.inboxes.ListInboxesRequest, requestOptions?: InboxesClient.RequestOptions): core.HttpResponsePromise<AgentMail.inboxes.ListInboxesResponse>;
|
|
33
34
|
private __list;
|
|
34
35
|
/**
|
|
35
|
-
* @param {AgentMail.inboxes.InboxId}
|
|
36
|
-
* @param {
|
|
36
|
+
* @param {AgentMail.inboxes.InboxId} inbox_id
|
|
37
|
+
* @param {InboxesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
37
38
|
*
|
|
38
39
|
* @throws {@link AgentMail.NotFoundError}
|
|
39
40
|
*
|
|
40
41
|
* @example
|
|
41
42
|
* await client.inboxes.get("inbox_id")
|
|
42
43
|
*/
|
|
43
|
-
get(
|
|
44
|
+
get(inbox_id: AgentMail.inboxes.InboxId, requestOptions?: InboxesClient.RequestOptions): core.HttpResponsePromise<AgentMail.inboxes.Inbox>;
|
|
44
45
|
private __get;
|
|
45
46
|
/**
|
|
46
47
|
* @param {AgentMail.inboxes.CreateInboxRequest} request
|
|
47
|
-
* @param {
|
|
48
|
+
* @param {InboxesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
48
49
|
*
|
|
49
50
|
* @throws {@link AgentMail.ValidationError}
|
|
50
51
|
*
|
|
51
52
|
* @example
|
|
52
53
|
* await client.inboxes.create({})
|
|
53
54
|
*/
|
|
54
|
-
create(request: AgentMail.inboxes.CreateInboxRequest, requestOptions?:
|
|
55
|
+
create(request: AgentMail.inboxes.CreateInboxRequest, requestOptions?: InboxesClient.RequestOptions): core.HttpResponsePromise<AgentMail.inboxes.Inbox>;
|
|
55
56
|
private __create;
|
|
56
57
|
/**
|
|
57
|
-
* @param {AgentMail.inboxes.InboxId}
|
|
58
|
+
* @param {AgentMail.inboxes.InboxId} inbox_id
|
|
58
59
|
* @param {AgentMail.inboxes.UpdateInboxRequest} request
|
|
59
|
-
* @param {
|
|
60
|
+
* @param {InboxesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
60
61
|
*
|
|
61
62
|
* @throws {@link AgentMail.NotFoundError}
|
|
62
63
|
*
|
|
@@ -65,18 +66,17 @@ export declare class Inboxes {
|
|
|
65
66
|
* displayName: "display_name"
|
|
66
67
|
* })
|
|
67
68
|
*/
|
|
68
|
-
update(
|
|
69
|
+
update(inbox_id: AgentMail.inboxes.InboxId, request: AgentMail.inboxes.UpdateInboxRequest, requestOptions?: InboxesClient.RequestOptions): core.HttpResponsePromise<AgentMail.inboxes.Inbox>;
|
|
69
70
|
private __update;
|
|
70
71
|
/**
|
|
71
|
-
* @param {AgentMail.inboxes.InboxId}
|
|
72
|
-
* @param {
|
|
72
|
+
* @param {AgentMail.inboxes.InboxId} inbox_id
|
|
73
|
+
* @param {InboxesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
73
74
|
*
|
|
74
75
|
* @throws {@link AgentMail.NotFoundError}
|
|
75
76
|
*
|
|
76
77
|
* @example
|
|
77
78
|
* await client.inboxes.delete("inbox_id")
|
|
78
79
|
*/
|
|
79
|
-
delete(
|
|
80
|
+
delete(inbox_id: AgentMail.inboxes.InboxId, requestOptions?: InboxesClient.RequestOptions): core.HttpResponsePromise<void>;
|
|
80
81
|
private __delete;
|
|
81
|
-
protected _getAuthorizationHeader(): Promise<string>;
|
|
82
82
|
}
|