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,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.MessagesClient = 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,26 +52,26 @@ 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 MessagesClient {
|
|
56
|
+
constructor(options = {}) {
|
|
57
|
+
this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
|
|
57
58
|
}
|
|
58
59
|
/**
|
|
59
|
-
* @param {AgentMail.inboxes.InboxId}
|
|
60
|
+
* @param {AgentMail.inboxes.InboxId} inbox_id
|
|
60
61
|
* @param {AgentMail.inboxes.ListMessagesRequest} request
|
|
61
|
-
* @param {
|
|
62
|
+
* @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
62
63
|
*
|
|
63
64
|
* @throws {@link AgentMail.NotFoundError}
|
|
64
65
|
*
|
|
65
66
|
* @example
|
|
66
67
|
* await client.inboxes.messages.list("inbox_id")
|
|
67
68
|
*/
|
|
68
|
-
list(
|
|
69
|
-
return core.HttpResponsePromise.fromPromise(this.__list(
|
|
69
|
+
list(inbox_id, request = {}, requestOptions) {
|
|
70
|
+
return core.HttpResponsePromise.fromPromise(this.__list(inbox_id, request, requestOptions));
|
|
70
71
|
}
|
|
71
|
-
__list(
|
|
72
|
-
return __awaiter(this, arguments, void 0, function* (
|
|
73
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
72
|
+
__list(inbox_id_1) {
|
|
73
|
+
return __awaiter(this, arguments, void 0, function* (inbox_id, request = {}, requestOptions) {
|
|
74
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
74
75
|
const { limit, pageToken, labels, before, after, ascending } = request;
|
|
75
76
|
const _queryParams = {};
|
|
76
77
|
if (limit != null) {
|
|
@@ -96,15 +97,18 @@ class Messages {
|
|
|
96
97
|
if (ascending != null) {
|
|
97
98
|
_queryParams.ascending = ascending.toString();
|
|
98
99
|
}
|
|
99
|
-
const
|
|
100
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
101
|
+
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);
|
|
100
102
|
const _response = yield core.fetcher({
|
|
101
|
-
url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : ((_c = (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentMailEnvironment.Production).http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(
|
|
103
|
+
url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : ((_c = (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentMailEnvironment.Production).http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/messages`),
|
|
102
104
|
method: "GET",
|
|
103
105
|
headers: _headers,
|
|
104
106
|
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
105
107
|
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,
|
|
106
108
|
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,
|
|
107
109
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
110
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
111
|
+
logging: this._options.logging,
|
|
108
112
|
});
|
|
109
113
|
if (_response.ok) {
|
|
110
114
|
return {
|
|
@@ -154,30 +158,33 @@ class Messages {
|
|
|
154
158
|
});
|
|
155
159
|
}
|
|
156
160
|
/**
|
|
157
|
-
* @param {AgentMail.inboxes.InboxId}
|
|
158
|
-
* @param {AgentMail.MessageId}
|
|
159
|
-
* @param {
|
|
161
|
+
* @param {AgentMail.inboxes.InboxId} inbox_id
|
|
162
|
+
* @param {AgentMail.MessageId} message_id
|
|
163
|
+
* @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
160
164
|
*
|
|
161
165
|
* @throws {@link AgentMail.NotFoundError}
|
|
162
166
|
*
|
|
163
167
|
* @example
|
|
164
168
|
* await client.inboxes.messages.get("inbox_id", "message_id")
|
|
165
169
|
*/
|
|
166
|
-
get(
|
|
167
|
-
return core.HttpResponsePromise.fromPromise(this.__get(
|
|
170
|
+
get(inbox_id, message_id, requestOptions) {
|
|
171
|
+
return core.HttpResponsePromise.fromPromise(this.__get(inbox_id, message_id, requestOptions));
|
|
168
172
|
}
|
|
169
|
-
__get(
|
|
173
|
+
__get(inbox_id, message_id, requestOptions) {
|
|
170
174
|
return __awaiter(this, void 0, void 0, function* () {
|
|
171
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
172
|
-
const
|
|
175
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
176
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
177
|
+
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);
|
|
173
178
|
const _response = yield core.fetcher({
|
|
174
|
-
url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : ((_c = (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentMailEnvironment.Production).http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(
|
|
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/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/messages/${core.url.encodePathParam(serializers.MessageId.jsonOrThrow(message_id, { omitUndefined: true }))}`),
|
|
175
180
|
method: "GET",
|
|
176
181
|
headers: _headers,
|
|
177
182
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
178
183
|
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,
|
|
179
184
|
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,
|
|
180
185
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
186
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
187
|
+
logging: this._options.logging,
|
|
181
188
|
});
|
|
182
189
|
if (_response.ok) {
|
|
183
190
|
return {
|
|
@@ -229,15 +236,16 @@ class Messages {
|
|
|
229
236
|
/**
|
|
230
237
|
* @throws {@link AgentMail.NotFoundError}
|
|
231
238
|
*/
|
|
232
|
-
getAttachment(
|
|
233
|
-
return core.HttpResponsePromise.fromPromise(this.__getAttachment(
|
|
239
|
+
getAttachment(inbox_id, message_id, attachment_id, requestOptions) {
|
|
240
|
+
return core.HttpResponsePromise.fromPromise(this.__getAttachment(inbox_id, message_id, attachment_id, requestOptions));
|
|
234
241
|
}
|
|
235
|
-
__getAttachment(
|
|
242
|
+
__getAttachment(inbox_id, message_id, attachment_id, requestOptions) {
|
|
236
243
|
return __awaiter(this, void 0, void 0, function* () {
|
|
237
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
238
|
-
const
|
|
244
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
245
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
246
|
+
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);
|
|
239
247
|
const _response = yield core.fetcher({
|
|
240
|
-
url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : ((_c = (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentMailEnvironment.Production).http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(
|
|
248
|
+
url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : ((_c = (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentMailEnvironment.Production).http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/messages/${core.url.encodePathParam(serializers.MessageId.jsonOrThrow(message_id, { omitUndefined: true }))}/attachments/${core.url.encodePathParam(serializers.AttachmentId.jsonOrThrow(attachment_id, { omitUndefined: true }))}`),
|
|
241
249
|
method: "GET",
|
|
242
250
|
headers: _headers,
|
|
243
251
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
@@ -245,6 +253,8 @@ class Messages {
|
|
|
245
253
|
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,
|
|
246
254
|
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,
|
|
247
255
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
256
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
257
|
+
logging: this._options.logging,
|
|
248
258
|
});
|
|
249
259
|
if (_response.ok) {
|
|
250
260
|
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
@@ -287,15 +297,16 @@ class Messages {
|
|
|
287
297
|
/**
|
|
288
298
|
* @throws {@link AgentMail.NotFoundError}
|
|
289
299
|
*/
|
|
290
|
-
getRaw(
|
|
291
|
-
return core.HttpResponsePromise.fromPromise(this.__getRaw(
|
|
300
|
+
getRaw(inbox_id, message_id, requestOptions) {
|
|
301
|
+
return core.HttpResponsePromise.fromPromise(this.__getRaw(inbox_id, message_id, requestOptions));
|
|
292
302
|
}
|
|
293
|
-
__getRaw(
|
|
303
|
+
__getRaw(inbox_id, message_id, requestOptions) {
|
|
294
304
|
return __awaiter(this, void 0, void 0, function* () {
|
|
295
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
296
|
-
const
|
|
305
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
306
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
307
|
+
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);
|
|
297
308
|
const _response = yield core.fetcher({
|
|
298
|
-
url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : ((_c = (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentMailEnvironment.Production).http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(
|
|
309
|
+
url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : ((_c = (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentMailEnvironment.Production).http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/messages/${core.url.encodePathParam(serializers.MessageId.jsonOrThrow(message_id, { omitUndefined: true }))}/raw`),
|
|
299
310
|
method: "GET",
|
|
300
311
|
headers: _headers,
|
|
301
312
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
@@ -303,6 +314,8 @@ class Messages {
|
|
|
303
314
|
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,
|
|
304
315
|
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,
|
|
305
316
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
317
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
318
|
+
logging: this._options.logging,
|
|
306
319
|
});
|
|
307
320
|
if (_response.ok) {
|
|
308
321
|
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
@@ -343,9 +356,9 @@ class Messages {
|
|
|
343
356
|
});
|
|
344
357
|
}
|
|
345
358
|
/**
|
|
346
|
-
* @param {AgentMail.inboxes.InboxId}
|
|
359
|
+
* @param {AgentMail.inboxes.InboxId} inbox_id
|
|
347
360
|
* @param {AgentMail.SendMessageRequest} request
|
|
348
|
-
* @param {
|
|
361
|
+
* @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
349
362
|
*
|
|
350
363
|
* @throws {@link AgentMail.ValidationError}
|
|
351
364
|
* @throws {@link AgentMail.NotFoundError}
|
|
@@ -354,15 +367,16 @@ class Messages {
|
|
|
354
367
|
* @example
|
|
355
368
|
* await client.inboxes.messages.send("inbox_id", {})
|
|
356
369
|
*/
|
|
357
|
-
send(
|
|
358
|
-
return core.HttpResponsePromise.fromPromise(this.__send(
|
|
370
|
+
send(inbox_id, request, requestOptions) {
|
|
371
|
+
return core.HttpResponsePromise.fromPromise(this.__send(inbox_id, request, requestOptions));
|
|
359
372
|
}
|
|
360
|
-
__send(
|
|
373
|
+
__send(inbox_id, request, requestOptions) {
|
|
361
374
|
return __awaiter(this, void 0, void 0, function* () {
|
|
362
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
363
|
-
const
|
|
375
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
376
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
377
|
+
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);
|
|
364
378
|
const _response = yield core.fetcher({
|
|
365
|
-
url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : ((_c = (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentMailEnvironment.Production).http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(
|
|
379
|
+
url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : ((_c = (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentMailEnvironment.Production).http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/messages/send`),
|
|
366
380
|
method: "POST",
|
|
367
381
|
headers: _headers,
|
|
368
382
|
contentType: "application/json",
|
|
@@ -377,6 +391,8 @@ class Messages {
|
|
|
377
391
|
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,
|
|
378
392
|
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,
|
|
379
393
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
394
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
395
|
+
logging: this._options.logging,
|
|
380
396
|
});
|
|
381
397
|
if (_response.ok) {
|
|
382
398
|
return {
|
|
@@ -442,10 +458,10 @@ class Messages {
|
|
|
442
458
|
});
|
|
443
459
|
}
|
|
444
460
|
/**
|
|
445
|
-
* @param {AgentMail.inboxes.InboxId}
|
|
446
|
-
* @param {AgentMail.MessageId}
|
|
461
|
+
* @param {AgentMail.inboxes.InboxId} inbox_id
|
|
462
|
+
* @param {AgentMail.MessageId} message_id
|
|
447
463
|
* @param {AgentMail.ReplyToMessageRequest} request
|
|
448
|
-
* @param {
|
|
464
|
+
* @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
449
465
|
*
|
|
450
466
|
* @throws {@link AgentMail.ValidationError}
|
|
451
467
|
* @throws {@link AgentMail.NotFoundError}
|
|
@@ -454,15 +470,16 @@ class Messages {
|
|
|
454
470
|
* @example
|
|
455
471
|
* await client.inboxes.messages.reply("inbox_id", "message_id", {})
|
|
456
472
|
*/
|
|
457
|
-
reply(
|
|
458
|
-
return core.HttpResponsePromise.fromPromise(this.__reply(
|
|
473
|
+
reply(inbox_id, message_id, request, requestOptions) {
|
|
474
|
+
return core.HttpResponsePromise.fromPromise(this.__reply(inbox_id, message_id, request, requestOptions));
|
|
459
475
|
}
|
|
460
|
-
__reply(
|
|
476
|
+
__reply(inbox_id, message_id, request, requestOptions) {
|
|
461
477
|
return __awaiter(this, void 0, void 0, function* () {
|
|
462
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
463
|
-
const
|
|
478
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
479
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
480
|
+
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);
|
|
464
481
|
const _response = yield core.fetcher({
|
|
465
|
-
url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : ((_c = (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentMailEnvironment.Production).http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(
|
|
482
|
+
url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : ((_c = (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentMailEnvironment.Production).http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/messages/${core.url.encodePathParam(serializers.MessageId.jsonOrThrow(message_id, { omitUndefined: true }))}/reply`),
|
|
466
483
|
method: "POST",
|
|
467
484
|
headers: _headers,
|
|
468
485
|
contentType: "application/json",
|
|
@@ -477,6 +494,8 @@ class Messages {
|
|
|
477
494
|
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,
|
|
478
495
|
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,
|
|
479
496
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
497
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
498
|
+
logging: this._options.logging,
|
|
480
499
|
});
|
|
481
500
|
if (_response.ok) {
|
|
482
501
|
return {
|
|
@@ -542,10 +561,10 @@ class Messages {
|
|
|
542
561
|
});
|
|
543
562
|
}
|
|
544
563
|
/**
|
|
545
|
-
* @param {AgentMail.inboxes.InboxId}
|
|
546
|
-
* @param {AgentMail.MessageId}
|
|
564
|
+
* @param {AgentMail.inboxes.InboxId} inbox_id
|
|
565
|
+
* @param {AgentMail.MessageId} message_id
|
|
547
566
|
* @param {AgentMail.UpdateMessageRequest} request
|
|
548
|
-
* @param {
|
|
567
|
+
* @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
549
568
|
*
|
|
550
569
|
* @throws {@link AgentMail.ValidationError}
|
|
551
570
|
* @throws {@link AgentMail.NotFoundError}
|
|
@@ -553,15 +572,16 @@ class Messages {
|
|
|
553
572
|
* @example
|
|
554
573
|
* await client.inboxes.messages.update("inbox_id", "message_id", {})
|
|
555
574
|
*/
|
|
556
|
-
update(
|
|
557
|
-
return core.HttpResponsePromise.fromPromise(this.__update(
|
|
575
|
+
update(inbox_id, message_id, request, requestOptions) {
|
|
576
|
+
return core.HttpResponsePromise.fromPromise(this.__update(inbox_id, message_id, request, requestOptions));
|
|
558
577
|
}
|
|
559
|
-
__update(
|
|
578
|
+
__update(inbox_id, message_id, request, requestOptions) {
|
|
560
579
|
return __awaiter(this, void 0, void 0, function* () {
|
|
561
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
562
|
-
const
|
|
580
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
581
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
582
|
+
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);
|
|
563
583
|
const _response = yield core.fetcher({
|
|
564
|
-
url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : ((_c = (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentMailEnvironment.Production).http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(
|
|
584
|
+
url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : ((_c = (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentMailEnvironment.Production).http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/messages/${core.url.encodePathParam(serializers.MessageId.jsonOrThrow(message_id, { omitUndefined: true }))}`),
|
|
565
585
|
method: "PATCH",
|
|
566
586
|
headers: _headers,
|
|
567
587
|
contentType: "application/json",
|
|
@@ -576,6 +596,8 @@ class Messages {
|
|
|
576
596
|
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,
|
|
577
597
|
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,
|
|
578
598
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
599
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
600
|
+
logging: this._options.logging,
|
|
579
601
|
});
|
|
580
602
|
if (_response.ok) {
|
|
581
603
|
return {
|
|
@@ -632,17 +654,5 @@ class Messages {
|
|
|
632
654
|
}
|
|
633
655
|
});
|
|
634
656
|
}
|
|
635
|
-
_getAuthorizationHeader() {
|
|
636
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
637
|
-
var _a;
|
|
638
|
-
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;
|
|
639
|
-
if (bearer == null) {
|
|
640
|
-
throw new errors.AgentMailError({
|
|
641
|
-
message: "Please specify a bearer by either passing it in to the constructor or initializing a AGENTMAIL_API_KEY environment variable",
|
|
642
|
-
});
|
|
643
|
-
}
|
|
644
|
-
return `Bearer ${bearer}`;
|
|
645
|
-
});
|
|
646
|
-
}
|
|
647
657
|
}
|
|
648
|
-
exports.
|
|
658
|
+
exports.MessagesClient = MessagesClient;
|
|
@@ -1,19 +1,20 @@
|
|
|
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 MetricsClient {
|
|
5
6
|
interface Options extends BaseClientOptions {
|
|
6
7
|
}
|
|
7
8
|
interface RequestOptions extends BaseRequestOptions {
|
|
8
9
|
}
|
|
9
10
|
}
|
|
10
|
-
export declare class
|
|
11
|
-
protected readonly _options:
|
|
12
|
-
constructor(
|
|
11
|
+
export declare class MetricsClient {
|
|
12
|
+
protected readonly _options: NormalizedClientOptionsWithAuth<MetricsClient.Options>;
|
|
13
|
+
constructor(options?: MetricsClient.Options);
|
|
13
14
|
/**
|
|
14
|
-
* @param {AgentMail.inboxes.InboxId}
|
|
15
|
+
* @param {AgentMail.inboxes.InboxId} inbox_id
|
|
15
16
|
* @param {AgentMail.inboxes.ListInboxMetricsRequest} request
|
|
16
|
-
* @param {
|
|
17
|
+
* @param {MetricsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
17
18
|
*
|
|
18
19
|
* @throws {@link AgentMail.NotFoundError}
|
|
19
20
|
* @throws {@link AgentMail.ValidationError}
|
|
@@ -24,7 +25,6 @@ export declare class Metrics {
|
|
|
24
25
|
* endTimestamp: new Date("2024-01-15T09:30:00.000Z")
|
|
25
26
|
* })
|
|
26
27
|
*/
|
|
27
|
-
get(
|
|
28
|
+
get(inbox_id: AgentMail.inboxes.InboxId, request: AgentMail.inboxes.ListInboxMetricsRequest, requestOptions?: MetricsClient.RequestOptions): core.HttpResponsePromise<AgentMail.ListMetricsResponse>;
|
|
28
29
|
private __get;
|
|
29
|
-
protected _getAuthorizationHeader(): Promise<string>;
|
|
30
30
|
}
|
|
@@ -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.MetricsClient = 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,14 +52,14 @@ 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 MetricsClient {
|
|
56
|
+
constructor(options = {}) {
|
|
57
|
+
this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
|
|
57
58
|
}
|
|
58
59
|
/**
|
|
59
|
-
* @param {AgentMail.inboxes.InboxId}
|
|
60
|
+
* @param {AgentMail.inboxes.InboxId} inbox_id
|
|
60
61
|
* @param {AgentMail.inboxes.ListInboxMetricsRequest} request
|
|
61
|
-
* @param {
|
|
62
|
+
* @param {MetricsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
62
63
|
*
|
|
63
64
|
* @throws {@link AgentMail.NotFoundError}
|
|
64
65
|
* @throws {@link AgentMail.ValidationError}
|
|
@@ -69,12 +70,12 @@ class Metrics {
|
|
|
69
70
|
* endTimestamp: new Date("2024-01-15T09:30:00.000Z")
|
|
70
71
|
* })
|
|
71
72
|
*/
|
|
72
|
-
get(
|
|
73
|
-
return core.HttpResponsePromise.fromPromise(this.__get(
|
|
73
|
+
get(inbox_id, request, requestOptions) {
|
|
74
|
+
return core.HttpResponsePromise.fromPromise(this.__get(inbox_id, request, requestOptions));
|
|
74
75
|
}
|
|
75
|
-
__get(
|
|
76
|
+
__get(inbox_id, request, requestOptions) {
|
|
76
77
|
return __awaiter(this, void 0, void 0, function* () {
|
|
77
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
78
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
78
79
|
const { eventTypes, startTimestamp, endTimestamp } = request;
|
|
79
80
|
const _queryParams = {};
|
|
80
81
|
if (eventTypes != null) {
|
|
@@ -87,15 +88,18 @@ class Metrics {
|
|
|
87
88
|
}
|
|
88
89
|
_queryParams.start_timestamp = startTimestamp.toISOString();
|
|
89
90
|
_queryParams.end_timestamp = endTimestamp.toISOString();
|
|
90
|
-
const
|
|
91
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
92
|
+
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);
|
|
91
93
|
const _response = yield core.fetcher({
|
|
92
|
-
url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : ((_c = (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentMailEnvironment.Production).http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(
|
|
94
|
+
url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : ((_c = (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentMailEnvironment.Production).http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/metrics`),
|
|
93
95
|
method: "GET",
|
|
94
96
|
headers: _headers,
|
|
95
97
|
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
96
98
|
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,
|
|
97
99
|
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,
|
|
98
100
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
101
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
102
|
+
logging: this._options.logging,
|
|
99
103
|
});
|
|
100
104
|
if (_response.ok) {
|
|
101
105
|
return {
|
|
@@ -152,17 +156,5 @@ class Metrics {
|
|
|
152
156
|
}
|
|
153
157
|
});
|
|
154
158
|
}
|
|
155
|
-
_getAuthorizationHeader() {
|
|
156
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
157
|
-
var _a;
|
|
158
|
-
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;
|
|
159
|
-
if (bearer == null) {
|
|
160
|
-
throw new errors.AgentMailError({
|
|
161
|
-
message: "Please specify a bearer by either passing it in to the constructor or initializing a AGENTMAIL_API_KEY environment variable",
|
|
162
|
-
});
|
|
163
|
-
}
|
|
164
|
-
return `Bearer ${bearer}`;
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
159
|
}
|
|
168
|
-
exports.
|
|
160
|
+
exports.MetricsClient = MetricsClient;
|
|
@@ -1,55 +1,55 @@
|
|
|
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 ThreadsClient {
|
|
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 ThreadsClient {
|
|
12
|
+
protected readonly _options: NormalizedClientOptionsWithAuth<ThreadsClient.Options>;
|
|
13
|
+
constructor(options?: ThreadsClient.Options);
|
|
13
14
|
/**
|
|
14
|
-
* @param {AgentMail.inboxes.InboxId}
|
|
15
|
+
* @param {AgentMail.inboxes.InboxId} inbox_id
|
|
15
16
|
* @param {AgentMail.inboxes.ListThreadsRequest} request
|
|
16
|
-
* @param {
|
|
17
|
+
* @param {ThreadsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
17
18
|
*
|
|
18
19
|
* @throws {@link AgentMail.NotFoundError}
|
|
19
20
|
*
|
|
20
21
|
* @example
|
|
21
22
|
* await client.inboxes.threads.list("inbox_id")
|
|
22
23
|
*/
|
|
23
|
-
list(
|
|
24
|
+
list(inbox_id: AgentMail.inboxes.InboxId, request?: AgentMail.inboxes.ListThreadsRequest, requestOptions?: ThreadsClient.RequestOptions): core.HttpResponsePromise<AgentMail.ListThreadsResponse>;
|
|
24
25
|
private __list;
|
|
25
26
|
/**
|
|
26
|
-
* @param {AgentMail.inboxes.InboxId}
|
|
27
|
-
* @param {AgentMail.ThreadId}
|
|
28
|
-
* @param {
|
|
27
|
+
* @param {AgentMail.inboxes.InboxId} inbox_id
|
|
28
|
+
* @param {AgentMail.ThreadId} thread_id
|
|
29
|
+
* @param {ThreadsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
29
30
|
*
|
|
30
31
|
* @throws {@link AgentMail.NotFoundError}
|
|
31
32
|
*
|
|
32
33
|
* @example
|
|
33
34
|
* await client.inboxes.threads.get("inbox_id", "thread_id")
|
|
34
35
|
*/
|
|
35
|
-
get(
|
|
36
|
+
get(inbox_id: AgentMail.inboxes.InboxId, thread_id: AgentMail.ThreadId, requestOptions?: ThreadsClient.RequestOptions): core.HttpResponsePromise<AgentMail.Thread>;
|
|
36
37
|
private __get;
|
|
37
38
|
/**
|
|
38
39
|
* @throws {@link AgentMail.NotFoundError}
|
|
39
40
|
*/
|
|
40
|
-
getAttachment(
|
|
41
|
+
getAttachment(inbox_id: AgentMail.inboxes.InboxId, thread_id: AgentMail.ThreadId, attachment_id: AgentMail.AttachmentId, requestOptions?: ThreadsClient.RequestOptions): core.HttpResponsePromise<core.BinaryResponse>;
|
|
41
42
|
private __getAttachment;
|
|
42
43
|
/**
|
|
43
|
-
* @param {AgentMail.inboxes.InboxId}
|
|
44
|
-
* @param {AgentMail.ThreadId}
|
|
45
|
-
* @param {
|
|
44
|
+
* @param {AgentMail.inboxes.InboxId} inbox_id
|
|
45
|
+
* @param {AgentMail.ThreadId} thread_id
|
|
46
|
+
* @param {ThreadsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
46
47
|
*
|
|
47
48
|
* @throws {@link AgentMail.NotFoundError}
|
|
48
49
|
*
|
|
49
50
|
* @example
|
|
50
51
|
* await client.inboxes.threads.delete("inbox_id", "thread_id")
|
|
51
52
|
*/
|
|
52
|
-
delete(
|
|
53
|
+
delete(inbox_id: AgentMail.inboxes.InboxId, thread_id: AgentMail.ThreadId, requestOptions?: ThreadsClient.RequestOptions): core.HttpResponsePromise<void>;
|
|
53
54
|
private __delete;
|
|
54
|
-
protected _getAuthorizationHeader(): Promise<string>;
|
|
55
55
|
}
|