UNPKG

15.1 kBJavaScriptView Raw
1"use strict";
2var __extends = (this && this.__extends) || (function () {
3 var extendStatics = function (d, b) {
4 extendStatics = Object.setPrototypeOf ||
5 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6 function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7 return extendStatics(d, b);
8 };
9 return function (d, b) {
10 if (typeof b !== "function" && b !== null)
11 throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12 extendStatics(d, b);
13 function __() { this.constructor = d; }
14 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15 };
16})();
17Object.defineProperty(exports, "__esModule", { value: true });
18var BaseClient_1 = require("./BaseClient");
19var models_1 = require("./models");
20var models_2 = require("./models");
21var AccountClient = /** @class */ (function (_super) {
22 __extends(AccountClient, _super);
23 /**
24 * Create a new AccountClient
25 * @param accountToken The account token that should be used with requests.
26 * @param configOptions Various options to customize client behavior.
27 */
28 function AccountClient(accountToken, configOptions) {
29 return _super.call(this, accountToken, models_1.ClientOptions.AuthHeaderNames.ACCOUNT_TOKEN, configOptions) || this;
30 }
31 /**
32 * Retrieve a list of Servers.
33 *
34 * @param filter - An optional filter for which data is retrieved.
35 * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
36 * @returns A promise that will complete when the API responds (or an error occurs).
37 */
38 AccountClient.prototype.getServers = function (filter, callback) {
39 if (filter === void 0) { filter = new models_2.ServerFilteringParameters(); }
40 this.setDefaultPaginationValues(filter);
41 return this.processRequestWithoutBody(models_1.ClientOptions.HttpMethod.GET, "/servers", filter, callback);
42 };
43 /**
44 * Retrieve a single server by ID.
45 *
46 * @param id - The ID of the Server for which you wish to retrieve details.
47 * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
48 * @returns A promise that will complete when the API responds (or an error occurs).
49 */
50 AccountClient.prototype.getServer = function (id, callback) {
51 return this.processRequestWithoutBody(models_1.ClientOptions.HttpMethod.GET, "/servers/".concat(id), {}, callback);
52 };
53 /**
54 * Create a new Server.
55 *
56 * @param options - The options to be used to create new Server.
57 * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
58 * @returns A promise that will complete when the API responds (or an error occurs).
59 */
60 AccountClient.prototype.createServer = function (options, callback) {
61 return this.processRequestWithBody(models_1.ClientOptions.HttpMethod.POST, "/servers", options, callback);
62 };
63 /**
64 * Modify the Server associated with this Client.
65 *
66 * @param id - The ID of the Server you wish to update.
67 * @param options - The options to be used to create new Server.
68 * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
69 * @returns A promise that will complete when the API responds (or an error occurs).
70 */
71 AccountClient.prototype.editServer = function (id, options, callback) {
72 return this.processRequestWithBody(models_1.ClientOptions.HttpMethod.PUT, "/servers/".concat(id), options, callback);
73 };
74 /**
75 * Modify the Server associated with this Client.
76 *
77 * @param id - The ID of the Domain you wish to delete.
78 * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
79 * @returns A promise that will complete when the API responds (or an error occurs).
80 */
81 AccountClient.prototype.deleteServer = function (id, callback) {
82 return this.processRequestWithoutBody(models_1.ClientOptions.HttpMethod.DELETE, "/servers/".concat(id), {}, callback);
83 };
84 /**
85 * Retrieve a batch of Domains.
86 *
87 * @param filter - An optional filter for which data is retrieved.
88 * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
89 * @returns A promise that will complete when the API responds (or an error occurs).
90 */
91 AccountClient.prototype.getDomains = function (filter, callback) {
92 if (filter === void 0) { filter = new models_1.FilteringParameters(); }
93 this.setDefaultPaginationValues(filter);
94 return this.processRequestWithoutBody(models_1.ClientOptions.HttpMethod.GET, "/domains", filter, callback);
95 };
96 /**
97 * Retrieve a single Domain by ID.
98 *
99 * @param id - The ID of the Domain for which you wish to retrieve details.
100 * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
101 * @returns A promise that will complete when the API responds (or an error occurs).
102 */
103 AccountClient.prototype.getDomain = function (id, callback) {
104 return this.processRequestWithoutBody(models_1.ClientOptions.HttpMethod.GET, "/domains/".concat(id), {}, callback);
105 };
106 /**
107 * Create a new Domain.
108 *
109 * @param options - The options to be used to create new Domain.
110 * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
111 * @returns A promise that will complete when the API responds (or an error occurs).
112 */
113 AccountClient.prototype.createDomain = function (options, callback) {
114 return this.processRequestWithBody(models_1.ClientOptions.HttpMethod.POST, "/domains/", options, callback);
115 };
116 /**
117 * Update a Domain.
118 *
119 * @param id - The ID of the Domain you wish to update.
120 * @param domain - The values on the Domain you wish to update.
121 * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
122 * @returns A promise that will complete when the API responds (or an error occurs).
123 */
124 AccountClient.prototype.editDomain = function (id, options, callback) {
125 return this.processRequestWithBody(models_1.ClientOptions.HttpMethod.PUT, "/domains/".concat(id), options, callback);
126 };
127 /**
128 * Delete a Domain.
129 *
130 * @param id - The ID of the Domain you wish to delete.
131 * @param options - The options to be used in create Domain.
132 * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
133 * @returns A promise that will complete when the API responds (or an error occurs).
134 */
135 AccountClient.prototype.deleteDomain = function (id, callback) {
136 return this.processRequestWithoutBody(models_1.ClientOptions.HttpMethod.DELETE, "/domains/".concat(id), {}, callback);
137 };
138 /**
139 * Trigger Domain DKIM key verification.
140 *
141 * @param id - The ID of the Domain you wish to trigger DKIM verification for.
142 * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
143 * @returns A promise that will complete when the API responds (or an error occurs).
144 */
145 AccountClient.prototype.verifyDomainDKIM = function (id, callback) {
146 return this.processRequestWithoutBody(models_1.ClientOptions.HttpMethod.PUT, "/domains/".concat(id, "/verifyDKIM"), {}, callback);
147 };
148 /**
149 * Trigger Domain DKIM key verification.
150 *
151 * @param id - The ID of the Domain you wish to trigger DKIM verification for.
152 * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
153 * @returns A promise that will complete when the API responds (or an error occurs).
154 */
155 AccountClient.prototype.verifyDomainReturnPath = function (id, callback) {
156 return this.processRequestWithoutBody(models_1.ClientOptions.HttpMethod.PUT, "/domains/".concat(id, "/verifyReturnPath"), {}, callback);
157 };
158 /**
159 * Trigger Domain DKIM key verification.
160 *
161 * @param id - The ID of the Domain you wish to trigger DKIM verification for.
162 * @param callback If the callback is provided, it will be passed to the resulting promise as a continuation.
163 * @returns A promise that will complete when the API responds (or an error occurs).
164 */
165 AccountClient.prototype.verifyDomainSPF = function (id, callback) {
166 return this.processRequestWithoutBody(models_1.ClientOptions.HttpMethod.PUT, "/domains/".concat(id, "/verifySPF"), {}, callback);
167 };
168 /**
169 * Trigger Domain DKIM key verification.
170 *
171 * @param id - The ID of the Domain you wish to trigger DKIM verification for.
172 * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
173 * @returns A promise that will complete when the API responds (or an error occurs).
174 */
175 AccountClient.prototype.rotateDomainDKIM = function (id, callback) {
176 return this.processRequestWithoutBody(models_1.ClientOptions.HttpMethod.PUT, "/domains/".concat(id, "/rotateDKIM"), {}, callback);
177 };
178 /**
179 * Retrieve a single Sender Signature by ID.
180 *
181 * @param id - The ID of the Sender Signature for which you wish to retrieve details.
182 * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
183 * @returns A promise that will complete when the API responds (or an error occurs).
184 */
185 AccountClient.prototype.getSenderSignature = function (id, callback) {
186 return this.processRequestWithoutBody(models_1.ClientOptions.HttpMethod.GET, "/senders/".concat(id), {}, callback);
187 };
188 /**
189 * Retrieve a batch of Sender Signatures.
190 *
191 * @param filter - An optional filter for which data is retrieved.
192 * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
193 * @returns A promise that will complete when the API responds (or an error occurs).
194 */
195 AccountClient.prototype.getSenderSignatures = function (filter, callback) {
196 if (filter === void 0) { filter = new models_1.FilteringParameters(); }
197 this.setDefaultPaginationValues(filter);
198 return this.processRequestWithoutBody(models_1.ClientOptions.HttpMethod.GET, "/senders", filter, callback);
199 };
200 /**
201 * Create a new Sender Signature.
202 *
203 * @param options - The options to be used to create new Sender Signature.
204 * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
205 * @returns A promise that will complete when the API responds (or an error occurs).
206 */
207 AccountClient.prototype.createSenderSignature = function (options, callback) {
208 return this.processRequestWithBody(models_1.ClientOptions.HttpMethod.POST, "/senders/", options, callback);
209 };
210 /**
211 * Update a Sender Signature.
212 *
213 * @param id - The ID of the Sender Signature for which you wish to update.
214 * @param options - The values on the Sender Signature you wish to update.
215 * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
216 * @returns A promise that will complete when the API responds (or an error occurs).
217 */
218 AccountClient.prototype.editSenderSignature = function (id, options, callback) {
219 return this.processRequestWithBody(models_1.ClientOptions.HttpMethod.PUT, "/senders/".concat(id), options, callback);
220 };
221 /**
222 * Delete a Domain.
223 *
224 * @param id - The ID of the Domain you wish to delete.
225 * @param options - The options to be used in create Domain.
226 * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
227 * @returns A promise that will complete when the API responds (or an error occurs).
228 */
229 AccountClient.prototype.deleteSenderSignature = function (id, callback) {
230 return this.processRequestWithoutBody(models_1.ClientOptions.HttpMethod.DELETE, "/senders/".concat(id), {}, callback);
231 };
232 /**
233 * Request a new confirmation email to be sent to the email address associated with a Sender Signature.
234 *
235 * @param id - The ID of the Sender Signature.
236 * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
237 * @returns A promise that will complete when the API responds (or an error occurs).
238 */
239 AccountClient.prototype.resendSenderSignatureConfirmation = function (id, callback) {
240 return this.processRequestWithoutBody(models_1.ClientOptions.HttpMethod.POST, "/senders/".concat(id, "/resend"), {}, callback);
241 };
242 /**
243 * Request that the SPF records for Sender Signature be verified.
244 *
245 * @param id - The ID of the Sender Signature.
246 * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
247 * @returns A promise that will complete when the API responds (or an error occurs).
248 */
249 AccountClient.prototype.verifySenderSignatureSPF = function (id, callback) {
250 return this.processRequestWithoutBody(models_1.ClientOptions.HttpMethod.POST, "/senders/".concat(id, "/verifySpf"), {}, callback);
251 };
252 /**
253 * Request that the SPF records for Sender Signature be verified.
254 *
255 * @param id - The ID of the Sender Signature.
256 * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
257 * @returns A promise that will complete when the API responds (or an error occurs).
258 */
259 AccountClient.prototype.requestNewDKIMForSenderSignature = function (id, callback) {
260 return this.processRequestWithoutBody(models_1.ClientOptions.HttpMethod.POST, "/senders/".concat(id, "/requestNewDkim"), {}, callback);
261 };
262 /**
263 * Request a push of templates from one server to another.
264 *
265 * @param options - details for pushing templates from one place to another.
266 * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
267 * @returns A promise that will complete when the API responds (or an error occurs).
268 */
269 AccountClient.prototype.pushTemplates = function (options, callback) {
270 return this.processRequestWithBody(models_1.ClientOptions.HttpMethod.PUT, "/templates/push", options, callback);
271 };
272 return AccountClient;
273}(BaseClient_1.default));
274exports.default = AccountClient;
275//# sourceMappingURL=AccountClient.js.map
\No newline at end of file