/* tslint:disable */
/* eslint-disable */
/**
 * Hexiosec Transfer API
 * API description for Hexiosec Transfer  ## Testing Requests  Endpoints that require authentication will use your session cookie from the main application if an API key is not provided. This is fine for testing GET requests, however POST/DELETE requests will require a CSRF token when using a session cookie. It is not possible to provide a CSRF token from this page, and so an API key must be used.
 *
 * The version of the OpenAPI document: 0.0.1
 * Contact: support@hexiosec.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 * as runtime from '../runtime.js';
import { AdminUsersResponseFromJSON, AdminUsersUpdateRequestToJSON, } from '../models/index.js';
/**
 *
 */
export class AdminUsersApi extends runtime.BaseAPI {
    /**
     * Add user to group by ID
     */
    async addUserToGroupRaw(requestParameters, initOverrides) {
        if (requestParameters['id'] == null) {
            throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling addUserToGroup().');
        }
        if (requestParameters['groupId'] == null) {
            throw new runtime.RequiredError('groupId', 'Required parameter "groupId" was null or undefined when calling addUserToGroup().');
        }
        const queryParameters = {};
        const headerParameters = {};
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token('APIKey', []);
            if (tokenString) {
                headerParameters['Authorization'] = `Bearer ${tokenString}`;
            }
        }
        const response = await this.request({
            path: `/admin/users/{id}/groups/{group_id}`
                .replace(`{${'id'}}`, encodeURIComponent(String(requestParameters['id'])))
                .replace(`{${'group_id'}}`, encodeURIComponent(String(requestParameters['groupId']))),
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.VoidApiResponse(response);
    }
    /**
     * Add user to group by ID
     */
    async addUserToGroup(requestParameters, initOverrides) {
        await this.addUserToGroupRaw(requestParameters, initOverrides);
    }
    /**
     * Delete user
     */
    async deleteUserByIDRaw(requestParameters, initOverrides) {
        if (requestParameters['id'] == null) {
            throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling deleteUserByID().');
        }
        const queryParameters = {};
        const headerParameters = {};
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token('APIKey', []);
            if (tokenString) {
                headerParameters['Authorization'] = `Bearer ${tokenString}`;
            }
        }
        const response = await this.request({
            path: `/admin/users/{id}`.replace(`{${'id'}}`, encodeURIComponent(String(requestParameters['id']))),
            method: 'DELETE',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.VoidApiResponse(response);
    }
    /**
     * Delete user
     */
    async deleteUserByID(requestParameters, initOverrides) {
        await this.deleteUserByIDRaw(requestParameters, initOverrides);
    }
    /**
     * Get user
     */
    async getUserByIDRaw(requestParameters, initOverrides) {
        if (requestParameters['id'] == null) {
            throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling getUserByID().');
        }
        const queryParameters = {};
        if (requestParameters['expand'] != null) {
            queryParameters['expand'] = requestParameters['expand'];
        }
        const headerParameters = {};
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token('APIKey', []);
            if (tokenString) {
                headerParameters['Authorization'] = `Bearer ${tokenString}`;
            }
        }
        const response = await this.request({
            path: `/admin/users/{id}`.replace(`{${'id'}}`, encodeURIComponent(String(requestParameters['id']))),
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => AdminUsersResponseFromJSON(jsonValue));
    }
    /**
     * Get user
     */
    async getUserByID(requestParameters, initOverrides) {
        const response = await this.getUserByIDRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     * Get all users
     */
    async getUsersRaw(requestParameters, initOverrides) {
        const queryParameters = {};
        if (requestParameters['tenantId'] != null) {
            queryParameters['tenant_id'] = requestParameters['tenantId'];
        }
        if (requestParameters['groupId'] != null) {
            queryParameters['group_id'] = requestParameters['groupId'];
        }
        if (requestParameters['disabled'] != null) {
            queryParameters['disabled'] = requestParameters['disabled'];
        }
        const headerParameters = {};
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token('APIKey', []);
            if (tokenString) {
                headerParameters['Authorization'] = `Bearer ${tokenString}`;
            }
        }
        const response = await this.request({
            path: `/admin/users`,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(AdminUsersResponseFromJSON));
    }
    /**
     * Get all users
     */
    async getUsers(requestParameters = {}, initOverrides) {
        const response = await this.getUsersRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     * Remove user from group by ID
     */
    async removeUserFromGroupRaw(requestParameters, initOverrides) {
        if (requestParameters['id'] == null) {
            throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling removeUserFromGroup().');
        }
        if (requestParameters['groupId'] == null) {
            throw new runtime.RequiredError('groupId', 'Required parameter "groupId" was null or undefined when calling removeUserFromGroup().');
        }
        const queryParameters = {};
        const headerParameters = {};
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token('APIKey', []);
            if (tokenString) {
                headerParameters['Authorization'] = `Bearer ${tokenString}`;
            }
        }
        const response = await this.request({
            path: `/admin/users/{id}/groups/{group_id}`
                .replace(`{${'id'}}`, encodeURIComponent(String(requestParameters['id'])))
                .replace(`{${'group_id'}}`, encodeURIComponent(String(requestParameters['groupId']))),
            method: 'DELETE',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.VoidApiResponse(response);
    }
    /**
     * Remove user from group by ID
     */
    async removeUserFromGroup(requestParameters, initOverrides) {
        await this.removeUserFromGroupRaw(requestParameters, initOverrides);
    }
    /**
     * Update user
     */
    async updateUserByIDRaw(requestParameters, initOverrides) {
        if (requestParameters['id'] == null) {
            throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling updateUserByID().');
        }
        if (requestParameters['adminUsersUpdateRequest'] == null) {
            throw new runtime.RequiredError('adminUsersUpdateRequest', 'Required parameter "adminUsersUpdateRequest" was null or undefined when calling updateUserByID().');
        }
        const queryParameters = {};
        const headerParameters = {};
        headerParameters['Content-Type'] = 'application/json';
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token('APIKey', []);
            if (tokenString) {
                headerParameters['Authorization'] = `Bearer ${tokenString}`;
            }
        }
        const response = await this.request({
            path: `/admin/users/{id}`.replace(`{${'id'}}`, encodeURIComponent(String(requestParameters['id']))),
            method: 'PATCH',
            headers: headerParameters,
            query: queryParameters,
            body: AdminUsersUpdateRequestToJSON(requestParameters['adminUsersUpdateRequest']),
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => AdminUsersResponseFromJSON(jsonValue));
    }
    /**
     * Update user
     */
    async updateUserByID(requestParameters, initOverrides) {
        const response = await this.updateUserByIDRaw(requestParameters, initOverrides);
        return await response.value();
    }
}
/**
 * @export
 */
export const GetUserByIDExpandEnum = {
    BandwidthUsage: 'bandwidth_usage',
    ActiveSessions: 'active_sessions',
    Groups: 'groups',
};
