UNPKG

@suin/esa-api

Version:

esa.io APIクライアント

635 lines 32.4 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.CommentApi = exports.CommentApiFactory = exports.CommentApiFp = exports.CommentApiAxiosParamCreator = 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"); /** * CommentApi - axios parameter creator * @export */ const CommentApiAxiosParamCreator = function (configuration) { return { /** * 記事に新しいコメントを作成します。 * @summary コメントを投稿する * @param {string} teamName チーム名 * @param {number} postNumber 記事ID * @param {CreateCommentBody} createCommentBody * @param {number} [page] ページ番号 * @param {number} [perPage] 1ページあたりに含まれる要素数 * @param {*} [options] Override http request option. * @throws {RequiredError} */ createComment: async (teamName, postNumber, createCommentBody, page, perPage, options = {}) => { // verify required parameter 'teamName' is not null or undefined (0, common_1.assertParamExists)("createComment", "teamName", teamName); // verify required parameter 'postNumber' is not null or undefined (0, common_1.assertParamExists)("createComment", "postNumber", postNumber); // verify required parameter 'createCommentBody' is not null or undefined (0, common_1.assertParamExists)("createComment", "createCommentBody", createCommentBody); const localVarPath = `/teams/{team_name}/posts/{post_number}/comments` .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); if (page !== undefined) { localVarQueryParameter["page"] = page; } if (perPage !== undefined) { localVarQueryParameter["per_page"] = perPage; } localVarHeaderParameter["Content-Type"] = "application/json"; (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers, }; localVarRequestOptions.data = (0, common_1.serializeDataIfNeeded)(createCommentBody, localVarRequestOptions, configuration); return { url: (0, common_1.toPathString)(localVarUrlObj), options: localVarRequestOptions, }; }, /** * 指定されたコメントを削除します。 * @summary コメントを削除する * @param {string} teamName チーム名 * @param {number} commentId コメントID * @param {*} [options] Override http request option. * @throws {RequiredError} */ deleteComment: async (teamName, commentId, options = {}) => { // verify required parameter 'teamName' is not null or undefined (0, common_1.assertParamExists)("deleteComment", "teamName", teamName); // verify required parameter 'commentId' is not null or undefined (0, common_1.assertParamExists)("deleteComment", "commentId", commentId); const localVarPath = `/teams/{team_name}/comments/{comment_id}` .replace(`{${"team_name"}}`, encodeURIComponent(String(teamName))) .replace(`{${"comment_id"}}`, encodeURIComponent(String(commentId))); // 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, }; }, /** * 指定されたコメントを取得します。 * @summary コメントを取得する * @param {string} teamName チーム名 * @param {number} commentId コメントID * @param {'stargazers'} [include] `stargazers`を指定するとStarの配列を含んだレスポンスを返します。 * @param {*} [options] Override http request option. * @throws {RequiredError} */ getComment: async (teamName, commentId, include, options = {}) => { // verify required parameter 'teamName' is not null or undefined (0, common_1.assertParamExists)("getComment", "teamName", teamName); // verify required parameter 'commentId' is not null or undefined (0, common_1.assertParamExists)("getComment", "commentId", commentId); const localVarPath = `/teams/{team_name}/comments/{comment_id}` .replace(`{${"team_name"}}`, encodeURIComponent(String(teamName))) .replace(`{${"comment_id"}}`, encodeURIComponent(String(commentId))); // 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 (include !== undefined) { localVarQueryParameter["include"] = include; } (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, }; }, /** * チーム全体のコメント一覧を作成日の降順で返却します。 * @summary コメント一覧を取得する * @param {string} teamName チーム名 * @param {number} [page] ページ番号 * @param {number} [perPage] 1ページあたりに含まれる要素数 * @param {*} [options] Override http request option. * @throws {RequiredError} */ getComments: async (teamName, page, perPage, options = {}) => { // verify required parameter 'teamName' is not null or undefined (0, common_1.assertParamExists)("getComments", "teamName", teamName); const localVarPath = `/teams/{team_name}/comments`.replace(`{${"team_name"}}`, encodeURIComponent(String(teamName))); // 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, }; }, /** * 記事のコメント一覧を更新日の降順で返却します。 * @summary 記事のコメント一覧を取得する * @param {string} teamName チーム名 * @param {number} postNumber 記事ID * @param {number} [page] ページ番号 * @param {number} [perPage] 1ページあたりに含まれる要素数 * @param {*} [options] Override http request option. * @throws {RequiredError} */ getPostComments: async (teamName, postNumber, page, perPage, options = {}) => { // verify required parameter 'teamName' is not null or undefined (0, common_1.assertParamExists)("getPostComments", "teamName", teamName); // verify required parameter 'postNumber' is not null or undefined (0, common_1.assertParamExists)("getPostComments", "postNumber", postNumber); const localVarPath = `/teams/{team_name}/posts/{post_number}/comments` .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, }; }, /** * 指定されたコメントを更新します。 * @summary コメントを更新する * @param {string} teamName チーム名 * @param {number} commentId コメントID * @param {UpdateCommentBody} updateCommentBody * @param {*} [options] Override http request option. * @throws {RequiredError} */ updateComment: async (teamName, commentId, updateCommentBody, options = {}) => { // verify required parameter 'teamName' is not null or undefined (0, common_1.assertParamExists)("updateComment", "teamName", teamName); // verify required parameter 'commentId' is not null or undefined (0, common_1.assertParamExists)("updateComment", "commentId", commentId); // verify required parameter 'updateCommentBody' is not null or undefined (0, common_1.assertParamExists)("updateComment", "updateCommentBody", updateCommentBody); const localVarPath = `/teams/{team_name}/comments/{comment_id}` .replace(`{${"team_name"}}`, encodeURIComponent(String(teamName))) .replace(`{${"comment_id"}}`, encodeURIComponent(String(commentId))); // 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: "PATCH", ...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); localVarHeaderParameter["Content-Type"] = "application/json"; (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers, }; localVarRequestOptions.data = (0, common_1.serializeDataIfNeeded)(updateCommentBody, localVarRequestOptions, configuration); return { url: (0, common_1.toPathString)(localVarUrlObj), options: localVarRequestOptions, }; }, }; }; exports.CommentApiAxiosParamCreator = CommentApiAxiosParamCreator; /** * CommentApi - functional programming interface * @export */ const CommentApiFp = function (configuration) { const localVarAxiosParamCreator = (0, exports.CommentApiAxiosParamCreator)(configuration); return { /** * 記事に新しいコメントを作成します。 * @summary コメントを投稿する * @param {string} teamName チーム名 * @param {number} postNumber 記事ID * @param {CreateCommentBody} createCommentBody * @param {number} [page] ページ番号 * @param {number} [perPage] 1ページあたりに含まれる要素数 * @param {*} [options] Override http request option. * @throws {RequiredError} */ async createComment(teamName, postNumber, createCommentBody, page, perPage, options) { const localVarAxiosArgs = await localVarAxiosParamCreator.createComment(teamName, postNumber, createCommentBody, page, perPage, options); return (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration); }, /** * 指定されたコメントを削除します。 * @summary コメントを削除する * @param {string} teamName チーム名 * @param {number} commentId コメントID * @param {*} [options] Override http request option. * @throws {RequiredError} */ async deleteComment(teamName, commentId, options) { const localVarAxiosArgs = await localVarAxiosParamCreator.deleteComment(teamName, commentId, options); return (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration); }, /** * 指定されたコメントを取得します。 * @summary コメントを取得する * @param {string} teamName チーム名 * @param {number} commentId コメントID * @param {'stargazers'} [include] `stargazers`を指定するとStarの配列を含んだレスポンスを返します。 * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getComment(teamName, commentId, include, options) { const localVarAxiosArgs = await localVarAxiosParamCreator.getComment(teamName, commentId, include, options); return (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration); }, /** * チーム全体のコメント一覧を作成日の降順で返却します。 * @summary コメント一覧を取得する * @param {string} teamName チーム名 * @param {number} [page] ページ番号 * @param {number} [perPage] 1ページあたりに含まれる要素数 * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getComments(teamName, page, perPage, options) { const localVarAxiosArgs = await localVarAxiosParamCreator.getComments(teamName, page, perPage, options); return (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration); }, /** * 記事のコメント一覧を更新日の降順で返却します。 * @summary 記事のコメント一覧を取得する * @param {string} teamName チーム名 * @param {number} postNumber 記事ID * @param {number} [page] ページ番号 * @param {number} [perPage] 1ページあたりに含まれる要素数 * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getPostComments(teamName, postNumber, page, perPage, options) { const localVarAxiosArgs = await localVarAxiosParamCreator.getPostComments(teamName, postNumber, page, perPage, options); return (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration); }, /** * 指定されたコメントを更新します。 * @summary コメントを更新する * @param {string} teamName チーム名 * @param {number} commentId コメントID * @param {UpdateCommentBody} updateCommentBody * @param {*} [options] Override http request option. * @throws {RequiredError} */ async updateComment(teamName, commentId, updateCommentBody, options) { const localVarAxiosArgs = await localVarAxiosParamCreator.updateComment(teamName, commentId, updateCommentBody, options); return (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration); }, }; }; exports.CommentApiFp = CommentApiFp; /** * CommentApi - factory interface * @export */ const CommentApiFactory = function (configuration, basePath, axios) { const localVarFp = (0, exports.CommentApiFp)(configuration); return { /** * 記事に新しいコメントを作成します。 * @summary コメントを投稿する * @param {string} teamName チーム名 * @param {number} postNumber 記事ID * @param {CreateCommentBody} createCommentBody * @param {number} [page] ページ番号 * @param {number} [perPage] 1ページあたりに含まれる要素数 * @param {*} [options] Override http request option. * @throws {RequiredError} */ createComment(teamName, postNumber, createCommentBody, page, perPage, options) { return localVarFp .createComment(teamName, postNumber, createCommentBody, page, perPage, options) .then((request) => request(axios, basePath)); }, /** * 指定されたコメントを削除します。 * @summary コメントを削除する * @param {string} teamName チーム名 * @param {number} commentId コメントID * @param {*} [options] Override http request option. * @throws {RequiredError} */ deleteComment(teamName, commentId, options) { return localVarFp .deleteComment(teamName, commentId, options) .then((request) => request(axios, basePath)); }, /** * 指定されたコメントを取得します。 * @summary コメントを取得する * @param {string} teamName チーム名 * @param {number} commentId コメントID * @param {'stargazers'} [include] `stargazers`を指定するとStarの配列を含んだレスポンスを返します。 * @param {*} [options] Override http request option. * @throws {RequiredError} */ getComment(teamName, commentId, include, options) { return localVarFp .getComment(teamName, commentId, include, options) .then((request) => request(axios, basePath)); }, /** * チーム全体のコメント一覧を作成日の降順で返却します。 * @summary コメント一覧を取得する * @param {string} teamName チーム名 * @param {number} [page] ページ番号 * @param {number} [perPage] 1ページあたりに含まれる要素数 * @param {*} [options] Override http request option. * @throws {RequiredError} */ getComments(teamName, page, perPage, options) { return localVarFp .getComments(teamName, page, perPage, options) .then((request) => request(axios, basePath)); }, /** * 記事のコメント一覧を更新日の降順で返却します。 * @summary 記事のコメント一覧を取得する * @param {string} teamName チーム名 * @param {number} postNumber 記事ID * @param {number} [page] ページ番号 * @param {number} [perPage] 1ページあたりに含まれる要素数 * @param {*} [options] Override http request option. * @throws {RequiredError} */ getPostComments(teamName, postNumber, page, perPage, options) { return localVarFp .getPostComments(teamName, postNumber, page, perPage, options) .then((request) => request(axios, basePath)); }, /** * 指定されたコメントを更新します。 * @summary コメントを更新する * @param {string} teamName チーム名 * @param {number} commentId コメントID * @param {UpdateCommentBody} updateCommentBody * @param {*} [options] Override http request option. * @throws {RequiredError} */ updateComment(teamName, commentId, updateCommentBody, options) { return localVarFp .updateComment(teamName, commentId, updateCommentBody, options) .then((request) => request(axios, basePath)); }, }; }; exports.CommentApiFactory = CommentApiFactory; /** * CommentApi - object-oriented interface * @export * @class CommentApi * @extends {BaseAPI} */ class CommentApi extends base_1.BaseAPI { /** * 記事に新しいコメントを作成します。 * @summary コメントを投稿する * @param {CommentApiCreateCommentRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof CommentApi */ createComment(requestParameters, options) { return (0, exports.CommentApiFp)(this.configuration) .createComment(requestParameters.teamName, requestParameters.postNumber, requestParameters.createCommentBody, requestParameters.page, requestParameters.perPage, options) .then((request) => request(this.axios, this.basePath)); } /** * 指定されたコメントを削除します。 * @summary コメントを削除する * @param {CommentApiDeleteCommentRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof CommentApi */ deleteComment(requestParameters, options) { return (0, exports.CommentApiFp)(this.configuration) .deleteComment(requestParameters.teamName, requestParameters.commentId, options) .then((request) => request(this.axios, this.basePath)); } /** * 指定されたコメントを取得します。 * @summary コメントを取得する * @param {CommentApiGetCommentRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof CommentApi */ getComment(requestParameters, options) { return (0, exports.CommentApiFp)(this.configuration) .getComment(requestParameters.teamName, requestParameters.commentId, requestParameters.include, options) .then((request) => request(this.axios, this.basePath)); } /** * チーム全体のコメント一覧を作成日の降順で返却します。 * @summary コメント一覧を取得する * @param {CommentApiGetCommentsRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof CommentApi */ getComments(requestParameters, options) { return (0, exports.CommentApiFp)(this.configuration) .getComments(requestParameters.teamName, requestParameters.page, requestParameters.perPage, options) .then((request) => request(this.axios, this.basePath)); } /** * 記事のコメント一覧を更新日の降順で返却します。 * @summary 記事のコメント一覧を取得する * @param {CommentApiGetPostCommentsRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof CommentApi */ getPostComments(requestParameters, options) { return (0, exports.CommentApiFp)(this.configuration) .getPostComments(requestParameters.teamName, requestParameters.postNumber, requestParameters.page, requestParameters.perPage, options) .then((request) => request(this.axios, this.basePath)); } /** * 指定されたコメントを更新します。 * @summary コメントを更新する * @param {CommentApiUpdateCommentRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof CommentApi */ updateComment(requestParameters, options) { return (0, exports.CommentApiFp)(this.configuration) .updateComment(requestParameters.teamName, requestParameters.commentId, requestParameters.updateCommentBody, options) .then((request) => request(this.axios, this.basePath)); } } exports.CommentApi = CommentApi; //# sourceMappingURL=comment-api.js.map