/* 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 { PaginatedRunFileList } from '../models';
// @ts-ignore
import type { PaginatedRunVerificationList } from '../models';
// @ts-ignore
import type { RunUsage } from '../models';
/**
 * RunOutputsApi - axios parameter creator
 */
export const RunOutputsApiAxiosParamCreator = function (configuration?: Configuration) {
    return {
        /**
         * Returns a paginated list of file-level diffs produced by the run, optionally filtered to a specific checkpoint.
         * @summary Retrieve Run Files
         * @param {string} id Unique run identifier (ULID).
         * @param {string} [checkpoint] Filter to a specific checkpoint ID. Omit to include all changes.
         * @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}
         */
        retrieveRunFiles: async (id: string, checkpoint?: string, pageLimit?: number, pageOffset?: number, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'id' is not null or undefined
            assertParamExists('retrieveRunFiles', 'id', id)
            const localVarPath = `/runs/{id}/files`
                .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 mTLS required
            await setApiKeyToObject(localVarHeaderParameter, "X-mTLS-Client-CN", configuration)

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

            if (checkpoint !== undefined) {
                localVarQueryParameter['checkpoint'] = checkpoint;
            }

            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 token and cost usage broken down by stage and model for a specific run.
         * @summary Retrieve Run Usage
         * @param {string} id Unique run identifier (ULID).
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        retrieveRunUsage: async (id: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'id' is not null or undefined
            assertParamExists('retrieveRunUsage', 'id', id)
            const localVarPath = `/runs/{id}/usage`
                .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 mTLS required
            await setApiKeyToObject(localVarHeaderParameter, "X-mTLS-Client-CN", configuration)

            // 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,
            };
        },
        /**
         * Returns verification results for a run, organized by criterion with individual control statuses.
         * @summary Retrieve Run Verification
         * @param {string} id Unique run identifier (ULID).
         * @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}
         */
        retrieveRunVerification: async (id: string, pageLimit?: number, pageOffset?: number, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'id' is not null or undefined
            assertParamExists('retrieveRunVerification', 'id', id)
            const localVarPath = `/runs/{id}/verification`
                .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 mTLS required
            await setApiKeyToObject(localVarHeaderParameter, "X-mTLS-Client-CN", configuration)

            // 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,
            };
        },
    }
};

/**
 * RunOutputsApi - functional programming interface
 */
export const RunOutputsApiFp = function(configuration?: Configuration) {
    const localVarAxiosParamCreator = RunOutputsApiAxiosParamCreator(configuration)
    return {
        /**
         * Returns a paginated list of file-level diffs produced by the run, optionally filtered to a specific checkpoint.
         * @summary Retrieve Run Files
         * @param {string} id Unique run identifier (ULID).
         * @param {string} [checkpoint] Filter to a specific checkpoint ID. Omit to include all changes.
         * @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 retrieveRunFiles(id: string, checkpoint?: string, pageLimit?: number, pageOffset?: number, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<PaginatedRunFileList>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.retrieveRunFiles(id, checkpoint, pageLimit, pageOffset, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['RunOutputsApi.retrieveRunFiles']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * Returns token and cost usage broken down by stage and model for a specific run.
         * @summary Retrieve Run Usage
         * @param {string} id Unique run identifier (ULID).
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async retrieveRunUsage(id: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<RunUsage>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.retrieveRunUsage(id, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['RunOutputsApi.retrieveRunUsage']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * Returns verification results for a run, organized by criterion with individual control statuses.
         * @summary Retrieve Run Verification
         * @param {string} id Unique run identifier (ULID).
         * @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 retrieveRunVerification(id: string, pageLimit?: number, pageOffset?: number, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<PaginatedRunVerificationList>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.retrieveRunVerification(id, pageLimit, pageOffset, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['RunOutputsApi.retrieveRunVerification']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
    }
};

/**
 * RunOutputsApi - factory interface
 */
export const RunOutputsApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
    const localVarFp = RunOutputsApiFp(configuration)
    return {
        /**
         * Returns a paginated list of file-level diffs produced by the run, optionally filtered to a specific checkpoint.
         * @summary Retrieve Run Files
         * @param {string} id Unique run identifier (ULID).
         * @param {string} [checkpoint] Filter to a specific checkpoint ID. Omit to include all changes.
         * @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}
         */
        retrieveRunFiles(id: string, checkpoint?: string, pageLimit?: number, pageOffset?: number, options?: RawAxiosRequestConfig): AxiosPromise<PaginatedRunFileList> {
            return localVarFp.retrieveRunFiles(id, checkpoint, pageLimit, pageOffset, options).then((request) => request(axios, basePath));
        },
        /**
         * Returns token and cost usage broken down by stage and model for a specific run.
         * @summary Retrieve Run Usage
         * @param {string} id Unique run identifier (ULID).
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        retrieveRunUsage(id: string, options?: RawAxiosRequestConfig): AxiosPromise<RunUsage> {
            return localVarFp.retrieveRunUsage(id, options).then((request) => request(axios, basePath));
        },
        /**
         * Returns verification results for a run, organized by criterion with individual control statuses.
         * @summary Retrieve Run Verification
         * @param {string} id Unique run identifier (ULID).
         * @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}
         */
        retrieveRunVerification(id: string, pageLimit?: number, pageOffset?: number, options?: RawAxiosRequestConfig): AxiosPromise<PaginatedRunVerificationList> {
            return localVarFp.retrieveRunVerification(id, pageLimit, pageOffset, options).then((request) => request(axios, basePath));
        },
    };
};

/**
 * RunOutputsApi - object-oriented interface
 */
export class RunOutputsApi extends BaseAPI {
    /**
     * Returns a paginated list of file-level diffs produced by the run, optionally filtered to a specific checkpoint.
     * @summary Retrieve Run Files
     * @param {string} id Unique run identifier (ULID).
     * @param {string} [checkpoint] Filter to a specific checkpoint ID. Omit to include all changes.
     * @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 retrieveRunFiles(id: string, checkpoint?: string, pageLimit?: number, pageOffset?: number, options?: RawAxiosRequestConfig) {
        return RunOutputsApiFp(this.configuration).retrieveRunFiles(id, checkpoint, pageLimit, pageOffset, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * Returns token and cost usage broken down by stage and model for a specific run.
     * @summary Retrieve Run Usage
     * @param {string} id Unique run identifier (ULID).
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    public retrieveRunUsage(id: string, options?: RawAxiosRequestConfig) {
        return RunOutputsApiFp(this.configuration).retrieveRunUsage(id, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * Returns verification results for a run, organized by criterion with individual control statuses.
     * @summary Retrieve Run Verification
     * @param {string} id Unique run identifier (ULID).
     * @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 retrieveRunVerification(id: string, pageLimit?: number, pageOffset?: number, options?: RawAxiosRequestConfig) {
        return RunOutputsApiFp(this.configuration).retrieveRunVerification(id, pageLimit, pageOffset, options).then((request) => request(this.axios, this.basePath));
    }
}

