import type { AxiosInstance } from 'contentful-sdk-core' ; import * as raw from './raw' ; import { normalizeSelect } from './utils' ; import copy from 'fast-copy' ; import { GetAppInstallationParams , GetSpaceEnvironmentParams , PaginationQueryParams , } from '../../../common-types' ; import { AppInstallationProps , CreateAppInstallationProps , } from '../../../entities/app-installation' ; import { CollectionProp } from '../../../common-types' ; import { RestEndpoint } from '../types' ; const getBaseUrl = ( params ) => `/spaces/${ params . spaceId }/environments/${ params . environmentId }/app_installations` ; export const getAppInstallationUrl = ( params ) => getBaseUrl ( params ) + `/${ params . appDefinitionId }` ; export const get = ( http , params ) => { return raw . get < AppInstallationProps > ( http , getAppInstallationUrl ( params ) , { params : normalizeSelect ( params . query ) , } ) ; } ; export const getMany = ( http , params ) => { return raw . get < CollectionProp < AppInstallationProps > > ( http , getBaseUrl ( params ) , { params : normalizeSelect ( params . query ) , } ) ; } ; export const upsert = ( http , params , rawData , headers ? ) => { const data = copy ( rawData ) ; return raw . put < AppInstallationProps > ( http , getAppInstallationUrl ( params ) , data , { ... headers , } ) ; } ; export const del = ( http , params ) => { return raw . del ( http , getAppInstallationUrl ( params ) ) ; } ;