/* 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, CreateOrUpdatePortalRequestToJSON, ListPortalsRequestToJSON, ListPortalsResponseFromJSON, PortalFromJSON, UserPortalPermissionsFromJSON, } from '../models/index';
/**
 *
 */
export class PortalsServicesApi extends runtime.BaseAPI {
    /**
     */
    async deleteRepoV1PortalPortalIdRaw(requestParameters, initOverrides) {
        if (requestParameters['portalId'] == null) {
            throw new runtime.RequiredError('portalId', 'Required parameter "portalId" was null or undefined when calling deleteRepoV1PortalPortalId().');
        }
        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/portal/{portalId}`;
        urlPath = urlPath.replace(`{${"portalId"}}`, encodeURIComponent(String(requestParameters['portalId'])));
        const response = await this.request({
            path: urlPath,
            method: 'DELETE',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.VoidApiResponse(response);
    }
    /**
     */
    async deleteRepoV1PortalPortalId(requestParameters, initOverrides) {
        await this.deleteRepoV1PortalPortalIdRaw(requestParameters, initOverrides);
    }
    /**
     */
    async getRepoV1PortalPortalIdRaw(requestParameters, initOverrides) {
        if (requestParameters['portalId'] == null) {
            throw new runtime.RequiredError('portalId', 'Required parameter "portalId" was null or undefined when calling getRepoV1PortalPortalId().');
        }
        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/portal/{portalId}`;
        urlPath = urlPath.replace(`{${"portalId"}}`, encodeURIComponent(String(requestParameters['portalId'])));
        const response = await this.request({
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => PortalFromJSON(jsonValue));
    }
    /**
     */
    async getRepoV1PortalPortalId(requestParameters, initOverrides) {
        const response = await this.getRepoV1PortalPortalIdRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async getRepoV1PortalPortalIdAclRaw(requestParameters, initOverrides) {
        if (requestParameters['portalId'] == null) {
            throw new runtime.RequiredError('portalId', 'Required parameter "portalId" was null or undefined when calling getRepoV1PortalPortalIdAcl().');
        }
        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/portal/{portalId}/acl`;
        urlPath = urlPath.replace(`{${"portalId"}}`, encodeURIComponent(String(requestParameters['portalId'])));
        const response = await this.request({
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => AccessControlListFromJSON(jsonValue));
    }
    /**
     */
    async getRepoV1PortalPortalIdAcl(requestParameters, initOverrides) {
        const response = await this.getRepoV1PortalPortalIdAclRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async getRepoV1PortalPortalIdPermissionsRaw(requestParameters, initOverrides) {
        if (requestParameters['portalId'] == null) {
            throw new runtime.RequiredError('portalId', 'Required parameter "portalId" was null or undefined when calling getRepoV1PortalPortalIdPermissions().');
        }
        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/portal/{portalId}/permissions`;
        urlPath = urlPath.replace(`{${"portalId"}}`, encodeURIComponent(String(requestParameters['portalId'])));
        const response = await this.request({
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => UserPortalPermissionsFromJSON(jsonValue));
    }
    /**
     */
    async getRepoV1PortalPortalIdPermissions(requestParameters, initOverrides) {
        const response = await this.getRepoV1PortalPortalIdPermissionsRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async postRepoV1PortalRaw(requestParameters, initOverrides) {
        if (requestParameters['createOrUpdatePortalRequest'] == null) {
            throw new runtime.RequiredError('createOrUpdatePortalRequest', 'Required parameter "createOrUpdatePortalRequest" was null or undefined when calling postRepoV1Portal().');
        }
        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/portal`;
        const response = await this.request({
            path: urlPath,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: CreateOrUpdatePortalRequestToJSON(requestParameters['createOrUpdatePortalRequest']),
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => PortalFromJSON(jsonValue));
    }
    /**
     */
    async postRepoV1Portal(requestParameters, initOverrides) {
        const response = await this.postRepoV1PortalRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async postRepoV1PortalListRaw(requestParameters, initOverrides) {
        if (requestParameters['listPortalsRequest'] == null) {
            throw new runtime.RequiredError('listPortalsRequest', 'Required parameter "listPortalsRequest" was null or undefined when calling postRepoV1PortalList().');
        }
        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/portal/list`;
        const response = await this.request({
            path: urlPath,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: ListPortalsRequestToJSON(requestParameters['listPortalsRequest']),
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => ListPortalsResponseFromJSON(jsonValue));
    }
    /**
     */
    async postRepoV1PortalList(requestParameters, initOverrides) {
        const response = await this.postRepoV1PortalListRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async putRepoV1PortalPortalIdRaw(requestParameters, initOverrides) {
        if (requestParameters['portalId'] == null) {
            throw new runtime.RequiredError('portalId', 'Required parameter "portalId" was null or undefined when calling putRepoV1PortalPortalId().');
        }
        if (requestParameters['createOrUpdatePortalRequest'] == null) {
            throw new runtime.RequiredError('createOrUpdatePortalRequest', 'Required parameter "createOrUpdatePortalRequest" was null or undefined when calling putRepoV1PortalPortalId().');
        }
        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/portal/{portalId}`;
        urlPath = urlPath.replace(`{${"portalId"}}`, encodeURIComponent(String(requestParameters['portalId'])));
        const response = await this.request({
            path: urlPath,
            method: 'PUT',
            headers: headerParameters,
            query: queryParameters,
            body: CreateOrUpdatePortalRequestToJSON(requestParameters['createOrUpdatePortalRequest']),
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => PortalFromJSON(jsonValue));
    }
    /**
     */
    async putRepoV1PortalPortalId(requestParameters, initOverrides) {
        const response = await this.putRepoV1PortalPortalIdRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async putRepoV1PortalPortalIdAclRaw(requestParameters, initOverrides) {
        if (requestParameters['portalId'] == null) {
            throw new runtime.RequiredError('portalId', 'Required parameter "portalId" was null or undefined when calling putRepoV1PortalPortalIdAcl().');
        }
        if (requestParameters['accessControlList'] == null) {
            throw new runtime.RequiredError('accessControlList', 'Required parameter "accessControlList" was null or undefined when calling putRepoV1PortalPortalIdAcl().');
        }
        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/portal/{portalId}/acl`;
        urlPath = urlPath.replace(`{${"portalId"}}`, encodeURIComponent(String(requestParameters['portalId'])));
        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 putRepoV1PortalPortalIdAcl(requestParameters, initOverrides) {
        const response = await this.putRepoV1PortalPortalIdAclRaw(requestParameters, initOverrides);
        return await response.value();
    }
}
//# sourceMappingURL=PortalsServicesApi.js.map