UNPKG

mailersend

Version:

Node.js helper module for MailerSend API

65 lines (64 loc) 2.51 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.UserModule = void 0; const request_service_1 = require("../services/request.service"); class UserModule 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(`/users`, queryParams); }); } single(userId) { return __awaiter(this, void 0, void 0, function* () { return yield this.get(`/users/${userId}`); }); } create(data) { return __awaiter(this, void 0, void 0, function* () { return yield this.post(`/users`, data); }); } update(userId, data) { return __awaiter(this, void 0, void 0, function* () { return yield this.put(`/users/${userId}`, data); }); } delete(userId) { return __awaiter(this, void 0, void 0, function* () { return yield this.deleteReq(`/users/${userId}`); }); } listInvites(queryParams) { return __awaiter(this, void 0, void 0, function* () { return yield this.get(`/invites`, queryParams); }); } singleInvite(inviteId) { return __awaiter(this, void 0, void 0, function* () { return yield this.get(`/invites/${inviteId}`); }); } resendInvite(inviteId) { return __awaiter(this, void 0, void 0, function* () { return yield this.post(`/invites/${inviteId}/resend`, {}); }); } deleteInvite(inviteId) { return __awaiter(this, void 0, void 0, function* () { return yield this.deleteReq(`/invites/${inviteId}`); }); } } exports.UserModule = UserModule;