UNPKG

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