import BigNumber from 'bignumber.js' ; import { AllFields , Constructable , EntityBuilderType , OneToOneLink , Field , CollectionField , OrderableEdmTypeField , CustomField , ComplexTypeField , ConstructorOrField , EdmTypeField , FieldBuilder , FieldOptions , PropertyMetadata , EntityBase as Entity , DeSerializers , DefaultDeSerializers , DeserializedType , Time , EntityApi , RequestBuilder , defaultDeSerializers , mergeDefaultDeSerializersWith , entityBuilder } from '../src/internal' ; export interface CommonComplexType < DeSerializersT extends DeSerializers = DefaultDeSerializers > { stringProperty : DeserializedType < DeSerializersT , 'Edm.String' > ; booleanProperty ? : DeserializedType < DeSerializersT , 'Edm.Boolean' > ; complexTypeProperty ? : NestedComplexType < DeSerializersT > ; } export class CommonComplexTypeField < EntityT extends Entity , DeSerializersT extends DeSerializers , NullableT extends boolean = false , SelectableT extends boolean = false > extends ComplexTypeField < EntityT , DeSerializersT , CommonComplexType , NullableT , SelectableT > { private _fieldBuilder : FieldBuilder < this , DeSerializersT > = new FieldBuilder ( this , this . deSerializers ) ; stringProperty : EdmTypeField < EntityT , DeSerializersT , 'Edm.String' , false , false > = this . _fieldBuilder . buildEdmTypeField ( 'StringProperty' , 'Edm.String' , false ) ; booleanProperty : EdmTypeField < EntityT , DeSerializersT , 'Edm.Boolean' , true , false > = this . _fieldBuilder . buildEdmTypeField ( 'BooleanProperty' , 'Edm.Boolean' , true ) ; complexTypeProperty : NestedComplexTypeField < EntityT , DeSerializersT , true , false > = this . _fieldBuilder . buildComplexTypeField ( 'ComplexTypeProperty' , NestedComplexTypeField , true ) ; constructor ( fieldName , fieldOf , deSerializers , fieldOptions ? ) { super ( fieldName , fieldOf , deSerializers , CommonComplexType , fieldOptions ) ; } } export namespace CommonComplexType { export const _propertyMetadata = [ { originalName : 'StringProperty' , name : 'stringProperty' , type : 'Edm.String' , isCollection : false } , { originalName : 'BooleanProperty' , name : 'booleanProperty' , type : 'Edm.Boolean' , isCollection : false } , { originalName : 'ComplexTypeProperty' , name : 'complexTypeProperty' , type : NestedComplexType , isCollection : false } ] ; } export interface NestedComplexType < DeSerializersT extends DeSerializers = DefaultDeSerializers > { stringProperty ? : DeserializedType < DeSerializersT , 'Edm.String' > ; } export class NestedComplexTypeField < EntityT extends Entity , DeSerializersT extends DeSerializers , NullableT extends boolean = false , SelectableT extends boolean = false > extends ComplexTypeField < EntityT , DeSerializersT , NestedComplexType , NullableT , SelectableT > { private _fieldBuilder : FieldBuilder < this , DeSerializersT > = new FieldBuilder ( this , this . deSerializers ) ; stringProperty : EdmTypeField < EntityT , DeSerializersT , 'Edm.String' , true , false > = this . _fieldBuilder . buildEdmTypeField ( 'StringProperty' , 'Edm.String' , true ) ; constructor ( fieldName , fieldOf , deSerializers , fieldOptions ? ) { super ( fieldName , fieldOf , deSerializers , NestedComplexType , fieldOptions ) ; } } export namespace NestedComplexType { export const _propertyMetadata = [ { originalName : 'StringProperty' , name : 'stringProperty' , type : 'Edm.String' , isCollection : false } ] ; } export class CommonEntitySingleLink < DeSerializersT extends DeSerializers > extends Entity implements CommonEntitySingleLinkType < DeSerializersT > { static _entityName = 'A_CommonEntitySingleLink' ; static _keys = [ 'KeyProperty' ] ; readonly _oDataVersion : any ; static _defaultServicePath = '/sap/opu/odata/sap/API_COMMON_SRV' ; keyProperty ! : DeserializedType < DeSerializersT , 'Edm.String' > ; stringProperty ? : DeserializedType < DeSerializersT , 'Edm.String' > ; } export interface CommonEntitySingleLinkType < DeSerializersT extends DeSerializers > { keyProperty : DeserializedType < DeSerializersT , 'Edm.String' > ; stringProperty ? : DeserializedType < DeSerializersT , 'Edm.String' > | null ; } export class CommonEntitySingleLinkApi < BinaryT = string , BooleanT = boolean , ByteT = number , DecimalT = BigNumber , DoubleT = number , FloatT = number , Int16T = number , Int32T = number , Int64T = BigNumber , GuidT = string , SByteT = number , SingleT = number , StringT = string , AnyT = any > implements EntityApi < CommonEntitySingleLink < DeSerializers < BinaryT , BooleanT , ByteT , DecimalT , DoubleT , FloatT , Int16T , Int32T , Int64T , GuidT , SByteT , SingleT , StringT , AnyT > > , DeSerializers < BinaryT , BooleanT , ByteT , DecimalT , DoubleT , FloatT , Int16T , Int32T , Int64T , GuidT , SByteT , SingleT , StringT , AnyT > > { public deSerializers : DeSerializers < BinaryT , BooleanT , ByteT , DecimalT , DoubleT , FloatT , Int16T , Int32T , Int64T , GuidT , SByteT , SingleT , StringT , AnyT > ; public schema ; constructor ( deSerializers = defaultDeSerializers as any ) { this . deSerializers = mergeDefaultDeSerializersWith ( deSerializers ) ; const fieldBuilder = new FieldBuilder ( CommonEntitySingleLink , this . deSerializers ) ; this . schema = { KEY_PROPERTY : fieldBuilder . buildEdmTypeField ( 'KeyProperty' , 'Edm.String' , false ) , STRING_PROPERTY : fieldBuilder . buildEdmTypeField ( 'StringProperty' , 'Edm.String' , true ) , ALL_FIELDS : new AllFields ( '*' , CommonEntity ) as AllFields < CommonEntity > } ; } requestBuilder ( ) { throw new Error ( 'Method not implemented.' ) ; } entityBuilder ( ) { return entityBuilder ( this ) ; } entityConstructor = CommonEntitySingleLink ; customField < NullableT extends boolean = false > ( fieldName , isNullable = false as NullableT ) { return new CustomField ( fieldName , this . entityConstructor , this . deSerializers , isNullable ) ; } } export class CommonEntity < DeSerializersT extends DeSerializers = DefaultDeSerializers > extends Entity implements CommonEntityType < DeSerializersT > { static _entityName = 'A_CommonEntity' ; readonly _oDataVersion : any ; static _defaultServicePath = '/sap/opu/odata/sap/API_COMMON_SRV' ; static _keys = [ 'KeyPropertyGuid' , 'KeyPropertyString' ] ; keyPropertyGuid ! : DeserializedType < DeSerializersT , 'Edm.Guid' > ; keyPropertyString ! : DeserializedType < DeSerializersT , 'Edm.String' > ; stringProperty ? : DeserializedType < DeSerializersT , 'Edm.String' > ; int16Property ? : DeserializedType < DeSerializersT , 'Edm.Int16' > ; collectionProperty ? : DeserializedType < DeSerializersT , 'Edm.String' > [ ] ; complexTypeProperty ? : CommonComplexType < DeSerializersT > ; toSingleLink ? : CommonEntitySingleLink < DeSerializersT > | null ; } export interface CommonEntityType < DeSerializersT extends DeSerializers = DefaultDeSerializers > { keyPropertyGuid : DeserializedType < DeSerializersT , 'Edm.Guid' > ; keyPropertyString : DeserializedType < DeSerializersT , 'Edm.String' > ; stringProperty ? : DeserializedType < DeSerializersT , 'Edm.String' > | null ; int16Property ? : DeserializedType < DeSerializersT , 'Edm.Int16' > | null ; collectionProperty ? : DeserializedType < DeSerializersT , 'Edm.String' > [ ] | null ; complexTypeProperty ? : CommonComplexType < DeSerializersT > | null ; toSingleLink ? : CommonEntitySingleLinkType < DeSerializersT > | null ; } export class CommonEntityApi < BinaryT = string , BooleanT = boolean , ByteT = number , DecimalT = BigNumber , DoubleT = number , FloatT = number , Int16T = number , Int32T = number , Int64T = BigNumber , GuidT = string , SByteT = number , SingleT = number , StringT = string , AnyT = any > implements EntityApi < CommonEntity < DeSerializers < BinaryT , BooleanT , ByteT , DecimalT , DoubleT , FloatT , Int16T , Int32T , Int64T , GuidT , SByteT , SingleT , StringT , AnyT > > , DeSerializers < BinaryT , BooleanT , ByteT , DecimalT , DoubleT , FloatT , Int16T , Int32T , Int64T , GuidT , SByteT , SingleT , StringT , AnyT > > { public deSerializers : DeSerializers < BinaryT , BooleanT , ByteT , DecimalT , DoubleT , FloatT , Int16T , Int32T , Int64T , GuidT , SByteT , SingleT , StringT , AnyT > ; public schema ; constructor ( deSerializers = defaultDeSerializers as any ) { this . deSerializers = mergeDefaultDeSerializersWith ( deSerializers ) ; const fieldBuilder = new FieldBuilder ( CommonEntity , this . deSerializers ) ; this . schema = { KEY_PROPERTY_GUID : fieldBuilder . buildEdmTypeField ( 'KeyPropertyGuid' , 'Edm.Guid' , false ) , KEY_PROPERTY_STRING : fieldBuilder . buildEdmTypeField ( 'KeyPropertyString' , 'Edm.String' , false ) , STRING_PROPERTY : fieldBuilder . buildEdmTypeField ( 'StringProperty' , 'Edm.String' , true ) , INT_16_PROPERTY : fieldBuilder . buildEdmTypeField ( 'Int16Property' , 'Edm.Int16' , true ) , COLLECTION_PROPERTY : fieldBuilder . buildCollectionField ( 'CollectionProperty' , 'Edm.String' , true ) , COMPLEX_TYPE_PROPERTY : fieldBuilder . buildComplexTypeField ( 'ComplexTypeProperty' , CommonComplexTypeField , true ) , TO_SINGLE_LINK : new OneToOneLink ( 'to_SingleLink' , commonEntityApi , new CommonEntitySingleLinkApi ( this . deSerializers ) ) as OneToOneLink < CommonEntity , DeSerializers < BinaryT , BooleanT , ByteT , DecimalT , DoubleT , FloatT , Int16T , Int32T , Int64T , GuidT , SByteT , SingleT , StringT , AnyT > , CommonEntitySingleLink < DeSerializers < BinaryT , BooleanT , ByteT , DecimalT , DoubleT , FloatT , Int16T , Int32T , Int64T , GuidT , SByteT , SingleT , StringT , AnyT > > > , ALL_FIELDS : new AllFields ( '*' , CommonEntity ) as AllFields < CommonEntity > } ; } requestBuilder ( ) { throw new Error ( 'Method not implemented.' ) ; } entityBuilder ( ) { return entityBuilder ( this ) ; } entityConstructor = CommonEntity ; customField < NullableT extends boolean = false > ( fieldName , isNullable = false as NullableT ) { return new CustomField ( fieldName , this . entityConstructor , this . deSerializers , isNullable ) ; } } export const commonEntityApi = new CommonEntityApi ( ) ;