/* tslint:disable */ /* eslint-disable */ /** * The Association for Cube Commons * The CubeCommons API caters to each and every whim of the Frontend, i.e. it receives, bundles, packages and formats data exactly as the Frontend needs it. * * The version of the OpenAPI document: 0.9.95 * Contact: tech@cubecommons.ca * * 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, AxiosRequestConfig } 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 } from '../common'; // @ts-ignore import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '../base'; // @ts-ignore import { ErrorResponse } from '../models'; // @ts-ignore import { FilesDetailsResponse } from '../models'; // @ts-ignore import { S3PresignedURLRequest } from '../models'; // @ts-ignore import { S3PresignedURLResponse } from '../models'; /** * CloudflareApi - axios parameter creator * @export */ export const CloudflareApiAxiosParamCreator = function (configuration?: Configuration) { return { /** * Get file details. * @summary Get file details * @param {string} fileId File ID * @param {*} [options] Override http request option. * @throws {RequiredError} */ fileDetails: async (fileId: string, options: AxiosRequestConfig = {}): Promise => { // verify required parameter 'fileId' is not null or undefined assertParamExists('fileDetails', 'fileId', fileId) const localVarPath = `/files/{fileId}` .replace(`{${"fileId"}}`, encodeURIComponent(String(fileId))); // 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 jwt_logged_in required // http bearer authentication required await setBearerAuthToObject(localVarHeaderParameter, configuration) setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Get S3 / R2 presigned url from Cloudflare * @summary Get S3 / R2 presigned url from Cloudflare * @param {S3PresignedURLRequest} s3PresignedURLRequest Add content * @param {*} [options] Override http request option. * @throws {RequiredError} */ uploadFilesViaPresignedUrl: async (s3PresignedURLRequest: S3PresignedURLRequest, options: AxiosRequestConfig = {}): Promise => { // verify required parameter 's3PresignedURLRequest' is not null or undefined assertParamExists('uploadFilesViaPresignedUrl', 's3PresignedURLRequest', s3PresignedURLRequest) const localVarPath = `/upload/s3-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 jwt_logged_in 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 = serializeDataIfNeeded(s3PresignedURLRequest, localVarRequestOptions, configuration) return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * This (and not it\'s return value!) has to be given directly to the TUS client as it\'s `endpoint` parameter. * @summary TUS \"endpoint\" to upload URL from Cloudflare * @param {string} uploadLength Upload Length * @param {string} [uploadMetadata] Upload Metadata * @param {*} [options] Override http request option. * @throws {RequiredError} */ uploadVideoTusEndpoint: async (uploadLength: string, uploadMetadata?: string, options: AxiosRequestConfig = {}): Promise => { // verify required parameter 'uploadLength' is not null or undefined assertParamExists('uploadVideoTusEndpoint', 'uploadLength', uploadLength) const localVarPath = `/upload/video-tus-reservation`; // 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 jwt_logged_in required // http bearer authentication required await setBearerAuthToObject(localVarHeaderParameter, configuration) if (uploadLength != null) { localVarHeaderParameter['upload-length'] = String(uploadLength); } if (uploadMetadata != null) { localVarHeaderParameter['upload-metadata'] = String(uploadMetadata); } setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, } }; /** * CloudflareApi - functional programming interface * @export */ export const CloudflareApiFp = function(configuration?: Configuration) { const localVarAxiosParamCreator = CloudflareApiAxiosParamCreator(configuration) return { /** * Get file details. * @summary Get file details * @param {string} fileId File ID * @param {*} [options] Override http request option. * @throws {RequiredError} */ async fileDetails(fileId: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.fileDetails(fileId, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * Get S3 / R2 presigned url from Cloudflare * @summary Get S3 / R2 presigned url from Cloudflare * @param {S3PresignedURLRequest} s3PresignedURLRequest Add content * @param {*} [options] Override http request option. * @throws {RequiredError} */ async uploadFilesViaPresignedUrl(s3PresignedURLRequest: S3PresignedURLRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.uploadFilesViaPresignedUrl(s3PresignedURLRequest, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * This (and not it\'s return value!) has to be given directly to the TUS client as it\'s `endpoint` parameter. * @summary TUS \"endpoint\" to upload URL from Cloudflare * @param {string} uploadLength Upload Length * @param {string} [uploadMetadata] Upload Metadata * @param {*} [options] Override http request option. * @throws {RequiredError} */ async uploadVideoTusEndpoint(uploadLength: string, uploadMetadata?: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.uploadVideoTusEndpoint(uploadLength, uploadMetadata, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, } }; /** * CloudflareApi - factory interface * @export */ export const CloudflareApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { const localVarFp = CloudflareApiFp(configuration) return { /** * Get file details. * @summary Get file details * @param {string} fileId File ID * @param {*} [options] Override http request option. * @throws {RequiredError} */ fileDetails(fileId: string, options?: any): AxiosPromise { return localVarFp.fileDetails(fileId, options).then((request) => request(axios, basePath)); }, /** * Get S3 / R2 presigned url from Cloudflare * @summary Get S3 / R2 presigned url from Cloudflare * @param {S3PresignedURLRequest} s3PresignedURLRequest Add content * @param {*} [options] Override http request option. * @throws {RequiredError} */ uploadFilesViaPresignedUrl(s3PresignedURLRequest: S3PresignedURLRequest, options?: any): AxiosPromise { return localVarFp.uploadFilesViaPresignedUrl(s3PresignedURLRequest, options).then((request) => request(axios, basePath)); }, /** * This (and not it\'s return value!) has to be given directly to the TUS client as it\'s `endpoint` parameter. * @summary TUS \"endpoint\" to upload URL from Cloudflare * @param {string} uploadLength Upload Length * @param {string} [uploadMetadata] Upload Metadata * @param {*} [options] Override http request option. * @throws {RequiredError} */ uploadVideoTusEndpoint(uploadLength: string, uploadMetadata?: string, options?: any): AxiosPromise { return localVarFp.uploadVideoTusEndpoint(uploadLength, uploadMetadata, options).then((request) => request(axios, basePath)); }, }; }; /** * CloudflareApi - interface * @export * @interface CloudflareApi */ export interface CloudflareApiInterface { /** * Get file details. * @summary Get file details * @param {string} fileId File ID * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof CloudflareApiInterface */ fileDetails(fileId: string, options?: AxiosRequestConfig): AxiosPromise; /** * Get S3 / R2 presigned url from Cloudflare * @summary Get S3 / R2 presigned url from Cloudflare * @param {S3PresignedURLRequest} s3PresignedURLRequest Add content * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof CloudflareApiInterface */ uploadFilesViaPresignedUrl(s3PresignedURLRequest: S3PresignedURLRequest, options?: AxiosRequestConfig): AxiosPromise; /** * This (and not it\'s return value!) has to be given directly to the TUS client as it\'s `endpoint` parameter. * @summary TUS \"endpoint\" to upload URL from Cloudflare * @param {string} uploadLength Upload Length * @param {string} [uploadMetadata] Upload Metadata * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof CloudflareApiInterface */ uploadVideoTusEndpoint(uploadLength: string, uploadMetadata?: string, options?: AxiosRequestConfig): AxiosPromise; } /** * CloudflareApi - object-oriented interface * @export * @class CloudflareApi * @extends {BaseAPI} */ export class CloudflareApi extends BaseAPI implements CloudflareApiInterface { /** * Get file details. * @summary Get file details * @param {string} fileId File ID * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof CloudflareApi */ public fileDetails(fileId: string, options?: AxiosRequestConfig) { return CloudflareApiFp(this.configuration).fileDetails(fileId, options).then((request) => request(this.axios, this.basePath)); } /** * Get S3 / R2 presigned url from Cloudflare * @summary Get S3 / R2 presigned url from Cloudflare * @param {S3PresignedURLRequest} s3PresignedURLRequest Add content * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof CloudflareApi */ public uploadFilesViaPresignedUrl(s3PresignedURLRequest: S3PresignedURLRequest, options?: AxiosRequestConfig) { return CloudflareApiFp(this.configuration).uploadFilesViaPresignedUrl(s3PresignedURLRequest, options).then((request) => request(this.axios, this.basePath)); } /** * This (and not it\'s return value!) has to be given directly to the TUS client as it\'s `endpoint` parameter. * @summary TUS \"endpoint\" to upload URL from Cloudflare * @param {string} uploadLength Upload Length * @param {string} [uploadMetadata] Upload Metadata * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof CloudflareApi */ public uploadVideoTusEndpoint(uploadLength: string, uploadMetadata?: string, options?: AxiosRequestConfig) { return CloudflareApiFp(this.configuration).uploadVideoTusEndpoint(uploadLength, uploadMetadata, options).then((request) => request(this.axios, this.basePath)); } }