/* 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.
 */


import type { Configuration } from '../configuration';
import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios';
import globalAxios from 'axios';
// Some imports not used depending on template conditions
// @ts-ignore
import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '../common';
// @ts-ignore
import { BASE_PATH, COLLECTION_FORMATS, type RequestArgs, BaseAPI, RequiredError, operationServerMap } from '../base';
// @ts-ignore
import type { APIErrorResponse } from '../models';
// @ts-ignore
import type { PermissionList } from '../models';
// @ts-ignore
import type { Role } from '../models';
// @ts-ignore
import type { RoleCreate } from '../models';
// @ts-ignore
import type { RoleList } from '../models';
// @ts-ignore
import type { RoleUpdate } from '../models';
/**
 * RoleApi - axios parameter creator
 * @export
 */
export const RoleApiAxiosParamCreator = function (configuration?: 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: string, roleName: string, requestBody: Array<string>, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'orgName' is not null or undefined
            assertParamExists('batchAddRolePermissions', 'orgName', orgName)
            // verify required parameter 'roleName' is not null or undefined
            assertParamExists('batchAddRolePermissions', 'roleName', roleName)
            // verify required parameter 'requestBody' is not null or undefined
            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, DUMMY_BASE_URL);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }

            const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
            const localVarHeaderParameter = {} as any;
            const localVarQueryParameter = {} as any;

            // authentication BearerToken required
            // http bearer authentication required
            await setBearerAuthToObject(localVarHeaderParameter, configuration)

            // authentication DigestAuth required
            await setApiKeyToObject(localVarHeaderParameter, "Authorization", configuration)


    
            localVarHeaderParameter['Content-Type'] = 'application/json';

            setSearchParams(localVarUrlObj, localVarQueryParameter);
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
            localVarRequestOptions.data = serializeDataIfNeeded(requestBody, localVarRequestOptions, configuration)

            return {
                url: 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: string, roleName: string, requestBody: Array<string>, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'orgName' is not null or undefined
            assertParamExists('batchRemoveRolePermissions', 'orgName', orgName)
            // verify required parameter 'roleName' is not null or undefined
            assertParamExists('batchRemoveRolePermissions', 'roleName', roleName)
            // verify required parameter 'requestBody' is not null or undefined
            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, DUMMY_BASE_URL);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }

            const localVarRequestOptions = { method: 'DELETE', ...baseOptions, ...options};
            const localVarHeaderParameter = {} as any;
            const localVarQueryParameter = {} as any;

            // authentication BearerToken required
            // http bearer authentication required
            await setBearerAuthToObject(localVarHeaderParameter, configuration)

            // authentication DigestAuth required
            await setApiKeyToObject(localVarHeaderParameter, "Authorization", configuration)


    
            localVarHeaderParameter['Content-Type'] = 'application/json';

            setSearchParams(localVarUrlObj, localVarQueryParameter);
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
            localVarRequestOptions.data = serializeDataIfNeeded(requestBody, localVarRequestOptions, configuration)

            return {
                url: 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: string, roleCreate: RoleCreate, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'orgName' is not null or undefined
            assertParamExists('createRole', 'orgName', orgName)
            // verify required parameter 'roleCreate' is not null or undefined
            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, DUMMY_BASE_URL);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }

            const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
            const localVarHeaderParameter = {} as any;
            const localVarQueryParameter = {} as any;

            // authentication BearerToken required
            // http bearer authentication required
            await setBearerAuthToObject(localVarHeaderParameter, configuration)

            // authentication DigestAuth required
            await setApiKeyToObject(localVarHeaderParameter, "Authorization", configuration)


    
            localVarHeaderParameter['Content-Type'] = 'application/json';

            setSearchParams(localVarUrlObj, localVarQueryParameter);
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
            localVarRequestOptions.data = serializeDataIfNeeded(roleCreate, localVarRequestOptions, configuration)

            return {
                url: 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: string, roleName: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'orgName' is not null or undefined
            assertParamExists('deleteRoleByName', 'orgName', orgName)
            // verify required parameter 'roleName' is not null or undefined
            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, DUMMY_BASE_URL);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }

            const localVarRequestOptions = { method: 'DELETE', ...baseOptions, ...options};
            const localVarHeaderParameter = {} as any;
            const localVarQueryParameter = {} as any;

            // authentication BearerToken required
            // http bearer authentication required
            await setBearerAuthToObject(localVarHeaderParameter, configuration)

            // authentication DigestAuth required
            await setApiKeyToObject(localVarHeaderParameter, "Authorization", configuration)


    
            setSearchParams(localVarUrlObj, localVarQueryParameter);
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};

            return {
                url: 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: string, roleName: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'orgName' is not null or undefined
            assertParamExists('getRoleByName', 'orgName', orgName)
            // verify required parameter 'roleName' is not null or undefined
            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, DUMMY_BASE_URL);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }

            const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
            const localVarHeaderParameter = {} as any;
            const localVarQueryParameter = {} as any;

            // authentication BearerToken required
            // http bearer authentication required
            await setBearerAuthToObject(localVarHeaderParameter, configuration)

            // authentication DigestAuth required
            await setApiKeyToObject(localVarHeaderParameter, "Authorization", configuration)


    
            setSearchParams(localVarUrlObj, localVarQueryParameter);
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};

            return {
                url: toPathString(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * List all permissions
         * @summary List all permissions
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listPermissions: async (options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            const localVarPath = `/admin/v1/permissions`;
            // use dummy base URL string because the URL constructor only accepts absolute URLs.
            const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }

            const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
            const localVarHeaderParameter = {} as any;
            const localVarQueryParameter = {} as any;

            // authentication BearerToken required
            // http bearer authentication required
            await setBearerAuthToObject(localVarHeaderParameter, configuration)

            // authentication DigestAuth required
            await setApiKeyToObject(localVarHeaderParameter, "Authorization", configuration)


    
            setSearchParams(localVarUrlObj, localVarQueryParameter);
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};

            return {
                url: 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: string, roleName: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'orgName' is not null or undefined
            assertParamExists('listRolePermissions', 'orgName', orgName)
            // verify required parameter 'roleName' is not null or undefined
            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, DUMMY_BASE_URL);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }

            const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
            const localVarHeaderParameter = {} as any;
            const localVarQueryParameter = {} as any;

            // authentication BearerToken required
            // http bearer authentication required
            await setBearerAuthToObject(localVarHeaderParameter, configuration)

            // authentication DigestAuth required
            await setApiKeyToObject(localVarHeaderParameter, "Authorization", configuration)


    
            setSearchParams(localVarUrlObj, localVarQueryParameter);
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};

            return {
                url: 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: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'orgName' is not null or undefined
            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, DUMMY_BASE_URL);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }

            const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
            const localVarHeaderParameter = {} as any;
            const localVarQueryParameter = {} as any;

            // authentication BearerToken required
            // http bearer authentication required
            await setBearerAuthToObject(localVarHeaderParameter, configuration)

            // authentication DigestAuth required
            await setApiKeyToObject(localVarHeaderParameter, "Authorization", configuration)


    
            setSearchParams(localVarUrlObj, localVarQueryParameter);
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};

            return {
                url: 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: string, roleName: string, roleUpdate: RoleUpdate, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'orgName' is not null or undefined
            assertParamExists('updateRoleByName', 'orgName', orgName)
            // verify required parameter 'roleName' is not null or undefined
            assertParamExists('updateRoleByName', 'roleName', roleName)
            // verify required parameter 'roleUpdate' is not null or undefined
            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, DUMMY_BASE_URL);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }

            const localVarRequestOptions = { method: 'PATCH', ...baseOptions, ...options};
            const localVarHeaderParameter = {} as any;
            const localVarQueryParameter = {} as any;

            // authentication BearerToken required
            // http bearer authentication required
            await setBearerAuthToObject(localVarHeaderParameter, configuration)

            // authentication DigestAuth required
            await setApiKeyToObject(localVarHeaderParameter, "Authorization", configuration)


    
            localVarHeaderParameter['Content-Type'] = 'application/json';

            setSearchParams(localVarUrlObj, localVarQueryParameter);
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
            localVarRequestOptions.data = serializeDataIfNeeded(roleUpdate, localVarRequestOptions, configuration)

            return {
                url: toPathString(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
    }
};

/**
 * RoleApi - functional programming interface
 * @export
 */
export const RoleApiFp = function(configuration?: Configuration) {
    const localVarAxiosParamCreator = 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: string, roleName: string, requestBody: Array<string>, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.batchAddRolePermissions(orgName, roleName, requestBody, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['RoleApi.batchAddRolePermissions']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, 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: string, roleName: string, requestBody: Array<string>, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.batchRemoveRolePermissions(orgName, roleName, requestBody, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['RoleApi.batchRemoveRolePermissions']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, 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: string, roleCreate: RoleCreate, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Role>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.createRole(orgName, roleCreate, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['RoleApi.createRole']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, 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: string, roleName: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.deleteRoleByName(orgName, roleName, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['RoleApi.deleteRoleByName']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, 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: string, roleName: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Role>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.getRoleByName(orgName, roleName, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['RoleApi.getRoleByName']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * List all permissions
         * @summary List all permissions
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async listPermissions(options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<PermissionList>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.listPermissions(options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['RoleApi.listPermissions']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, 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: string, roleName: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<PermissionList>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.listRolePermissions(orgName, roleName, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['RoleApi.listRolePermissions']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, 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: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<RoleList>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.listRoles(orgName, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['RoleApi.listRoles']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, 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: string, roleName: string, roleUpdate: RoleUpdate, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Role>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.updateRoleByName(orgName, roleName, roleUpdate, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['RoleApi.updateRoleByName']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
    }
};

/**
 * RoleApi - factory interface
 * @export
 */
export const RoleApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
    const localVarFp = 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: RoleApiBatchAddRolePermissionsRequest, options?: RawAxiosRequestConfig): AxiosPromise<void> {
            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: RoleApiBatchRemoveRolePermissionsRequest, options?: RawAxiosRequestConfig): AxiosPromise<void> {
            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: RoleApiCreateRoleRequest, options?: RawAxiosRequestConfig): AxiosPromise<Role> {
            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: RoleApiDeleteRoleByNameRequest, options?: RawAxiosRequestConfig): AxiosPromise<void> {
            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: RoleApiGetRoleByNameRequest, options?: RawAxiosRequestConfig): AxiosPromise<Role> {
            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?: RawAxiosRequestConfig): AxiosPromise<PermissionList> {
            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: RoleApiListRolePermissionsRequest, options?: RawAxiosRequestConfig): AxiosPromise<PermissionList> {
            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: RoleApiListRolesRequest, options?: RawAxiosRequestConfig): AxiosPromise<RoleList> {
            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: RoleApiUpdateRoleByNameRequest, options?: RawAxiosRequestConfig): AxiosPromise<Role> {
            return localVarFp.updateRoleByName(requestParameters.orgName, requestParameters.roleName, requestParameters.roleUpdate, options).then((request) => request(axios, basePath));
        },
    };
};

/**
 * RoleApi - interface
 * @export
 * @interface RoleApi
 */
export interface RoleApiInterface {
    /**
     * 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 RoleApiInterface
     */
    batchAddRolePermissions(requestParameters: RoleApiBatchAddRolePermissionsRequest, options?: RawAxiosRequestConfig): AxiosPromise<void>;

    /**
     * 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 RoleApiInterface
     */
    batchRemoveRolePermissions(requestParameters: RoleApiBatchRemoveRolePermissionsRequest, options?: RawAxiosRequestConfig): AxiosPromise<void>;

    /**
     * Create role
     * @summary Create role
     * @param {RoleApiCreateRoleRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof RoleApiInterface
     */
    createRole(requestParameters: RoleApiCreateRoleRequest, options?: RawAxiosRequestConfig): AxiosPromise<Role>;

    /**
     * Delete role by name
     * @summary Delete role by name
     * @param {RoleApiDeleteRoleByNameRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof RoleApiInterface
     */
    deleteRoleByName(requestParameters: RoleApiDeleteRoleByNameRequest, options?: RawAxiosRequestConfig): AxiosPromise<void>;

    /**
     * Get role by name
     * @summary Get role by name
     * @param {RoleApiGetRoleByNameRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof RoleApiInterface
     */
    getRoleByName(requestParameters: RoleApiGetRoleByNameRequest, options?: RawAxiosRequestConfig): AxiosPromise<Role>;

    /**
     * List all permissions
     * @summary List all permissions
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof RoleApiInterface
     */
    listPermissions(options?: RawAxiosRequestConfig): AxiosPromise<PermissionList>;

    /**
     * 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 RoleApiInterface
     */
    listRolePermissions(requestParameters: RoleApiListRolePermissionsRequest, options?: RawAxiosRequestConfig): AxiosPromise<PermissionList>;

    /**
     * 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 RoleApiInterface
     */
    listRoles(requestParameters: RoleApiListRolesRequest, options?: RawAxiosRequestConfig): AxiosPromise<RoleList>;

    /**
     * Update role by name
     * @summary Update role by name
     * @param {RoleApiUpdateRoleByNameRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof RoleApiInterface
     */
    updateRoleByName(requestParameters: RoleApiUpdateRoleByNameRequest, options?: RawAxiosRequestConfig): AxiosPromise<Role>;

}

/**
 * Request parameters for batchAddRolePermissions operation in RoleApi.
 * @export
 * @interface RoleApiBatchAddRolePermissionsRequest
 */
export interface RoleApiBatchAddRolePermissionsRequest {
    /**
     * name of the Org
     * @type {string}
     * @memberof RoleApiBatchAddRolePermissions
     */
    readonly orgName: string

    /**
     * 
     * @type {string}
     * @memberof RoleApiBatchAddRolePermissions
     */
    readonly roleName: string

    /**
     * 
     * @type {Array<string>}
     * @memberof RoleApiBatchAddRolePermissions
     */
    readonly requestBody: Array<string>
}

/**
 * Request parameters for batchRemoveRolePermissions operation in RoleApi.
 * @export
 * @interface RoleApiBatchRemoveRolePermissionsRequest
 */
export interface RoleApiBatchRemoveRolePermissionsRequest {
    /**
     * name of the Org
     * @type {string}
     * @memberof RoleApiBatchRemoveRolePermissions
     */
    readonly orgName: string

    /**
     * 
     * @type {string}
     * @memberof RoleApiBatchRemoveRolePermissions
     */
    readonly roleName: string

    /**
     * 
     * @type {Array<string>}
     * @memberof RoleApiBatchRemoveRolePermissions
     */
    readonly requestBody: Array<string>
}

/**
 * Request parameters for createRole operation in RoleApi.
 * @export
 * @interface RoleApiCreateRoleRequest
 */
export interface RoleApiCreateRoleRequest {
    /**
     * name of the Org
     * @type {string}
     * @memberof RoleApiCreateRole
     */
    readonly orgName: string

    /**
     * 
     * @type {RoleCreate}
     * @memberof RoleApiCreateRole
     */
    readonly roleCreate: RoleCreate
}

/**
 * Request parameters for deleteRoleByName operation in RoleApi.
 * @export
 * @interface RoleApiDeleteRoleByNameRequest
 */
export interface RoleApiDeleteRoleByNameRequest {
    /**
     * name of the Org
     * @type {string}
     * @memberof RoleApiDeleteRoleByName
     */
    readonly orgName: string

    /**
     * 
     * @type {string}
     * @memberof RoleApiDeleteRoleByName
     */
    readonly roleName: string
}

/**
 * Request parameters for getRoleByName operation in RoleApi.
 * @export
 * @interface RoleApiGetRoleByNameRequest
 */
export interface RoleApiGetRoleByNameRequest {
    /**
     * name of the Org
     * @type {string}
     * @memberof RoleApiGetRoleByName
     */
    readonly orgName: string

    /**
     * 
     * @type {string}
     * @memberof RoleApiGetRoleByName
     */
    readonly roleName: string
}

/**
 * Request parameters for listRolePermissions operation in RoleApi.
 * @export
 * @interface RoleApiListRolePermissionsRequest
 */
export interface RoleApiListRolePermissionsRequest {
    /**
     * name of the Org
     * @type {string}
     * @memberof RoleApiListRolePermissions
     */
    readonly orgName: string

    /**
     * 
     * @type {string}
     * @memberof RoleApiListRolePermissions
     */
    readonly roleName: string
}

/**
 * Request parameters for listRoles operation in RoleApi.
 * @export
 * @interface RoleApiListRolesRequest
 */
export interface RoleApiListRolesRequest {
    /**
     * name of the Org
     * @type {string}
     * @memberof RoleApiListRoles
     */
    readonly orgName: string
}

/**
 * Request parameters for updateRoleByName operation in RoleApi.
 * @export
 * @interface RoleApiUpdateRoleByNameRequest
 */
export interface RoleApiUpdateRoleByNameRequest {
    /**
     * name of the Org
     * @type {string}
     * @memberof RoleApiUpdateRoleByName
     */
    readonly orgName: string

    /**
     * 
     * @type {string}
     * @memberof RoleApiUpdateRoleByName
     */
    readonly roleName: string

    /**
     * 
     * @type {RoleUpdate}
     * @memberof RoleApiUpdateRoleByName
     */
    readonly roleUpdate: RoleUpdate
}

/**
 * RoleApi - object-oriented interface
 * @export
 * @class RoleApi
 * @extends {BaseAPI}
 */
export class RoleApi extends BaseAPI implements RoleApiInterface {
    /**
     * 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
     */
    public batchAddRolePermissions(requestParameters: RoleApiBatchAddRolePermissionsRequest, options?: RawAxiosRequestConfig) {
        return 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
     */
    public batchRemoveRolePermissions(requestParameters: RoleApiBatchRemoveRolePermissionsRequest, options?: RawAxiosRequestConfig) {
        return 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
     */
    public createRole(requestParameters: RoleApiCreateRoleRequest, options?: RawAxiosRequestConfig) {
        return 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
     */
    public deleteRoleByName(requestParameters: RoleApiDeleteRoleByNameRequest, options?: RawAxiosRequestConfig) {
        return 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
     */
    public getRoleByName(requestParameters: RoleApiGetRoleByNameRequest, options?: RawAxiosRequestConfig) {
        return 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
     */
    public listPermissions(options?: RawAxiosRequestConfig) {
        return 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
     */
    public listRolePermissions(requestParameters: RoleApiListRolePermissionsRequest, options?: RawAxiosRequestConfig) {
        return 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
     */
    public listRoles(requestParameters: RoleApiListRolesRequest, options?: RawAxiosRequestConfig) {
        return 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
     */
    public updateRoleByName(requestParameters: RoleApiUpdateRoleByNameRequest, options?: RawAxiosRequestConfig) {
        return RoleApiFp(this.configuration).updateRoleByName(requestParameters.orgName, requestParameters.roleName, requestParameters.roleUpdate, options).then((request) => request(this.axios, this.basePath));
    }
}

