UNPKG

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