agentmail 0.5.50 → 0.5.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/BaseClient.js +2 -2
- package/dist/cjs/Client.d.ts +3 -0
- package/dist/cjs/Client.js +21 -16
- package/dist/cjs/api/resources/forwarding/client/Client.d.ts +127 -0
- package/dist/cjs/api/resources/forwarding/client/Client.js +503 -0
- package/dist/cjs/api/resources/forwarding/client/index.d.ts +1 -0
- package/dist/cjs/api/resources/forwarding/client/index.js +2 -0
- package/dist/cjs/api/resources/forwarding/errors/ForwardingForbiddenError.d.ts +6 -0
- package/dist/cjs/api/resources/forwarding/errors/ForwardingForbiddenError.js +54 -0
- package/dist/cjs/api/resources/forwarding/errors/ForwardingRateLimitError.d.ts +6 -0
- package/dist/cjs/api/resources/forwarding/errors/ForwardingRateLimitError.js +54 -0
- package/dist/cjs/api/resources/forwarding/errors/index.d.ts +2 -0
- package/dist/cjs/api/resources/forwarding/errors/index.js +18 -0
- package/dist/cjs/api/resources/forwarding/exports.d.ts +2 -0
- package/dist/cjs/api/resources/forwarding/exports.js +21 -0
- package/dist/cjs/api/resources/forwarding/index.d.ts +3 -0
- package/dist/cjs/api/resources/forwarding/index.js +19 -0
- package/dist/cjs/api/resources/forwarding/types/ConfirmForwardingVerificationRequest.d.ts +10 -0
- package/dist/cjs/api/resources/forwarding/types/ConfirmForwardingVerificationRequest.js +3 -0
- package/dist/cjs/api/resources/forwarding/types/Forwarding.d.ts +15 -0
- package/dist/cjs/api/resources/forwarding/types/Forwarding.js +3 -0
- package/dist/cjs/api/resources/forwarding/types/ForwardingDestination.d.ts +5 -0
- package/dist/cjs/api/resources/forwarding/types/ForwardingDestination.js +3 -0
- package/dist/cjs/api/resources/forwarding/types/ForwardingVerificationConfirmed.d.ts +4 -0
- package/dist/cjs/api/resources/forwarding/types/ForwardingVerificationConfirmed.js +3 -0
- package/dist/cjs/api/resources/forwarding/types/ForwardingVerificationStarted.d.ts +4 -0
- package/dist/cjs/api/resources/forwarding/types/ForwardingVerificationStarted.js +3 -0
- package/dist/cjs/api/resources/forwarding/types/StartForwardingVerificationRequest.d.ts +5 -0
- package/dist/cjs/api/resources/forwarding/types/StartForwardingVerificationRequest.js +3 -0
- package/dist/cjs/api/resources/forwarding/types/UpdateForwardingRequest.d.ts +9 -0
- package/dist/cjs/api/resources/forwarding/types/UpdateForwardingRequest.js +3 -0
- package/dist/cjs/api/resources/forwarding/types/UpdateForwardingResponse.d.ts +8 -0
- package/dist/cjs/api/resources/forwarding/types/UpdateForwardingResponse.js +3 -0
- package/dist/cjs/api/resources/forwarding/types/index.d.ts +8 -0
- package/dist/cjs/api/resources/forwarding/types/index.js +24 -0
- package/dist/cjs/api/resources/inboxes/client/Client.d.ts +7 -1
- package/dist/cjs/api/resources/inboxes/client/Client.js +27 -11
- package/dist/cjs/api/resources/inboxes/resources/forwarding/client/Client.d.ts +79 -0
- package/dist/cjs/api/resources/inboxes/resources/forwarding/client/Client.js +317 -0
- package/dist/cjs/api/resources/inboxes/resources/forwarding/client/index.d.ts +1 -0
- package/dist/cjs/api/resources/inboxes/resources/forwarding/client/index.js +2 -0
- package/dist/cjs/api/resources/inboxes/resources/forwarding/exports.d.ts +2 -0
- package/dist/cjs/api/resources/inboxes/resources/forwarding/exports.js +21 -0
- package/dist/cjs/api/resources/inboxes/resources/forwarding/index.d.ts +1 -0
- package/dist/cjs/api/resources/inboxes/resources/forwarding/index.js +17 -0
- package/dist/cjs/api/resources/inboxes/resources/index.d.ts +1 -0
- package/dist/cjs/api/resources/inboxes/resources/index.js +2 -1
- package/dist/cjs/api/resources/index.d.ts +3 -0
- package/dist/cjs/api/resources/index.js +4 -1
- package/dist/cjs/api/resources/messages/types/Message.d.ts +2 -0
- package/dist/cjs/api/resources/messages/types/MessageItem.d.ts +2 -0
- package/dist/cjs/api/resources/messages/types/MessageOpenedAt.d.ts +6 -0
- package/dist/cjs/api/resources/messages/types/MessageOpenedAt.js +3 -0
- package/dist/cjs/api/resources/messages/types/MessageTrackOpens.d.ts +5 -0
- package/dist/cjs/api/resources/messages/types/MessageTrackOpens.js +3 -0
- package/dist/cjs/api/resources/messages/types/TrackOpens.d.ts +4 -3
- package/dist/cjs/api/resources/messages/types/index.d.ts +2 -0
- package/dist/cjs/api/resources/messages/types/index.js +2 -0
- package/dist/cjs/api/resources/pods/client/Client.d.ts +3 -0
- package/dist/cjs/api/resources/pods/client/Client.js +15 -10
- package/dist/cjs/api/resources/pods/resources/forwarding/client/Client.d.ts +80 -0
- package/dist/cjs/api/resources/pods/resources/forwarding/client/Client.js +318 -0
- package/dist/cjs/api/resources/pods/resources/forwarding/client/index.d.ts +1 -0
- package/dist/cjs/api/resources/pods/resources/forwarding/client/index.js +2 -0
- package/dist/cjs/api/resources/pods/resources/forwarding/exports.d.ts +2 -0
- package/dist/cjs/api/resources/pods/resources/forwarding/exports.js +21 -0
- package/dist/cjs/api/resources/pods/resources/forwarding/index.d.ts +1 -0
- package/dist/cjs/api/resources/pods/resources/forwarding/index.js +17 -0
- package/dist/cjs/api/resources/pods/resources/index.d.ts +1 -0
- package/dist/cjs/api/resources/pods/resources/index.js +2 -1
- package/dist/cjs/serialization/resources/forwarding/index.d.ts +1 -0
- package/dist/cjs/serialization/resources/forwarding/index.js +17 -0
- package/dist/cjs/serialization/resources/forwarding/types/ConfirmForwardingVerificationRequest.d.ts +11 -0
- package/dist/cjs/serialization/resources/forwarding/types/ConfirmForwardingVerificationRequest.js +43 -0
- package/dist/cjs/serialization/resources/forwarding/types/Forwarding.d.ts +11 -0
- package/dist/cjs/serialization/resources/forwarding/types/Forwarding.js +43 -0
- package/dist/cjs/serialization/resources/forwarding/types/ForwardingDestination.d.ts +7 -0
- package/dist/cjs/serialization/resources/forwarding/types/ForwardingDestination.js +39 -0
- package/dist/cjs/serialization/resources/forwarding/types/ForwardingVerificationConfirmed.d.ts +9 -0
- package/dist/cjs/serialization/resources/forwarding/types/ForwardingVerificationConfirmed.js +41 -0
- package/dist/cjs/serialization/resources/forwarding/types/ForwardingVerificationStarted.d.ts +9 -0
- package/dist/cjs/serialization/resources/forwarding/types/ForwardingVerificationStarted.js +41 -0
- package/dist/cjs/serialization/resources/forwarding/types/StartForwardingVerificationRequest.d.ts +10 -0
- package/dist/cjs/serialization/resources/forwarding/types/StartForwardingVerificationRequest.js +42 -0
- package/dist/cjs/serialization/resources/forwarding/types/UpdateForwardingRequest.d.ts +10 -0
- package/dist/cjs/serialization/resources/forwarding/types/UpdateForwardingRequest.js +42 -0
- package/dist/cjs/serialization/resources/forwarding/types/UpdateForwardingResponse.d.ts +10 -0
- package/dist/cjs/serialization/resources/forwarding/types/UpdateForwardingResponse.js +42 -0
- package/dist/cjs/serialization/resources/forwarding/types/index.d.ts +8 -0
- package/dist/cjs/serialization/resources/forwarding/types/index.js +24 -0
- package/dist/cjs/serialization/resources/index.d.ts +2 -0
- package/dist/cjs/serialization/resources/index.js +3 -1
- package/dist/cjs/serialization/resources/messages/types/Message.d.ts +4 -0
- package/dist/cjs/serialization/resources/messages/types/Message.js +4 -0
- package/dist/cjs/serialization/resources/messages/types/MessageItem.d.ts +4 -0
- package/dist/cjs/serialization/resources/messages/types/MessageItem.js +4 -0
- package/dist/cjs/serialization/resources/messages/types/MessageOpenedAt.d.ts +7 -0
- package/dist/cjs/serialization/resources/messages/types/MessageOpenedAt.js +39 -0
- package/dist/cjs/serialization/resources/messages/types/MessageTrackOpens.d.ts +7 -0
- package/dist/cjs/serialization/resources/messages/types/MessageTrackOpens.js +39 -0
- package/dist/cjs/serialization/resources/messages/types/index.d.ts +2 -0
- package/dist/cjs/serialization/resources/messages/types/index.js +2 -0
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.mjs +2 -2
- package/dist/esm/Client.d.mts +3 -0
- package/dist/esm/Client.mjs +5 -0
- package/dist/esm/api/resources/forwarding/client/Client.d.mts +127 -0
- package/dist/esm/api/resources/forwarding/client/Client.mjs +466 -0
- package/dist/esm/api/resources/forwarding/client/index.d.mts +1 -0
- package/dist/esm/api/resources/forwarding/client/index.mjs +1 -0
- package/dist/esm/api/resources/forwarding/errors/ForwardingForbiddenError.d.mts +6 -0
- package/dist/esm/api/resources/forwarding/errors/ForwardingForbiddenError.mjs +17 -0
- package/dist/esm/api/resources/forwarding/errors/ForwardingRateLimitError.d.mts +6 -0
- package/dist/esm/api/resources/forwarding/errors/ForwardingRateLimitError.mjs +17 -0
- package/dist/esm/api/resources/forwarding/errors/index.d.mts +2 -0
- package/dist/esm/api/resources/forwarding/errors/index.mjs +2 -0
- package/dist/esm/api/resources/forwarding/exports.d.mts +2 -0
- package/dist/esm/api/resources/forwarding/exports.mjs +3 -0
- package/dist/esm/api/resources/forwarding/index.d.mts +3 -0
- package/dist/esm/api/resources/forwarding/index.mjs +3 -0
- package/dist/esm/api/resources/forwarding/types/ConfirmForwardingVerificationRequest.d.mts +10 -0
- package/dist/esm/api/resources/forwarding/types/ConfirmForwardingVerificationRequest.mjs +2 -0
- package/dist/esm/api/resources/forwarding/types/Forwarding.d.mts +15 -0
- package/dist/esm/api/resources/forwarding/types/Forwarding.mjs +2 -0
- package/dist/esm/api/resources/forwarding/types/ForwardingDestination.d.mts +5 -0
- package/dist/esm/api/resources/forwarding/types/ForwardingDestination.mjs +2 -0
- package/dist/esm/api/resources/forwarding/types/ForwardingVerificationConfirmed.d.mts +4 -0
- package/dist/esm/api/resources/forwarding/types/ForwardingVerificationConfirmed.mjs +2 -0
- package/dist/esm/api/resources/forwarding/types/ForwardingVerificationStarted.d.mts +4 -0
- package/dist/esm/api/resources/forwarding/types/ForwardingVerificationStarted.mjs +2 -0
- package/dist/esm/api/resources/forwarding/types/StartForwardingVerificationRequest.d.mts +5 -0
- package/dist/esm/api/resources/forwarding/types/StartForwardingVerificationRequest.mjs +2 -0
- package/dist/esm/api/resources/forwarding/types/UpdateForwardingRequest.d.mts +9 -0
- package/dist/esm/api/resources/forwarding/types/UpdateForwardingRequest.mjs +2 -0
- package/dist/esm/api/resources/forwarding/types/UpdateForwardingResponse.d.mts +8 -0
- package/dist/esm/api/resources/forwarding/types/UpdateForwardingResponse.mjs +2 -0
- package/dist/esm/api/resources/forwarding/types/index.d.mts +8 -0
- package/dist/esm/api/resources/forwarding/types/index.mjs +8 -0
- package/dist/esm/api/resources/inboxes/client/Client.d.mts +7 -1
- package/dist/esm/api/resources/inboxes/client/Client.mjs +17 -1
- package/dist/esm/api/resources/inboxes/resources/forwarding/client/Client.d.mts +79 -0
- package/dist/esm/api/resources/inboxes/resources/forwarding/client/Client.mjs +280 -0
- package/dist/esm/api/resources/inboxes/resources/forwarding/client/index.d.mts +1 -0
- package/dist/esm/api/resources/inboxes/resources/forwarding/client/index.mjs +1 -0
- package/dist/esm/api/resources/inboxes/resources/forwarding/exports.d.mts +2 -0
- package/dist/esm/api/resources/inboxes/resources/forwarding/exports.mjs +3 -0
- package/dist/esm/api/resources/inboxes/resources/forwarding/index.d.mts +1 -0
- package/dist/esm/api/resources/inboxes/resources/forwarding/index.mjs +1 -0
- package/dist/esm/api/resources/inboxes/resources/index.d.mts +1 -0
- package/dist/esm/api/resources/inboxes/resources/index.mjs +1 -0
- package/dist/esm/api/resources/index.d.mts +3 -0
- package/dist/esm/api/resources/index.mjs +3 -0
- package/dist/esm/api/resources/messages/types/Message.d.mts +2 -0
- package/dist/esm/api/resources/messages/types/MessageItem.d.mts +2 -0
- package/dist/esm/api/resources/messages/types/MessageOpenedAt.d.mts +6 -0
- package/dist/esm/api/resources/messages/types/MessageOpenedAt.mjs +2 -0
- package/dist/esm/api/resources/messages/types/MessageTrackOpens.d.mts +5 -0
- package/dist/esm/api/resources/messages/types/MessageTrackOpens.mjs +2 -0
- package/dist/esm/api/resources/messages/types/TrackOpens.d.mts +4 -3
- package/dist/esm/api/resources/messages/types/index.d.mts +2 -0
- package/dist/esm/api/resources/messages/types/index.mjs +2 -0
- package/dist/esm/api/resources/pods/client/Client.d.mts +3 -0
- package/dist/esm/api/resources/pods/client/Client.mjs +5 -0
- package/dist/esm/api/resources/pods/resources/forwarding/client/Client.d.mts +80 -0
- package/dist/esm/api/resources/pods/resources/forwarding/client/Client.mjs +281 -0
- package/dist/esm/api/resources/pods/resources/forwarding/client/index.d.mts +1 -0
- package/dist/esm/api/resources/pods/resources/forwarding/client/index.mjs +1 -0
- package/dist/esm/api/resources/pods/resources/forwarding/exports.d.mts +2 -0
- package/dist/esm/api/resources/pods/resources/forwarding/exports.mjs +3 -0
- package/dist/esm/api/resources/pods/resources/forwarding/index.d.mts +1 -0
- package/dist/esm/api/resources/pods/resources/forwarding/index.mjs +1 -0
- package/dist/esm/api/resources/pods/resources/index.d.mts +1 -0
- package/dist/esm/api/resources/pods/resources/index.mjs +1 -0
- package/dist/esm/serialization/resources/forwarding/index.d.mts +1 -0
- package/dist/esm/serialization/resources/forwarding/index.mjs +1 -0
- package/dist/esm/serialization/resources/forwarding/types/ConfirmForwardingVerificationRequest.d.mts +11 -0
- package/dist/esm/serialization/resources/forwarding/types/ConfirmForwardingVerificationRequest.mjs +7 -0
- package/dist/esm/serialization/resources/forwarding/types/Forwarding.d.mts +11 -0
- package/dist/esm/serialization/resources/forwarding/types/Forwarding.mjs +7 -0
- package/dist/esm/serialization/resources/forwarding/types/ForwardingDestination.d.mts +7 -0
- package/dist/esm/serialization/resources/forwarding/types/ForwardingDestination.mjs +3 -0
- package/dist/esm/serialization/resources/forwarding/types/ForwardingVerificationConfirmed.d.mts +9 -0
- package/dist/esm/serialization/resources/forwarding/types/ForwardingVerificationConfirmed.mjs +5 -0
- package/dist/esm/serialization/resources/forwarding/types/ForwardingVerificationStarted.d.mts +9 -0
- package/dist/esm/serialization/resources/forwarding/types/ForwardingVerificationStarted.mjs +5 -0
- package/dist/esm/serialization/resources/forwarding/types/StartForwardingVerificationRequest.d.mts +10 -0
- package/dist/esm/serialization/resources/forwarding/types/StartForwardingVerificationRequest.mjs +6 -0
- package/dist/esm/serialization/resources/forwarding/types/UpdateForwardingRequest.d.mts +10 -0
- package/dist/esm/serialization/resources/forwarding/types/UpdateForwardingRequest.mjs +6 -0
- package/dist/esm/serialization/resources/forwarding/types/UpdateForwardingResponse.d.mts +10 -0
- package/dist/esm/serialization/resources/forwarding/types/UpdateForwardingResponse.mjs +6 -0
- package/dist/esm/serialization/resources/forwarding/types/index.d.mts +8 -0
- package/dist/esm/serialization/resources/forwarding/types/index.mjs +8 -0
- package/dist/esm/serialization/resources/index.d.mts +2 -0
- package/dist/esm/serialization/resources/index.mjs +2 -0
- package/dist/esm/serialization/resources/messages/types/Message.d.mts +4 -0
- package/dist/esm/serialization/resources/messages/types/Message.mjs +4 -0
- package/dist/esm/serialization/resources/messages/types/MessageItem.d.mts +4 -0
- package/dist/esm/serialization/resources/messages/types/MessageItem.mjs +4 -0
- package/dist/esm/serialization/resources/messages/types/MessageOpenedAt.d.mts +7 -0
- package/dist/esm/serialization/resources/messages/types/MessageOpenedAt.mjs +3 -0
- package/dist/esm/serialization/resources/messages/types/MessageTrackOpens.d.mts +7 -0
- package/dist/esm/serialization/resources/messages/types/MessageTrackOpens.mjs +3 -0
- package/dist/esm/serialization/resources/messages/types/index.d.mts +2 -0
- package/dist/esm/serialization/resources/messages/types/index.mjs +2 -0
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/dist/llms.txt +3 -1
- package/package.json +34 -1
- package/reference.md +1026 -239
|
@@ -0,0 +1,503 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
36
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
37
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
38
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
39
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
40
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
41
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
42
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
|
+
exports.ForwardingClient = void 0;
|
|
47
|
+
const BaseClient_js_1 = require("../../../../BaseClient.js");
|
|
48
|
+
const headers_js_1 = require("../../../../core/headers.js");
|
|
49
|
+
const core = __importStar(require("../../../../core/index.js"));
|
|
50
|
+
const environments = __importStar(require("../../../../environments.js"));
|
|
51
|
+
const handleNonStatusCodeError_js_1 = require("../../../../errors/handleNonStatusCodeError.js");
|
|
52
|
+
const errors = __importStar(require("../../../../errors/index.js"));
|
|
53
|
+
const serializers = __importStar(require("../../../../serialization/index.js"));
|
|
54
|
+
const AgentMail = __importStar(require("../../../index.js"));
|
|
55
|
+
class ForwardingClient {
|
|
56
|
+
constructor(options = {}) {
|
|
57
|
+
this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Get the forwarding the organization sets. Pods and inboxes that set no forwarding of their own
|
|
61
|
+
* use this list. Needs an organization-scoped API key.
|
|
62
|
+
*
|
|
63
|
+
* **CLI:**
|
|
64
|
+
* ```bash
|
|
65
|
+
* agentmail forwarding get
|
|
66
|
+
* ```
|
|
67
|
+
*
|
|
68
|
+
* @param {ForwardingClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
69
|
+
*
|
|
70
|
+
* @throws {@link AgentMail.ForwardingForbiddenError}
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* await client.forwarding.get()
|
|
74
|
+
*/
|
|
75
|
+
get(requestOptions) {
|
|
76
|
+
return core.HttpResponsePromise.fromPromise(this.__get(requestOptions));
|
|
77
|
+
}
|
|
78
|
+
__get(requestOptions) {
|
|
79
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
80
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
81
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
82
|
+
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);
|
|
83
|
+
const _response = yield core.fetcher({
|
|
84
|
+
url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : ((_c = (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentMailEnvironment.Prod)
|
|
85
|
+
.http, "/v0/forwarding"),
|
|
86
|
+
method: "GET",
|
|
87
|
+
headers: _headers,
|
|
88
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
89
|
+
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,
|
|
90
|
+
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,
|
|
91
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
92
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
93
|
+
logging: this._options.logging,
|
|
94
|
+
});
|
|
95
|
+
if (_response.ok) {
|
|
96
|
+
return {
|
|
97
|
+
data: serializers.Forwarding.parseOrThrow(_response.body, {
|
|
98
|
+
unrecognizedObjectKeys: "passthrough",
|
|
99
|
+
allowUnrecognizedUnionMembers: true,
|
|
100
|
+
allowUnrecognizedEnumValues: true,
|
|
101
|
+
skipValidation: true,
|
|
102
|
+
breadcrumbsPrefix: ["response"],
|
|
103
|
+
}),
|
|
104
|
+
rawResponse: _response.rawResponse,
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
if (_response.error.reason === "status-code") {
|
|
108
|
+
switch (_response.error.statusCode) {
|
|
109
|
+
case 403:
|
|
110
|
+
throw new AgentMail.ForwardingForbiddenError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
111
|
+
unrecognizedObjectKeys: "passthrough",
|
|
112
|
+
allowUnrecognizedUnionMembers: true,
|
|
113
|
+
allowUnrecognizedEnumValues: true,
|
|
114
|
+
skipValidation: true,
|
|
115
|
+
breadcrumbsPrefix: ["response"],
|
|
116
|
+
}), _response.rawResponse);
|
|
117
|
+
default:
|
|
118
|
+
throw new errors.AgentMailError({
|
|
119
|
+
statusCode: _response.error.statusCode,
|
|
120
|
+
body: _response.error.body,
|
|
121
|
+
rawResponse: _response.rawResponse,
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v0/forwarding");
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Set the addresses the organization forwards to. The list replaces the current one. An address
|
|
130
|
+
* that is not verified is saved but receives nothing until it is verified. Needs an
|
|
131
|
+
* organization-scoped API key in an organization that has completed agent verification.
|
|
132
|
+
*
|
|
133
|
+
* **CLI:**
|
|
134
|
+
* ```bash
|
|
135
|
+
* agentmail forwarding update --destinations ops@example.com --destinations archive@example.com
|
|
136
|
+
* ```
|
|
137
|
+
*
|
|
138
|
+
* @param {AgentMail.UpdateForwardingRequest} request
|
|
139
|
+
* @param {ForwardingClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
140
|
+
*
|
|
141
|
+
* @throws {@link AgentMail.ValidationError}
|
|
142
|
+
* @throws {@link AgentMail.ForwardingForbiddenError}
|
|
143
|
+
*
|
|
144
|
+
* @example
|
|
145
|
+
* await client.forwarding.update({
|
|
146
|
+
* destinations: ["destinations", "destinations"]
|
|
147
|
+
* })
|
|
148
|
+
*/
|
|
149
|
+
update(request, requestOptions) {
|
|
150
|
+
return core.HttpResponsePromise.fromPromise(this.__update(request, requestOptions));
|
|
151
|
+
}
|
|
152
|
+
__update(request, requestOptions) {
|
|
153
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
154
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
155
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
156
|
+
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);
|
|
157
|
+
const _response = yield core.fetcher({
|
|
158
|
+
url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : ((_c = (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentMailEnvironment.Prod)
|
|
159
|
+
.http, "/v0/forwarding"),
|
|
160
|
+
method: "PUT",
|
|
161
|
+
headers: _headers,
|
|
162
|
+
contentType: "application/json",
|
|
163
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
164
|
+
requestType: "json",
|
|
165
|
+
body: serializers.UpdateForwardingRequest.jsonOrThrow(request, {
|
|
166
|
+
unrecognizedObjectKeys: "strip",
|
|
167
|
+
omitUndefined: true,
|
|
168
|
+
}),
|
|
169
|
+
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,
|
|
170
|
+
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,
|
|
171
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
172
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
173
|
+
logging: this._options.logging,
|
|
174
|
+
});
|
|
175
|
+
if (_response.ok) {
|
|
176
|
+
return {
|
|
177
|
+
data: serializers.UpdateForwardingResponse.parseOrThrow(_response.body, {
|
|
178
|
+
unrecognizedObjectKeys: "passthrough",
|
|
179
|
+
allowUnrecognizedUnionMembers: true,
|
|
180
|
+
allowUnrecognizedEnumValues: true,
|
|
181
|
+
skipValidation: true,
|
|
182
|
+
breadcrumbsPrefix: ["response"],
|
|
183
|
+
}),
|
|
184
|
+
rawResponse: _response.rawResponse,
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
if (_response.error.reason === "status-code") {
|
|
188
|
+
switch (_response.error.statusCode) {
|
|
189
|
+
case 400:
|
|
190
|
+
throw new AgentMail.ValidationError(serializers.ValidationErrorResponse.parseOrThrow(_response.error.body, {
|
|
191
|
+
unrecognizedObjectKeys: "passthrough",
|
|
192
|
+
allowUnrecognizedUnionMembers: true,
|
|
193
|
+
allowUnrecognizedEnumValues: true,
|
|
194
|
+
skipValidation: true,
|
|
195
|
+
breadcrumbsPrefix: ["response"],
|
|
196
|
+
}), _response.rawResponse);
|
|
197
|
+
case 403:
|
|
198
|
+
throw new AgentMail.ForwardingForbiddenError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
199
|
+
unrecognizedObjectKeys: "passthrough",
|
|
200
|
+
allowUnrecognizedUnionMembers: true,
|
|
201
|
+
allowUnrecognizedEnumValues: true,
|
|
202
|
+
skipValidation: true,
|
|
203
|
+
breadcrumbsPrefix: ["response"],
|
|
204
|
+
}), _response.rawResponse);
|
|
205
|
+
default:
|
|
206
|
+
throw new errors.AgentMailError({
|
|
207
|
+
statusCode: _response.error.statusCode,
|
|
208
|
+
body: _response.error.body,
|
|
209
|
+
rawResponse: _response.rawResponse,
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "PUT", "/v0/forwarding");
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Remove the organization's forwarding, so its inboxes stop forwarding unless their pod or the
|
|
218
|
+
* inbox sets its own. Verified addresses stay verified, so adding one again needs no new code.
|
|
219
|
+
* Returns `not_found` when the organization sets no forwarding.
|
|
220
|
+
*
|
|
221
|
+
* **CLI:**
|
|
222
|
+
* ```bash
|
|
223
|
+
* agentmail forwarding delete
|
|
224
|
+
* ```
|
|
225
|
+
*
|
|
226
|
+
* @param {ForwardingClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
227
|
+
*
|
|
228
|
+
* @throws {@link AgentMail.NotFoundError}
|
|
229
|
+
* @throws {@link AgentMail.ForwardingForbiddenError}
|
|
230
|
+
*
|
|
231
|
+
* @example
|
|
232
|
+
* await client.forwarding.delete()
|
|
233
|
+
*/
|
|
234
|
+
delete(requestOptions) {
|
|
235
|
+
return core.HttpResponsePromise.fromPromise(this.__delete(requestOptions));
|
|
236
|
+
}
|
|
237
|
+
__delete(requestOptions) {
|
|
238
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
239
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
240
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
241
|
+
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);
|
|
242
|
+
const _response = yield core.fetcher({
|
|
243
|
+
url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : ((_c = (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentMailEnvironment.Prod)
|
|
244
|
+
.http, "/v0/forwarding"),
|
|
245
|
+
method: "DELETE",
|
|
246
|
+
headers: _headers,
|
|
247
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
248
|
+
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,
|
|
249
|
+
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,
|
|
250
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
251
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
252
|
+
logging: this._options.logging,
|
|
253
|
+
});
|
|
254
|
+
if (_response.ok) {
|
|
255
|
+
return {
|
|
256
|
+
data: serializers.Forwarding.parseOrThrow(_response.body, {
|
|
257
|
+
unrecognizedObjectKeys: "passthrough",
|
|
258
|
+
allowUnrecognizedUnionMembers: true,
|
|
259
|
+
allowUnrecognizedEnumValues: true,
|
|
260
|
+
skipValidation: true,
|
|
261
|
+
breadcrumbsPrefix: ["response"],
|
|
262
|
+
}),
|
|
263
|
+
rawResponse: _response.rawResponse,
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
if (_response.error.reason === "status-code") {
|
|
267
|
+
switch (_response.error.statusCode) {
|
|
268
|
+
case 404:
|
|
269
|
+
throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
270
|
+
unrecognizedObjectKeys: "passthrough",
|
|
271
|
+
allowUnrecognizedUnionMembers: true,
|
|
272
|
+
allowUnrecognizedEnumValues: true,
|
|
273
|
+
skipValidation: true,
|
|
274
|
+
breadcrumbsPrefix: ["response"],
|
|
275
|
+
}), _response.rawResponse);
|
|
276
|
+
case 403:
|
|
277
|
+
throw new AgentMail.ForwardingForbiddenError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
278
|
+
unrecognizedObjectKeys: "passthrough",
|
|
279
|
+
allowUnrecognizedUnionMembers: true,
|
|
280
|
+
allowUnrecognizedEnumValues: true,
|
|
281
|
+
skipValidation: true,
|
|
282
|
+
breadcrumbsPrefix: ["response"],
|
|
283
|
+
}), _response.rawResponse);
|
|
284
|
+
default:
|
|
285
|
+
throw new errors.AgentMailError({
|
|
286
|
+
statusCode: _response.error.statusCode,
|
|
287
|
+
body: _response.error.body,
|
|
288
|
+
rawResponse: _response.rawResponse,
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "DELETE", "/v0/forwarding");
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* Email a confirmation code to an address, so it can receive forwarded mail once confirmed.
|
|
297
|
+
* Verification belongs to the organization: once verified, the address can be used at the
|
|
298
|
+
* organization, any pod and any inbox. Starting again replaces any code already sent to the
|
|
299
|
+
* address. Needs an organization- or pod-scoped API key in an organization that has completed
|
|
300
|
+
* agent verification.
|
|
301
|
+
*
|
|
302
|
+
* **CLI:**
|
|
303
|
+
* ```bash
|
|
304
|
+
* agentmail forwarding start-verification --destination ops@example.com
|
|
305
|
+
* ```
|
|
306
|
+
*
|
|
307
|
+
* @param {AgentMail.StartForwardingVerificationRequest} request
|
|
308
|
+
* @param {ForwardingClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
309
|
+
*
|
|
310
|
+
* @throws {@link AgentMail.ValidationError}
|
|
311
|
+
* @throws {@link AgentMail.ForwardingForbiddenError}
|
|
312
|
+
* @throws {@link AgentMail.UnprocessableError}
|
|
313
|
+
* @throws {@link AgentMail.ForwardingRateLimitError}
|
|
314
|
+
*
|
|
315
|
+
* @example
|
|
316
|
+
* await client.forwarding.startVerification({
|
|
317
|
+
* destination: "destination"
|
|
318
|
+
* })
|
|
319
|
+
*/
|
|
320
|
+
startVerification(request, requestOptions) {
|
|
321
|
+
return core.HttpResponsePromise.fromPromise(this.__startVerification(request, requestOptions));
|
|
322
|
+
}
|
|
323
|
+
__startVerification(request, requestOptions) {
|
|
324
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
325
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
326
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
327
|
+
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);
|
|
328
|
+
const _response = yield core.fetcher({
|
|
329
|
+
url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : ((_c = (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentMailEnvironment.Prod)
|
|
330
|
+
.http, "/v0/forwarding/verifications"),
|
|
331
|
+
method: "POST",
|
|
332
|
+
headers: _headers,
|
|
333
|
+
contentType: "application/json",
|
|
334
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
335
|
+
requestType: "json",
|
|
336
|
+
body: serializers.StartForwardingVerificationRequest.jsonOrThrow(request, {
|
|
337
|
+
unrecognizedObjectKeys: "strip",
|
|
338
|
+
omitUndefined: true,
|
|
339
|
+
}),
|
|
340
|
+
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,
|
|
341
|
+
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,
|
|
342
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
343
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
344
|
+
logging: this._options.logging,
|
|
345
|
+
});
|
|
346
|
+
if (_response.ok) {
|
|
347
|
+
return {
|
|
348
|
+
data: serializers.ForwardingVerificationStarted.parseOrThrow(_response.body, {
|
|
349
|
+
unrecognizedObjectKeys: "passthrough",
|
|
350
|
+
allowUnrecognizedUnionMembers: true,
|
|
351
|
+
allowUnrecognizedEnumValues: true,
|
|
352
|
+
skipValidation: true,
|
|
353
|
+
breadcrumbsPrefix: ["response"],
|
|
354
|
+
}),
|
|
355
|
+
rawResponse: _response.rawResponse,
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
if (_response.error.reason === "status-code") {
|
|
359
|
+
switch (_response.error.statusCode) {
|
|
360
|
+
case 400:
|
|
361
|
+
throw new AgentMail.ValidationError(serializers.ValidationErrorResponse.parseOrThrow(_response.error.body, {
|
|
362
|
+
unrecognizedObjectKeys: "passthrough",
|
|
363
|
+
allowUnrecognizedUnionMembers: true,
|
|
364
|
+
allowUnrecognizedEnumValues: true,
|
|
365
|
+
skipValidation: true,
|
|
366
|
+
breadcrumbsPrefix: ["response"],
|
|
367
|
+
}), _response.rawResponse);
|
|
368
|
+
case 403:
|
|
369
|
+
throw new AgentMail.ForwardingForbiddenError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
370
|
+
unrecognizedObjectKeys: "passthrough",
|
|
371
|
+
allowUnrecognizedUnionMembers: true,
|
|
372
|
+
allowUnrecognizedEnumValues: true,
|
|
373
|
+
skipValidation: true,
|
|
374
|
+
breadcrumbsPrefix: ["response"],
|
|
375
|
+
}), _response.rawResponse);
|
|
376
|
+
case 422:
|
|
377
|
+
throw new AgentMail.UnprocessableError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
378
|
+
unrecognizedObjectKeys: "passthrough",
|
|
379
|
+
allowUnrecognizedUnionMembers: true,
|
|
380
|
+
allowUnrecognizedEnumValues: true,
|
|
381
|
+
skipValidation: true,
|
|
382
|
+
breadcrumbsPrefix: ["response"],
|
|
383
|
+
}), _response.rawResponse);
|
|
384
|
+
case 429:
|
|
385
|
+
throw new AgentMail.ForwardingRateLimitError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
386
|
+
unrecognizedObjectKeys: "passthrough",
|
|
387
|
+
allowUnrecognizedUnionMembers: true,
|
|
388
|
+
allowUnrecognizedEnumValues: true,
|
|
389
|
+
skipValidation: true,
|
|
390
|
+
breadcrumbsPrefix: ["response"],
|
|
391
|
+
}), _response.rawResponse);
|
|
392
|
+
default:
|
|
393
|
+
throw new errors.AgentMailError({
|
|
394
|
+
statusCode: _response.error.statusCode,
|
|
395
|
+
body: _response.error.body,
|
|
396
|
+
rawResponse: _response.rawResponse,
|
|
397
|
+
});
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v0/forwarding/verifications");
|
|
401
|
+
});
|
|
402
|
+
}
|
|
403
|
+
/**
|
|
404
|
+
* Submit the code emailed by Start Verification to verify the address. A code allows 10 wrong
|
|
405
|
+
* attempts, then stops working even with the right code, and Start Verification sends a new one.
|
|
406
|
+
* Needs an organization- or pod-scoped API key in an organization that has completed agent
|
|
407
|
+
* verification.
|
|
408
|
+
*
|
|
409
|
+
* **CLI:**
|
|
410
|
+
* ```bash
|
|
411
|
+
* agentmail forwarding confirm-verification --destination ops@example.com --code 7KQ2M-XW9PD
|
|
412
|
+
* ```
|
|
413
|
+
*
|
|
414
|
+
* @param {AgentMail.ConfirmForwardingVerificationRequest} request
|
|
415
|
+
* @param {ForwardingClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
416
|
+
*
|
|
417
|
+
* @throws {@link AgentMail.ValidationError}
|
|
418
|
+
* @throws {@link AgentMail.ForwardingForbiddenError}
|
|
419
|
+
* @throws {@link AgentMail.ConflictError}
|
|
420
|
+
*
|
|
421
|
+
* @example
|
|
422
|
+
* await client.forwarding.confirmVerification({
|
|
423
|
+
* destination: "destination",
|
|
424
|
+
* code: "code"
|
|
425
|
+
* })
|
|
426
|
+
*/
|
|
427
|
+
confirmVerification(request, requestOptions) {
|
|
428
|
+
return core.HttpResponsePromise.fromPromise(this.__confirmVerification(request, requestOptions));
|
|
429
|
+
}
|
|
430
|
+
__confirmVerification(request, requestOptions) {
|
|
431
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
432
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
433
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
434
|
+
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);
|
|
435
|
+
const _response = yield core.fetcher({
|
|
436
|
+
url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : ((_c = (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentMailEnvironment.Prod)
|
|
437
|
+
.http, "/v0/forwarding/verifications/confirm"),
|
|
438
|
+
method: "POST",
|
|
439
|
+
headers: _headers,
|
|
440
|
+
contentType: "application/json",
|
|
441
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
442
|
+
requestType: "json",
|
|
443
|
+
body: serializers.ConfirmForwardingVerificationRequest.jsonOrThrow(request, {
|
|
444
|
+
unrecognizedObjectKeys: "strip",
|
|
445
|
+
omitUndefined: true,
|
|
446
|
+
}),
|
|
447
|
+
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,
|
|
448
|
+
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,
|
|
449
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
450
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
451
|
+
logging: this._options.logging,
|
|
452
|
+
});
|
|
453
|
+
if (_response.ok) {
|
|
454
|
+
return {
|
|
455
|
+
data: serializers.ForwardingVerificationConfirmed.parseOrThrow(_response.body, {
|
|
456
|
+
unrecognizedObjectKeys: "passthrough",
|
|
457
|
+
allowUnrecognizedUnionMembers: true,
|
|
458
|
+
allowUnrecognizedEnumValues: true,
|
|
459
|
+
skipValidation: true,
|
|
460
|
+
breadcrumbsPrefix: ["response"],
|
|
461
|
+
}),
|
|
462
|
+
rawResponse: _response.rawResponse,
|
|
463
|
+
};
|
|
464
|
+
}
|
|
465
|
+
if (_response.error.reason === "status-code") {
|
|
466
|
+
switch (_response.error.statusCode) {
|
|
467
|
+
case 400:
|
|
468
|
+
throw new AgentMail.ValidationError(serializers.ValidationErrorResponse.parseOrThrow(_response.error.body, {
|
|
469
|
+
unrecognizedObjectKeys: "passthrough",
|
|
470
|
+
allowUnrecognizedUnionMembers: true,
|
|
471
|
+
allowUnrecognizedEnumValues: true,
|
|
472
|
+
skipValidation: true,
|
|
473
|
+
breadcrumbsPrefix: ["response"],
|
|
474
|
+
}), _response.rawResponse);
|
|
475
|
+
case 403:
|
|
476
|
+
throw new AgentMail.ForwardingForbiddenError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
477
|
+
unrecognizedObjectKeys: "passthrough",
|
|
478
|
+
allowUnrecognizedUnionMembers: true,
|
|
479
|
+
allowUnrecognizedEnumValues: true,
|
|
480
|
+
skipValidation: true,
|
|
481
|
+
breadcrumbsPrefix: ["response"],
|
|
482
|
+
}), _response.rawResponse);
|
|
483
|
+
case 409:
|
|
484
|
+
throw new AgentMail.ConflictError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
485
|
+
unrecognizedObjectKeys: "passthrough",
|
|
486
|
+
allowUnrecognizedUnionMembers: true,
|
|
487
|
+
allowUnrecognizedEnumValues: true,
|
|
488
|
+
skipValidation: true,
|
|
489
|
+
breadcrumbsPrefix: ["response"],
|
|
490
|
+
}), _response.rawResponse);
|
|
491
|
+
default:
|
|
492
|
+
throw new errors.AgentMailError({
|
|
493
|
+
statusCode: _response.error.statusCode,
|
|
494
|
+
body: _response.error.body,
|
|
495
|
+
rawResponse: _response.rawResponse,
|
|
496
|
+
});
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v0/forwarding/verifications/confirm");
|
|
500
|
+
});
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
exports.ForwardingClient = ForwardingClient;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type * as core from "../../../../core/index.js";
|
|
2
|
+
import * as errors from "../../../../errors/index.js";
|
|
3
|
+
import type * as AgentMail from "../../../index.js";
|
|
4
|
+
export declare class ForwardingForbiddenError extends errors.AgentMailError {
|
|
5
|
+
constructor(body: AgentMail.ErrorResponse, rawResponse?: core.RawResponse);
|
|
6
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
exports.ForwardingForbiddenError = void 0;
|
|
38
|
+
const errors = __importStar(require("../../../../errors/index.js"));
|
|
39
|
+
class ForwardingForbiddenError extends errors.AgentMailError {
|
|
40
|
+
constructor(body, rawResponse) {
|
|
41
|
+
super({
|
|
42
|
+
message: "ForwardingForbiddenError",
|
|
43
|
+
statusCode: 403,
|
|
44
|
+
body: body,
|
|
45
|
+
rawResponse: rawResponse,
|
|
46
|
+
});
|
|
47
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
48
|
+
if (Error.captureStackTrace) {
|
|
49
|
+
Error.captureStackTrace(this, this.constructor);
|
|
50
|
+
}
|
|
51
|
+
this.name = this.constructor.name;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
exports.ForwardingForbiddenError = ForwardingForbiddenError;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type * as core from "../../../../core/index.js";
|
|
2
|
+
import * as errors from "../../../../errors/index.js";
|
|
3
|
+
import type * as AgentMail from "../../../index.js";
|
|
4
|
+
export declare class ForwardingRateLimitError extends errors.AgentMailError {
|
|
5
|
+
constructor(body: AgentMail.ErrorResponse, rawResponse?: core.RawResponse);
|
|
6
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
exports.ForwardingRateLimitError = void 0;
|
|
38
|
+
const errors = __importStar(require("../../../../errors/index.js"));
|
|
39
|
+
class ForwardingRateLimitError extends errors.AgentMailError {
|
|
40
|
+
constructor(body, rawResponse) {
|
|
41
|
+
super({
|
|
42
|
+
message: "ForwardingRateLimitError",
|
|
43
|
+
statusCode: 429,
|
|
44
|
+
body: body,
|
|
45
|
+
rawResponse: rawResponse,
|
|
46
|
+
});
|
|
47
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
48
|
+
if (Error.captureStackTrace) {
|
|
49
|
+
Error.captureStackTrace(this, this.constructor);
|
|
50
|
+
}
|
|
51
|
+
this.name = this.constructor.name;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
exports.ForwardingRateLimitError = ForwardingRateLimitError;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./ForwardingForbiddenError.js"), exports);
|
|
18
|
+
__exportStar(require("./ForwardingRateLimitError.js"), exports);
|