import type { AxiosInstance } from 'contentful-sdk-core' ; import copy from 'fast-copy' ; import { SetOptional } from 'type-fest' ; import { CollectionProp , GetSpaceParams , QueryParams } from '../../../common-types' ; import { SpaceProps } from '../../../entities/space' ; import { RestEndpoint } from '../types' ; import * as raw from './raw' ; export const get = ( http , params ) => raw . get < SpaceProps > ( http , `/spaces/${ params . spaceId }` ) ; export const getMany = ( http , params ) => raw . get < CollectionProp < SpaceProps > > ( http , `/spaces` , { params : params . query , } ) ; export const create = ( http , params , payload , headers ? ) => { return raw . post ( http , `/spaces` , payload , { headers : params . organizationId ? { ... headers , 'X-Contentful-Organization' : params . organizationId } : headers , } ) ; } ; export const update = ( http , params , rawData , headers ? ) => { const data = copy ( rawData ) ; delete data . sys ; return raw . put < SpaceProps > ( http , `/spaces/${ params . spaceId }` , data , { headers : { 'X-Contentful-Version' : rawData . sys . version ?? 0 , ... headers , } , } ) ; } ; export const del = ( http , params ) => raw . del ( http , `/spaces/${ params . spaceId }` ) ;