"use strict";
/* tslint:disable */
/* eslint-disable */
/**
 * Admin API
 * The Admin API is used to manage the ApeCloud platform.
 *
 * The version of the OpenAPI document: 1.0.0
 * Contact: support@apecloud.com
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.RoleApi = exports.RoleApiFactory = exports.RoleApiFp = exports.RoleApiAxiosParamCreator = void 0;
const axios_1 = __importDefault(require("axios"));
// Some imports not used depending on template conditions
// @ts-ignore
const common_1 = require("../common");
// @ts-ignore
const base_1 = require("../base");
/**
 * RoleApi - axios parameter creator
 * @export
 */
const RoleApiAxiosParamCreator = function (configuration) {
    return {
        /**
         * Batch add permissions to a role
         * @summary Batch add permissions to a role
         * @param {string} orgName name of the Org
         * @param {string} roleName
         * @param {Array<string>} requestBody
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        batchAddRolePermissions: async (orgName, roleName, requestBody, options = {}) => {
            // verify required parameter 'orgName' is not null or undefined
            (0, common_1.assertParamExists)('batchAddRolePermissions', 'orgName', orgName);
            // verify required parameter 'roleName' is not null or undefined
            (0, common_1.assertParamExists)('batchAddRolePermissions', 'roleName', roleName);
            // verify required parameter 'requestBody' is not null or undefined
            (0, common_1.assertParamExists)('batchAddRolePermissions', 'requestBody', requestBody);
            const localVarPath = `/admin/v1/organizations/{orgName}/roles/{roleName}/permissions/batch`
                .replace(`{${"orgName"}}`, encodeURIComponent(String(orgName)))
                .replace(`{${"roleName"}}`, encodeURIComponent(String(roleName)));
            // use dummy base URL string because the URL constructor only accepts absolute URLs.
            const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }
            const localVarRequestOptions = Object.assign(Object.assign({ method: 'POST' }, baseOptions), options);
            const localVarHeaderParameter = {};
            const localVarQueryParameter = {};
            // authentication BearerToken required
            // http bearer authentication required
            await (0, common_1.setBearerAuthToObject)(localVarHeaderParameter, configuration);
            // authentication DigestAuth required
            await (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "Authorization", configuration);
            localVarHeaderParameter['Content-Type'] = 'application/json';
            (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
            localVarRequestOptions.data = (0, common_1.serializeDataIfNeeded)(requestBody, localVarRequestOptions, configuration);
            return {
                url: (0, common_1.toPathString)(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * Batch remove permissions from a role
         * @summary Batch remove permissions from a role
         * @param {string} orgName name of the Org
         * @param {string} roleName
         * @param {Array<string>} requestBody
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        batchRemoveRolePermissions: async (orgName, roleName, requestBody, options = {}) => {
            // verify required parameter 'orgName' is not null or undefined
            (0, common_1.assertParamExists)('batchRemoveRolePermissions', 'orgName', orgName);
            // verify required parameter 'roleName' is not null or undefined
            (0, common_1.assertParamExists)('batchRemoveRolePermissions', 'roleName', roleName);
            // verify required parameter 'requestBody' is not null or undefined
            (0, common_1.assertParamExists)('batchRemoveRolePermissions', 'requestBody', requestBody);
            const localVarPath = `/admin/v1/organizations/{orgName}/roles/{roleName}/permissions/batch`
                .replace(`{${"orgName"}}`, encodeURIComponent(String(orgName)))
                .replace(`{${"roleName"}}`, encodeURIComponent(String(roleName)));
            // use dummy base URL string because the URL constructor only accepts absolute URLs.
            const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }
            const localVarRequestOptions = Object.assign(Object.assign({ method: 'DELETE' }, baseOptions), options);
            const localVarHeaderParameter = {};
            const localVarQueryParameter = {};
            // authentication BearerToken required
            // http bearer authentication required
            await (0, common_1.setBearerAuthToObject)(localVarHeaderParameter, configuration);
            // authentication DigestAuth required
            await (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "Authorization", configuration);
            localVarHeaderParameter['Content-Type'] = 'application/json';
            (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
            localVarRequestOptions.data = (0, common_1.serializeDataIfNeeded)(requestBody, localVarRequestOptions, configuration);
            return {
                url: (0, common_1.toPathString)(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * Create role
         * @summary Create role
         * @param {string} orgName name of the Org
         * @param {RoleCreate} roleCreate
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        createRole: async (orgName, roleCreate, options = {}) => {
            // verify required parameter 'orgName' is not null or undefined
            (0, common_1.assertParamExists)('createRole', 'orgName', orgName);
            // verify required parameter 'roleCreate' is not null or undefined
            (0, common_1.assertParamExists)('createRole', 'roleCreate', roleCreate);
            const localVarPath = `/admin/v1/organizations/{orgName}/roles`
                .replace(`{${"orgName"}}`, encodeURIComponent(String(orgName)));
            // use dummy base URL string because the URL constructor only accepts absolute URLs.
            const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }
            const localVarRequestOptions = Object.assign(Object.assign({ method: 'POST' }, baseOptions), options);
            const localVarHeaderParameter = {};
            const localVarQueryParameter = {};
            // authentication BearerToken required
            // http bearer authentication required
            await (0, common_1.setBearerAuthToObject)(localVarHeaderParameter, configuration);
            // authentication DigestAuth required
            await (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "Authorization", configuration);
            localVarHeaderParameter['Content-Type'] = 'application/json';
            (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
            localVarRequestOptions.data = (0, common_1.serializeDataIfNeeded)(roleCreate, localVarRequestOptions, configuration);
            return {
                url: (0, common_1.toPathString)(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * Delete role by name
         * @summary Delete role by name
         * @param {string} orgName name of the Org
         * @param {string} roleName
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        deleteRoleByName: async (orgName, roleName, options = {}) => {
            // verify required parameter 'orgName' is not null or undefined
            (0, common_1.assertParamExists)('deleteRoleByName', 'orgName', orgName);
            // verify required parameter 'roleName' is not null or undefined
            (0, common_1.assertParamExists)('deleteRoleByName', 'roleName', roleName);
            const localVarPath = `/admin/v1/organizations/{orgName}/roles/{roleName}`
                .replace(`{${"orgName"}}`, encodeURIComponent(String(orgName)))
                .replace(`{${"roleName"}}`, encodeURIComponent(String(roleName)));
            // use dummy base URL string because the URL constructor only accepts absolute URLs.
            const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }
            const localVarRequestOptions = Object.assign(Object.assign({ method: 'DELETE' }, baseOptions), options);
            const localVarHeaderParameter = {};
            const localVarQueryParameter = {};
            // authentication BearerToken required
            // http bearer authentication required
            await (0, common_1.setBearerAuthToObject)(localVarHeaderParameter, configuration);
            // authentication DigestAuth required
            await (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "Authorization", configuration);
            (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
            return {
                url: (0, common_1.toPathString)(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * Get role by name
         * @summary Get role by name
         * @param {string} orgName name of the Org
         * @param {string} roleName
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getRoleByName: async (orgName, roleName, options = {}) => {
            // verify required parameter 'orgName' is not null or undefined
            (0, common_1.assertParamExists)('getRoleByName', 'orgName', orgName);
            // verify required parameter 'roleName' is not null or undefined
            (0, common_1.assertParamExists)('getRoleByName', 'roleName', roleName);
            const localVarPath = `/admin/v1/organizations/{orgName}/roles/{roleName}`
                .replace(`{${"orgName"}}`, encodeURIComponent(String(orgName)))
                .replace(`{${"roleName"}}`, encodeURIComponent(String(roleName)));
            // use dummy base URL string because the URL constructor only accepts absolute URLs.
            const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }
            const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
            const localVarHeaderParameter = {};
            const localVarQueryParameter = {};
            // authentication BearerToken required
            // http bearer authentication required
            await (0, common_1.setBearerAuthToObject)(localVarHeaderParameter, configuration);
            // authentication DigestAuth required
            await (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "Authorization", configuration);
            (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
            return {
                url: (0, common_1.toPathString)(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * List all permissions
         * @summary List all permissions
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listPermissions: async (options = {}) => {
            const localVarPath = `/admin/v1/permissions`;
            // use dummy base URL string because the URL constructor only accepts absolute URLs.
            const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }
            const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
            const localVarHeaderParameter = {};
            const localVarQueryParameter = {};
            // authentication BearerToken required
            // http bearer authentication required
            await (0, common_1.setBearerAuthToObject)(localVarHeaderParameter, configuration);
            // authentication DigestAuth required
            await (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "Authorization", configuration);
            (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
            return {
                url: (0, common_1.toPathString)(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * List permissions of a role
         * @summary List permissions of a role
         * @param {string} orgName name of the Org
         * @param {string} roleName
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listRolePermissions: async (orgName, roleName, options = {}) => {
            // verify required parameter 'orgName' is not null or undefined
            (0, common_1.assertParamExists)('listRolePermissions', 'orgName', orgName);
            // verify required parameter 'roleName' is not null or undefined
            (0, common_1.assertParamExists)('listRolePermissions', 'roleName', roleName);
            const localVarPath = `/admin/v1/organizations/{orgName}/roles/{roleName}/permissions`
                .replace(`{${"orgName"}}`, encodeURIComponent(String(orgName)))
                .replace(`{${"roleName"}}`, encodeURIComponent(String(roleName)));
            // use dummy base URL string because the URL constructor only accepts absolute URLs.
            const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }
            const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
            const localVarHeaderParameter = {};
            const localVarQueryParameter = {};
            // authentication BearerToken required
            // http bearer authentication required
            await (0, common_1.setBearerAuthToObject)(localVarHeaderParameter, configuration);
            // authentication DigestAuth required
            await (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "Authorization", configuration);
            (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
            return {
                url: (0, common_1.toPathString)(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * List roles of a organization
         * @summary List roles of a organization
         * @param {string} orgName name of the Org
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listRoles: async (orgName, options = {}) => {
            // verify required parameter 'orgName' is not null or undefined
            (0, common_1.assertParamExists)('listRoles', 'orgName', orgName);
            const localVarPath = `/admin/v1/organizations/{orgName}/roles`
                .replace(`{${"orgName"}}`, encodeURIComponent(String(orgName)));
            // use dummy base URL string because the URL constructor only accepts absolute URLs.
            const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }
            const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
            const localVarHeaderParameter = {};
            const localVarQueryParameter = {};
            // authentication BearerToken required
            // http bearer authentication required
            await (0, common_1.setBearerAuthToObject)(localVarHeaderParameter, configuration);
            // authentication DigestAuth required
            await (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "Authorization", configuration);
            (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
            return {
                url: (0, common_1.toPathString)(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * Update role by name
         * @summary Update role by name
         * @param {string} orgName name of the Org
         * @param {string} roleName
         * @param {RoleUpdate} roleUpdate
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        updateRoleByName: async (orgName, roleName, roleUpdate, options = {}) => {
            // verify required parameter 'orgName' is not null or undefined
            (0, common_1.assertParamExists)('updateRoleByName', 'orgName', orgName);
            // verify required parameter 'roleName' is not null or undefined
            (0, common_1.assertParamExists)('updateRoleByName', 'roleName', roleName);
            // verify required parameter 'roleUpdate' is not null or undefined
            (0, common_1.assertParamExists)('updateRoleByName', 'roleUpdate', roleUpdate);
            const localVarPath = `/admin/v1/organizations/{orgName}/roles/{roleName}`
                .replace(`{${"orgName"}}`, encodeURIComponent(String(orgName)))
                .replace(`{${"roleName"}}`, encodeURIComponent(String(roleName)));
            // use dummy base URL string because the URL constructor only accepts absolute URLs.
            const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }
            const localVarRequestOptions = Object.assign(Object.assign({ method: 'PATCH' }, baseOptions), options);
            const localVarHeaderParameter = {};
            const localVarQueryParameter = {};
            // authentication BearerToken required
            // http bearer authentication required
            await (0, common_1.setBearerAuthToObject)(localVarHeaderParameter, configuration);
            // authentication DigestAuth required
            await (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "Authorization", configuration);
            localVarHeaderParameter['Content-Type'] = 'application/json';
            (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
            localVarRequestOptions.data = (0, common_1.serializeDataIfNeeded)(roleUpdate, localVarRequestOptions, configuration);
            return {
                url: (0, common_1.toPathString)(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
    };
};
exports.RoleApiAxiosParamCreator = RoleApiAxiosParamCreator;
/**
 * RoleApi - functional programming interface
 * @export
 */
const RoleApiFp = function (configuration) {
    const localVarAxiosParamCreator = (0, exports.RoleApiAxiosParamCreator)(configuration);
    return {
        /**
         * Batch add permissions to a role
         * @summary Batch add permissions to a role
         * @param {string} orgName name of the Org
         * @param {string} roleName
         * @param {Array<string>} requestBody
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async batchAddRolePermissions(orgName, roleName, requestBody, options) {
            var _a, _b, _c;
            const localVarAxiosArgs = await localVarAxiosParamCreator.batchAddRolePermissions(orgName, roleName, requestBody, options);
            const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
            const localVarOperationServerBasePath = (_c = (_b = base_1.operationServerMap['RoleApi.batchAddRolePermissions']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
            return (axios, basePath) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * Batch remove permissions from a role
         * @summary Batch remove permissions from a role
         * @param {string} orgName name of the Org
         * @param {string} roleName
         * @param {Array<string>} requestBody
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async batchRemoveRolePermissions(orgName, roleName, requestBody, options) {
            var _a, _b, _c;
            const localVarAxiosArgs = await localVarAxiosParamCreator.batchRemoveRolePermissions(orgName, roleName, requestBody, options);
            const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
            const localVarOperationServerBasePath = (_c = (_b = base_1.operationServerMap['RoleApi.batchRemoveRolePermissions']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
            return (axios, basePath) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * Create role
         * @summary Create role
         * @param {string} orgName name of the Org
         * @param {RoleCreate} roleCreate
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async createRole(orgName, roleCreate, options) {
            var _a, _b, _c;
            const localVarAxiosArgs = await localVarAxiosParamCreator.createRole(orgName, roleCreate, options);
            const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
            const localVarOperationServerBasePath = (_c = (_b = base_1.operationServerMap['RoleApi.createRole']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
            return (axios, basePath) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * Delete role by name
         * @summary Delete role by name
         * @param {string} orgName name of the Org
         * @param {string} roleName
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async deleteRoleByName(orgName, roleName, options) {
            var _a, _b, _c;
            const localVarAxiosArgs = await localVarAxiosParamCreator.deleteRoleByName(orgName, roleName, options);
            const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
            const localVarOperationServerBasePath = (_c = (_b = base_1.operationServerMap['RoleApi.deleteRoleByName']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
            return (axios, basePath) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * Get role by name
         * @summary Get role by name
         * @param {string} orgName name of the Org
         * @param {string} roleName
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async getRoleByName(orgName, roleName, options) {
            var _a, _b, _c;
            const localVarAxiosArgs = await localVarAxiosParamCreator.getRoleByName(orgName, roleName, options);
            const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
            const localVarOperationServerBasePath = (_c = (_b = base_1.operationServerMap['RoleApi.getRoleByName']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
            return (axios, basePath) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * List all permissions
         * @summary List all permissions
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async listPermissions(options) {
            var _a, _b, _c;
            const localVarAxiosArgs = await localVarAxiosParamCreator.listPermissions(options);
            const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
            const localVarOperationServerBasePath = (_c = (_b = base_1.operationServerMap['RoleApi.listPermissions']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
            return (axios, basePath) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * List permissions of a role
         * @summary List permissions of a role
         * @param {string} orgName name of the Org
         * @param {string} roleName
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async listRolePermissions(orgName, roleName, options) {
            var _a, _b, _c;
            const localVarAxiosArgs = await localVarAxiosParamCreator.listRolePermissions(orgName, roleName, options);
            const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
            const localVarOperationServerBasePath = (_c = (_b = base_1.operationServerMap['RoleApi.listRolePermissions']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
            return (axios, basePath) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * List roles of a organization
         * @summary List roles of a organization
         * @param {string} orgName name of the Org
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async listRoles(orgName, options) {
            var _a, _b, _c;
            const localVarAxiosArgs = await localVarAxiosParamCreator.listRoles(orgName, options);
            const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
            const localVarOperationServerBasePath = (_c = (_b = base_1.operationServerMap['RoleApi.listRoles']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
            return (axios, basePath) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * Update role by name
         * @summary Update role by name
         * @param {string} orgName name of the Org
         * @param {string} roleName
         * @param {RoleUpdate} roleUpdate
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async updateRoleByName(orgName, roleName, roleUpdate, options) {
            var _a, _b, _c;
            const localVarAxiosArgs = await localVarAxiosParamCreator.updateRoleByName(orgName, roleName, roleUpdate, options);
            const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
            const localVarOperationServerBasePath = (_c = (_b = base_1.operationServerMap['RoleApi.updateRoleByName']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
            return (axios, basePath) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
    };
};
exports.RoleApiFp = RoleApiFp;
/**
 * RoleApi - factory interface
 * @export
 */
const RoleApiFactory = function (configuration, basePath, axios) {
    const localVarFp = (0, exports.RoleApiFp)(configuration);
    return {
        /**
         * Batch add permissions to a role
         * @summary Batch add permissions to a role
         * @param {RoleApiBatchAddRolePermissionsRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        batchAddRolePermissions(requestParameters, options) {
            return localVarFp.batchAddRolePermissions(requestParameters.orgName, requestParameters.roleName, requestParameters.requestBody, options).then((request) => request(axios, basePath));
        },
        /**
         * Batch remove permissions from a role
         * @summary Batch remove permissions from a role
         * @param {RoleApiBatchRemoveRolePermissionsRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        batchRemoveRolePermissions(requestParameters, options) {
            return localVarFp.batchRemoveRolePermissions(requestParameters.orgName, requestParameters.roleName, requestParameters.requestBody, options).then((request) => request(axios, basePath));
        },
        /**
         * Create role
         * @summary Create role
         * @param {RoleApiCreateRoleRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        createRole(requestParameters, options) {
            return localVarFp.createRole(requestParameters.orgName, requestParameters.roleCreate, options).then((request) => request(axios, basePath));
        },
        /**
         * Delete role by name
         * @summary Delete role by name
         * @param {RoleApiDeleteRoleByNameRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        deleteRoleByName(requestParameters, options) {
            return localVarFp.deleteRoleByName(requestParameters.orgName, requestParameters.roleName, options).then((request) => request(axios, basePath));
        },
        /**
         * Get role by name
         * @summary Get role by name
         * @param {RoleApiGetRoleByNameRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getRoleByName(requestParameters, options) {
            return localVarFp.getRoleByName(requestParameters.orgName, requestParameters.roleName, options).then((request) => request(axios, basePath));
        },
        /**
         * List all permissions
         * @summary List all permissions
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listPermissions(options) {
            return localVarFp.listPermissions(options).then((request) => request(axios, basePath));
        },
        /**
         * List permissions of a role
         * @summary List permissions of a role
         * @param {RoleApiListRolePermissionsRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listRolePermissions(requestParameters, options) {
            return localVarFp.listRolePermissions(requestParameters.orgName, requestParameters.roleName, options).then((request) => request(axios, basePath));
        },
        /**
         * List roles of a organization
         * @summary List roles of a organization
         * @param {RoleApiListRolesRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listRoles(requestParameters, options) {
            return localVarFp.listRoles(requestParameters.orgName, options).then((request) => request(axios, basePath));
        },
        /**
         * Update role by name
         * @summary Update role by name
         * @param {RoleApiUpdateRoleByNameRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        updateRoleByName(requestParameters, options) {
            return localVarFp.updateRoleByName(requestParameters.orgName, requestParameters.roleName, requestParameters.roleUpdate, options).then((request) => request(axios, basePath));
        },
    };
};
exports.RoleApiFactory = RoleApiFactory;
/**
 * RoleApi - object-oriented interface
 * @export
 * @class RoleApi
 * @extends {BaseAPI}
 */
class RoleApi extends base_1.BaseAPI {
    /**
     * Batch add permissions to a role
     * @summary Batch add permissions to a role
     * @param {RoleApiBatchAddRolePermissionsRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof RoleApi
     */
    batchAddRolePermissions(requestParameters, options) {
        return (0, exports.RoleApiFp)(this.configuration).batchAddRolePermissions(requestParameters.orgName, requestParameters.roleName, requestParameters.requestBody, options).then((request) => request(this.axios, this.basePath));
    }
    /**
     * Batch remove permissions from a role
     * @summary Batch remove permissions from a role
     * @param {RoleApiBatchRemoveRolePermissionsRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof RoleApi
     */
    batchRemoveRolePermissions(requestParameters, options) {
        return (0, exports.RoleApiFp)(this.configuration).batchRemoveRolePermissions(requestParameters.orgName, requestParameters.roleName, requestParameters.requestBody, options).then((request) => request(this.axios, this.basePath));
    }
    /**
     * Create role
     * @summary Create role
     * @param {RoleApiCreateRoleRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof RoleApi
     */
    createRole(requestParameters, options) {
        return (0, exports.RoleApiFp)(this.configuration).createRole(requestParameters.orgName, requestParameters.roleCreate, options).then((request) => request(this.axios, this.basePath));
    }
    /**
     * Delete role by name
     * @summary Delete role by name
     * @param {RoleApiDeleteRoleByNameRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof RoleApi
     */
    deleteRoleByName(requestParameters, options) {
        return (0, exports.RoleApiFp)(this.configuration).deleteRoleByName(requestParameters.orgName, requestParameters.roleName, options).then((request) => request(this.axios, this.basePath));
    }
    /**
     * Get role by name
     * @summary Get role by name
     * @param {RoleApiGetRoleByNameRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof RoleApi
     */
    getRoleByName(requestParameters, options) {
        return (0, exports.RoleApiFp)(this.configuration).getRoleByName(requestParameters.orgName, requestParameters.roleName, options).then((request) => request(this.axios, this.basePath));
    }
    /**
     * List all permissions
     * @summary List all permissions
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof RoleApi
     */
    listPermissions(options) {
        return (0, exports.RoleApiFp)(this.configuration).listPermissions(options).then((request) => request(this.axios, this.basePath));
    }
    /**
     * List permissions of a role
     * @summary List permissions of a role
     * @param {RoleApiListRolePermissionsRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof RoleApi
     */
    listRolePermissions(requestParameters, options) {
        return (0, exports.RoleApiFp)(this.configuration).listRolePermissions(requestParameters.orgName, requestParameters.roleName, options).then((request) => request(this.axios, this.basePath));
    }
    /**
     * List roles of a organization
     * @summary List roles of a organization
     * @param {RoleApiListRolesRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof RoleApi
     */
    listRoles(requestParameters, options) {
        return (0, exports.RoleApiFp)(this.configuration).listRoles(requestParameters.orgName, options).then((request) => request(this.axios, this.basePath));
    }
    /**
     * Update role by name
     * @summary Update role by name
     * @param {RoleApiUpdateRoleByNameRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof RoleApi
     */
    updateRoleByName(requestParameters, options) {
        return (0, exports.RoleApiFp)(this.configuration).updateRoleByName(requestParameters.orgName, requestParameters.roleName, requestParameters.roleUpdate, options).then((request) => request(this.axios, this.basePath));
    }
}
exports.RoleApi = RoleApi;
//# sourceMappingURL=role-api.js.map