/* 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 { ChallengeFromJSON, ChallengeToJSON, ChallengePagedResultsFromJSON, ChallengeTeamFromJSON, ChallengeTeamToJSON, ChallengeTeamPagedResultsFromJSON, PaginatedIdsFromJSON, } from '../models/index';
/**
 *
 */
export class ChallengeServicesApi extends runtime.BaseAPI {
    /**
     */
    async deleteRepoV1ChallengeChallengeIdRaw(requestParameters, initOverrides) {
        if (requestParameters['challengeId'] == null) {
            throw new runtime.RequiredError('challengeId', 'Required parameter "challengeId" was null or undefined when calling deleteRepoV1ChallengeChallengeId().');
        }
        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/challenge/{challengeId}`;
        urlPath = urlPath.replace(`{${"challengeId"}}`, encodeURIComponent(String(requestParameters['challengeId'])));
        const response = await this.request({
            path: urlPath,
            method: 'DELETE',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.VoidApiResponse(response);
    }
    /**
     */
    async deleteRepoV1ChallengeChallengeId(requestParameters, initOverrides) {
        await this.deleteRepoV1ChallengeChallengeIdRaw(requestParameters, initOverrides);
    }
    /**
     */
    async deleteRepoV1ChallengeTeamChallengeTeamIdRaw(requestParameters, initOverrides) {
        if (requestParameters['challengeTeamId'] == null) {
            throw new runtime.RequiredError('challengeTeamId', 'Required parameter "challengeTeamId" was null or undefined when calling deleteRepoV1ChallengeTeamChallengeTeamId().');
        }
        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/challengeTeam/{challengeTeamId}`;
        urlPath = urlPath.replace(`{${"challengeTeamId"}}`, encodeURIComponent(String(requestParameters['challengeTeamId'])));
        const response = await this.request({
            path: urlPath,
            method: 'DELETE',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.VoidApiResponse(response);
    }
    /**
     */
    async deleteRepoV1ChallengeTeamChallengeTeamId(requestParameters, initOverrides) {
        await this.deleteRepoV1ChallengeTeamChallengeTeamIdRaw(requestParameters, initOverrides);
    }
    /**
     */
    async getRepoV1ChallengeRaw(requestParameters, initOverrides) {
        if (requestParameters['participantId'] == null) {
            throw new runtime.RequiredError('participantId', 'Required parameter "participantId" was null or undefined when calling getRepoV1Challenge().');
        }
        const queryParameters = {};
        if (requestParameters['participantId'] != null) {
            queryParameters['participantId'] = requestParameters['participantId'];
        }
        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/challenge`;
        const response = await this.request({
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => ChallengePagedResultsFromJSON(jsonValue));
    }
    /**
     */
    async getRepoV1Challenge(requestParameters, initOverrides) {
        const response = await this.getRepoV1ChallengeRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async getRepoV1ChallengeChallengeIdRaw(requestParameters, initOverrides) {
        if (requestParameters['challengeId'] == null) {
            throw new runtime.RequiredError('challengeId', 'Required parameter "challengeId" was null or undefined when calling getRepoV1ChallengeChallengeId().');
        }
        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/challenge/{challengeId}`;
        urlPath = urlPath.replace(`{${"challengeId"}}`, encodeURIComponent(String(requestParameters['challengeId'])));
        const response = await this.request({
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => ChallengeFromJSON(jsonValue));
    }
    /**
     */
    async getRepoV1ChallengeChallengeId(requestParameters, initOverrides) {
        const response = await this.getRepoV1ChallengeChallengeIdRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async getRepoV1ChallengeChallengeIdChallengeTeamRaw(requestParameters, initOverrides) {
        if (requestParameters['challengeId'] == null) {
            throw new runtime.RequiredError('challengeId', 'Required parameter "challengeId" was null or undefined when calling getRepoV1ChallengeChallengeIdChallengeTeam().');
        }
        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/challenge/{challengeId}/challengeTeam`;
        urlPath = urlPath.replace(`{${"challengeId"}}`, encodeURIComponent(String(requestParameters['challengeId'])));
        const response = await this.request({
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => ChallengeTeamPagedResultsFromJSON(jsonValue));
    }
    /**
     */
    async getRepoV1ChallengeChallengeIdChallengeTeam(requestParameters, initOverrides) {
        const response = await this.getRepoV1ChallengeChallengeIdChallengeTeamRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async getRepoV1ChallengeChallengeIdParticipantRaw(requestParameters, initOverrides) {
        if (requestParameters['challengeId'] == null) {
            throw new runtime.RequiredError('challengeId', 'Required parameter "challengeId" was null or undefined when calling getRepoV1ChallengeChallengeIdParticipant().');
        }
        const queryParameters = {};
        if (requestParameters['affiliated'] != null) {
            queryParameters['affiliated'] = requestParameters['affiliated'];
        }
        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/challenge/{challengeId}/participant`;
        urlPath = urlPath.replace(`{${"challengeId"}}`, encodeURIComponent(String(requestParameters['challengeId'])));
        const response = await this.request({
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => PaginatedIdsFromJSON(jsonValue));
    }
    /**
     */
    async getRepoV1ChallengeChallengeIdParticipant(requestParameters, initOverrides) {
        const response = await this.getRepoV1ChallengeChallengeIdParticipantRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async getRepoV1ChallengeChallengeIdRegistratableTeamRaw(requestParameters, initOverrides) {
        if (requestParameters['challengeId'] == null) {
            throw new runtime.RequiredError('challengeId', 'Required parameter "challengeId" was null or undefined when calling getRepoV1ChallengeChallengeIdRegistratableTeam().');
        }
        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/challenge/{challengeId}/registratableTeam`;
        urlPath = urlPath.replace(`{${"challengeId"}}`, encodeURIComponent(String(requestParameters['challengeId'])));
        const response = await this.request({
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => PaginatedIdsFromJSON(jsonValue));
    }
    /**
     */
    async getRepoV1ChallengeChallengeIdRegistratableTeam(requestParameters, initOverrides) {
        const response = await this.getRepoV1ChallengeChallengeIdRegistratableTeamRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async getRepoV1ChallengeChallengeIdSubmissionTeamsRaw(requestParameters, initOverrides) {
        if (requestParameters['challengeId'] == null) {
            throw new runtime.RequiredError('challengeId', 'Required parameter "challengeId" was null or undefined when calling getRepoV1ChallengeChallengeIdSubmissionTeams().');
        }
        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/challenge/{challengeId}/submissionTeams`;
        urlPath = urlPath.replace(`{${"challengeId"}}`, encodeURIComponent(String(requestParameters['challengeId'])));
        const response = await this.request({
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => PaginatedIdsFromJSON(jsonValue));
    }
    /**
     */
    async getRepoV1ChallengeChallengeIdSubmissionTeams(requestParameters, initOverrides) {
        const response = await this.getRepoV1ChallengeChallengeIdSubmissionTeamsRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async getRepoV1EntityIdChallengeRaw(requestParameters, initOverrides) {
        if (requestParameters['id'] == null) {
            throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling getRepoV1EntityIdChallenge().');
        }
        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/entity/{id}/challenge`;
        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) => ChallengeFromJSON(jsonValue));
    }
    /**
     */
    async getRepoV1EntityIdChallenge(requestParameters, initOverrides) {
        const response = await this.getRepoV1EntityIdChallengeRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async postRepoV1ChallengeRaw(requestParameters, initOverrides) {
        if (requestParameters['challenge'] == null) {
            throw new runtime.RequiredError('challenge', 'Required parameter "challenge" was null or undefined when calling postRepoV1Challenge().');
        }
        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/challenge`;
        const response = await this.request({
            path: urlPath,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: ChallengeToJSON(requestParameters['challenge']),
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => ChallengeFromJSON(jsonValue));
    }
    /**
     */
    async postRepoV1Challenge(requestParameters, initOverrides) {
        const response = await this.postRepoV1ChallengeRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async postRepoV1ChallengeChallengeIdChallengeTeamRaw(requestParameters, initOverrides) {
        if (requestParameters['challengeId'] == null) {
            throw new runtime.RequiredError('challengeId', 'Required parameter "challengeId" was null or undefined when calling postRepoV1ChallengeChallengeIdChallengeTeam().');
        }
        if (requestParameters['challengeTeam'] == null) {
            throw new runtime.RequiredError('challengeTeam', 'Required parameter "challengeTeam" was null or undefined when calling postRepoV1ChallengeChallengeIdChallengeTeam().');
        }
        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/challenge/{challengeId}/challengeTeam`;
        urlPath = urlPath.replace(`{${"challengeId"}}`, encodeURIComponent(String(requestParameters['challengeId'])));
        const response = await this.request({
            path: urlPath,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: ChallengeTeamToJSON(requestParameters['challengeTeam']),
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => ChallengeTeamFromJSON(jsonValue));
    }
    /**
     */
    async postRepoV1ChallengeChallengeIdChallengeTeam(requestParameters, initOverrides) {
        const response = await this.postRepoV1ChallengeChallengeIdChallengeTeamRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async putRepoV1ChallengeChallengeIdRaw(requestParameters, initOverrides) {
        if (requestParameters['challengeId'] == null) {
            throw new runtime.RequiredError('challengeId', 'Required parameter "challengeId" was null or undefined when calling putRepoV1ChallengeChallengeId().');
        }
        if (requestParameters['challenge'] == null) {
            throw new runtime.RequiredError('challenge', 'Required parameter "challenge" was null or undefined when calling putRepoV1ChallengeChallengeId().');
        }
        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/challenge/{challengeId}`;
        urlPath = urlPath.replace(`{${"challengeId"}}`, encodeURIComponent(String(requestParameters['challengeId'])));
        const response = await this.request({
            path: urlPath,
            method: 'PUT',
            headers: headerParameters,
            query: queryParameters,
            body: ChallengeToJSON(requestParameters['challenge']),
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => ChallengeFromJSON(jsonValue));
    }
    /**
     */
    async putRepoV1ChallengeChallengeId(requestParameters, initOverrides) {
        const response = await this.putRepoV1ChallengeChallengeIdRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async putRepoV1ChallengeChallengeIdChallengeTeamChallengeTeamIdRaw(requestParameters, initOverrides) {
        if (requestParameters['challengeId'] == null) {
            throw new runtime.RequiredError('challengeId', 'Required parameter "challengeId" was null or undefined when calling putRepoV1ChallengeChallengeIdChallengeTeamChallengeTeamId().');
        }
        if (requestParameters['challengeTeamId'] == null) {
            throw new runtime.RequiredError('challengeTeamId', 'Required parameter "challengeTeamId" was null or undefined when calling putRepoV1ChallengeChallengeIdChallengeTeamChallengeTeamId().');
        }
        if (requestParameters['challengeTeam'] == null) {
            throw new runtime.RequiredError('challengeTeam', 'Required parameter "challengeTeam" was null or undefined when calling putRepoV1ChallengeChallengeIdChallengeTeamChallengeTeamId().');
        }
        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/challenge/{challengeId}/challengeTeam/{challengeTeamId}`;
        urlPath = urlPath.replace(`{${"challengeId"}}`, encodeURIComponent(String(requestParameters['challengeId'])));
        urlPath = urlPath.replace(`{${"challengeTeamId"}}`, encodeURIComponent(String(requestParameters['challengeTeamId'])));
        const response = await this.request({
            path: urlPath,
            method: 'PUT',
            headers: headerParameters,
            query: queryParameters,
            body: ChallengeTeamToJSON(requestParameters['challengeTeam']),
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => ChallengeTeamFromJSON(jsonValue));
    }
    /**
     */
    async putRepoV1ChallengeChallengeIdChallengeTeamChallengeTeamId(requestParameters, initOverrides) {
        const response = await this.putRepoV1ChallengeChallengeIdChallengeTeamChallengeTeamIdRaw(requestParameters, initOverrides);
        return await response.value();
    }
}
//# sourceMappingURL=ChallengeServicesApi.js.map