import { AxiosInstance } from 'contentful-sdk-core' ; import * as raw from './raw' ; import { normalizeSelect } from './utils' ; import { CollectionProp , GetAppBundleParams , GetAppDefinitionParams , QueryParams , } from '../../../common-types' ; import { RestEndpoint } from '../types' ; import { AppBundleProps , CreateAppBundleProps } from '../../../entities/app-bundle' ; const getBaseUrl = ( params ) => `/organizations/${ params . organizationId }/app_definitions/${ params . appDefinitionId }/app_bundles` ; const getAppBundleUrl = ( params ) => `${ getBaseUrl ( params ) }/${ params . appBundleId }` ; export const get = ( http , params ) => { return raw . get < AppBundleProps > ( http , getAppBundleUrl ( params ) ) ; } ; export const getMany = ( http , params ) => { return raw . get < CollectionProp < AppBundleProps > > ( http , getBaseUrl ( params ) , { params : normalizeSelect ( params . query ) , } ) ; } ; export const del = ( http , params ) => { return raw . del < void > ( http , getAppBundleUrl ( params ) ) ; } ; export const create = ( http , params , payload ) => { const { appUploadId , comment } = payload ; const data = { upload : { sys : { type : 'Link' , linkType : 'AppUpload' , id : appUploadId , } , } , comment , } ; return raw . post < AppBundleProps > ( http , getBaseUrl ( params ) , data ) ; } ;