/* tslint:disable */
/* eslint-disable */
/**
 * UCX Proxy
 * A single use API for the UCX Proxy.
 *
 * The version of the OpenAPI document: 0.0.12
 * Contact: customersuccess@equisoft.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';
import type {
  ErrorSchema,
  SourceSchema,
} from '../models/index';
import {
    ErrorSchemaFromJSON,
    ErrorSchemaToJSON,
    SourceSchemaFromJSON,
    SourceSchemaToJSON,
} from '../models/index';

/**
 * 
 */
export class SourceApi extends runtime.BaseAPI {

    /**
     * Creates request options for listSources without sending the request
     */
    async listSourcesRequestOpts(): Promise<runtime.RequestOpts> {
        const queryParameters: any = {};

        const headerParameters: runtime.HTTPHeaders = {};

        if (this.configuration && this.configuration.accessToken) {
            // oauth required
            const token = this.configuration.accessToken;
            const tokenString = await token("default", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }


        let urlPath = `/sources/available`;

        return {
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        };
    }

    /**
     * Get all sources
     */
    async listSourcesRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<SourceSchema>>> {
        const requestOptions = await this.listSourcesRequestOpts();
        const response = await this.request(requestOptions, initOverrides);

        return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(SourceSchemaFromJSON));
    }

    /**
     * Get all sources
     */
    async listSources(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<SourceSchema>> {
        const response = await this.listSourcesRaw(initOverrides);
        return await response.value();
    }

}
