import type { AxiosInstance } from 'contentful-sdk-core' ; import copy from 'fast-copy' ; import { SetOptional } from 'type-fest' ; import { CollectionProp , GetOrganizationParams , GetSpaceMembershipProps , GetSpaceParams , QueryParams , } from '../../../common-types' ; import { CreateSpaceMembershipProps , SpaceMembershipProps , } from '../../../entities/space-membership' ; import { RestEndpoint } from '../types' ; import * as raw from './raw' ; function spaceMembershipDeprecationWarning ( ) { console . warn ( 'The user attribute in the space membership root is deprecated. The attribute has been moved inside the sys  object (i.e. sys.user)' ) ; } const getBaseUrl = ( params ) => `/spaces/${ params . spaceId }/space_memberships` ; const getEntityUrl = ( params ) => `${ getBaseUrl ( params ) }/${ params . spaceMembershipId }` ; export const get = ( http , params ) => { spaceMembershipDeprecationWarning ( ) ; return raw . get < SpaceMembershipProps > ( http , getEntityUrl ( params ) ) ; } ; export const getMany = ( http , params ) => { spaceMembershipDeprecationWarning ( ) ; return raw . get < CollectionProp < SpaceMembershipProps > > ( http , getBaseUrl ( params ) , { params : params . query , } ) ; } ; export const getForOrganization = ( http , params ) => { return raw . get < SpaceMembershipProps > ( http , `/organizations/${ params . organizationId }/space_memberships/${ params . spaceMembershipId }` ) ; } ; export const getManyForOrganization = ( http , params ) => { return raw . get < CollectionProp < SpaceMembershipProps > > ( http , `/organizations/${ params . organizationId }/space_memberships` , { params : params . query , } ) ; } ; export const create = ( http , params , data , headers ? ) => { spaceMembershipDeprecationWarning ( ) ; return raw . post < SpaceMembershipProps > ( http , getBaseUrl ( params ) , data , { headers , } ) ; } ; export const createWithId = ( http , params , data , headers ? ) => { spaceMembershipDeprecationWarning ( ) ; return raw . put < SpaceMembershipProps > ( http , getEntityUrl ( params ) , data , { headers , } ) ; } ; export const update = ( http , params , rawData , headers ? ) => { const data = copy ( rawData ) ; delete data . sys ; return raw . put < SpaceMembershipProps > ( http , getEntityUrl ( params ) , data , { headers : { ... headers , 'X-Contentful-Version' : rawData . sys . version ?? 0 , } , } ) ; } ; export const del = ( http , params ) => { return raw . del ( http , getEntityUrl ( params ) ) ; } ;