import { freezeSys , toPlainObject } from 'contentful-sdk-core' ; import copy from 'fast-copy' ; import { Except } from 'type-fest' ; import { BasicMetaSysProps , SysLink , DefaultElements , MakeRequest } from '../common-types' ; import { wrapCollection } from '../common-utils' ; import enhanceWithMethods from '../enhance-with-methods' ; type AppUploadSys = Except < BasicMetaSysProps , 'version' > ; export type AppUploadProps = { sys : AppUploadSys & { expiresAt : string ; organization : SysLink ; } ; } ; export interface AppUpload extends AppUploadProps , DefaultElements < AppUploadProps > { return example delete ( ) : Promise < void > ; } private function createAppUploadApi ( makeRequest ) { const getParams = ( data ) => ( { organizationId : data . sys . organization . sys . id , appUploadId : data . sys . id , } ) ; return { delete : function del ( ) { const data = this . toPlainObject ( ) as AppUploadProps ; return makeRequest ( { entityType : 'AppUpload' , action : 'delete' , params : getParams ( data ) , } ) ; } , } ; } private param makeRequest param data return export function wrapAppUpload ( makeRequest , data ) { const appUpload = toPlainObject ( copy ( data ) ) ; const appUploadWithMethods = enhanceWithMethods ( appUpload , createAppUploadApi ( makeRequest ) ) ; return freezeSys ( appUploadWithMethods ) ; } private param makeRequest param data return export const wrapAppUploadCollection = wrapCollection ( wrapAppUpload ) ;