UNPKG

@suin/esa-api

Version:

esa.io APIクライアント

337 lines 15.9 kB
"use strict"; /* tslint:disable */ /* eslint-disable */ /** * esa API v1 * チームのナレッジ共有サービス[esa.io](https://esa.io/)のAPI v1の仕様書 * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.WatchApi = exports.WatchApiFactory = exports.WatchApiFp = exports.WatchApiAxiosParamCreator = void 0; const axios_1 = __importDefault(require("axios")); // Some imports not used depending on template conditions // @ts-ignore const common_1 = require("../common"); // @ts-ignore const base_1 = require("../base"); /** * WatchApi - axios parameter creator * @export */ const WatchApiAxiosParamCreator = function (configuration) { return { /** * 指定された記事にWatchをしたユーザ一覧を取得します。 * @summary Watchしたユーザー一覧を取得する * @param {string} teamName チーム名 * @param {number} postNumber 記事ID * @param {number} [page] ページ番号 * @param {number} [perPage] 1ページあたりに含まれる要素数 * @param {*} [options] Override http request option. * @throws {RequiredError} */ getWatchers: async (teamName, postNumber, page, perPage, options = {}) => { // verify required parameter 'teamName' is not null or undefined (0, common_1.assertParamExists)("getWatchers", "teamName", teamName); // verify required parameter 'postNumber' is not null or undefined (0, common_1.assertParamExists)("getWatchers", "postNumber", postNumber); const localVarPath = `/teams/{team_name}/posts/{post_number}/watchers` .replace(`{${"team_name"}}`, encodeURIComponent(String(teamName))) .replace(`{${"post_number"}}`, encodeURIComponent(String(postNumber))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = { method: "GET", ...baseOptions, ...options, }; const localVarHeaderParameter = {}; const localVarQueryParameter = {}; // authentication AccessTokenHeader required // http bearer authentication required await (0, common_1.setBearerAuthToObject)(localVarHeaderParameter, configuration); // authentication AccessTokenQueryParam required await (0, common_1.setApiKeyToObject)(localVarQueryParameter, "access_token", configuration); // authentication OAuth2 required // oauth required await (0, common_1.setOAuthToObject)(localVarHeaderParameter, "OAuth2", ["read"], configuration); if (page !== undefined) { localVarQueryParameter["page"] = page; } if (perPage !== undefined) { localVarQueryParameter["per_page"] = perPage; } (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers, }; return { url: (0, common_1.toPathString)(localVarUrlObj), options: localVarRequestOptions, }; }, /** * 指定された記事へのWatchを取り消します。 * @summary 記事のWatchを取り消す * @param {string} teamName チーム名 * @param {number} postNumber 記事ID * @param {*} [options] Override http request option. * @throws {RequiredError} */ unwachPost: async (teamName, postNumber, options = {}) => { // verify required parameter 'teamName' is not null or undefined (0, common_1.assertParamExists)("unwachPost", "teamName", teamName); // verify required parameter 'postNumber' is not null or undefined (0, common_1.assertParamExists)("unwachPost", "postNumber", postNumber); const localVarPath = `/teams/{team_name}/posts/{post_number}/watch` .replace(`{${"team_name"}}`, encodeURIComponent(String(teamName))) .replace(`{${"post_number"}}`, encodeURIComponent(String(postNumber))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = { method: "DELETE", ...baseOptions, ...options, }; const localVarHeaderParameter = {}; const localVarQueryParameter = {}; // authentication AccessTokenHeader required // http bearer authentication required await (0, common_1.setBearerAuthToObject)(localVarHeaderParameter, configuration); // authentication AccessTokenQueryParam required await (0, common_1.setApiKeyToObject)(localVarQueryParameter, "access_token", configuration); // authentication OAuth2 required // oauth required await (0, common_1.setOAuthToObject)(localVarHeaderParameter, "OAuth2", ["write"], configuration); (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers, }; return { url: (0, common_1.toPathString)(localVarUrlObj), options: localVarRequestOptions, }; }, /** * 指定された記事にWatchをします。 * @summary 記事をWatchする * @param {string} teamName チーム名 * @param {number} postNumber 記事ID * @param {*} [options] Override http request option. * @throws {RequiredError} */ watchPost: async (teamName, postNumber, options = {}) => { // verify required parameter 'teamName' is not null or undefined (0, common_1.assertParamExists)("watchPost", "teamName", teamName); // verify required parameter 'postNumber' is not null or undefined (0, common_1.assertParamExists)("watchPost", "postNumber", postNumber); const localVarPath = `/teams/{team_name}/posts/{post_number}/watch` .replace(`{${"team_name"}}`, encodeURIComponent(String(teamName))) .replace(`{${"post_number"}}`, encodeURIComponent(String(postNumber))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = { method: "POST", ...baseOptions, ...options, }; const localVarHeaderParameter = {}; const localVarQueryParameter = {}; // authentication AccessTokenHeader required // http bearer authentication required await (0, common_1.setBearerAuthToObject)(localVarHeaderParameter, configuration); // authentication AccessTokenQueryParam required await (0, common_1.setApiKeyToObject)(localVarQueryParameter, "access_token", configuration); // authentication OAuth2 required // oauth required await (0, common_1.setOAuthToObject)(localVarHeaderParameter, "OAuth2", ["write"], configuration); (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers, }; return { url: (0, common_1.toPathString)(localVarUrlObj), options: localVarRequestOptions, }; }, }; }; exports.WatchApiAxiosParamCreator = WatchApiAxiosParamCreator; /** * WatchApi - functional programming interface * @export */ const WatchApiFp = function (configuration) { const localVarAxiosParamCreator = (0, exports.WatchApiAxiosParamCreator)(configuration); return { /** * 指定された記事にWatchをしたユーザ一覧を取得します。 * @summary Watchしたユーザー一覧を取得する * @param {string} teamName チーム名 * @param {number} postNumber 記事ID * @param {number} [page] ページ番号 * @param {number} [perPage] 1ページあたりに含まれる要素数 * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getWatchers(teamName, postNumber, page, perPage, options) { const localVarAxiosArgs = await localVarAxiosParamCreator.getWatchers(teamName, postNumber, page, perPage, options); return (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration); }, /** * 指定された記事へのWatchを取り消します。 * @summary 記事のWatchを取り消す * @param {string} teamName チーム名 * @param {number} postNumber 記事ID * @param {*} [options] Override http request option. * @throws {RequiredError} */ async unwachPost(teamName, postNumber, options) { const localVarAxiosArgs = await localVarAxiosParamCreator.unwachPost(teamName, postNumber, options); return (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration); }, /** * 指定された記事にWatchをします。 * @summary 記事をWatchする * @param {string} teamName チーム名 * @param {number} postNumber 記事ID * @param {*} [options] Override http request option. * @throws {RequiredError} */ async watchPost(teamName, postNumber, options) { const localVarAxiosArgs = await localVarAxiosParamCreator.watchPost(teamName, postNumber, options); return (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration); }, }; }; exports.WatchApiFp = WatchApiFp; /** * WatchApi - factory interface * @export */ const WatchApiFactory = function (configuration, basePath, axios) { const localVarFp = (0, exports.WatchApiFp)(configuration); return { /** * 指定された記事にWatchをしたユーザ一覧を取得します。 * @summary Watchしたユーザー一覧を取得する * @param {string} teamName チーム名 * @param {number} postNumber 記事ID * @param {number} [page] ページ番号 * @param {number} [perPage] 1ページあたりに含まれる要素数 * @param {*} [options] Override http request option. * @throws {RequiredError} */ getWatchers(teamName, postNumber, page, perPage, options) { return localVarFp .getWatchers(teamName, postNumber, page, perPage, options) .then((request) => request(axios, basePath)); }, /** * 指定された記事へのWatchを取り消します。 * @summary 記事のWatchを取り消す * @param {string} teamName チーム名 * @param {number} postNumber 記事ID * @param {*} [options] Override http request option. * @throws {RequiredError} */ unwachPost(teamName, postNumber, options) { return localVarFp .unwachPost(teamName, postNumber, options) .then((request) => request(axios, basePath)); }, /** * 指定された記事にWatchをします。 * @summary 記事をWatchする * @param {string} teamName チーム名 * @param {number} postNumber 記事ID * @param {*} [options] Override http request option. * @throws {RequiredError} */ watchPost(teamName, postNumber, options) { return localVarFp .watchPost(teamName, postNumber, options) .then((request) => request(axios, basePath)); }, }; }; exports.WatchApiFactory = WatchApiFactory; /** * WatchApi - object-oriented interface * @export * @class WatchApi * @extends {BaseAPI} */ class WatchApi extends base_1.BaseAPI { /** * 指定された記事にWatchをしたユーザ一覧を取得します。 * @summary Watchしたユーザー一覧を取得する * @param {WatchApiGetWatchersRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof WatchApi */ getWatchers(requestParameters, options) { return (0, exports.WatchApiFp)(this.configuration) .getWatchers(requestParameters.teamName, requestParameters.postNumber, requestParameters.page, requestParameters.perPage, options) .then((request) => request(this.axios, this.basePath)); } /** * 指定された記事へのWatchを取り消します。 * @summary 記事のWatchを取り消す * @param {WatchApiUnwachPostRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof WatchApi */ unwachPost(requestParameters, options) { return (0, exports.WatchApiFp)(this.configuration) .unwachPost(requestParameters.teamName, requestParameters.postNumber, options) .then((request) => request(this.axios, this.basePath)); } /** * 指定された記事にWatchをします。 * @summary 記事をWatchする * @param {WatchApiWatchPostRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof WatchApi */ watchPost(requestParameters, options) { return (0, exports.WatchApiFp)(this.configuration) .watchPost(requestParameters.teamName, requestParameters.postNumber, options) .then((request) => request(this.axios, this.basePath)); } } exports.WatchApi = WatchApi; //# sourceMappingURL=watch-api.js.map