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
|
@@ -43,20 +43,21 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
43
43
|
});
|
|
44
44
|
};
|
|
45
45
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
|
-
exports.
|
|
46
|
+
exports.DomainsClient = void 0;
|
|
47
|
+
const BaseClient_js_1 = require("../../../../BaseClient.js");
|
|
47
48
|
const headers_js_1 = require("../../../../core/headers.js");
|
|
48
49
|
const core = __importStar(require("../../../../core/index.js"));
|
|
49
50
|
const environments = __importStar(require("../../../../environments.js"));
|
|
50
51
|
const errors = __importStar(require("../../../../errors/index.js"));
|
|
51
52
|
const serializers = __importStar(require("../../../../serialization/index.js"));
|
|
52
53
|
const AgentMail = __importStar(require("../../../index.js"));
|
|
53
|
-
class
|
|
54
|
-
constructor(
|
|
55
|
-
this._options =
|
|
54
|
+
class DomainsClient {
|
|
55
|
+
constructor(options = {}) {
|
|
56
|
+
this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
|
|
56
57
|
}
|
|
57
58
|
/**
|
|
58
59
|
* @param {AgentMail.ListDomainsRequest} request
|
|
59
|
-
* @param {
|
|
60
|
+
* @param {DomainsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
60
61
|
*
|
|
61
62
|
* @example
|
|
62
63
|
* await client.domains.list()
|
|
@@ -66,7 +67,7 @@ class Domains {
|
|
|
66
67
|
}
|
|
67
68
|
__list() {
|
|
68
69
|
return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
|
|
69
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
70
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
70
71
|
const { limit, pageToken } = request;
|
|
71
72
|
const _queryParams = {};
|
|
72
73
|
if (limit != null) {
|
|
@@ -75,7 +76,8 @@ class Domains {
|
|
|
75
76
|
if (pageToken != null) {
|
|
76
77
|
_queryParams.page_token = pageToken;
|
|
77
78
|
}
|
|
78
|
-
const
|
|
79
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
80
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
79
81
|
const _response = yield core.fetcher({
|
|
80
82
|
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"),
|
|
81
83
|
method: "GET",
|
|
@@ -84,6 +86,8 @@ class Domains {
|
|
|
84
86
|
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,
|
|
85
87
|
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,
|
|
86
88
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
89
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
90
|
+
logging: this._options.logging,
|
|
87
91
|
});
|
|
88
92
|
if (_response.ok) {
|
|
89
93
|
return {
|
|
@@ -122,29 +126,32 @@ class Domains {
|
|
|
122
126
|
});
|
|
123
127
|
}
|
|
124
128
|
/**
|
|
125
|
-
* @param {AgentMail.DomainId}
|
|
126
|
-
* @param {
|
|
129
|
+
* @param {AgentMail.DomainId} domain_id
|
|
130
|
+
* @param {DomainsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
127
131
|
*
|
|
128
132
|
* @throws {@link AgentMail.NotFoundError}
|
|
129
133
|
*
|
|
130
134
|
* @example
|
|
131
135
|
* await client.domains.get("domain_id")
|
|
132
136
|
*/
|
|
133
|
-
get(
|
|
134
|
-
return core.HttpResponsePromise.fromPromise(this.__get(
|
|
137
|
+
get(domain_id, requestOptions) {
|
|
138
|
+
return core.HttpResponsePromise.fromPromise(this.__get(domain_id, requestOptions));
|
|
135
139
|
}
|
|
136
|
-
__get(
|
|
140
|
+
__get(domain_id, requestOptions) {
|
|
137
141
|
return __awaiter(this, void 0, void 0, function* () {
|
|
138
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
139
|
-
const
|
|
142
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
143
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
144
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
140
145
|
const _response = yield core.fetcher({
|
|
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/domains/${core.url.encodePathParam(serializers.DomainId.jsonOrThrow(
|
|
146
|
+
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 }))}`),
|
|
142
147
|
method: "GET",
|
|
143
148
|
headers: _headers,
|
|
144
149
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
145
150
|
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,
|
|
146
151
|
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,
|
|
147
152
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
153
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
154
|
+
logging: this._options.logging,
|
|
148
155
|
});
|
|
149
156
|
if (_response.ok) {
|
|
150
157
|
return {
|
|
@@ -196,15 +203,16 @@ class Domains {
|
|
|
196
203
|
/**
|
|
197
204
|
* @throws {@link AgentMail.NotFoundError}
|
|
198
205
|
*/
|
|
199
|
-
getZoneFile(
|
|
200
|
-
return core.HttpResponsePromise.fromPromise(this.__getZoneFile(
|
|
206
|
+
getZoneFile(domain_id, requestOptions) {
|
|
207
|
+
return core.HttpResponsePromise.fromPromise(this.__getZoneFile(domain_id, requestOptions));
|
|
201
208
|
}
|
|
202
|
-
__getZoneFile(
|
|
209
|
+
__getZoneFile(domain_id, requestOptions) {
|
|
203
210
|
return __awaiter(this, void 0, void 0, function* () {
|
|
204
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
205
|
-
const
|
|
211
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
212
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
213
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
206
214
|
const _response = yield core.fetcher({
|
|
207
|
-
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(
|
|
215
|
+
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`),
|
|
208
216
|
method: "GET",
|
|
209
217
|
headers: _headers,
|
|
210
218
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
@@ -212,6 +220,8 @@ class Domains {
|
|
|
212
220
|
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,
|
|
213
221
|
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,
|
|
214
222
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
223
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
224
|
+
logging: this._options.logging,
|
|
215
225
|
});
|
|
216
226
|
if (_response.ok) {
|
|
217
227
|
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
@@ -253,7 +263,7 @@ class Domains {
|
|
|
253
263
|
}
|
|
254
264
|
/**
|
|
255
265
|
* @param {AgentMail.CreateDomainRequest} request
|
|
256
|
-
* @param {
|
|
266
|
+
* @param {DomainsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
257
267
|
*
|
|
258
268
|
* @throws {@link AgentMail.ValidationError}
|
|
259
269
|
*
|
|
@@ -268,8 +278,9 @@ class Domains {
|
|
|
268
278
|
}
|
|
269
279
|
__create(request, requestOptions) {
|
|
270
280
|
return __awaiter(this, void 0, void 0, function* () {
|
|
271
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
272
|
-
const
|
|
281
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
282
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
283
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
273
284
|
const _response = yield core.fetcher({
|
|
274
285
|
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"),
|
|
275
286
|
method: "POST",
|
|
@@ -286,6 +297,8 @@ class Domains {
|
|
|
286
297
|
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,
|
|
287
298
|
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,
|
|
288
299
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
300
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
301
|
+
logging: this._options.logging,
|
|
289
302
|
});
|
|
290
303
|
if (_response.ok) {
|
|
291
304
|
return {
|
|
@@ -335,29 +348,32 @@ class Domains {
|
|
|
335
348
|
});
|
|
336
349
|
}
|
|
337
350
|
/**
|
|
338
|
-
* @param {AgentMail.DomainId}
|
|
339
|
-
* @param {
|
|
351
|
+
* @param {AgentMail.DomainId} domain_id
|
|
352
|
+
* @param {DomainsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
340
353
|
*
|
|
341
354
|
* @throws {@link AgentMail.NotFoundError}
|
|
342
355
|
*
|
|
343
356
|
* @example
|
|
344
357
|
* await client.domains.delete("domain_id")
|
|
345
358
|
*/
|
|
346
|
-
delete(
|
|
347
|
-
return core.HttpResponsePromise.fromPromise(this.__delete(
|
|
359
|
+
delete(domain_id, requestOptions) {
|
|
360
|
+
return core.HttpResponsePromise.fromPromise(this.__delete(domain_id, requestOptions));
|
|
348
361
|
}
|
|
349
|
-
__delete(
|
|
362
|
+
__delete(domain_id, requestOptions) {
|
|
350
363
|
return __awaiter(this, void 0, void 0, function* () {
|
|
351
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
352
|
-
const
|
|
364
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
365
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
366
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
353
367
|
const _response = yield core.fetcher({
|
|
354
|
-
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(
|
|
368
|
+
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 }))}`),
|
|
355
369
|
method: "DELETE",
|
|
356
370
|
headers: _headers,
|
|
357
371
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
358
372
|
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,
|
|
359
373
|
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,
|
|
360
374
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
375
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
376
|
+
logging: this._options.logging,
|
|
361
377
|
});
|
|
362
378
|
if (_response.ok) {
|
|
363
379
|
return { data: undefined, rawResponse: _response.rawResponse };
|
|
@@ -398,29 +414,32 @@ class Domains {
|
|
|
398
414
|
});
|
|
399
415
|
}
|
|
400
416
|
/**
|
|
401
|
-
* @param {AgentMail.DomainId}
|
|
402
|
-
* @param {
|
|
417
|
+
* @param {AgentMail.DomainId} domain_id
|
|
418
|
+
* @param {DomainsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
403
419
|
*
|
|
404
420
|
* @throws {@link AgentMail.NotFoundError}
|
|
405
421
|
*
|
|
406
422
|
* @example
|
|
407
423
|
* await client.domains.verify("domain_id")
|
|
408
424
|
*/
|
|
409
|
-
verify(
|
|
410
|
-
return core.HttpResponsePromise.fromPromise(this.__verify(
|
|
425
|
+
verify(domain_id, requestOptions) {
|
|
426
|
+
return core.HttpResponsePromise.fromPromise(this.__verify(domain_id, requestOptions));
|
|
411
427
|
}
|
|
412
|
-
__verify(
|
|
428
|
+
__verify(domain_id, requestOptions) {
|
|
413
429
|
return __awaiter(this, void 0, void 0, function* () {
|
|
414
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
415
|
-
const
|
|
430
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
431
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
432
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
416
433
|
const _response = yield core.fetcher({
|
|
417
|
-
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(
|
|
434
|
+
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`),
|
|
418
435
|
method: "POST",
|
|
419
436
|
headers: _headers,
|
|
420
437
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
421
438
|
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,
|
|
422
439
|
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,
|
|
423
440
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
441
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
442
|
+
logging: this._options.logging,
|
|
424
443
|
});
|
|
425
444
|
if (_response.ok) {
|
|
426
445
|
return { data: undefined, rawResponse: _response.rawResponse };
|
|
@@ -460,17 +479,5 @@ class Domains {
|
|
|
460
479
|
}
|
|
461
480
|
});
|
|
462
481
|
}
|
|
463
|
-
_getAuthorizationHeader() {
|
|
464
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
465
|
-
var _a;
|
|
466
|
-
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;
|
|
467
|
-
if (bearer == null) {
|
|
468
|
-
throw new errors.AgentMailError({
|
|
469
|
-
message: "Please specify a bearer by either passing it in to the constructor or initializing a AGENTMAIL_API_KEY environment variable",
|
|
470
|
-
});
|
|
471
|
-
}
|
|
472
|
-
return `Bearer ${bearer}`;
|
|
473
|
-
});
|
|
474
|
-
}
|
|
475
482
|
}
|
|
476
|
-
exports.
|
|
483
|
+
exports.DomainsClient = DomainsClient;
|
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js";
|
|
2
|
+
import { type NormalizedClientOptionsWithAuth } from "../../../../BaseClient.js";
|
|
2
3
|
import * as core from "../../../../core/index.js";
|
|
3
4
|
import * as AgentMail from "../../../index.js";
|
|
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
|
}
|
|
@@ -43,7 +43,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
43
43
|
});
|
|
44
44
|
};
|
|
45
45
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
|
-
exports.
|
|
46
|
+
exports.DraftsClient = void 0;
|
|
47
|
+
const BaseClient_js_1 = require("../../../../BaseClient.js");
|
|
47
48
|
const headers_js_1 = require("../../../../core/headers.js");
|
|
48
49
|
const core = __importStar(require("../../../../core/index.js"));
|
|
49
50
|
const json_js_1 = require("../../../../core/json.js");
|
|
@@ -51,13 +52,13 @@ const environments = __importStar(require("../../../../environments.js"));
|
|
|
51
52
|
const errors = __importStar(require("../../../../errors/index.js"));
|
|
52
53
|
const serializers = __importStar(require("../../../../serialization/index.js"));
|
|
53
54
|
const AgentMail = __importStar(require("../../../index.js"));
|
|
54
|
-
class
|
|
55
|
-
constructor(
|
|
56
|
-
this._options =
|
|
55
|
+
class DraftsClient {
|
|
56
|
+
constructor(options = {}) {
|
|
57
|
+
this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
|
|
57
58
|
}
|
|
58
59
|
/**
|
|
59
60
|
* @param {AgentMail.ListDraftsRequest} request
|
|
60
|
-
* @param {
|
|
61
|
+
* @param {DraftsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
61
62
|
*
|
|
62
63
|
* @throws {@link AgentMail.NotFoundError}
|
|
63
64
|
*
|
|
@@ -69,7 +70,7 @@ class Drafts {
|
|
|
69
70
|
}
|
|
70
71
|
__list() {
|
|
71
72
|
return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
|
|
72
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
73
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
73
74
|
const { limit, pageToken, labels, before, after, ascending } = request;
|
|
74
75
|
const _queryParams = {};
|
|
75
76
|
if (limit != null) {
|
|
@@ -95,7 +96,8 @@ class Drafts {
|
|
|
95
96
|
if (ascending != null) {
|
|
96
97
|
_queryParams.ascending = ascending.toString();
|
|
97
98
|
}
|
|
98
|
-
const
|
|
99
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
100
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
99
101
|
const _response = yield core.fetcher({
|
|
100
102
|
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"),
|
|
101
103
|
method: "GET",
|
|
@@ -104,6 +106,8 @@ class Drafts {
|
|
|
104
106
|
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,
|
|
105
107
|
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,
|
|
106
108
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
109
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
110
|
+
logging: this._options.logging,
|
|
107
111
|
});
|
|
108
112
|
if (_response.ok) {
|
|
109
113
|
return {
|
|
@@ -153,29 +157,32 @@ class Drafts {
|
|
|
153
157
|
});
|
|
154
158
|
}
|
|
155
159
|
/**
|
|
156
|
-
* @param {AgentMail.DraftId}
|
|
157
|
-
* @param {
|
|
160
|
+
* @param {AgentMail.DraftId} draft_id
|
|
161
|
+
* @param {DraftsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
158
162
|
*
|
|
159
163
|
* @throws {@link AgentMail.NotFoundError}
|
|
160
164
|
*
|
|
161
165
|
* @example
|
|
162
166
|
* await client.drafts.get("draft_id")
|
|
163
167
|
*/
|
|
164
|
-
get(
|
|
165
|
-
return core.HttpResponsePromise.fromPromise(this.__get(
|
|
168
|
+
get(draft_id, requestOptions) {
|
|
169
|
+
return core.HttpResponsePromise.fromPromise(this.__get(draft_id, requestOptions));
|
|
166
170
|
}
|
|
167
|
-
__get(
|
|
171
|
+
__get(draft_id, requestOptions) {
|
|
168
172
|
return __awaiter(this, void 0, void 0, function* () {
|
|
169
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
170
|
-
const
|
|
173
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
174
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
175
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
171
176
|
const _response = yield core.fetcher({
|
|
172
|
-
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(
|
|
177
|
+
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 }))}`),
|
|
173
178
|
method: "GET",
|
|
174
179
|
headers: _headers,
|
|
175
180
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
176
181
|
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
182
|
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
183
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
184
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
185
|
+
logging: this._options.logging,
|
|
179
186
|
});
|
|
180
187
|
if (_response.ok) {
|
|
181
188
|
return {
|
|
@@ -224,17 +231,5 @@ class Drafts {
|
|
|
224
231
|
}
|
|
225
232
|
});
|
|
226
233
|
}
|
|
227
|
-
_getAuthorizationHeader() {
|
|
228
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
229
|
-
var _a;
|
|
230
|
-
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;
|
|
231
|
-
if (bearer == null) {
|
|
232
|
-
throw new errors.AgentMailError({
|
|
233
|
-
message: "Please specify a bearer by either passing it in to the constructor or initializing a AGENTMAIL_API_KEY environment variable",
|
|
234
|
-
});
|
|
235
|
-
}
|
|
236
|
-
return `Bearer ${bearer}`;
|
|
237
|
-
});
|
|
238
|
-
}
|
|
239
234
|
}
|
|
240
|
-
exports.
|
|
235
|
+
exports.DraftsClient = DraftsClient;
|
|
@@ -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.js";
|
|
2
2
|
export * from "./Complaint.js";
|
|
3
3
|
export * from "./Delivery.js";
|
|
4
|
+
export * from "./DomainVerifiedEvent.js";
|
|
4
5
|
export * from "./EventId.js";
|
|
6
|
+
export * from "./EventType.js";
|
|
7
|
+
export * from "./EventTypes.js";
|
|
5
8
|
export * from "./MessageBouncedEvent.js";
|
|
6
9
|
export * from "./MessageComplainedEvent.js";
|
|
7
10
|
export * from "./MessageDeliveredEvent.js";
|
|
@@ -17,7 +17,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./Bounce.js"), exports);
|
|
18
18
|
__exportStar(require("./Complaint.js"), exports);
|
|
19
19
|
__exportStar(require("./Delivery.js"), exports);
|
|
20
|
+
__exportStar(require("./DomainVerifiedEvent.js"), exports);
|
|
20
21
|
__exportStar(require("./EventId.js"), exports);
|
|
22
|
+
__exportStar(require("./EventType.js"), exports);
|
|
23
|
+
__exportStar(require("./EventTypes.js"), exports);
|
|
21
24
|
__exportStar(require("./MessageBouncedEvent.js"), exports);
|
|
22
25
|
__exportStar(require("./MessageComplainedEvent.js"), exports);
|
|
23
26
|
__exportStar(require("./MessageDeliveredEvent.js"), exports);
|
|
@@ -1,62 +1,63 @@
|
|
|
1
1
|
import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js";
|
|
2
|
+
import { type NormalizedClientOptionsWithAuth } from "../../../../BaseClient.js";
|
|
2
3
|
import * as core from "../../../../core/index.js";
|
|
3
4
|
import * as AgentMail from "../../../index.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
export declare namespace
|
|
5
|
+
import { DraftsClient } from "../resources/drafts/client/Client.js";
|
|
6
|
+
import { MessagesClient } from "../resources/messages/client/Client.js";
|
|
7
|
+
import { MetricsClient } from "../resources/metrics/client/Client.js";
|
|
8
|
+
import { ThreadsClient } from "../resources/threads/client/Client.js";
|
|
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
|
}
|