UNPKG

emailengine-client

Version:

A TypeScript client for the EmailEngine API

60 lines 3.32 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.SMTPGatewayAPI = void 0; const helpers_1 = require("../../../misc/helpers"); const GetGatewayInfoOptions_1 = require("./models/GetGatewayInfoOptions"); const ListRegisteredGatewaysOptions_1 = require("./models/ListRegisteredGatewaysOptions"); const RegisterNewGatewayOptions_1 = require("./models/RegisterNewGatewayOptions"); const UpdatesGatewayInfoOptions_1 = require("./models/UpdatesGatewayInfoOptions"); const DeleteSMTPGatewayOptions_1 = require("./models/DeleteSMTPGatewayOptions"); class SMTPGatewayAPI { constructor(client) { this.axiosInstance = client.axios; } getGatewayInfo(options) { return __awaiter(this, void 0, void 0, function* () { options = new GetGatewayInfoOptions_1.GetGatewayInfoOptions(options); const response = yield this.axiosInstance.get(`/v1/gateway/${options.gateway}`, (0, helpers_1.setupAxiosRequestConfig)(options)); return response.data; }); } listRegisteredGateways(options) { return __awaiter(this, void 0, void 0, function* () { options = new ListRegisteredGatewaysOptions_1.ListRegisteredGatewaysOptions(options); const response = yield this.axiosInstance.get(`/v1/gateways`, (0, helpers_1.setupAxiosRequestConfig)(options)); return response.data; }); } registerNewGateway(options) { return __awaiter(this, void 0, void 0, function* () { options = new RegisterNewGatewayOptions_1.RegisterNewGatewayOptions(options); const response = yield this.axiosInstance.post(`/v1/gateway`, options.body, (0, helpers_1.setupAxiosRequestConfig)(options)); return response.data; }); } updateGatewayInfo(options) { return __awaiter(this, void 0, void 0, function* () { options = new UpdatesGatewayInfoOptions_1.UpdatesGatewayInfoOptions(options); const response = yield this.axiosInstance.put(`/v1/gateway/edit/${options.gateway}`, options.body, (0, helpers_1.setupAxiosRequestConfig)(options)); return response.data; }); } deleteSMTPGateway(options) { return __awaiter(this, void 0, void 0, function* () { options = new DeleteSMTPGatewayOptions_1.DeleteSMTPGatewayOptions(options); const response = yield this.axiosInstance.delete(`/v1/gateway/${options.gateway}`, (0, helpers_1.setupAxiosRequestConfig)(options)); return response.data; }); } } exports.SMTPGatewayAPI = SMTPGatewayAPI; //# sourceMappingURL=api.js.map