import type { AxiosInstance } from 'contentful-sdk-core' ; import copy from 'fast-copy' ; import { SetOptional } from 'type-fest' ; import { CollectionProp , GetOrganizationParams , GetTeamMembershipParams , GetTeamParams , QueryParams , } from '../../../common-types' ; import { CreateTeamMembershipProps , TeamMembershipProps } from '../../../entities/team-membership' ; import { RestEndpoint } from '../types' ; import * as raw from './raw' ; import { normalizeSelect } from './utils' ; const getBaseUrl = ( params ) => `/organizations/${ params . organizationId }/teams/${ params . teamId }/team_memberships` ; const getEntityUrl = ( params ) => `/organizations/${ params . organizationId }/teams/${ params . teamId }/team_memberships/${ params . teamMembershipId }` ; export const get = ( http , params ) => raw . get < TeamMembershipProps > ( http , getEntityUrl ( params ) ) ; export const getManyForOrganization = ( http , params ) => raw . get < CollectionProp < TeamMembershipProps > > ( http , `/organizations/${ params . organizationId }/team_memberships` , { params : normalizeSelect ( params . query ) , } ) ; export const getManyForTeam = ( http , params ) => { return raw . get < CollectionProp < TeamMembershipProps > > ( http , getBaseUrl ( params ) , { params : normalizeSelect ( params . query ) , } ) ; } ; export const create = ( http , params , rawData , headers ? ) => { return raw . post < TeamMembershipProps > ( http , getBaseUrl ( params ) , rawData , { headers } ) ; } ; export const update = ( http , params , rawData , headers ? ) => { const data = copy ( rawData ) ; delete data . sys ; return raw . put < TeamMembershipProps > ( http , getEntityUrl ( params ) , data , { headers : { 'X-Contentful-Version' : rawData . sys . version || 0 , ... headers , } , } ) ; } ; export const del = ( http , params ) => raw . del ( http , getEntityUrl ( params ) ) ;