import type { AxiosInstance } from 'contentful-sdk-core' ; import copy from 'fast-copy' ; import { SetOptional } from 'type-fest' ; import { CollectionProp , GetOrganizationMembershipProps , GetOrganizationParams , QueryParams , } from '../../../common-types' ; import { OrganizationMembershipProps } from '../../../entities/organization-membership' ; import { RestEndpoint } from '../types' ; import * as raw from './raw' ; const getBaseUrl = ( params ) => `/organizations/${ params . organizationId }/organization_memberships` ; const getEntityUrl = ( params ) => `${ getBaseUrl ( params ) }/${ params . organizationMembershipId }` ; export const get = ( http , params ) => { return raw . get < OrganizationMembershipProps > ( http , getEntityUrl ( params ) ) ; } ; export const getMany = ( http , params ) => { return raw . get < CollectionProp < OrganizationMembershipProps > > ( http , getBaseUrl ( params ) ) ; } ; export const update = ( http , params , rawData , headers ? ) => { const data = copy ( rawData ) ; delete data . sys ; const { role } = data ; return raw . put < OrganizationMembershipProps > ( http , getEntityUrl ( params ) , { role } , { headers : { ... headers , 'X-Contentful-Version' : rawData . sys . version ?? 0 , } , } ) ; } ; export const del = ( http , params ) => { return raw . del ( http , getEntityUrl ( params ) ) ; } ;