import { CallableConfig , Options , Parser } from '../types' ; import { ODataSchemaElement } from './element' ; import { ODataCallableParser } from './parsers' ; import { ODataSchema } from './schema' ; export class ODataCallable < R > extends ODataSchemaElement { entitySetPath ? : string ; bound ? : boolean ; composable ? : boolean ; parser : ODataCallableParser < R > ; constructor ( config , schema ) { super ( config , schema ) ; this . entitySetPath = config . entitySetPath ; this . bound = config . bound ; this . composable = config . composable ; this . parser = new ODataCallableParser ( config , schema . namespace , schema . alias ) ; } path ( ) { let path ; if ( this . entitySetPath ) path = this . entitySetPath ; else if ( this . bound ) path = `${ this . schema . namespace }.${ this . name }` ; else path = this . parser . return ? this . api . findEntitySetForType ( this . parser . return . type ) ?. name || this . name : this . name ; return path ; } configure ( { parserForType , } ) { this . parser . configure ( { options : this . api . options , parserForType } ) ; } param value param options returns deserialize ( value , options ? ) { return this . parser . deserialize ( value , options ) ; } param value param options returns serialize ( value , options ? ) { return this . parser . serialize ( value , options ) ; } param value param options returns encode ( value , options ? ) { return this . parser . encode ( value , options ) ; } returns binding ( ) { return this . parser . binding ( ) ; } }