emailengine-client
Version:
A TypeScript client for the EmailEngine API
52 lines • 2.88 kB
JavaScript
;
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.BlocklistsApi = void 0;
const helpers_1 = require("../../../misc/helpers");
const AddBlocklistAddressOptions_1 = require("./models/AddBlocklistAddressOptions");
const GetBlocklistsOptions_1 = require("./models/GetBlocklistsOptions");
const GetBlocklistAddressesOptions_1 = require("./models/GetBlocklistAddressesOptions");
const RemoveBlocklistAddressOptions_1 = require("./models/RemoveBlocklistAddressOptions");
class BlocklistsApi {
constructor(client) {
this.axiosInstance = client.axios;
}
addBlocklistAddress(options) {
return __awaiter(this, void 0, void 0, function* () {
options = new AddBlocklistAddressOptions_1.AddBlocklistAddressOptions(options);
const response = yield this.axiosInstance.post(`/v1/blocklist/${options.listId}`, options.body, (0, helpers_1.setupAxiosRequestConfig)(options));
return response.data;
});
}
getBlocklists(options) {
return __awaiter(this, void 0, void 0, function* () {
options = new GetBlocklistsOptions_1.GetBlocklistsOptions(options);
const response = yield this.axiosInstance.get(`/v1/blocklists`, (0, helpers_1.setupAxiosRequestConfig)(options));
return response.data;
});
}
getBlocklistAddresses(options) {
return __awaiter(this, void 0, void 0, function* () {
options = new GetBlocklistAddressesOptions_1.GetBlocklistAddressesOptions(options);
const response = yield this.axiosInstance.get(`/v1/blocklist/${options.listId}`, (0, helpers_1.setupAxiosRequestConfig)(options));
return response.data;
});
}
removeBlocklistAddress(options) {
return __awaiter(this, void 0, void 0, function* () {
options = new RemoveBlocklistAddressOptions_1.RemoveBlocklistAddressOptions(options);
const response = yield this.axiosInstance.delete(`/v1/blocklist/${options.listId}`, (0, helpers_1.setupAxiosRequestConfig)(options));
return response.data;
});
}
}
exports.BlocklistsApi = BlocklistsApi;
//# sourceMappingURL=api.js.map