import type { AxiosInstance } from 'contentful-sdk-core' ; import copy from 'fast-copy' ; import { SetOptional } from 'type-fest' ; import { CollectionProp , GetSpaceEnvAliasParams , GetSpaceParams , PaginationQueryParams , } from '../../../common-types' ; import { CreateEnvironmentAliasProps , EnvironmentAliasProps , } from '../../../entities/environment-alias' ; import { RestEndpoint } from '../types' ; import * as raw from './raw' ; /**
 * Urls
 */ const getBaseUrl = ( params ) => `/spaces/${ params . spaceId }/environment_aliases` ; const getEnvironmentAliasUrl = ( params ) => getBaseUrl ( params ) + `/${ params . environmentAliasId }` ; /**
 * Endpoints
 */ export const get = ( http , params ) => { return raw . get < EnvironmentAliasProps > ( http , getEnvironmentAliasUrl ( params ) ) ; } ; export const getMany = ( http , params ) => { return raw . get < CollectionProp < EnvironmentAliasProps > > ( http , getBaseUrl ( params ) , { params : params . query , } ) ; } ; export const createWithId = ( http , params , rawData , headers ? ) => { const data = copy ( rawData ) ; return raw . put < EnvironmentAliasProps > ( http , getEnvironmentAliasUrl ( params ) , data , { headers : headers , } ) ; } ; export const update = ( http , params , rawData , headers ? ) => { const data = copy ( rawData ) ; delete data . sys ; return raw . put < EnvironmentAliasProps > ( http , getEnvironmentAliasUrl ( params ) , data , { headers : { ... headers , 'X-Contentful-Version' : rawData . sys . version ?? 0 , } , } ) ; } ; export const del = ( http , params ) => { return raw . del ( http , getEnvironmentAliasUrl ( params ) ) ; } ;