UNPKG

38.2 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 index_1 = require("./models/index");
20var index_2 = require("./models/index");
21/**
22 * Server client class that can be used to interact with an individual Postmark Server.
23 */
24var ServerClient = /** @class */ (function (_super) {
25 __extends(ServerClient, _super);
26 /**
27 * Create a client.
28 *
29 * @param serverToken - The token for the server that you wish to interact with.
30 * @param configOptions - Options to customize the behavior of the this client.
31 */
32 function ServerClient(serverToken, configOptions) {
33 return _super.call(this, serverToken, index_1.ClientOptions.AuthHeaderNames.SERVER_TOKEN, configOptions) || this;
34 }
35 /** Send a single email message.
36 *
37 * @param email - Email message to send.
38 * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
39 * @returns A promise that will complete when the API responds (or an error occurs).
40 */
41 ServerClient.prototype.sendEmail = function (email, callback) {
42 return this.processRequestWithBody(index_1.ClientOptions.HttpMethod.POST, "/email", email, callback);
43 };
44 /**
45 * Send a batch of email messages.
46 *
47 * @param emails - An array of messages to send.
48 * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
49 * @returns A promise that will complete when the API responds (or an error occurs).
50 */
51 ServerClient.prototype.sendEmailBatch = function (emails, callback) {
52 return this.processRequestWithBody(index_1.ClientOptions.HttpMethod.POST, "/email/batch", emails, callback);
53 };
54 /**
55 * Send a message using a template.
56 *
57 * @param template - Message you wish to send.
58 * @param callback If the callback is provided, it will be passed to the resulting promise as a continuation.
59 * @returns A promise that will complete when the API responds (or an error occurs).
60 */
61 ServerClient.prototype.sendEmailWithTemplate = function (template, callback) {
62 return this.processRequestWithBody(index_1.ClientOptions.HttpMethod.POST, "/email/withTemplate", template, callback);
63 };
64 /**
65 * Send a batch of template email messages.
66 *
67 * @param templates - An array of templated messages you wish to send using this Client.
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 ServerClient.prototype.sendEmailBatchWithTemplates = function (templates, callback) {
72 return this.processRequestWithBody(index_1.ClientOptions.HttpMethod.POST, "/email/batchWithTemplates", { Messages: templates }, callback);
73 };
74 /**
75 * Get bounce statistic information for the associated Server.
76 *
77 * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
78 * @returns A promise that will complete when the API responds (or an error occurs).
79 */
80 ServerClient.prototype.getDeliveryStatistics = function (callback) {
81 return this.processRequestWithoutBody(index_1.ClientOptions.HttpMethod.GET, "/deliveryStats", {}, callback);
82 };
83 /**
84 * Get a batch of bounces.
85 *
86 * @param filter - Optional filtering parameters.
87 * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
88 * @returns A promise that will complete when the API responds (or an error occurs).
89 */
90 ServerClient.prototype.getBounces = function (filter, callback) {
91 if (filter === void 0) { filter = new index_2.BounceFilteringParameters(); }
92 this.setDefaultPaginationValues(filter);
93 return this.processRequestWithoutBody(index_1.ClientOptions.HttpMethod.GET, "/bounces", filter, callback);
94 };
95 /**
96 * Get details for a specific Bounce.
97 *
98 * @param id - The ID of the Bounce you wish to retrieve.
99 * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
100 * @returns A promise that will complete when the API responds (or an error occurs).
101 */
102 ServerClient.prototype.getBounce = function (id, callback) {
103 return this.processRequestWithoutBody(index_1.ClientOptions.HttpMethod.GET, "/bounces/".concat(id), {}, callback);
104 };
105 /**
106 * Get a Bounce Dump for a specific Bounce.
107 *
108 * @param id - The ID of the Bounce for which you wish to retrieve Bounce Dump.
109 * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
110 * @returns A promise that will complete when the API responds (or an error occurs).
111 */
112 ServerClient.prototype.getBounceDump = function (id, callback) {
113 return this.processRequestWithoutBody(index_1.ClientOptions.HttpMethod.GET, "/bounces/".concat(id, "/dump"), {}, callback);
114 };
115 /**
116 * Activate email address that was deactivated due to a Bounce.
117 *
118 * @param id - The ID of the Bounce for which you wish to activate the associated email.
119 * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
120 * @returns A promise that will complete when the API responds (or an error occurs).
121 */
122 ServerClient.prototype.activateBounce = function (id, callback) {
123 return this.processRequestWithBody(index_1.ClientOptions.HttpMethod.PUT, "/bounces/".concat(id, "/activate"), {}, callback);
124 };
125 /**
126 * Get the list of templates associated with this server.
127 *
128 * @param filter - Optional filtering options.
129 * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
130 * @returns A promise that will complete when the API responds (or an error occurs).
131 */
132 ServerClient.prototype.getTemplates = function (filter, callback) {
133 if (filter === void 0) { filter = new index_2.TemplateFilteringParameters(); }
134 this.setDefaultPaginationValues(filter);
135 return this.processRequestWithoutBody(index_1.ClientOptions.HttpMethod.GET, "/templates", filter, callback);
136 };
137 /**
138 * Get the a specific template associated with this server.
139 *
140 * @param idOrAlias - ID or alias for the template you wish to retrieve.
141 * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
142 * @returns A promise that will complete when the API responds (or an error occurs).
143 */
144 ServerClient.prototype.getTemplate = function (idOrAlias, callback) {
145 return this.processRequestWithoutBody(index_1.ClientOptions.HttpMethod.GET, "/templates/".concat(idOrAlias), {}, callback);
146 };
147 /**
148 * Delete a template associated with this server.
149 *
150 * @param idOrAlias - ID or template alias you wish to delete.
151 * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
152 * @returns A promise that will complete when the API responds (or an error occurs).
153 */
154 ServerClient.prototype.deleteTemplate = function (idOrAlias, callback) {
155 return this.processRequestWithoutBody(index_1.ClientOptions.HttpMethod.DELETE, "/templates/".concat(idOrAlias), {}, callback);
156 };
157 /**
158 * Create a new template on the associated server.
159 *
160 * @param options - Configuration options to be used to create the Template.
161 * @param callback If the callback is provided, it will be passed to the resulting promise as a continuation.
162 * @returns A promise that will complete when the API responds (or an error occurs).
163 */
164 ServerClient.prototype.createTemplate = function (options, callback) {
165 return this.processRequestWithBody(index_1.ClientOptions.HttpMethod.POST, "/templates/", options, callback);
166 };
167 /**
168 * Update a template on the associated server.
169 *
170 * @param idOrAlias - Id or alias of the template you wish to update.
171 * @param options - Template options you wish to update.
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 ServerClient.prototype.editTemplate = function (idOrAlias, options, callback) {
176 return this.processRequestWithBody(index_1.ClientOptions.HttpMethod.PUT, "/templates/".concat(idOrAlias), options, callback);
177 };
178 /**
179 * Validate template markup to verify that it will be parsed. Also provides a recommended template
180 * model to be used when sending using the specified template content.
181 *
182 * @param options - The template content you wish to validate.
183 * @param callback If the callback is provided, it will be passed to the resulting promise as a continuation.
184 * @returns A promise that will complete when the API responds (or an error occurs).
185 */
186 ServerClient.prototype.validateTemplate = function (options, callback) {
187 return this.processRequestWithBody(index_1.ClientOptions.HttpMethod.POST, "/templates/validate", options, callback);
188 };
189 /**
190 * Get the information for the Server associated with this Client.
191 *
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 ServerClient.prototype.getServer = function (callback) {
196 return this.processRequestWithoutBody(index_1.ClientOptions.HttpMethod.GET, "/server", {}, callback);
197 };
198 /**
199 * Modify the Server associated with this Client.
200 *
201 * @param options - The options you wish to modify.
202 * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
203 * @returns A promise that will complete when the API responds (or an error occurs).
204 */
205 ServerClient.prototype.editServer = function (options, callback) {
206 return this.processRequestWithBody(index_1.ClientOptions.HttpMethod.PUT, "/server", options, callback);
207 };
208 /**
209 * Get a batch of Outbound Messages.
210 *
211 * @param filter - Optional filtering parameters.
212 * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
213 * @returns A promise that will complete when the API responds (or an error occurs).
214 */
215 ServerClient.prototype.getOutboundMessages = function (filter, callback) {
216 if (filter === void 0) { filter = new index_2.OutboundMessagesFilteringParameters(); }
217 this.setDefaultPaginationValues(filter);
218 return this.processRequestWithoutBody(index_1.ClientOptions.HttpMethod.GET, "/messages/outbound", filter, callback);
219 };
220 /**
221 * Get details for a specific Outbound Message.
222 *
223 * @param messageId - The ID of the OutboundMessage you wish to retrieve.
224 * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
225 * @returns A promise that will complete when the API responds (or an error occurs).
226 */
227 ServerClient.prototype.getOutboundMessageDetails = function (messageId, callback) {
228 return this.processRequestWithoutBody(index_1.ClientOptions.HttpMethod.GET, "/messages/outbound/".concat(messageId), {}, callback);
229 };
230 /**
231 * Get details for a specific Outbound Message.
232 *
233 * @param messageId - The ID of the OutboundMessage you wish to retrieve.
234 * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
235 * @returns A promise that will complete when the API responds (or an error occurs).
236 */
237 ServerClient.prototype.getOutboundMessageDump = function (messageId, callback) {
238 return this.processRequestWithoutBody(index_1.ClientOptions.HttpMethod.GET, "/messages/outbound/".concat(messageId, "/dump"), {}, callback);
239 };
240 /**
241 * Get a batch of Inbound Messages.
242 *
243 * @param filter - Optional filtering parameters.
244 * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
245 * @returns A promise that will complete when the API responds (or an error occurs).
246 */
247 ServerClient.prototype.getInboundMessages = function (filter, callback) {
248 if (filter === void 0) { filter = new index_2.InboundMessagesFilteringParameters(); }
249 this.setDefaultPaginationValues(filter);
250 return this.processRequestWithoutBody(index_1.ClientOptions.HttpMethod.GET, "/messages/inbound", filter, callback);
251 };
252 /**
253 * Get details for a specific Inbound Message.
254 *
255 * @param messageId - The ID of the Inbound Message you wish to retrieve.
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 ServerClient.prototype.getInboundMessageDetails = function (messageId, callback) {
260 return this.processRequestWithoutBody(index_1.ClientOptions.HttpMethod.GET, "/messages/inbound/".concat(messageId, "/details"), {}, callback);
261 };
262 /**
263 * Cause an Inbound Message to bypass filtering rules defined on this Client's associated Server.
264 *
265 * @param messageId - The ID of the Inbound Message for which you wish to bypass the filtering rules.
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 ServerClient.prototype.bypassBlockedInboundMessage = function (messageId, callback) {
270 return this.processRequestWithoutBody(index_1.ClientOptions.HttpMethod.PUT, "/messages/inbound/".concat(messageId, "/bypass"), {}, callback);
271 };
272 /**
273 * Request that Postmark retry POSTing to the Inbound Hook for the specified message.
274 *
275 * @param messageId - The ID of the Inbound Message for which you wish to retry the inbound hook.
276 * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
277 * @returns A promise that will complete when the API responds (or an error occurs).
278 */
279 ServerClient.prototype.retryInboundHookForMessage = function (messageId, callback) {
280 return this.processRequestWithoutBody(index_1.ClientOptions.HttpMethod.PUT, "/messages/inbound/".concat(messageId, "/retry"), {}, callback);
281 };
282 /**
283 * Get the Opens for Outbound Messages.
284 *
285 * @param filter - Optional filtering parameters.
286 * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
287 * @returns A promise that will complete when the API responds (or an error occurs).
288 */
289 ServerClient.prototype.getMessageOpens = function (filter, callback) {
290 if (filter === void 0) { filter = new index_2.OutboundMessageOpensFilteringParameters(); }
291 this.setDefaultPaginationValues(filter);
292 return this.processRequestWithoutBody(index_1.ClientOptions.HttpMethod.GET, "/messages/outbound/opens", filter, callback);
293 };
294 /**
295 * Get details of Opens for specific Outbound Message.
296 *
297 * @param messageId - Message ID of the message for which you wish to retrieve Opens.
298 * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
299 * @returns A promise that will complete when the API responds (or an error occurs).
300 */
301 ServerClient.prototype.getMessageOpensForSingleMessage = function (messageId, filter, callback) {
302 if (filter === void 0) { filter = new index_2.OutboundMessageOpensFilteringParameters(50, 0); }
303 this.setDefaultPaginationValues(filter);
304 return this.processRequestWithoutBody(index_1.ClientOptions.HttpMethod.GET, "/messages/outbound/opens/".concat(messageId), filter, callback);
305 };
306 /**
307 * Get the Clicks for Outbound Messages.
308 *
309 * @param filter - Optional filtering parameters.
310 * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
311 * @returns A promise that will complete when the API responds (or an error occurs).
312 */
313 ServerClient.prototype.getMessageClicks = function (filter, callback) {
314 if (filter === void 0) { filter = new index_2.OutboundMessageClicksFilteringParameters(); }
315 this.setDefaultPaginationValues(filter);
316 return this.processRequestWithoutBody(index_1.ClientOptions.HttpMethod.GET, "/messages/outbound/clicks", filter, callback);
317 };
318 /**
319 * Get Click information for a single Outbound Message.
320 *
321 * @param messageId - The MessageID for which clicks should be retrieved.
322 * @param filter - Optional filtering parameters.
323 * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
324 * @returns A promise that will complete when the API responds (or an error occurs).
325 */
326 ServerClient.prototype.getMessageClicksForSingleMessage = function (messageId, filter, callback) {
327 if (filter === void 0) { filter = new index_2.OutboundMessageClicksFilteringParameters(); }
328 this.setDefaultPaginationValues(filter);
329 return this.processRequestWithoutBody(index_1.ClientOptions.HttpMethod.GET, "/messages/outbound/clicks/".concat(messageId), filter, callback);
330 };
331 /**
332 * Get overview statistics on Outbound Messages sent from the Server associated with this Client.
333 *
334 * @param filter - Optional filtering parameters.
335 * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
336 * @returns A promise that will complete when the API responds (or an error occurs).
337 */
338 ServerClient.prototype.getOutboundOverview = function (filter, callback) {
339 if (filter === void 0) { filter = new index_2.StatisticsFilteringParameters(); }
340 return this.processRequestWithoutBody(index_1.ClientOptions.HttpMethod.GET, "/stats/outbound", filter, callback);
341 };
342 /**
343 * Get statistics on email sent from the Server associated with this Client.
344 *
345 * @param filter - Optional filtering parameters.
346 * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
347 * @returns A promise that will complete when the API responds (or an error occurs).
348 */
349 ServerClient.prototype.getSentCounts = function (filter, callback) {
350 if (filter === void 0) { filter = new index_2.StatisticsFilteringParameters(); }
351 return this.processRequestWithoutBody(index_1.ClientOptions.HttpMethod.GET, "/stats/outbound/sends", filter, callback);
352 };
353 /**
354 * Get statistiscs on emails that bounced after being sent from the Server associated with this Client.
355 *
356 * @param filter - Optional filtering parameters.
357 * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
358 * @returns A promise that will complete when the API responds (or an error occurs).
359 */
360 ServerClient.prototype.getBounceCounts = function (filter, callback) {
361 if (filter === void 0) { filter = new index_2.StatisticsFilteringParameters(); }
362 return this.processRequestWithoutBody(index_1.ClientOptions.HttpMethod.GET, "/stats/outbound/bounces", filter, callback);
363 };
364 /**
365 * Get SPAM complaint statistics for email sent from the Server associated with this Client.
366 *
367 * @param filter - Optional filtering parameters.
368 * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
369 * @returns A promise that will complete when the API responds (or an error occurs).
370 */
371 ServerClient.prototype.getSpamComplaintsCounts = function (filter, callback) {
372 if (filter === void 0) { filter = new index_2.StatisticsFilteringParameters(); }
373 return this.processRequestWithoutBody(index_1.ClientOptions.HttpMethod.GET, "/stats/outbound/spam", filter, callback);
374 };
375 /**
376 * Get email tracking statistics for messages sent from the Server associated with this Client.
377 *
378 * @param filter - Optional filtering parameters.
379 * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
380 * @returns A promise that will complete when the API responds (or an error occurs).
381 */
382 ServerClient.prototype.getTrackedEmailCounts = function (filter, callback) {
383 if (filter === void 0) { filter = new index_2.StatisticsFilteringParameters(); }
384 return this.processRequestWithoutBody(index_1.ClientOptions.HttpMethod.GET, "/stats/outbound/tracked", filter, callback);
385 };
386 /**
387 * Get Open statistics for messages sent from the Server associated with this Client.
388 *
389 * @param filter - Optional filtering parameters.
390 * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
391 * @returns A promise that will complete when the API responds (or an error occurs).
392 */
393 ServerClient.prototype.getEmailOpenCounts = function (filter, callback) {
394 if (filter === void 0) { filter = new index_2.StatisticsFilteringParameters(); }
395 return this.processRequestWithoutBody(index_1.ClientOptions.HttpMethod.GET, "/stats/outbound/opens", filter, callback);
396 };
397 /**
398 * Get Email Client Platform statistics for messages sent from the Server associated with this Client.
399 *
400 * @param filter - Optional filtering parameters.
401 * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
402 * @returns A promise that will complete when the API responds (or an error occurs).
403 */
404 ServerClient.prototype.getEmailOpenPlatformUsage = function (filter, callback) {
405 if (filter === void 0) { filter = new index_2.StatisticsFilteringParameters(); }
406 return this.processRequestWithoutBody(index_1.ClientOptions.HttpMethod.GET, "/stats/outbound/opens/platforms", filter, callback);
407 };
408 /**
409 * Get statistics on which Email Clients were used to open messages sent from the Server associated with this Client.
410 *
411 * @param filter - Optional filtering parameters.
412 * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
413 * @returns A promise that will complete when the API responds (or an error occurs).
414 */
415 ServerClient.prototype.getEmailOpenClientUsage = function (filter, callback) {
416 if (filter === void 0) { filter = new index_2.StatisticsFilteringParameters(); }
417 return this.processRequestWithoutBody(index_1.ClientOptions.HttpMethod.GET, "/stats/outbound/opens/emailClients", filter, callback);
418 };
419 /**
420 * Get Read Time statistics for messages sent from the Server associated with this Client.
421 * @param filter Optional filtering parameters.
422 * @param callback If the callback is provided, it will be passed to the resulting promise as a continuation.
423 * @returns A promise that will complete when the API responds (or an error occurs).
424 */
425 ServerClient.prototype.getEmailOpenReadTimes = function (filter, callback) {
426 if (filter === void 0) { filter = new index_2.StatisticsFilteringParameters(); }
427 return this.processRequestWithoutBody(index_1.ClientOptions.HttpMethod.GET, "/stats/outbound/opens/readTimes", filter, callback);
428 };
429 /**
430 * Get total clicks statistics for tracked links for messages sent from the Server associated with this Client.
431 *
432 * @param filter - Optional filtering parameters.
433 * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
434 * @returns A promise that will complete when the API responds (or an error occurs).
435 */
436 ServerClient.prototype.getClickCounts = function (filter, callback) {
437 if (filter === void 0) { filter = new index_2.StatisticsFilteringParameters(); }
438 return this.processRequestWithoutBody(index_1.ClientOptions.HttpMethod.GET, "/stats/outbound/clicks", filter, callback);
439 };
440 /**
441 * Get browser family statistics for tracked links for messages sent from the Server associated with this Client.
442 * @param filter Optional filtering parameters.
443 * @param callback If the callback is provided, it will be passed to the resulting promise as a continuation.
444 * @returns A promise that will complete when the API responds (or an error occurs).
445 */
446 ServerClient.prototype.getClickBrowserUsage = function (filter, callback) {
447 if (filter === void 0) { filter = new index_2.StatisticsFilteringParameters(); }
448 return this.processRequestWithoutBody(index_1.ClientOptions.HttpMethod.GET, "/stats/outbound/clicks/browserFamilies", filter, callback);
449 };
450 /**
451 * Get browser platform statistics for tracked links for messages sent from the Server associated with this Client.
452 *
453 * @param filter - Optional filtering parameters.
454 * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
455 * @returns A promise that will complete when the API responds (or an error occurs).
456 */
457 ServerClient.prototype.getClickPlatformUsage = function (filter, callback) {
458 if (filter === void 0) { filter = new index_2.StatisticsFilteringParameters(); }
459 return this.processRequestWithoutBody(index_1.ClientOptions.HttpMethod.GET, "/stats/outbound/clicks/platforms", filter, callback);
460 };
461 /**
462 * Get click location (in HTML or Text body of the email) statistics for tracked links for messages sent
463 * from the Server associated with this Client.
464 *
465 * @param filter - Optional filtering parameters.
466 * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
467 * @returns A promise that will complete when the API responds (or an error occurs).
468 */
469 ServerClient.prototype.getClickLocation = function (filter, callback) {
470 if (filter === void 0) { filter = new index_2.StatisticsFilteringParameters(); }
471 return this.processRequestWithoutBody(index_1.ClientOptions.HttpMethod.GET, "/stats/outbound/clicks/location", filter, callback);
472 };
473 /**
474 * Create an Inbound Rule Trigger.
475 *
476 * @param options - Configuration options to be used when creating this Trigger.
477 * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
478 * @returns A promise that will complete when the API responds (or an error occurs).
479 */
480 ServerClient.prototype.createInboundRuleTrigger = function (options, callback) {
481 return this.processRequestWithBody(index_1.ClientOptions.HttpMethod.POST, "/triggers/inboundRules", options, callback);
482 };
483 /**
484 * Delete an Inbound Rule Trigger.
485 *
486 * @param id - The ID of the Inbound Rule Trigger you wish to delete.
487 * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
488 * @returns A promise that will complete when the API responds (or an error occurs).
489 */
490 ServerClient.prototype.deleteInboundRuleTrigger = function (id, callback) {
491 return this.processRequestWithoutBody(index_1.ClientOptions.HttpMethod.DELETE, "/triggers/inboundRules/".concat(id), {}, callback);
492 };
493 /**
494 * Get a list of Inbound Rule Triggers.
495 *
496 * @param filter - Optional filtering parameters.
497 * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
498 * @returns A promise that will complete when the API responds (or an error occurs).
499 */
500 ServerClient.prototype.getInboundRuleTriggers = function (filter, callback) {
501 if (filter === void 0) { filter = new index_1.FilteringParameters(); }
502 this.setDefaultPaginationValues(filter);
503 return this.processRequestWithoutBody(index_1.ClientOptions.HttpMethod.GET, "/triggers/inboundRules", filter, callback);
504 };
505 /**
506 * Get the list of Webhooks for specific server.
507 *
508 * @param filter - Optional filtering parameters
509 * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
510 * @returns A promise that will complete when the API responds (or an error occurs).
511 */
512 ServerClient.prototype.getWebhooks = function (filter, callback) {
513 if (filter === void 0) { filter = {}; }
514 return this.processRequestWithoutBody(index_1.ClientOptions.HttpMethod.GET, "/webhooks", filter, callback);
515 };
516 /**
517 * Get details for a specific Webhook.
518 *
519 * @param id - The ID of the Webhook you wish to retrieve.
520 * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
521 * @returns A promise that will complete when the API responds (or an error occurs).
522 */
523 ServerClient.prototype.getWebhook = function (id, callback) {
524 return this.processRequestWithoutBody(index_1.ClientOptions.HttpMethod.GET, "/webhooks/".concat(id), {}, callback);
525 };
526 /**
527 * Create a Webhook on the associated server.
528 *
529 * @param options - Configuration options to be used when creating Webhook trigger.
530 * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
531 * @returns A promise that will complete when the API responds (or an error occurs).
532 */
533 ServerClient.prototype.createWebhook = function (options, callback) {
534 return this.processRequestWithBody(index_1.ClientOptions.HttpMethod.POST, "/webhooks", options, callback);
535 };
536 /**
537 * Update Webhook on the associated server.
538 *
539 * @param id - Id of the webhook you wish to update.
540 * @param options - Webhook options you wish to update.
541 * @param callback If the callback is provided, it will be passed to the resulting promise as a continuation.
542 * @returns A promise that will complete when the API responds (or an error occurs).
543 */
544 ServerClient.prototype.editWebhook = function (id, options, callback) {
545 return this.processRequestWithBody(index_1.ClientOptions.HttpMethod.PUT, "/webhooks/".concat(id), options, callback);
546 };
547 /**
548 * Delete an existing Webhook.
549 *
550 * @param id - The ID of the Webhook you wish to delete.
551 * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
552 * @returns A promise that will complete when the API responds (or an error occurs).
553 */
554 ServerClient.prototype.deleteWebhook = function (id, callback) {
555 return this.processRequestWithoutBody(index_1.ClientOptions.HttpMethod.DELETE, "/webhooks/".concat(id), {}, callback);
556 };
557 /**
558 * Get the list of message streams on a server.
559 *
560 * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
561 * @returns A promise that will complete when the API responds (or an error occurs).
562 */
563 ServerClient.prototype.getMessageStreams = function (filter, callback) {
564 if (filter === void 0) { filter = {}; }
565 return this.processRequestWithoutBody(index_1.ClientOptions.HttpMethod.GET, "/message-streams", filter, callback);
566 };
567 /**
568 * Get details for a specific message stream on a server.
569 *
570 * @param id - The ID of the message stream you wish to retrieve.
571 * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
572 * @returns A promise that will complete when the API responds (or an error occurs).
573 */
574 ServerClient.prototype.getMessageStream = function (id, callback) {
575 return this.processRequestWithoutBody(index_1.ClientOptions.HttpMethod.GET, "/message-streams/".concat(id), {}, callback);
576 };
577 /**
578 * Update message stream on the associated server.
579 *
580 * @param id - Id of the webhook you wish to update.
581 * @param options - Webhook options you wish to update.
582 * @param callback If the callback is provided, it will be passed to the resulting promise as a continuation.
583 * @returns A promise that will complete when the API responds (or an error occurs).
584 */
585 ServerClient.prototype.editMessageStream = function (id, options, callback) {
586 return this.processRequestWithBody(index_1.ClientOptions.HttpMethod.PATCH, "/message-streams/".concat(id), options, callback);
587 };
588 /**
589 * Create a message stream on the associated server.
590 *
591 * @param options - Configuration options to be used when creating message stream on the server.
592 * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
593 * @returns A promise that will complete when the API responds (or an error occurs).
594 */
595 ServerClient.prototype.createMessageStream = function (options, callback) {
596 return this.processRequestWithBody(index_1.ClientOptions.HttpMethod.POST, "/message-streams", options, callback);
597 };
598 /**
599 * Archive a message stream on the associated server.
600 *
601 * @param options - Configuration options to be used when creating message stream on the server.
602 * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
603 * @returns A promise that will complete when the API responds (or an error occurs).
604 */
605 ServerClient.prototype.archiveMessageStream = function (id, callback) {
606 return this.processRequestWithBody(index_1.ClientOptions.HttpMethod.POST, "/message-streams/".concat(id, "/archive"), {}, callback);
607 };
608 /**
609 * Unarchive a message stream on the associated server.
610 *
611 * @param options - Configuration options to be used when creating message stream on the server.
612 * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
613 * @returns A promise that will complete when the API responds (or an error occurs).
614 */
615 ServerClient.prototype.unarchiveMessageStream = function (id, callback) {
616 return this.processRequestWithBody(index_1.ClientOptions.HttpMethod.POST, "/message-streams/".concat(id, "/unarchive"), {}, callback);
617 };
618 /**
619 * Get the list of suppressions for a message stream on a server.
620 *
621 * @param messageStream - Select message stream
622 * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
623 * @returns A promise that will complete when the API responds (or an error occurs).
624 */
625 ServerClient.prototype.getSuppressions = function (messageStream, filter, callback) {
626 if (filter === void 0) { filter = new index_2.SuppressionFilteringParameters(); }
627 return this.processRequestWithoutBody(index_1.ClientOptions.HttpMethod.GET, "/message-streams/".concat(messageStream, "/suppressions/dump"), filter, callback);
628 };
629 /**
630 * Add email addresses to a suppressions list on a message stream on a server.
631 *
632 * @param messageStream - Select message stream
633 * @param options - Suppressions you wish to add.
634 * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
635 * @returns A promise that will complete when the API responds (or an error occurs).
636 */
637 ServerClient.prototype.createSuppressions = function (messageStream, options, callback) {
638 return this.processRequestWithBody(index_1.ClientOptions.HttpMethod.POST, "/message-streams/".concat(messageStream, "/suppressions"), options, callback);
639 };
640 /**
641 * Delete email addresses from a suppressions list on a message stream on a server.
642 *
643 * @param messageStream - Select message stream
644 * @param options - Suppressions you wish to delete.
645 * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
646 * @returns A promise that will complete when the API responds (or an error occurs).
647 */
648 ServerClient.prototype.deleteSuppressions = function (messageStream, options, callback) {
649 return this.processRequestWithBody(index_1.ClientOptions.HttpMethod.POST, "/message-streams/".concat(messageStream, "/suppressions/delete"), options, callback);
650 };
651 return ServerClient;
652}(BaseClient_1.default));
653exports.default = ServerClient;
654//# sourceMappingURL=ServerClient.js.map
\No newline at end of file