/* tslint:disable */
/* eslint-disable */
/**
 * Synapse REST API
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: v1
 *
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */
import * as runtime from '../runtime';
import { CreateDiscussionReplyToJSON, CreateDiscussionThreadToJSON, DiscussionReplyBundleFromJSON, DiscussionSearchRequestToJSON, DiscussionSearchResponseFromJSON, DiscussionThreadBundleFromJSON, EntityIdListToJSON, EntityThreadCountsFromJSON, ForumFromJSON, MessageURLFromJSON, PaginatedIdsFromJSON, PaginatedResultsOfDiscussionReplyBundleFromJSON, PaginatedResultsOfDiscussionThreadBundleFromJSON, ReplyCountFromJSON, ThreadCountFromJSON, UpdateReplyMessageToJSON, UpdateThreadMessageToJSON, UpdateThreadTitleToJSON, } from '../models/index';
/**
 *
 */
export class DiscussionServicesApi extends runtime.BaseAPI {
    /**
     */
    async deleteRepoV1ReplyReplyIdRaw(requestParameters, initOverrides) {
        if (requestParameters['replyId'] == null) {
            throw new runtime.RequiredError('replyId', 'Required parameter "replyId" was null or undefined when calling deleteRepoV1ReplyReplyId().');
        }
        const queryParameters = {};
        const headerParameters = {};
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("bearerAuth", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/repo/v1/reply/{replyId}`;
        urlPath = urlPath.replace(`{${"replyId"}}`, encodeURIComponent(String(requestParameters['replyId'])));
        const response = await this.request({
            path: urlPath,
            method: 'DELETE',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.VoidApiResponse(response);
    }
    /**
     */
    async deleteRepoV1ReplyReplyId(requestParameters, initOverrides) {
        await this.deleteRepoV1ReplyReplyIdRaw(requestParameters, initOverrides);
    }
    /**
     */
    async deleteRepoV1ThreadThreadIdRaw(requestParameters, initOverrides) {
        if (requestParameters['threadId'] == null) {
            throw new runtime.RequiredError('threadId', 'Required parameter "threadId" was null or undefined when calling deleteRepoV1ThreadThreadId().');
        }
        const queryParameters = {};
        const headerParameters = {};
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("bearerAuth", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/repo/v1/thread/{threadId}`;
        urlPath = urlPath.replace(`{${"threadId"}}`, encodeURIComponent(String(requestParameters['threadId'])));
        const response = await this.request({
            path: urlPath,
            method: 'DELETE',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.VoidApiResponse(response);
    }
    /**
     */
    async deleteRepoV1ThreadThreadId(requestParameters, initOverrides) {
        await this.deleteRepoV1ThreadThreadIdRaw(requestParameters, initOverrides);
    }
    /**
     */
    async getRepoV1EntityIdThreadsRaw(requestParameters, initOverrides) {
        if (requestParameters['limit'] == null) {
            throw new runtime.RequiredError('limit', 'Required parameter "limit" was null or undefined when calling getRepoV1EntityIdThreads().');
        }
        if (requestParameters['offset'] == null) {
            throw new runtime.RequiredError('offset', 'Required parameter "offset" was null or undefined when calling getRepoV1EntityIdThreads().');
        }
        if (requestParameters['id'] == null) {
            throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling getRepoV1EntityIdThreads().');
        }
        const queryParameters = {};
        if (requestParameters['limit'] != null) {
            queryParameters['limit'] = requestParameters['limit'];
        }
        if (requestParameters['offset'] != null) {
            queryParameters['offset'] = requestParameters['offset'];
        }
        if (requestParameters['sort'] != null) {
            queryParameters['sort'] = requestParameters['sort'];
        }
        if (requestParameters['ascending'] != null) {
            queryParameters['ascending'] = requestParameters['ascending'];
        }
        const headerParameters = {};
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("bearerAuth", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/repo/v1/entity/{id}/threads`;
        urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
        const response = await this.request({
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => PaginatedResultsOfDiscussionThreadBundleFromJSON(jsonValue));
    }
    /**
     */
    async getRepoV1EntityIdThreads(requestParameters, initOverrides) {
        const response = await this.getRepoV1EntityIdThreadsRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async getRepoV1ForumForumIdRaw(requestParameters, initOverrides) {
        if (requestParameters['forumId'] == null) {
            throw new runtime.RequiredError('forumId', 'Required parameter "forumId" was null or undefined when calling getRepoV1ForumForumId().');
        }
        const queryParameters = {};
        const headerParameters = {};
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("bearerAuth", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/repo/v1/forum/{forumId}`;
        urlPath = urlPath.replace(`{${"forumId"}}`, encodeURIComponent(String(requestParameters['forumId'])));
        const response = await this.request({
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => ForumFromJSON(jsonValue));
    }
    /**
     */
    async getRepoV1ForumForumId(requestParameters, initOverrides) {
        const response = await this.getRepoV1ForumForumIdRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async getRepoV1ForumForumIdModeratorsRaw(requestParameters, initOverrides) {
        if (requestParameters['limit'] == null) {
            throw new runtime.RequiredError('limit', 'Required parameter "limit" was null or undefined when calling getRepoV1ForumForumIdModerators().');
        }
        if (requestParameters['offset'] == null) {
            throw new runtime.RequiredError('offset', 'Required parameter "offset" was null or undefined when calling getRepoV1ForumForumIdModerators().');
        }
        if (requestParameters['forumId'] == null) {
            throw new runtime.RequiredError('forumId', 'Required parameter "forumId" was null or undefined when calling getRepoV1ForumForumIdModerators().');
        }
        const queryParameters = {};
        if (requestParameters['limit'] != null) {
            queryParameters['limit'] = requestParameters['limit'];
        }
        if (requestParameters['offset'] != null) {
            queryParameters['offset'] = requestParameters['offset'];
        }
        const headerParameters = {};
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("bearerAuth", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/repo/v1/forum/{forumId}/moderators`;
        urlPath = urlPath.replace(`{${"forumId"}}`, encodeURIComponent(String(requestParameters['forumId'])));
        const response = await this.request({
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => PaginatedIdsFromJSON(jsonValue));
    }
    /**
     */
    async getRepoV1ForumForumIdModerators(requestParameters, initOverrides) {
        const response = await this.getRepoV1ForumForumIdModeratorsRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async getRepoV1ForumForumIdThreadcountRaw(requestParameters, initOverrides) {
        if (requestParameters['filter'] == null) {
            throw new runtime.RequiredError('filter', 'Required parameter "filter" was null or undefined when calling getRepoV1ForumForumIdThreadcount().');
        }
        if (requestParameters['forumId'] == null) {
            throw new runtime.RequiredError('forumId', 'Required parameter "forumId" was null or undefined when calling getRepoV1ForumForumIdThreadcount().');
        }
        const queryParameters = {};
        if (requestParameters['filter'] != null) {
            queryParameters['filter'] = requestParameters['filter'];
        }
        const headerParameters = {};
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("bearerAuth", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/repo/v1/forum/{forumId}/threadcount`;
        urlPath = urlPath.replace(`{${"forumId"}}`, encodeURIComponent(String(requestParameters['forumId'])));
        const response = await this.request({
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => ThreadCountFromJSON(jsonValue));
    }
    /**
     */
    async getRepoV1ForumForumIdThreadcount(requestParameters, initOverrides) {
        const response = await this.getRepoV1ForumForumIdThreadcountRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async getRepoV1ForumForumIdThreadsRaw(requestParameters, initOverrides) {
        if (requestParameters['limit'] == null) {
            throw new runtime.RequiredError('limit', 'Required parameter "limit" was null or undefined when calling getRepoV1ForumForumIdThreads().');
        }
        if (requestParameters['offset'] == null) {
            throw new runtime.RequiredError('offset', 'Required parameter "offset" was null or undefined when calling getRepoV1ForumForumIdThreads().');
        }
        if (requestParameters['filter'] == null) {
            throw new runtime.RequiredError('filter', 'Required parameter "filter" was null or undefined when calling getRepoV1ForumForumIdThreads().');
        }
        if (requestParameters['forumId'] == null) {
            throw new runtime.RequiredError('forumId', 'Required parameter "forumId" was null or undefined when calling getRepoV1ForumForumIdThreads().');
        }
        const queryParameters = {};
        if (requestParameters['limit'] != null) {
            queryParameters['limit'] = requestParameters['limit'];
        }
        if (requestParameters['offset'] != null) {
            queryParameters['offset'] = requestParameters['offset'];
        }
        if (requestParameters['sort'] != null) {
            queryParameters['sort'] = requestParameters['sort'];
        }
        if (requestParameters['ascending'] != null) {
            queryParameters['ascending'] = requestParameters['ascending'];
        }
        if (requestParameters['filter'] != null) {
            queryParameters['filter'] = requestParameters['filter'];
        }
        const headerParameters = {};
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("bearerAuth", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/repo/v1/forum/{forumId}/threads`;
        urlPath = urlPath.replace(`{${"forumId"}}`, encodeURIComponent(String(requestParameters['forumId'])));
        const response = await this.request({
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => PaginatedResultsOfDiscussionThreadBundleFromJSON(jsonValue));
    }
    /**
     */
    async getRepoV1ForumForumIdThreads(requestParameters, initOverrides) {
        const response = await this.getRepoV1ForumForumIdThreadsRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async getRepoV1ForumObjectIdObjectTypeRaw(requestParameters, initOverrides) {
        if (requestParameters['objectId'] == null) {
            throw new runtime.RequiredError('objectId', 'Required parameter "objectId" was null or undefined when calling getRepoV1ForumObjectIdObjectType().');
        }
        if (requestParameters['objectType'] == null) {
            throw new runtime.RequiredError('objectType', 'Required parameter "objectType" was null or undefined when calling getRepoV1ForumObjectIdObjectType().');
        }
        const queryParameters = {};
        const headerParameters = {};
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("bearerAuth", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/repo/v1/forum/{objectId}/{objectType}`;
        urlPath = urlPath.replace(`{${"objectId"}}`, encodeURIComponent(String(requestParameters['objectId'])));
        urlPath = urlPath.replace(`{${"objectType"}}`, encodeURIComponent(String(requestParameters['objectType'])));
        const response = await this.request({
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => ForumFromJSON(jsonValue));
    }
    /**
     */
    async getRepoV1ForumObjectIdObjectType(requestParameters, initOverrides) {
        const response = await this.getRepoV1ForumObjectIdObjectTypeRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async getRepoV1ProjectProjectIdForumRaw(requestParameters, initOverrides) {
        if (requestParameters['projectId'] == null) {
            throw new runtime.RequiredError('projectId', 'Required parameter "projectId" was null or undefined when calling getRepoV1ProjectProjectIdForum().');
        }
        const queryParameters = {};
        const headerParameters = {};
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("bearerAuth", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/repo/v1/project/{projectId}/forum`;
        urlPath = urlPath.replace(`{${"projectId"}}`, encodeURIComponent(String(requestParameters['projectId'])));
        const response = await this.request({
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => ForumFromJSON(jsonValue));
    }
    /**
     */
    async getRepoV1ProjectProjectIdForum(requestParameters, initOverrides) {
        const response = await this.getRepoV1ProjectProjectIdForumRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async getRepoV1ReplyMessageUrlRaw(requestParameters, initOverrides) {
        if (requestParameters['messageKey'] == null) {
            throw new runtime.RequiredError('messageKey', 'Required parameter "messageKey" was null or undefined when calling getRepoV1ReplyMessageUrl().');
        }
        const queryParameters = {};
        if (requestParameters['messageKey'] != null) {
            queryParameters['messageKey'] = requestParameters['messageKey'];
        }
        const headerParameters = {};
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("bearerAuth", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/repo/v1/reply/messageUrl`;
        const response = await this.request({
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => MessageURLFromJSON(jsonValue));
    }
    /**
     */
    async getRepoV1ReplyMessageUrl(requestParameters, initOverrides) {
        const response = await this.getRepoV1ReplyMessageUrlRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async getRepoV1ReplyReplyIdRaw(requestParameters, initOverrides) {
        if (requestParameters['replyId'] == null) {
            throw new runtime.RequiredError('replyId', 'Required parameter "replyId" was null or undefined when calling getRepoV1ReplyReplyId().');
        }
        const queryParameters = {};
        const headerParameters = {};
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("bearerAuth", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/repo/v1/reply/{replyId}`;
        urlPath = urlPath.replace(`{${"replyId"}}`, encodeURIComponent(String(requestParameters['replyId'])));
        const response = await this.request({
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => DiscussionReplyBundleFromJSON(jsonValue));
    }
    /**
     */
    async getRepoV1ReplyReplyId(requestParameters, initOverrides) {
        const response = await this.getRepoV1ReplyReplyIdRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async getRepoV1ThreadMessageUrlRaw(requestParameters, initOverrides) {
        if (requestParameters['messageKey'] == null) {
            throw new runtime.RequiredError('messageKey', 'Required parameter "messageKey" was null or undefined when calling getRepoV1ThreadMessageUrl().');
        }
        const queryParameters = {};
        if (requestParameters['messageKey'] != null) {
            queryParameters['messageKey'] = requestParameters['messageKey'];
        }
        const headerParameters = {};
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("bearerAuth", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/repo/v1/thread/messageUrl`;
        const response = await this.request({
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => MessageURLFromJSON(jsonValue));
    }
    /**
     */
    async getRepoV1ThreadMessageUrl(requestParameters, initOverrides) {
        const response = await this.getRepoV1ThreadMessageUrlRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async getRepoV1ThreadSubmissionSubmissionIdRaw(requestParameters, initOverrides) {
        if (requestParameters['submissionId'] == null) {
            throw new runtime.RequiredError('submissionId', 'Required parameter "submissionId" was null or undefined when calling getRepoV1ThreadSubmissionSubmissionId().');
        }
        const queryParameters = {};
        const headerParameters = {};
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("bearerAuth", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/repo/v1/thread/submission/{submissionId}`;
        urlPath = urlPath.replace(`{${"submissionId"}}`, encodeURIComponent(String(requestParameters['submissionId'])));
        const response = await this.request({
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => DiscussionThreadBundleFromJSON(jsonValue));
    }
    /**
     */
    async getRepoV1ThreadSubmissionSubmissionId(requestParameters, initOverrides) {
        const response = await this.getRepoV1ThreadSubmissionSubmissionIdRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async getRepoV1ThreadThreadIdRaw(requestParameters, initOverrides) {
        if (requestParameters['threadId'] == null) {
            throw new runtime.RequiredError('threadId', 'Required parameter "threadId" was null or undefined when calling getRepoV1ThreadThreadId().');
        }
        const queryParameters = {};
        const headerParameters = {};
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("bearerAuth", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/repo/v1/thread/{threadId}`;
        urlPath = urlPath.replace(`{${"threadId"}}`, encodeURIComponent(String(requestParameters['threadId'])));
        const response = await this.request({
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => DiscussionThreadBundleFromJSON(jsonValue));
    }
    /**
     */
    async getRepoV1ThreadThreadId(requestParameters, initOverrides) {
        const response = await this.getRepoV1ThreadThreadIdRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async getRepoV1ThreadThreadIdRepliesRaw(requestParameters, initOverrides) {
        if (requestParameters['limit'] == null) {
            throw new runtime.RequiredError('limit', 'Required parameter "limit" was null or undefined when calling getRepoV1ThreadThreadIdReplies().');
        }
        if (requestParameters['offset'] == null) {
            throw new runtime.RequiredError('offset', 'Required parameter "offset" was null or undefined when calling getRepoV1ThreadThreadIdReplies().');
        }
        if (requestParameters['filter'] == null) {
            throw new runtime.RequiredError('filter', 'Required parameter "filter" was null or undefined when calling getRepoV1ThreadThreadIdReplies().');
        }
        if (requestParameters['threadId'] == null) {
            throw new runtime.RequiredError('threadId', 'Required parameter "threadId" was null or undefined when calling getRepoV1ThreadThreadIdReplies().');
        }
        const queryParameters = {};
        if (requestParameters['limit'] != null) {
            queryParameters['limit'] = requestParameters['limit'];
        }
        if (requestParameters['offset'] != null) {
            queryParameters['offset'] = requestParameters['offset'];
        }
        if (requestParameters['sort'] != null) {
            queryParameters['sort'] = requestParameters['sort'];
        }
        if (requestParameters['ascending'] != null) {
            queryParameters['ascending'] = requestParameters['ascending'];
        }
        if (requestParameters['filter'] != null) {
            queryParameters['filter'] = requestParameters['filter'];
        }
        const headerParameters = {};
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("bearerAuth", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/repo/v1/thread/{threadId}/replies`;
        urlPath = urlPath.replace(`{${"threadId"}}`, encodeURIComponent(String(requestParameters['threadId'])));
        const response = await this.request({
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => PaginatedResultsOfDiscussionReplyBundleFromJSON(jsonValue));
    }
    /**
     */
    async getRepoV1ThreadThreadIdReplies(requestParameters, initOverrides) {
        const response = await this.getRepoV1ThreadThreadIdRepliesRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async getRepoV1ThreadThreadIdReplycountRaw(requestParameters, initOverrides) {
        if (requestParameters['filter'] == null) {
            throw new runtime.RequiredError('filter', 'Required parameter "filter" was null or undefined when calling getRepoV1ThreadThreadIdReplycount().');
        }
        if (requestParameters['threadId'] == null) {
            throw new runtime.RequiredError('threadId', 'Required parameter "threadId" was null or undefined when calling getRepoV1ThreadThreadIdReplycount().');
        }
        const queryParameters = {};
        if (requestParameters['filter'] != null) {
            queryParameters['filter'] = requestParameters['filter'];
        }
        const headerParameters = {};
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("bearerAuth", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/repo/v1/thread/{threadId}/replycount`;
        urlPath = urlPath.replace(`{${"threadId"}}`, encodeURIComponent(String(requestParameters['threadId'])));
        const response = await this.request({
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => ReplyCountFromJSON(jsonValue));
    }
    /**
     */
    async getRepoV1ThreadThreadIdReplycount(requestParameters, initOverrides) {
        const response = await this.getRepoV1ThreadThreadIdReplycountRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async postRepoV1EntityThreadcountsRaw(requestParameters, initOverrides) {
        if (requestParameters['entityIdList'] == null) {
            throw new runtime.RequiredError('entityIdList', 'Required parameter "entityIdList" was null or undefined when calling postRepoV1EntityThreadcounts().');
        }
        const queryParameters = {};
        const headerParameters = {};
        headerParameters['Content-Type'] = 'application/json';
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("bearerAuth", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/repo/v1/entity/threadcounts`;
        const response = await this.request({
            path: urlPath,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: EntityIdListToJSON(requestParameters['entityIdList']),
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => EntityThreadCountsFromJSON(jsonValue));
    }
    /**
     */
    async postRepoV1EntityThreadcounts(requestParameters, initOverrides) {
        const response = await this.postRepoV1EntityThreadcountsRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async postRepoV1ForumForumIdSearchRaw(requestParameters, initOverrides) {
        if (requestParameters['forumId'] == null) {
            throw new runtime.RequiredError('forumId', 'Required parameter "forumId" was null or undefined when calling postRepoV1ForumForumIdSearch().');
        }
        if (requestParameters['discussionSearchRequest'] == null) {
            throw new runtime.RequiredError('discussionSearchRequest', 'Required parameter "discussionSearchRequest" was null or undefined when calling postRepoV1ForumForumIdSearch().');
        }
        const queryParameters = {};
        const headerParameters = {};
        headerParameters['Content-Type'] = 'application/json';
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("bearerAuth", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/repo/v1/forum/{forumId}/search`;
        urlPath = urlPath.replace(`{${"forumId"}}`, encodeURIComponent(String(requestParameters['forumId'])));
        const response = await this.request({
            path: urlPath,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: DiscussionSearchRequestToJSON(requestParameters['discussionSearchRequest']),
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => DiscussionSearchResponseFromJSON(jsonValue));
    }
    /**
     */
    async postRepoV1ForumForumIdSearch(requestParameters, initOverrides) {
        const response = await this.postRepoV1ForumForumIdSearchRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async postRepoV1ReplyRaw(requestParameters, initOverrides) {
        if (requestParameters['createDiscussionReply'] == null) {
            throw new runtime.RequiredError('createDiscussionReply', 'Required parameter "createDiscussionReply" was null or undefined when calling postRepoV1Reply().');
        }
        const queryParameters = {};
        const headerParameters = {};
        headerParameters['Content-Type'] = 'application/json';
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("bearerAuth", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/repo/v1/reply`;
        const response = await this.request({
            path: urlPath,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: CreateDiscussionReplyToJSON(requestParameters['createDiscussionReply']),
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => DiscussionReplyBundleFromJSON(jsonValue));
    }
    /**
     */
    async postRepoV1Reply(requestParameters, initOverrides) {
        const response = await this.postRepoV1ReplyRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async postRepoV1ThreadRaw(requestParameters, initOverrides) {
        if (requestParameters['createDiscussionThread'] == null) {
            throw new runtime.RequiredError('createDiscussionThread', 'Required parameter "createDiscussionThread" was null or undefined when calling postRepoV1Thread().');
        }
        const queryParameters = {};
        const headerParameters = {};
        headerParameters['Content-Type'] = 'application/json';
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("bearerAuth", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/repo/v1/thread`;
        const response = await this.request({
            path: urlPath,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: CreateDiscussionThreadToJSON(requestParameters['createDiscussionThread']),
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => DiscussionThreadBundleFromJSON(jsonValue));
    }
    /**
     */
    async postRepoV1Thread(requestParameters, initOverrides) {
        const response = await this.postRepoV1ThreadRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async putRepoV1ReplyReplyIdMessageRaw(requestParameters, initOverrides) {
        if (requestParameters['replyId'] == null) {
            throw new runtime.RequiredError('replyId', 'Required parameter "replyId" was null or undefined when calling putRepoV1ReplyReplyIdMessage().');
        }
        if (requestParameters['updateReplyMessage'] == null) {
            throw new runtime.RequiredError('updateReplyMessage', 'Required parameter "updateReplyMessage" was null or undefined when calling putRepoV1ReplyReplyIdMessage().');
        }
        const queryParameters = {};
        const headerParameters = {};
        headerParameters['Content-Type'] = 'application/json';
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("bearerAuth", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/repo/v1/reply/{replyId}/message`;
        urlPath = urlPath.replace(`{${"replyId"}}`, encodeURIComponent(String(requestParameters['replyId'])));
        const response = await this.request({
            path: urlPath,
            method: 'PUT',
            headers: headerParameters,
            query: queryParameters,
            body: UpdateReplyMessageToJSON(requestParameters['updateReplyMessage']),
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => DiscussionReplyBundleFromJSON(jsonValue));
    }
    /**
     */
    async putRepoV1ReplyReplyIdMessage(requestParameters, initOverrides) {
        const response = await this.putRepoV1ReplyReplyIdMessageRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async putRepoV1ThreadThreadIdMessageRaw(requestParameters, initOverrides) {
        if (requestParameters['threadId'] == null) {
            throw new runtime.RequiredError('threadId', 'Required parameter "threadId" was null or undefined when calling putRepoV1ThreadThreadIdMessage().');
        }
        if (requestParameters['updateThreadMessage'] == null) {
            throw new runtime.RequiredError('updateThreadMessage', 'Required parameter "updateThreadMessage" was null or undefined when calling putRepoV1ThreadThreadIdMessage().');
        }
        const queryParameters = {};
        const headerParameters = {};
        headerParameters['Content-Type'] = 'application/json';
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("bearerAuth", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/repo/v1/thread/{threadId}/message`;
        urlPath = urlPath.replace(`{${"threadId"}}`, encodeURIComponent(String(requestParameters['threadId'])));
        const response = await this.request({
            path: urlPath,
            method: 'PUT',
            headers: headerParameters,
            query: queryParameters,
            body: UpdateThreadMessageToJSON(requestParameters['updateThreadMessage']),
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => DiscussionThreadBundleFromJSON(jsonValue));
    }
    /**
     */
    async putRepoV1ThreadThreadIdMessage(requestParameters, initOverrides) {
        const response = await this.putRepoV1ThreadThreadIdMessageRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async putRepoV1ThreadThreadIdPinRaw(requestParameters, initOverrides) {
        if (requestParameters['threadId'] == null) {
            throw new runtime.RequiredError('threadId', 'Required parameter "threadId" was null or undefined when calling putRepoV1ThreadThreadIdPin().');
        }
        const queryParameters = {};
        const headerParameters = {};
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("bearerAuth", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/repo/v1/thread/{threadId}/pin`;
        urlPath = urlPath.replace(`{${"threadId"}}`, encodeURIComponent(String(requestParameters['threadId'])));
        const response = await this.request({
            path: urlPath,
            method: 'PUT',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.VoidApiResponse(response);
    }
    /**
     */
    async putRepoV1ThreadThreadIdPin(requestParameters, initOverrides) {
        await this.putRepoV1ThreadThreadIdPinRaw(requestParameters, initOverrides);
    }
    /**
     */
    async putRepoV1ThreadThreadIdRestoreRaw(requestParameters, initOverrides) {
        if (requestParameters['threadId'] == null) {
            throw new runtime.RequiredError('threadId', 'Required parameter "threadId" was null or undefined when calling putRepoV1ThreadThreadIdRestore().');
        }
        const queryParameters = {};
        const headerParameters = {};
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("bearerAuth", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/repo/v1/thread/{threadId}/restore`;
        urlPath = urlPath.replace(`{${"threadId"}}`, encodeURIComponent(String(requestParameters['threadId'])));
        const response = await this.request({
            path: urlPath,
            method: 'PUT',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.VoidApiResponse(response);
    }
    /**
     */
    async putRepoV1ThreadThreadIdRestore(requestParameters, initOverrides) {
        await this.putRepoV1ThreadThreadIdRestoreRaw(requestParameters, initOverrides);
    }
    /**
     */
    async putRepoV1ThreadThreadIdTitleRaw(requestParameters, initOverrides) {
        if (requestParameters['threadId'] == null) {
            throw new runtime.RequiredError('threadId', 'Required parameter "threadId" was null or undefined when calling putRepoV1ThreadThreadIdTitle().');
        }
        if (requestParameters['updateThreadTitle'] == null) {
            throw new runtime.RequiredError('updateThreadTitle', 'Required parameter "updateThreadTitle" was null or undefined when calling putRepoV1ThreadThreadIdTitle().');
        }
        const queryParameters = {};
        const headerParameters = {};
        headerParameters['Content-Type'] = 'application/json';
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("bearerAuth", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/repo/v1/thread/{threadId}/title`;
        urlPath = urlPath.replace(`{${"threadId"}}`, encodeURIComponent(String(requestParameters['threadId'])));
        const response = await this.request({
            path: urlPath,
            method: 'PUT',
            headers: headerParameters,
            query: queryParameters,
            body: UpdateThreadTitleToJSON(requestParameters['updateThreadTitle']),
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => DiscussionThreadBundleFromJSON(jsonValue));
    }
    /**
     */
    async putRepoV1ThreadThreadIdTitle(requestParameters, initOverrides) {
        const response = await this.putRepoV1ThreadThreadIdTitleRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async putRepoV1ThreadThreadIdUnpinRaw(requestParameters, initOverrides) {
        if (requestParameters['threadId'] == null) {
            throw new runtime.RequiredError('threadId', 'Required parameter "threadId" was null or undefined when calling putRepoV1ThreadThreadIdUnpin().');
        }
        const queryParameters = {};
        const headerParameters = {};
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("bearerAuth", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/repo/v1/thread/{threadId}/unpin`;
        urlPath = urlPath.replace(`{${"threadId"}}`, encodeURIComponent(String(requestParameters['threadId'])));
        const response = await this.request({
            path: urlPath,
            method: 'PUT',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.VoidApiResponse(response);
    }
    /**
     */
    async putRepoV1ThreadThreadIdUnpin(requestParameters, initOverrides) {
        await this.putRepoV1ThreadThreadIdUnpinRaw(requestParameters, initOverrides);
    }
}
//# sourceMappingURL=DiscussionServicesApi.js.map