import type { AxiosInstance } from 'contentful-sdk-core' ; import copy from 'fast-copy' ; import { SetOptional } from 'type-fest' ; import { CollectionProp , GetSpaceEnvironmentParams , QueryParams } from '../../../common-types' ; import { CreateLocaleProps , LocaleProps } from '../../../entities/locale' ; import { RestEndpoint } from '../types' ; import * as raw from './raw' ; import { normalizeSelect } from './utils' ; export const get = ( http , params ) => { return raw . get < LocaleProps > ( http , `/spaces/${ params . spaceId }/environments/${ params . environmentId }/locales/${ params . localeId }` ) ; } ; export const getMany = ( http , params ) => { return raw . get < CollectionProp < LocaleProps > > ( http , `/spaces/${ params . spaceId }/environments/${ params . environmentId }/locales` , { params : normalizeSelect ( params . query ) , } ) ; } ; export const create = ( http , params , data , headers ? ) => { return raw . post < LocaleProps > ( http , `/spaces/${ params . spaceId }/environments/${ params . environmentId }/locales` , data , { headers , } ) ; } ; export const update = ( http , params , rawData , headers ? ) => { const data = copy ( rawData ) ; delete data . sys ; delete data . default ; return raw . put < LocaleProps > ( http , `/spaces/${ params . spaceId }/environments/${ params . environmentId }/locales/${ params . localeId }` , 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 }/locales/${ params . localeId }` ) ; } ;