/* 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 { AccessApprovalFromJSON, AccessApprovalToJSON, AccessApprovalNotificationRequestToJSON, AccessApprovalNotificationResponseFromJSON, AccessApprovalSearchRequestToJSON, AccessApprovalSearchResponseFromJSON, AccessorGroupRequestToJSON, AccessorGroupResponseFromJSON, AccessorGroupRevokeRequestToJSON, BatchAccessApprovalInfoRequestToJSON, BatchAccessApprovalInfoResponseFromJSON, } from '../models/index';
/**
 *
 */
export class AccessApprovalServicesApi extends runtime.BaseAPI {
    /**
     */
    async deleteRepoV1AccessApprovalRaw(requestParameters, initOverrides) {
        if (requestParameters['requirementId'] == null) {
            throw new runtime.RequiredError('requirementId', 'Required parameter "requirementId" was null or undefined when calling deleteRepoV1AccessApproval().');
        }
        if (requestParameters['accessorId'] == null) {
            throw new runtime.RequiredError('accessorId', 'Required parameter "accessorId" was null or undefined when calling deleteRepoV1AccessApproval().');
        }
        const queryParameters = {};
        if (requestParameters['requirementId'] != null) {
            queryParameters['requirementId'] = requestParameters['requirementId'];
        }
        if (requestParameters['accessorId'] != null) {
            queryParameters['accessorId'] = requestParameters['accessorId'];
        }
        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/accessApproval`;
        const response = await this.request({
            path: urlPath,
            method: 'DELETE',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.VoidApiResponse(response);
    }
    /**
     */
    async deleteRepoV1AccessApproval(requestParameters, initOverrides) {
        await this.deleteRepoV1AccessApprovalRaw(requestParameters, initOverrides);
    }
    /**
     */
    async getRepoV1AccessApprovalApprovalIdRaw(requestParameters, initOverrides) {
        if (requestParameters['approvalId'] == null) {
            throw new runtime.RequiredError('approvalId', 'Required parameter "approvalId" was null or undefined when calling getRepoV1AccessApprovalApprovalId().');
        }
        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/accessApproval/{approvalId}`;
        urlPath = urlPath.replace(`{${"approvalId"}}`, encodeURIComponent(String(requestParameters['approvalId'])));
        const response = await this.request({
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => AccessApprovalFromJSON(jsonValue));
    }
    /**
     */
    async getRepoV1AccessApprovalApprovalId(requestParameters, initOverrides) {
        const response = await this.getRepoV1AccessApprovalApprovalIdRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async postRepoV1AccessApprovalRaw(requestParameters, initOverrides) {
        if (requestParameters['accessApproval'] == null) {
            throw new runtime.RequiredError('accessApproval', 'Required parameter "accessApproval" was null or undefined when calling postRepoV1AccessApproval().');
        }
        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/accessApproval`;
        const response = await this.request({
            path: urlPath,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: AccessApprovalToJSON(requestParameters['accessApproval']),
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => AccessApprovalFromJSON(jsonValue));
    }
    /**
     */
    async postRepoV1AccessApproval(requestParameters, initOverrides) {
        const response = await this.postRepoV1AccessApprovalRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async postRepoV1AccessApprovalGroupRaw(requestParameters, initOverrides) {
        if (requestParameters['accessorGroupRequest'] == null) {
            throw new runtime.RequiredError('accessorGroupRequest', 'Required parameter "accessorGroupRequest" was null or undefined when calling postRepoV1AccessApprovalGroup().');
        }
        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/accessApproval/group`;
        const response = await this.request({
            path: urlPath,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: AccessorGroupRequestToJSON(requestParameters['accessorGroupRequest']),
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => AccessorGroupResponseFromJSON(jsonValue));
    }
    /**
     */
    async postRepoV1AccessApprovalGroup(requestParameters, initOverrides) {
        const response = await this.postRepoV1AccessApprovalGroupRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async postRepoV1AccessApprovalInformationRaw(requestParameters, initOverrides) {
        if (requestParameters['batchAccessApprovalInfoRequest'] == null) {
            throw new runtime.RequiredError('batchAccessApprovalInfoRequest', 'Required parameter "batchAccessApprovalInfoRequest" was null or undefined when calling postRepoV1AccessApprovalInformation().');
        }
        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/accessApproval/information`;
        const response = await this.request({
            path: urlPath,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: BatchAccessApprovalInfoRequestToJSON(requestParameters['batchAccessApprovalInfoRequest']),
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => BatchAccessApprovalInfoResponseFromJSON(jsonValue));
    }
    /**
     */
    async postRepoV1AccessApprovalInformation(requestParameters, initOverrides) {
        const response = await this.postRepoV1AccessApprovalInformationRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async postRepoV1AccessApprovalNotificationsRaw(requestParameters, initOverrides) {
        if (requestParameters['accessApprovalNotificationRequest'] == null) {
            throw new runtime.RequiredError('accessApprovalNotificationRequest', 'Required parameter "accessApprovalNotificationRequest" was null or undefined when calling postRepoV1AccessApprovalNotifications().');
        }
        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/accessApproval/notifications`;
        const response = await this.request({
            path: urlPath,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: AccessApprovalNotificationRequestToJSON(requestParameters['accessApprovalNotificationRequest']),
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => AccessApprovalNotificationResponseFromJSON(jsonValue));
    }
    /**
     */
    async postRepoV1AccessApprovalNotifications(requestParameters, initOverrides) {
        const response = await this.postRepoV1AccessApprovalNotificationsRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async postRepoV1AccessApprovalSearchRaw(requestParameters, initOverrides) {
        if (requestParameters['accessApprovalSearchRequest'] == null) {
            throw new runtime.RequiredError('accessApprovalSearchRequest', 'Required parameter "accessApprovalSearchRequest" was null or undefined when calling postRepoV1AccessApprovalSearch().');
        }
        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/accessApproval/search`;
        const response = await this.request({
            path: urlPath,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: AccessApprovalSearchRequestToJSON(requestParameters['accessApprovalSearchRequest']),
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => AccessApprovalSearchResponseFromJSON(jsonValue));
    }
    /**
     */
    async postRepoV1AccessApprovalSearch(requestParameters, initOverrides) {
        const response = await this.postRepoV1AccessApprovalSearchRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async putRepoV1AccessApprovalGroupRevokeRaw(requestParameters, initOverrides) {
        if (requestParameters['accessorGroupRevokeRequest'] == null) {
            throw new runtime.RequiredError('accessorGroupRevokeRequest', 'Required parameter "accessorGroupRevokeRequest" was null or undefined when calling putRepoV1AccessApprovalGroupRevoke().');
        }
        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/accessApproval/group/revoke`;
        const response = await this.request({
            path: urlPath,
            method: 'PUT',
            headers: headerParameters,
            query: queryParameters,
            body: AccessorGroupRevokeRequestToJSON(requestParameters['accessorGroupRevokeRequest']),
        }, initOverrides);
        return new runtime.VoidApiResponse(response);
    }
    /**
     */
    async putRepoV1AccessApprovalGroupRevoke(requestParameters, initOverrides) {
        await this.putRepoV1AccessApprovalGroupRevokeRaw(requestParameters, initOverrides);
    }
}
//# sourceMappingURL=AccessApprovalServicesApi.js.map