import { ApiOptions , FetchPolicy , ODataMetadataType , ODataVersion , Options , OptionsHelper , QueryOptionNames , } from './types' ; import { DEFAULT_FETCH_POLICY , DEFAULT_STRIP_METADATA , DEFAULT_VERSION , } from './constants' ; import { ODataHelper } from './helper' ; export class ODataApiOptions implements ApiOptions , OptionsHelper { /**
     * Default OData version
     */ version : ODataVersion ; /**
     * Send enum as string in the request
     */ stringAsEnum ? : boolean ; /**
     * Strip metadata from the response
     */ stripMetadata : ODataMetadataType ; /**
     * Cache fetch policy
     */ fetchPolicy : FetchPolicy ; /**
     * Extra params to be sent in the request
     */ params : { [ param ] : string | string [ ] ; } ; /**
     * Extra headers to be sent in the request
     */ headers : { [ param ] : string | string [ ] ; } ; /**
     * Http request with credentials
     */ withCredentials ? : boolean ; /**
     * Send query options in the request body
     */ bodyQueryOptions : QueryOptionNames [ ] ; link accept ? : { exponentialDecimals ? : boolean ; ieee754Compatible ? : boolean ; metadata ? : ODataMetadataType ; streaming ? : boolean ; } ; etag : { link ifMatch : boolean ; link ifNoneMatch : boolean ; } = { ifMatch : true , ifNoneMatch : false } ; prefer ? : { link maxPageSize ? : number ; link return ? : 'representation' | 'minimal' ; link continueOnError ? : boolean ; link includeAnnotations ? : string ; } ; deleteRefBy : 'path' | 'id' ; constructor ( config ) { this . version = config . version || DEFAULT_VERSION ; this . stringAsEnum = config . stringAsEnum ; this . params = config . params || { } ; this . headers = config . headers || { } ; this . withCredentials = config . withCredentials ; this . stripMetadata = config . stripMetadata || DEFAULT_STRIP_METADATA ; this . fetchPolicy = config . fetchPolicy || DEFAULT_FETCH_POLICY ; this . bodyQueryOptions = config . bodyQueryOptions || [ ] ; this . accept = config . accept ; Object . assign ( this . etag , config . etag || { } ) ; this . prefer = config . prefer ; this . deleteRefBy = config . deleteRefBy || 'path' ; } get helper ( ) { return ODataHelper [ this . version ] ; } } export class ODataParserOptions implements OptionsHelper { version : ODataVersion ; stringAsEnum ? : boolean ; constructor ( config ) { this . version = config . version || DEFAULT_VERSION ; this . stringAsEnum = config . stringAsEnum ; } get helper ( ) { return ODataHelper [ this . version ] ; } }