/* 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 { EventCreateRequestToJSON, EventResponseFromJSON, ReportErrorRequestToJSON, } from '../models/index.js';
/**
 *
 */
export class EventsApi extends runtime.BaseAPI {
    /**
     * Get tenant audit events
     */
    async getEventsRaw(requestParameters, initOverrides) {
        const queryParameters = {};
        if (requestParameters['limit'] != null) {
            queryParameters['limit'] = requestParameters['limit'];
        }
        if (requestParameters['offset'] != null) {
            queryParameters['offset'] = requestParameters['offset'];
        }
        if (requestParameters['user'] != null) {
            queryParameters['user'] = requestParameters['user'];
        }
        if (requestParameters['ip'] != null) {
            queryParameters['ip'] = requestParameters['ip'];
        }
        if (requestParameters['file'] != null) {
            queryParameters['file'] = requestParameters['file'];
        }
        if (requestParameters['invite'] != null) {
            queryParameters['invite'] = requestParameters['invite'];
        }
        if (requestParameters['device'] != null) {
            queryParameters['device'] = requestParameters['device'];
        }
        const headerParameters = {};
        const response = await this.request({
            path: `/events`,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(EventResponseFromJSON));
    }
    /**
     * Get tenant audit events
     */
    async getEvents(requestParameters = {}, initOverrides) {
        const response = await this.getEventsRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     * Client-side error reporting
     */
    async reportErrorRaw(requestParameters, initOverrides) {
        if (requestParameters['reportErrorRequest'] == null) {
            throw new runtime.RequiredError('reportErrorRequest', 'Required parameter "reportErrorRequest" was null or undefined when calling reportError().');
        }
        const queryParameters = {};
        const headerParameters = {};
        headerParameters['Content-Type'] = 'application/json';
        const response = await this.request({
            path: `/events/error`,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: ReportErrorRequestToJSON(requestParameters['reportErrorRequest']),
        }, initOverrides);
        return new runtime.VoidApiResponse(response);
    }
    /**
     * Client-side error reporting
     */
    async reportError(requestParameters, initOverrides) {
        await this.reportErrorRaw(requestParameters, initOverrides);
    }
    /**
     * Create an event entry
     */
    async reportEventRaw(requestParameters, initOverrides) {
        if (requestParameters['eventCreateRequest'] == null) {
            throw new runtime.RequiredError('eventCreateRequest', 'Required parameter "eventCreateRequest" was null or undefined when calling reportEvent().');
        }
        const queryParameters = {};
        const headerParameters = {};
        headerParameters['Content-Type'] = 'application/json';
        const response = await this.request({
            path: `/events`,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: EventCreateRequestToJSON(requestParameters['eventCreateRequest']),
        }, initOverrides);
        return new runtime.VoidApiResponse(response);
    }
    /**
     * Create an event entry
     */
    async reportEvent(requestParameters, initOverrides) {
        await this.reportEventRaw(requestParameters, initOverrides);
    }
}
