import type { AxiosInstance } from 'contentful-sdk-core' ; import * as raw from './raw' ; import copy from 'fast-copy' ; import { normalizeSelect } from './utils' ; import { GetAppDefinitionParams , GetOrganizationParams , QueryParams } from '../../../common-types' ; import { AppDefinitionProps , CreateAppDefinitionProps } from '../../../entities/app-definition' ; import { RestEndpoint } from '../types' ; import { SetOptional } from 'type-fest' ; const getBaseUrl = ( params ) => `/organizations/${ params . organizationId }/app_definitions` ; export const getAppDefinitionUrl = ( params ) => getBaseUrl ( params ) + `/${ params . appDefinitionId }` ; export const get = ( http , params ) => { return raw . get ( http , getAppDefinitionUrl ( params ) , { params : normalizeSelect ( params . query ) , } ) ; } ; export const getMany = ( http , params ) => { return raw . get ( http , getBaseUrl ( params ) , { params : params . query , } ) ; } ; export const create = ( http , params , rawData ) => { const data = copy ( rawData ) ; return raw . post ( http , getBaseUrl ( params ) , data ) ; } ; export const update = ( http , params , rawData , headers ? ) => { const data = copy ( rawData ) ; delete data . sys ; return raw . put ( http , getAppDefinitionUrl ( params ) , data , { headers : { 'X-Contentful-Version' : rawData . sys . version ?? 0 , ... headers , } , } ) ; } ; export const del = ( http , params ) => { return raw . del ( http , getAppDefinitionUrl ( params ) ) ; } ;