/* tslint:disable */
/* eslint-disable */
/**
 * Fabro Run API
 * HTTP API for managing Fabro workflow run executions.
 *
 * The version of the OpenAPI document: 0.1.0
 * 
 *
 * 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, replaceWithSerializableTypeIfNeeded } from '../common';
// @ts-ignore
import { BASE_PATH, COLLECTION_FORMATS, type RequestArgs, BaseAPI, RequiredError, operationServerMap } from '../base';
// @ts-ignore
import type { ErrorResponse } from '../models';
// @ts-ignore
import type { ExecuteQueryRequest } from '../models';
// @ts-ignore
import type { ExecuteQueryResponse } from '../models';
// @ts-ignore
import type { PaginatedHistoryEntryList } from '../models';
// @ts-ignore
import type { PaginatedSavedQueryList } from '../models';
// @ts-ignore
import type { SaveQueryRequest } from '../models';
// @ts-ignore
import type { SavedQuery } from '../models';
/**
 * InsightsApi - axios parameter creator
 */
export const InsightsApiAxiosParamCreator = function (configuration?: Configuration) {
    return {
        /**
         * Saves a new named SQL query for later reuse.
         * @summary Create Saved Query
         * @param {SaveQueryRequest} saveQueryRequest 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        createSavedQuery: async (saveQueryRequest: SaveQueryRequest, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'saveQueryRequest' is not null or undefined
            assertParamExists('createSavedQuery', 'saveQueryRequest', saveQueryRequest)
            const localVarPath = `/api/v1/insights/queries`;
            // 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 SessionCookie required

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

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

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

            return {
                url: toPathString(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * Permanently removes a saved query.
         * @summary Delete Saved Query
         * @param {string} id Unique identifier of a saved query.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        deleteSavedQuery: async (id: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'id' is not null or undefined
            assertParamExists('deleteSavedQuery', 'id', id)
            const localVarPath = `/api/v1/insights/queries/{id}`
                .replace(`{${"id"}}`, encodeURIComponent(String(id)));
            // 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 SessionCookie required

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

            localVarHeaderParameter['Accept'] = 'application/json';

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

            return {
                url: toPathString(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * Executes an ad-hoc SQL query against the analytics database and returns columnar results.
         * @summary Execute Query
         * @param {ExecuteQueryRequest} executeQueryRequest 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        executeQuery: async (executeQueryRequest: ExecuteQueryRequest, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'executeQueryRequest' is not null or undefined
            assertParamExists('executeQuery', 'executeQueryRequest', executeQueryRequest)
            const localVarPath = `/api/v1/insights/execute`;
            // 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 SessionCookie required

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

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

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

            return {
                url: toPathString(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * Returns a paginated history of recently executed queries with timing and row counts.
         * @summary List Query History
         * @param {number} [pageLimit] Maximum number of items to return per page.
         * @param {number} [pageOffset] Number of items to skip before returning results.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listQueryHistory: async (pageLimit?: number, pageOffset?: number, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            const localVarPath = `/api/v1/insights/history`;
            // 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 SessionCookie required

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

            if (pageLimit !== undefined) {
                localVarQueryParameter['page[limit]'] = pageLimit;
            }

            if (pageOffset !== undefined) {
                localVarQueryParameter['page[offset]'] = pageOffset;
            }

            localVarHeaderParameter['Accept'] = 'application/json';

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

            return {
                url: toPathString(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * Returns a paginated list of saved SQL queries for the insights editor.
         * @summary List Saved Queries
         * @param {number} [pageLimit] Maximum number of items to return per page.
         * @param {number} [pageOffset] Number of items to skip before returning results.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listSavedQueries: async (pageLimit?: number, pageOffset?: number, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            const localVarPath = `/api/v1/insights/queries`;
            // 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 SessionCookie required

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

            if (pageLimit !== undefined) {
                localVarQueryParameter['page[limit]'] = pageLimit;
            }

            if (pageOffset !== undefined) {
                localVarQueryParameter['page[offset]'] = pageOffset;
            }

            localVarHeaderParameter['Accept'] = 'application/json';

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

            return {
                url: toPathString(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * Returns a single saved query by ID.
         * @summary Retrieve Saved Query
         * @param {string} id Unique identifier of a saved query.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        retrieveSavedQuery: async (id: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'id' is not null or undefined
            assertParamExists('retrieveSavedQuery', 'id', id)
            const localVarPath = `/api/v1/insights/queries/{id}`
                .replace(`{${"id"}}`, encodeURIComponent(String(id)));
            // 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 SessionCookie required

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

            localVarHeaderParameter['Accept'] = 'application/json';

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

            return {
                url: toPathString(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * Replaces the name and SQL of an existing saved query.
         * @summary Update Saved Query
         * @param {string} id Unique identifier of a saved query.
         * @param {SaveQueryRequest} saveQueryRequest 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        updateSavedQuery: async (id: string, saveQueryRequest: SaveQueryRequest, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'id' is not null or undefined
            assertParamExists('updateSavedQuery', 'id', id)
            // verify required parameter 'saveQueryRequest' is not null or undefined
            assertParamExists('updateSavedQuery', 'saveQueryRequest', saveQueryRequest)
            const localVarPath = `/api/v1/insights/queries/{id}`
                .replace(`{${"id"}}`, encodeURIComponent(String(id)));
            // 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: 'PUT', ...baseOptions, ...options};
            const localVarHeaderParameter = {} as any;
            const localVarQueryParameter = {} as any;

            // authentication SessionCookie required

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

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

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

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

/**
 * InsightsApi - functional programming interface
 */
export const InsightsApiFp = function(configuration?: Configuration) {
    const localVarAxiosParamCreator = InsightsApiAxiosParamCreator(configuration)
    return {
        /**
         * Saves a new named SQL query for later reuse.
         * @summary Create Saved Query
         * @param {SaveQueryRequest} saveQueryRequest 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async createSavedQuery(saveQueryRequest: SaveQueryRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<SavedQuery>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.createSavedQuery(saveQueryRequest, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['InsightsApi.createSavedQuery']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * Permanently removes a saved query.
         * @summary Delete Saved Query
         * @param {string} id Unique identifier of a saved query.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async deleteSavedQuery(id: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.deleteSavedQuery(id, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['InsightsApi.deleteSavedQuery']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * Executes an ad-hoc SQL query against the analytics database and returns columnar results.
         * @summary Execute Query
         * @param {ExecuteQueryRequest} executeQueryRequest 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async executeQuery(executeQueryRequest: ExecuteQueryRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ExecuteQueryResponse>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.executeQuery(executeQueryRequest, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['InsightsApi.executeQuery']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * Returns a paginated history of recently executed queries with timing and row counts.
         * @summary List Query History
         * @param {number} [pageLimit] Maximum number of items to return per page.
         * @param {number} [pageOffset] Number of items to skip before returning results.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async listQueryHistory(pageLimit?: number, pageOffset?: number, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<PaginatedHistoryEntryList>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.listQueryHistory(pageLimit, pageOffset, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['InsightsApi.listQueryHistory']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * Returns a paginated list of saved SQL queries for the insights editor.
         * @summary List Saved Queries
         * @param {number} [pageLimit] Maximum number of items to return per page.
         * @param {number} [pageOffset] Number of items to skip before returning results.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async listSavedQueries(pageLimit?: number, pageOffset?: number, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<PaginatedSavedQueryList>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.listSavedQueries(pageLimit, pageOffset, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['InsightsApi.listSavedQueries']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * Returns a single saved query by ID.
         * @summary Retrieve Saved Query
         * @param {string} id Unique identifier of a saved query.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async retrieveSavedQuery(id: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<SavedQuery>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.retrieveSavedQuery(id, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['InsightsApi.retrieveSavedQuery']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * Replaces the name and SQL of an existing saved query.
         * @summary Update Saved Query
         * @param {string} id Unique identifier of a saved query.
         * @param {SaveQueryRequest} saveQueryRequest 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async updateSavedQuery(id: string, saveQueryRequest: SaveQueryRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<SavedQuery>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.updateSavedQuery(id, saveQueryRequest, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['InsightsApi.updateSavedQuery']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
    }
};

/**
 * InsightsApi - factory interface
 */
export const InsightsApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
    const localVarFp = InsightsApiFp(configuration)
    return {
        /**
         * Saves a new named SQL query for later reuse.
         * @summary Create Saved Query
         * @param {SaveQueryRequest} saveQueryRequest 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        createSavedQuery(saveQueryRequest: SaveQueryRequest, options?: RawAxiosRequestConfig): AxiosPromise<SavedQuery> {
            return localVarFp.createSavedQuery(saveQueryRequest, options).then((request) => request(axios, basePath));
        },
        /**
         * Permanently removes a saved query.
         * @summary Delete Saved Query
         * @param {string} id Unique identifier of a saved query.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        deleteSavedQuery(id: string, options?: RawAxiosRequestConfig): AxiosPromise<void> {
            return localVarFp.deleteSavedQuery(id, options).then((request) => request(axios, basePath));
        },
        /**
         * Executes an ad-hoc SQL query against the analytics database and returns columnar results.
         * @summary Execute Query
         * @param {ExecuteQueryRequest} executeQueryRequest 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        executeQuery(executeQueryRequest: ExecuteQueryRequest, options?: RawAxiosRequestConfig): AxiosPromise<ExecuteQueryResponse> {
            return localVarFp.executeQuery(executeQueryRequest, options).then((request) => request(axios, basePath));
        },
        /**
         * Returns a paginated history of recently executed queries with timing and row counts.
         * @summary List Query History
         * @param {number} [pageLimit] Maximum number of items to return per page.
         * @param {number} [pageOffset] Number of items to skip before returning results.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listQueryHistory(pageLimit?: number, pageOffset?: number, options?: RawAxiosRequestConfig): AxiosPromise<PaginatedHistoryEntryList> {
            return localVarFp.listQueryHistory(pageLimit, pageOffset, options).then((request) => request(axios, basePath));
        },
        /**
         * Returns a paginated list of saved SQL queries for the insights editor.
         * @summary List Saved Queries
         * @param {number} [pageLimit] Maximum number of items to return per page.
         * @param {number} [pageOffset] Number of items to skip before returning results.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listSavedQueries(pageLimit?: number, pageOffset?: number, options?: RawAxiosRequestConfig): AxiosPromise<PaginatedSavedQueryList> {
            return localVarFp.listSavedQueries(pageLimit, pageOffset, options).then((request) => request(axios, basePath));
        },
        /**
         * Returns a single saved query by ID.
         * @summary Retrieve Saved Query
         * @param {string} id Unique identifier of a saved query.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        retrieveSavedQuery(id: string, options?: RawAxiosRequestConfig): AxiosPromise<SavedQuery> {
            return localVarFp.retrieveSavedQuery(id, options).then((request) => request(axios, basePath));
        },
        /**
         * Replaces the name and SQL of an existing saved query.
         * @summary Update Saved Query
         * @param {string} id Unique identifier of a saved query.
         * @param {SaveQueryRequest} saveQueryRequest 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        updateSavedQuery(id: string, saveQueryRequest: SaveQueryRequest, options?: RawAxiosRequestConfig): AxiosPromise<SavedQuery> {
            return localVarFp.updateSavedQuery(id, saveQueryRequest, options).then((request) => request(axios, basePath));
        },
    };
};

/**
 * InsightsApi - object-oriented interface
 */
export class InsightsApi extends BaseAPI {
    /**
     * Saves a new named SQL query for later reuse.
     * @summary Create Saved Query
     * @param {SaveQueryRequest} saveQueryRequest 
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    public createSavedQuery(saveQueryRequest: SaveQueryRequest, options?: RawAxiosRequestConfig) {
        return InsightsApiFp(this.configuration).createSavedQuery(saveQueryRequest, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * Permanently removes a saved query.
     * @summary Delete Saved Query
     * @param {string} id Unique identifier of a saved query.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    public deleteSavedQuery(id: string, options?: RawAxiosRequestConfig) {
        return InsightsApiFp(this.configuration).deleteSavedQuery(id, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * Executes an ad-hoc SQL query against the analytics database and returns columnar results.
     * @summary Execute Query
     * @param {ExecuteQueryRequest} executeQueryRequest 
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    public executeQuery(executeQueryRequest: ExecuteQueryRequest, options?: RawAxiosRequestConfig) {
        return InsightsApiFp(this.configuration).executeQuery(executeQueryRequest, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * Returns a paginated history of recently executed queries with timing and row counts.
     * @summary List Query History
     * @param {number} [pageLimit] Maximum number of items to return per page.
     * @param {number} [pageOffset] Number of items to skip before returning results.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    public listQueryHistory(pageLimit?: number, pageOffset?: number, options?: RawAxiosRequestConfig) {
        return InsightsApiFp(this.configuration).listQueryHistory(pageLimit, pageOffset, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * Returns a paginated list of saved SQL queries for the insights editor.
     * @summary List Saved Queries
     * @param {number} [pageLimit] Maximum number of items to return per page.
     * @param {number} [pageOffset] Number of items to skip before returning results.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    public listSavedQueries(pageLimit?: number, pageOffset?: number, options?: RawAxiosRequestConfig) {
        return InsightsApiFp(this.configuration).listSavedQueries(pageLimit, pageOffset, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * Returns a single saved query by ID.
     * @summary Retrieve Saved Query
     * @param {string} id Unique identifier of a saved query.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    public retrieveSavedQuery(id: string, options?: RawAxiosRequestConfig) {
        return InsightsApiFp(this.configuration).retrieveSavedQuery(id, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * Replaces the name and SQL of an existing saved query.
     * @summary Update Saved Query
     * @param {string} id Unique identifier of a saved query.
     * @param {SaveQueryRequest} saveQueryRequest 
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    public updateSavedQuery(id: string, saveQueryRequest: SaveQueryRequest, options?: RawAxiosRequestConfig) {
        return InsightsApiFp(this.configuration).updateSavedQuery(id, saveQueryRequest, options).then((request) => request(this.axios, this.basePath));
    }
}

