import type { AxiosInstance } from 'contentful-sdk-core' ; import copy from 'fast-copy' ; import { SetOptional } from 'type-fest' ; import { CollectionProp , GetSpaceEnvironmentParams , GetSpaceParams , PaginationQueryParams , } from '../../../common-types' ; import { CreateEnvironmentProps , EnvironmentProps } from '../../../entities/environment' ; import { RestEndpoint } from '../types' ; import * as raw from './raw' ; export const get = ( http , params ) => { return raw . get < EnvironmentProps > ( http , `/spaces/${ params . spaceId }/environments/${ params . environmentId }` ) ; } ; export const getMany = ( http , params ) => { return raw . get < CollectionProp < EnvironmentProps > > ( http , `/spaces/${ params . spaceId }/environments` , { params : params . query , } ) ; } ; export const update = ( http , params , rawData , headers ? ) => { const data = copy ( rawData ) ; delete data . sys ; return raw . put < EnvironmentProps > ( http , `/spaces/${ params . spaceId }/environments/${ params . environmentId }` , data , { headers : { ... headers , 'X-Contentful-Version' : rawData . sys . version ?? 0 , } , } ) ; } ; export const del = ( http , params ) => { return raw . del ( http , `/spaces/${ params . spaceId }/environments/${ params . environmentId }` ) ; } ; export const create = ( http , params , rawData , headers ? ) => { const data = copy ( rawData ) ; return raw . post < EnvironmentProps > ( http , `/spaces/${ params . spaceId }/environments` , data , { headers , } ) ; } ; export const createWithId = ( http , params , rawData , headers ? ) => { const data = copy ( rawData ) ; return raw . put < EnvironmentProps > ( http , `/spaces/${ params . spaceId }/environments/${ params . environmentId }` , data , { headers : { ... headers , ... ( params . sourceEnvironmentId ? { 'X-Contentful-Source-Environment' : params . sourceEnvironmentId , } : { } ) , } , } ) ; } ;