UNPKG

mailersend

Version:

Node.js helper module for MailerSend API

56 lines (55 loc) 2.58 kB
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.RecipientModule = void 0; const request_service_1 = require("../../services/request.service"); const models_1 = require("../../models"); class RecipientModule extends request_service_1.RequestService { constructor(apiKey, baseUrl) { super(apiKey, baseUrl); } list(queryParams) { return __awaiter(this, void 0, void 0, function* () { return yield this.get(`/recipients`, queryParams); }); } single(recipientId) { return __awaiter(this, void 0, void 0, function* () { return yield this.get(`/recipients/${recipientId}`); }); } delete(recipientId) { return __awaiter(this, void 0, void 0, function* () { return yield this.deleteReq(`/recipients/${recipientId}`); }); } blockList(queryParams_1) { return __awaiter(this, arguments, void 0, function* (queryParams, type = models_1.BlockListType.BLOCK_LIST) { return yield this.get(`/suppressions/${type}`, queryParams); }); } blockRecipients(blockRecipients_1) { return __awaiter(this, arguments, void 0, function* (blockRecipients, type = models_1.BlockListType.BLOCK_LIST) { return yield this.post(`/suppressions/${type}`, blockRecipients); }); } delBlockListRecipients(ids_1) { return __awaiter(this, arguments, void 0, function* (ids, type = models_1.BlockListType.BLOCK_LIST) { return yield this.deleteReq(`/suppressions/${type}`, { ids }); }); } delAllBlockListRecipients() { return __awaiter(this, arguments, void 0, function* (type = models_1.BlockListType.BLOCK_LIST) { return yield this.deleteReq(`/suppressions/${type}`, { all: true }); }); } } exports.RecipientModule = RecipientModule;