/* 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 { AccessControlListFromJSON, AccessControlListToJSON, AccessRequirementFromJSON, AccessRequirementToJSON, AccessRequirementConversionRequestToJSON, AccessRequirementPermissionsFromJSON, AccessRequirementSearchRequestToJSON, AccessRequirementSearchResponseFromJSON, PaginatedResultsOfAccessRequirementFromJSON, RestrictableObjectDescriptorResponseFromJSON, } from '../models/index';
/**
 *
 */
export class AccessRequirementServicesApi extends runtime.BaseAPI {
    /**
     */
    async deleteRepoV1AccessRequirementRequirementIdRaw(requestParameters, initOverrides) {
        if (requestParameters['requirementId'] == null) {
            throw new runtime.RequiredError('requirementId', 'Required parameter "requirementId" was null or undefined when calling deleteRepoV1AccessRequirementRequirementId().');
        }
        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/accessRequirement/{requirementId}`;
        urlPath = urlPath.replace(`{${"requirementId"}}`, encodeURIComponent(String(requestParameters['requirementId'])));
        const response = await this.request({
            path: urlPath,
            method: 'DELETE',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.VoidApiResponse(response);
    }
    /**
     */
    async deleteRepoV1AccessRequirementRequirementId(requestParameters, initOverrides) {
        await this.deleteRepoV1AccessRequirementRequirementIdRaw(requestParameters, initOverrides);
    }
    /**
     */
    async deleteRepoV1AccessRequirementRequirementIdAclRaw(requestParameters, initOverrides) {
        if (requestParameters['requirementId'] == null) {
            throw new runtime.RequiredError('requirementId', 'Required parameter "requirementId" was null or undefined when calling deleteRepoV1AccessRequirementRequirementIdAcl().');
        }
        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/accessRequirement/{requirementId}/acl`;
        urlPath = urlPath.replace(`{${"requirementId"}}`, encodeURIComponent(String(requestParameters['requirementId'])));
        const response = await this.request({
            path: urlPath,
            method: 'DELETE',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.VoidApiResponse(response);
    }
    /**
     */
    async deleteRepoV1AccessRequirementRequirementIdAcl(requestParameters, initOverrides) {
        await this.deleteRepoV1AccessRequirementRequirementIdAclRaw(requestParameters, initOverrides);
    }
    /**
     */
    async getRepoV1AccessRequirementRequirementIdRaw(requestParameters, initOverrides) {
        if (requestParameters['requirementId'] == null) {
            throw new runtime.RequiredError('requirementId', 'Required parameter "requirementId" was null or undefined when calling getRepoV1AccessRequirementRequirementId().');
        }
        const queryParameters = {};
        const headerParameters = {};
        let urlPath = `/repo/v1/accessRequirement/{requirementId}`;
        urlPath = urlPath.replace(`{${"requirementId"}}`, encodeURIComponent(String(requestParameters['requirementId'])));
        const response = await this.request({
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => AccessRequirementFromJSON(jsonValue));
    }
    /**
     */
    async getRepoV1AccessRequirementRequirementId(requestParameters, initOverrides) {
        const response = await this.getRepoV1AccessRequirementRequirementIdRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async getRepoV1AccessRequirementRequirementIdAclRaw(requestParameters, initOverrides) {
        if (requestParameters['requirementId'] == null) {
            throw new runtime.RequiredError('requirementId', 'Required parameter "requirementId" was null or undefined when calling getRepoV1AccessRequirementRequirementIdAcl().');
        }
        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/accessRequirement/{requirementId}/acl`;
        urlPath = urlPath.replace(`{${"requirementId"}}`, encodeURIComponent(String(requestParameters['requirementId'])));
        const response = await this.request({
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => AccessControlListFromJSON(jsonValue));
    }
    /**
     */
    async getRepoV1AccessRequirementRequirementIdAcl(requestParameters, initOverrides) {
        const response = await this.getRepoV1AccessRequirementRequirementIdAclRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async getRepoV1AccessRequirementRequirementIdPermissionsRaw(requestParameters, initOverrides) {
        if (requestParameters['requirementId'] == null) {
            throw new runtime.RequiredError('requirementId', 'Required parameter "requirementId" was null or undefined when calling getRepoV1AccessRequirementRequirementIdPermissions().');
        }
        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/accessRequirement/{requirementId}/permissions`;
        urlPath = urlPath.replace(`{${"requirementId"}}`, encodeURIComponent(String(requestParameters['requirementId'])));
        const response = await this.request({
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => AccessRequirementPermissionsFromJSON(jsonValue));
    }
    /**
     */
    async getRepoV1AccessRequirementRequirementIdPermissions(requestParameters, initOverrides) {
        const response = await this.getRepoV1AccessRequirementRequirementIdPermissionsRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async getRepoV1AccessRequirementRequirementIdSubjectsRaw(requestParameters, initOverrides) {
        if (requestParameters['requirementId'] == null) {
            throw new runtime.RequiredError('requirementId', 'Required parameter "requirementId" was null or undefined when calling getRepoV1AccessRequirementRequirementIdSubjects().');
        }
        const queryParameters = {};
        if (requestParameters['nextPageToken'] != null) {
            queryParameters['nextPageToken'] = requestParameters['nextPageToken'];
        }
        const headerParameters = {};
        let urlPath = `/repo/v1/accessRequirement/{requirementId}/subjects`;
        urlPath = urlPath.replace(`{${"requirementId"}}`, encodeURIComponent(String(requestParameters['requirementId'])));
        const response = await this.request({
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => RestrictableObjectDescriptorResponseFromJSON(jsonValue));
    }
    /**
     */
    async getRepoV1AccessRequirementRequirementIdSubjects(requestParameters, initOverrides) {
        const response = await this.getRepoV1AccessRequirementRequirementIdSubjectsRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async getRepoV1EntityIdAccessRequirementRaw(requestParameters, initOverrides) {
        if (requestParameters['id'] == null) {
            throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling getRepoV1EntityIdAccessRequirement().');
        }
        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/entity/{id}/accessRequirement`;
        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) => PaginatedResultsOfAccessRequirementFromJSON(jsonValue));
    }
    /**
     */
    async getRepoV1EntityIdAccessRequirement(requestParameters, initOverrides) {
        const response = await this.getRepoV1EntityIdAccessRequirementRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async getRepoV1TeamIdAccessRequirementRaw(requestParameters, initOverrides) {
        if (requestParameters['id'] == null) {
            throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling getRepoV1TeamIdAccessRequirement().');
        }
        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/team/{id}/accessRequirement`;
        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) => PaginatedResultsOfAccessRequirementFromJSON(jsonValue));
    }
    /**
     */
    async getRepoV1TeamIdAccessRequirement(requestParameters, initOverrides) {
        const response = await this.getRepoV1TeamIdAccessRequirementRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async postRepoV1AccessRequirementRaw(requestParameters, initOverrides) {
        if (requestParameters['accessRequirement'] == null) {
            throw new runtime.RequiredError('accessRequirement', 'Required parameter "accessRequirement" was null or undefined when calling postRepoV1AccessRequirement().');
        }
        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/accessRequirement`;
        const response = await this.request({
            path: urlPath,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: AccessRequirementToJSON(requestParameters['accessRequirement']),
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => AccessRequirementFromJSON(jsonValue));
    }
    /**
     */
    async postRepoV1AccessRequirement(requestParameters, initOverrides) {
        const response = await this.postRepoV1AccessRequirementRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async postRepoV1AccessRequirementRequirementIdAclRaw(requestParameters, initOverrides) {
        if (requestParameters['requirementId'] == null) {
            throw new runtime.RequiredError('requirementId', 'Required parameter "requirementId" was null or undefined when calling postRepoV1AccessRequirementRequirementIdAcl().');
        }
        if (requestParameters['accessControlList'] == null) {
            throw new runtime.RequiredError('accessControlList', 'Required parameter "accessControlList" was null or undefined when calling postRepoV1AccessRequirementRequirementIdAcl().');
        }
        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/accessRequirement/{requirementId}/acl`;
        urlPath = urlPath.replace(`{${"requirementId"}}`, encodeURIComponent(String(requestParameters['requirementId'])));
        const response = await this.request({
            path: urlPath,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: AccessControlListToJSON(requestParameters['accessControlList']),
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => AccessControlListFromJSON(jsonValue));
    }
    /**
     */
    async postRepoV1AccessRequirementRequirementIdAcl(requestParameters, initOverrides) {
        const response = await this.postRepoV1AccessRequirementRequirementIdAclRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async postRepoV1AccessRequirementSearchRaw(requestParameters, initOverrides) {
        if (requestParameters['accessRequirementSearchRequest'] == null) {
            throw new runtime.RequiredError('accessRequirementSearchRequest', 'Required parameter "accessRequirementSearchRequest" was null or undefined when calling postRepoV1AccessRequirementSearch().');
        }
        const queryParameters = {};
        const headerParameters = {};
        headerParameters['Content-Type'] = 'application/json';
        let urlPath = `/repo/v1/accessRequirement/search`;
        const response = await this.request({
            path: urlPath,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: AccessRequirementSearchRequestToJSON(requestParameters['accessRequirementSearchRequest']),
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => AccessRequirementSearchResponseFromJSON(jsonValue));
    }
    /**
     */
    async postRepoV1AccessRequirementSearch(requestParameters, initOverrides) {
        const response = await this.postRepoV1AccessRequirementSearchRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async postRepoV1EntityIdLockAccessRequirementRaw(requestParameters, initOverrides) {
        if (requestParameters['id'] == null) {
            throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling postRepoV1EntityIdLockAccessRequirement().');
        }
        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}/lockAccessRequirement`;
        urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
        const response = await this.request({
            path: urlPath,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => AccessRequirementFromJSON(jsonValue));
    }
    /**
     */
    async postRepoV1EntityIdLockAccessRequirement(requestParameters, initOverrides) {
        const response = await this.postRepoV1EntityIdLockAccessRequirementRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async putRepoV1AccessRequirementConversionRaw(requestParameters, initOverrides) {
        if (requestParameters['accessRequirementConversionRequest'] == null) {
            throw new runtime.RequiredError('accessRequirementConversionRequest', 'Required parameter "accessRequirementConversionRequest" was null or undefined when calling putRepoV1AccessRequirementConversion().');
        }
        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/accessRequirement/conversion`;
        const response = await this.request({
            path: urlPath,
            method: 'PUT',
            headers: headerParameters,
            query: queryParameters,
            body: AccessRequirementConversionRequestToJSON(requestParameters['accessRequirementConversionRequest']),
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => AccessRequirementFromJSON(jsonValue));
    }
    /**
     */
    async putRepoV1AccessRequirementConversion(requestParameters, initOverrides) {
        const response = await this.putRepoV1AccessRequirementConversionRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async putRepoV1AccessRequirementRequirementIdRaw(requestParameters, initOverrides) {
        if (requestParameters['requirementId'] == null) {
            throw new runtime.RequiredError('requirementId', 'Required parameter "requirementId" was null or undefined when calling putRepoV1AccessRequirementRequirementId().');
        }
        if (requestParameters['accessRequirement'] == null) {
            throw new runtime.RequiredError('accessRequirement', 'Required parameter "accessRequirement" was null or undefined when calling putRepoV1AccessRequirementRequirementId().');
        }
        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/accessRequirement/{requirementId}`;
        urlPath = urlPath.replace(`{${"requirementId"}}`, encodeURIComponent(String(requestParameters['requirementId'])));
        const response = await this.request({
            path: urlPath,
            method: 'PUT',
            headers: headerParameters,
            query: queryParameters,
            body: AccessRequirementToJSON(requestParameters['accessRequirement']),
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => AccessRequirementFromJSON(jsonValue));
    }
    /**
     */
    async putRepoV1AccessRequirementRequirementId(requestParameters, initOverrides) {
        const response = await this.putRepoV1AccessRequirementRequirementIdRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async putRepoV1AccessRequirementRequirementIdAclRaw(requestParameters, initOverrides) {
        if (requestParameters['requirementId'] == null) {
            throw new runtime.RequiredError('requirementId', 'Required parameter "requirementId" was null or undefined when calling putRepoV1AccessRequirementRequirementIdAcl().');
        }
        if (requestParameters['accessControlList'] == null) {
            throw new runtime.RequiredError('accessControlList', 'Required parameter "accessControlList" was null or undefined when calling putRepoV1AccessRequirementRequirementIdAcl().');
        }
        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/accessRequirement/{requirementId}/acl`;
        urlPath = urlPath.replace(`{${"requirementId"}}`, encodeURIComponent(String(requestParameters['requirementId'])));
        const response = await this.request({
            path: urlPath,
            method: 'PUT',
            headers: headerParameters,
            query: queryParameters,
            body: AccessControlListToJSON(requestParameters['accessControlList']),
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => AccessControlListFromJSON(jsonValue));
    }
    /**
     */
    async putRepoV1AccessRequirementRequirementIdAcl(requestParameters, initOverrides) {
        const response = await this.putRepoV1AccessRequirementRequirementIdAclRaw(requestParameters, initOverrides);
        return await response.value();
    }
}
//# sourceMappingURL=AccessRequirementServicesApi.js.map