/* 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 { CountFromJSON, MembershipRequestFromJSON, MembershipRequestToJSON, PaginatedResultsOfMembershipRequestFromJSON, } from '../models/index';
/**
 *
 */
export class MembershipRequestServicesApi extends runtime.BaseAPI {
    /**
     */
    async deleteRepoV1MembershipRequestIdRaw(requestParameters, initOverrides) {
        if (requestParameters['id'] == null) {
            throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling deleteRepoV1MembershipRequestId().');
        }
        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/membershipRequest/{id}`;
        urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
        const response = await this.request({
            path: urlPath,
            method: 'DELETE',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.VoidApiResponse(response);
    }
    /**
     */
    async deleteRepoV1MembershipRequestId(requestParameters, initOverrides) {
        await this.deleteRepoV1MembershipRequestIdRaw(requestParameters, initOverrides);
    }
    /**
     */
    async getRepoV1MembershipRequestIdRaw(requestParameters, initOverrides) {
        if (requestParameters['id'] == null) {
            throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling getRepoV1MembershipRequestId().');
        }
        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/membershipRequest/{id}`;
        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) => MembershipRequestFromJSON(jsonValue));
    }
    /**
     */
    async getRepoV1MembershipRequestId(requestParameters, initOverrides) {
        const response = await this.getRepoV1MembershipRequestIdRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async getRepoV1MembershipRequestOpenRequestCountRaw(initOverrides) {
        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/membershipRequest/openRequestCount`;
        const response = await this.request({
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => CountFromJSON(jsonValue));
    }
    /**
     */
    async getRepoV1MembershipRequestOpenRequestCount(initOverrides) {
        const response = await this.getRepoV1MembershipRequestOpenRequestCountRaw(initOverrides);
        return await response.value();
    }
    /**
     */
    async getRepoV1TeamIdOpenRequestRaw(requestParameters, initOverrides) {
        if (requestParameters['id'] == null) {
            throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling getRepoV1TeamIdOpenRequest().');
        }
        const queryParameters = {};
        if (requestParameters['requestorId'] != null) {
            queryParameters['requestorId'] = requestParameters['requestorId'];
        }
        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/team/{id}/openRequest`;
        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) => PaginatedResultsOfMembershipRequestFromJSON(jsonValue));
    }
    /**
     */
    async getRepoV1TeamIdOpenRequest(requestParameters, initOverrides) {
        const response = await this.getRepoV1TeamIdOpenRequestRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async getRepoV1UserIdOpenRequestRaw(requestParameters, initOverrides) {
        if (requestParameters['id'] == null) {
            throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling getRepoV1UserIdOpenRequest().');
        }
        const queryParameters = {};
        if (requestParameters['teamId'] != null) {
            queryParameters['teamId'] = requestParameters['teamId'];
        }
        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/user/{id}/openRequest`;
        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) => PaginatedResultsOfMembershipRequestFromJSON(jsonValue));
    }
    /**
     */
    async getRepoV1UserIdOpenRequest(requestParameters, initOverrides) {
        const response = await this.getRepoV1UserIdOpenRequestRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async postRepoV1MembershipRequestRaw(requestParameters, initOverrides) {
        if (requestParameters['acceptRequestEndpoint'] == null) {
            throw new runtime.RequiredError('acceptRequestEndpoint', 'Required parameter "acceptRequestEndpoint" was null or undefined when calling postRepoV1MembershipRequest().');
        }
        if (requestParameters['notificationUnsubscribeEndpoint'] == null) {
            throw new runtime.RequiredError('notificationUnsubscribeEndpoint', 'Required parameter "notificationUnsubscribeEndpoint" was null or undefined when calling postRepoV1MembershipRequest().');
        }
        if (requestParameters['membershipRequest'] == null) {
            throw new runtime.RequiredError('membershipRequest', 'Required parameter "membershipRequest" was null or undefined when calling postRepoV1MembershipRequest().');
        }
        const queryParameters = {};
        if (requestParameters['acceptRequestEndpoint'] != null) {
            queryParameters['acceptRequestEndpoint'] = requestParameters['acceptRequestEndpoint'];
        }
        if (requestParameters['notificationUnsubscribeEndpoint'] != null) {
            queryParameters['notificationUnsubscribeEndpoint'] = requestParameters['notificationUnsubscribeEndpoint'];
        }
        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/membershipRequest`;
        const response = await this.request({
            path: urlPath,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: MembershipRequestToJSON(requestParameters['membershipRequest']),
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => MembershipRequestFromJSON(jsonValue));
    }
    /**
     */
    async postRepoV1MembershipRequest(requestParameters, initOverrides) {
        const response = await this.postRepoV1MembershipRequestRaw(requestParameters, initOverrides);
        return await response.value();
    }
}
//# sourceMappingURL=MembershipRequestServicesApi.js.map