UNPKG

emailengine-client

Version:

A TypeScript client for the EmailEngine API

60 lines 3.22 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.OAuth2AppApi = void 0; const helpers_1 = require("../../../misc/helpers"); const RegisterOAuth2AppOptions_1 = require("./models/RegisterOAuth2AppOptions"); const GetOAuth2InfoOptions_1 = require("./models/GetOAuth2InfoOptions"); const ListOAuth2AppsOptions_1 = require("./models/ListOAuth2AppsOptions"); const UpdateOAuth2AppOptions_1 = require("./models/UpdateOAuth2AppOptions"); const RemoveOAuth2AppOptions_1 = require("./models/RemoveOAuth2AppOptions"); class OAuth2AppApi { constructor(client) { this.axiosInstance = client.axios; } registerOAuth2App(options) { return __awaiter(this, void 0, void 0, function* () { options = new RegisterOAuth2AppOptions_1.RegisterOAuth2AppOptions(options); const response = yield this.axiosInstance.post(`/v1/oauth2`, options.body, (0, helpers_1.setupAxiosRequestConfig)(options)); return response.data; }); } getOAuth2AppInfo(options) { return __awaiter(this, void 0, void 0, function* () { options = new GetOAuth2InfoOptions_1.GetOAuth2InfoOptions(options); const response = yield this.axiosInstance.get(`/v1/oauth2/${options.app}`, (0, helpers_1.setupAxiosRequestConfig)(options)); return response.data; }); } listOAuth2Apps(options) { return __awaiter(this, void 0, void 0, function* () { options = new ListOAuth2AppsOptions_1.ListOAuth2AppsOptions(options); const response = yield this.axiosInstance.get(`/v1/oauth2`, (0, helpers_1.setupAxiosRequestConfig)(options)); return response.data; }); } updateOAuth2App(options) { return __awaiter(this, void 0, void 0, function* () { options = new UpdateOAuth2AppOptions_1.UpdateOAuth2AppOptions(options); const response = yield this.axiosInstance.put(`/v1/oauth2/${options.app}`, options.body, (0, helpers_1.setupAxiosRequestConfig)(options)); return response.data; }); } removeOAuth2App(options) { return __awaiter(this, void 0, void 0, function* () { options = new RemoveOAuth2AppOptions_1.RemoveOAuth2AppOptions(options); const response = yield this.axiosInstance.delete(`/v1/oauth2/${options.app}`, (0, helpers_1.setupAxiosRequestConfig)(options)); return response.data; }); } } exports.OAuth2AppApi = OAuth2AppApi; //# sourceMappingURL=api.js.map