/* 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 { RunBilling } from '../models';
/**
 * RunOutputsApi - axios parameter creator
 */
export const RunOutputsApiAxiosParamCreator = function (configuration?: Configuration) {
    return {
        /**
         * Returns token counts and billed totals broken down by stage and model for a specific run.
         * @summary Retrieve Run Billing
         * @param {string} id Unique run identifier (ULID).
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        retrieveRunBilling: async (id: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'id' is not null or undefined
            assertParamExists('retrieveRunBilling', 'id', id)
            const localVarPath = `/api/v1/runs/{id}/billing`
                .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,
            };
        },
    }
};

/**
 * RunOutputsApi - functional programming interface
 */
export const RunOutputsApiFp = function(configuration?: Configuration) {
    const localVarAxiosParamCreator = RunOutputsApiAxiosParamCreator(configuration)
    return {
        /**
         * Returns token counts and billed totals broken down by stage and model for a specific run.
         * @summary Retrieve Run Billing
         * @param {string} id Unique run identifier (ULID).
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async retrieveRunBilling(id: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<RunBilling>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.retrieveRunBilling(id, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['RunOutputsApi.retrieveRunBilling']?.[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 token counts and billed totals broken down by stage and model for a specific run.
         * @summary Retrieve Run Billing
         * @param {string} id Unique run identifier (ULID).
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        retrieveRunBilling(id: string, options?: RawAxiosRequestConfig): AxiosPromise<RunBilling> {
            return localVarFp.retrieveRunBilling(id, options).then((request) => request(axios, basePath));
        },
    };
};

/**
 * RunOutputsApi - object-oriented interface
 */
export class RunOutputsApi extends BaseAPI {
    /**
     * Returns token counts and billed totals broken down by stage and model for a specific run.
     * @summary Retrieve Run Billing
     * @param {string} id Unique run identifier (ULID).
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    public retrieveRunBilling(id: string, options?: RawAxiosRequestConfig) {
        return RunOutputsApiFp(this.configuration).retrieveRunBilling(id, options).then((request) => request(this.axios, this.basePath));
    }
}

