UNPKG

@vectorize-io/vectorize-client

Version:
93 lines (78 loc) 3.15 kB
/* tslint:disable */ /* eslint-disable */ /** * Vectorize API * API for Vectorize services (Beta) * * The version of the OpenAPI document: 0.1.2 * * * 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 { GetWorkspaces400Response, StartFileUploadRequest, StartFileUploadResponse, } from '../models/index'; import { GetWorkspaces400ResponseFromJSON, GetWorkspaces400ResponseToJSON, StartFileUploadRequestFromJSON, StartFileUploadRequestToJSON, StartFileUploadResponseFromJSON, StartFileUploadResponseToJSON, } from '../models/index'; export interface StartFileUploadOperationRequest { organizationId: string; startFileUploadRequest: StartFileUploadRequest; } /** * */ export class FilesApi extends runtime.BaseAPI { /** * Upload a generic file to the platform */ async startFileUploadRaw(requestParameters: StartFileUploadOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<StartFileUploadResponse>> { if (requestParameters['organizationId'] == null) { throw new runtime.RequiredError( 'organizationId', 'Required parameter "organizationId" was null or undefined when calling startFileUpload().' ); } if (requestParameters['startFileUploadRequest'] == null) { throw new runtime.RequiredError( 'startFileUploadRequest', 'Required parameter "startFileUploadRequest" was null or undefined when calling startFileUpload().' ); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("bearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } const response = await this.request({ path: `/org/{organizationId}/files`.replace(`{${"organizationId"}}`, encodeURIComponent(String(requestParameters['organizationId']))), method: 'POST', headers: headerParameters, query: queryParameters, body: StartFileUploadRequestToJSON(requestParameters['startFileUploadRequest']), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => StartFileUploadResponseFromJSON(jsonValue)); } /** * Upload a generic file to the platform */ async startFileUpload(requestParameters: StartFileUploadOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<StartFileUploadResponse> { const response = await this.startFileUploadRaw(requestParameters, initOverrides); return await response.value(); } }