/* 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, InviteeVerificationSignedTokenFromJSON, InviteeVerificationSignedTokenToJSON, MembershipInvitationFromJSON, MembershipInvitationToJSON, MembershipInvtnSignedTokenToJSON, PaginatedResultsOfMembershipInvitationFromJSON, } from '../models/index';
/**
 *
 */
export class MembershipInvitationServicesApi extends runtime.BaseAPI {
    /**
     */
    async deleteRepoV1MembershipInvitationIdRaw(requestParameters, initOverrides) {
        if (requestParameters['id'] == null) {
            throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling deleteRepoV1MembershipInvitationId().');
        }
        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/membershipInvitation/{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 deleteRepoV1MembershipInvitationId(requestParameters, initOverrides) {
        await this.deleteRepoV1MembershipInvitationIdRaw(requestParameters, initOverrides);
    }
    /**
     */
    async getRepoV1MembershipInvitationIdRaw(requestParameters, initOverrides) {
        if (requestParameters['id'] == null) {
            throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling getRepoV1MembershipInvitationId().');
        }
        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/membershipInvitation/{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) => MembershipInvitationFromJSON(jsonValue));
    }
    /**
     */
    async getRepoV1MembershipInvitationId(requestParameters, initOverrides) {
        const response = await this.getRepoV1MembershipInvitationIdRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async getRepoV1MembershipInvitationIdInviteeVerificationSignedTokenRaw(requestParameters, initOverrides) {
        if (requestParameters['id'] == null) {
            throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling getRepoV1MembershipInvitationIdInviteeVerificationSignedToken().');
        }
        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/membershipInvitation/{id}/inviteeVerificationSignedToken`;
        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) => InviteeVerificationSignedTokenFromJSON(jsonValue));
    }
    /**
     */
    async getRepoV1MembershipInvitationIdInviteeVerificationSignedToken(requestParameters, initOverrides) {
        const response = await this.getRepoV1MembershipInvitationIdInviteeVerificationSignedTokenRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async getRepoV1MembershipInvitationOpenInvitationCountRaw(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/membershipInvitation/openInvitationCount`;
        const response = await this.request({
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => CountFromJSON(jsonValue));
    }
    /**
     */
    async getRepoV1MembershipInvitationOpenInvitationCount(initOverrides) {
        const response = await this.getRepoV1MembershipInvitationOpenInvitationCountRaw(initOverrides);
        return await response.value();
    }
    /**
     */
    async getRepoV1TeamIdOpenInvitationRaw(requestParameters, initOverrides) {
        if (requestParameters['id'] == null) {
            throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling getRepoV1TeamIdOpenInvitation().');
        }
        const queryParameters = {};
        if (requestParameters['inviteeId'] != null) {
            queryParameters['inviteeId'] = requestParameters['inviteeId'];
        }
        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}/openInvitation`;
        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) => PaginatedResultsOfMembershipInvitationFromJSON(jsonValue));
    }
    /**
     */
    async getRepoV1TeamIdOpenInvitation(requestParameters, initOverrides) {
        const response = await this.getRepoV1TeamIdOpenInvitationRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async getRepoV1UserIdOpenInvitationRaw(requestParameters, initOverrides) {
        if (requestParameters['id'] == null) {
            throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling getRepoV1UserIdOpenInvitation().');
        }
        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 = {};
        let urlPath = `/repo/v1/user/{id}/openInvitation`;
        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) => PaginatedResultsOfMembershipInvitationFromJSON(jsonValue));
    }
    /**
     */
    async getRepoV1UserIdOpenInvitation(requestParameters, initOverrides) {
        const response = await this.getRepoV1UserIdOpenInvitationRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async postRepoV1MembershipInvitationRaw(requestParameters, initOverrides) {
        if (requestParameters['notificationUnsubscribeEndpoint'] == null) {
            throw new runtime.RequiredError('notificationUnsubscribeEndpoint', 'Required parameter "notificationUnsubscribeEndpoint" was null or undefined when calling postRepoV1MembershipInvitation().');
        }
        if (requestParameters['membershipInvitation'] == null) {
            throw new runtime.RequiredError('membershipInvitation', 'Required parameter "membershipInvitation" was null or undefined when calling postRepoV1MembershipInvitation().');
        }
        const queryParameters = {};
        if (requestParameters['acceptInvitationEndpoint'] != null) {
            queryParameters['acceptInvitationEndpoint'] = requestParameters['acceptInvitationEndpoint'];
        }
        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/membershipInvitation`;
        const response = await this.request({
            path: urlPath,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: MembershipInvitationToJSON(requestParameters['membershipInvitation']),
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => MembershipInvitationFromJSON(jsonValue));
    }
    /**
     */
    async postRepoV1MembershipInvitation(requestParameters, initOverrides) {
        const response = await this.postRepoV1MembershipInvitationRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async postRepoV1MembershipInvitationIdRaw(requestParameters, initOverrides) {
        if (requestParameters['id'] == null) {
            throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling postRepoV1MembershipInvitationId().');
        }
        if (requestParameters['membershipInvtnSignedToken'] == null) {
            throw new runtime.RequiredError('membershipInvtnSignedToken', 'Required parameter "membershipInvtnSignedToken" was null or undefined when calling postRepoV1MembershipInvitationId().');
        }
        const queryParameters = {};
        const headerParameters = {};
        headerParameters['Content-Type'] = 'application/json';
        let urlPath = `/repo/v1/membershipInvitation/{id}`;
        urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
        const response = await this.request({
            path: urlPath,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: MembershipInvtnSignedTokenToJSON(requestParameters['membershipInvtnSignedToken']),
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => MembershipInvitationFromJSON(jsonValue));
    }
    /**
     */
    async postRepoV1MembershipInvitationId(requestParameters, initOverrides) {
        const response = await this.postRepoV1MembershipInvitationIdRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async putRepoV1MembershipInvitationIdInviteeIdRaw(requestParameters, initOverrides) {
        if (requestParameters['id'] == null) {
            throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling putRepoV1MembershipInvitationIdInviteeId().');
        }
        if (requestParameters['inviteeVerificationSignedToken'] == null) {
            throw new runtime.RequiredError('inviteeVerificationSignedToken', 'Required parameter "inviteeVerificationSignedToken" was null or undefined when calling putRepoV1MembershipInvitationIdInviteeId().');
        }
        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/membershipInvitation/{id}/inviteeId`;
        urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
        const response = await this.request({
            path: urlPath,
            method: 'PUT',
            headers: headerParameters,
            query: queryParameters,
            body: InviteeVerificationSignedTokenToJSON(requestParameters['inviteeVerificationSignedToken']),
        }, initOverrides);
        return new runtime.VoidApiResponse(response);
    }
    /**
     */
    async putRepoV1MembershipInvitationIdInviteeId(requestParameters, initOverrides) {
        await this.putRepoV1MembershipInvitationIdInviteeIdRaw(requestParameters, initOverrides);
    }
}
//# sourceMappingURL=MembershipInvitationServicesApi.js.map