/* tslint:disable */ /* eslint-disable */ /** * Credify API doc version 1 * API documentations version 1. * * The version of the OpenAPI document: 1.0.0-oas3 * Contact: dev@credify.one * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import globalAxios, { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios'; import { Configuration } from '../configuration'; // Some imports not used depending on template conditions // @ts-ignore import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '../common'; // @ts-ignore import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '../base'; // @ts-ignore import { FileUploadResponse } from '../model'; // @ts-ignore import { PresignURLRequest } from '../model'; // @ts-ignore import { PresignURLResponse } from '../model'; /** * StorageApi - axios parameter creator * @export */ export const StorageApiAxiosParamCreator = function (configuration?: Configuration) { return { /** * This generates a pre-signed URL for file uploading. * @summary Pre-sign URL * @param {PresignURLRequest} presignURLRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ generatePresignedUrl: async (presignURLRequest: PresignURLRequest, options: AxiosRequestConfig = {}): Promise => { // verify required parameter 'presignURLRequest' is not null or undefined assertParamExists('generatePresignedUrl', 'presignURLRequest', presignURLRequest) const localVarPath = `/v1/presigned-url`; // 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 bearerAuth required // http bearer authentication required await setBearerAuthToObject(localVarHeaderParameter, configuration) localVarHeaderParameter['Content-Type'] = 'application/json'; setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = presignURLRequest return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * This uploads a file. * @summary Upload file * @param {string} [referenceId] Presigned URL reference. This is generated in the presign URL API. * @param {any} [fileName] * @param {*} [options] Override http request option. * @throws {RequiredError} */ uploadFile: async (referenceId?: string, fileName?: any, options: AxiosRequestConfig = {}): Promise => { const localVarPath = `/v1/upload`; // 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; const localVarFormParams = new ((configuration && configuration.formDataCtor) || FormData)(); // authentication bearerAuth required // http bearer authentication required await setBearerAuthToObject(localVarHeaderParameter, configuration) if (referenceId !== undefined) { localVarFormParams.append('reference_id', referenceId as any); } if (fileName !== undefined) { localVarFormParams.append('file_name', fileName as any); } localVarHeaderParameter['Content-Type'] = 'multipart/form-data'; setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = localVarFormParams; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, } }; /** * StorageApi - functional programming interface * @export */ export const StorageApiFp = function(configuration?: Configuration) { const localVarAxiosParamCreator = StorageApiAxiosParamCreator(configuration) return { /** * This generates a pre-signed URL for file uploading. * @summary Pre-sign URL * @param {PresignURLRequest} presignURLRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ async generatePresignedUrl(presignURLRequest: PresignURLRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.generatePresignedUrl(presignURLRequest, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * This uploads a file. * @summary Upload file * @param {string} [referenceId] Presigned URL reference. This is generated in the presign URL API. * @param {any} [fileName] * @param {*} [options] Override http request option. * @throws {RequiredError} */ async uploadFile(referenceId?: string, fileName?: any, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.uploadFile(referenceId, fileName, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, } }; /** * StorageApi - factory interface * @export */ export const StorageApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { const localVarFp = StorageApiFp(configuration) return { /** * This generates a pre-signed URL for file uploading. * @summary Pre-sign URL * @param {PresignURLRequest} presignURLRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ generatePresignedUrl(presignURLRequest: PresignURLRequest, options?: any): AxiosPromise { return localVarFp.generatePresignedUrl(presignURLRequest, options).then((request) => request(axios, basePath)); }, /** * This uploads a file. * @summary Upload file * @param {string} [referenceId] Presigned URL reference. This is generated in the presign URL API. * @param {any} [fileName] * @param {*} [options] Override http request option. * @throws {RequiredError} */ uploadFile(referenceId?: string, fileName?: any, options?: any): AxiosPromise { return localVarFp.uploadFile(referenceId, fileName, options).then((request) => request(axios, basePath)); }, }; }; /** * StorageApi - interface * @export * @interface StorageApi */ export interface StorageApiInterface { /** * This generates a pre-signed URL for file uploading. * @summary Pre-sign URL * @param {PresignURLRequest} presignURLRequest * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof StorageApiInterface */ generatePresignedUrl(presignURLRequest: PresignURLRequest, options?: AxiosRequestConfig): AxiosPromise; /** * This uploads a file. * @summary Upload file * @param {string} [referenceId] Presigned URL reference. This is generated in the presign URL API. * @param {any} [fileName] * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof StorageApiInterface */ uploadFile(referenceId?: string, fileName?: any, options?: AxiosRequestConfig): AxiosPromise; } /** * StorageApi - object-oriented interface * @export * @class StorageApi * @extends {BaseAPI} */ export class StorageApi extends BaseAPI implements StorageApiInterface { /** * This generates a pre-signed URL for file uploading. * @summary Pre-sign URL * @param {PresignURLRequest} presignURLRequest * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof StorageApi */ public generatePresignedUrl(presignURLRequest: PresignURLRequest, options?: AxiosRequestConfig) { return StorageApiFp(this.configuration).generatePresignedUrl(presignURLRequest, options).then((request) => request(this.axios, this.basePath)); } /** * This uploads a file. * @summary Upload file * @param {string} [referenceId] Presigned URL reference. This is generated in the presign URL API. * @param {any} [fileName] * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof StorageApi */ public uploadFile(referenceId?: string, fileName?: any, options?: AxiosRequestConfig) { return StorageApiFp(this.configuration).uploadFile(referenceId, fileName, options).then((request) => request(this.axios, this.basePath)); } }