import type { AxiosInstance } from 'contentful-sdk-core' ; import { Stream } from 'stream' ; import { GetSpaceParams } from '../../../common-types' ; import { getUploadHttpClient } from '../../../upload-http-client' ; import { RestEndpoint } from '../types' ; import * as raw from './raw' ; export const create = ( http , params , data ) => { const httpUpload = getUploadHttpClient ( http ) ; const { file } = data ; if ( ! file ) { return Promise . reject ( new Error ( 'Unable to locate a file to upload.' ) ) ; } return raw . post ( httpUpload , `/spaces/${ params . spaceId }/uploads` , file , { headers : { 'Content-Type' : 'application/octet-stream' , } , } ) ; } ; export const del = ( http , params ) => { const httpUpload = getUploadHttpClient ( http ) ; return raw . del ( httpUpload , `/spaces/${ params . spaceId }/uploads/${ params . uploadId }` ) ; } ; export const get = ( http , params ) => { const httpUpload = getUploadHttpClient ( http ) ; return raw . get ( httpUpload , `/spaces/${ params . spaceId }/uploads/${ params . uploadId }` ) ; } ;