import { HttpParameterCodec } from '@angular/common/http' ; export interface ConfigurationParameters { apiKeys ? : { [ key ] : string ; } ; username ? : string ; password ? : string ; accessToken ? : string | ( ( ) => string ) ; basePath ? : string ; withCredentials ? : boolean ; encoder ? : HttpParameterCodec ; } export class Configuration { apiKeys ? : { [ key ] : string ; } ; username ? : string ; password ? : string ; accessToken ? : string | ( ( ) => string ) ; basePath ? : string ; withCredentials ? : boolean ; encoder ? : HttpParameterCodec ; constructor ( configurationParameters = { } ) { this . apiKeys = configurationParameters . apiKeys ; this . username = configurationParameters . username ; this . password = configurationParameters . password ; this . accessToken = configurationParameters . accessToken ; this . basePath = configurationParameters . basePath ; this . withCredentials = configurationParameters . withCredentials ; this . encoder = configurationParameters . encoder ; } /**
     * Select the correct content-type to use for a request.
     * Uses  Configuration to determine the correct content-type.
     * If no content type is found return the first found type if the contentTypes is not empty
     *  param contentTypes returns public selectHeaderContentType ( contentTypes ) { if ( contentTypes . length === 0 ) { return undefined ; } const type = contentTypes . find ( ( x ) => this . isJsonMime ( x ) ) ; if ( type === undefined ) { return contentTypes [ 0 ] ; } return type ; } /**
     * Select the correct accept content-type to use for a request.
     * Uses  Configuration to determine the correct accept content-type.
     * If no content type is found return the first found type if the contentTypes is not empty
     *  param accepts returns public selectHeaderAccept ( accepts ) { if ( accepts . length === 0 ) { return undefined ; } const type = accepts . find ( ( x ) => this . isJsonMime ( x ) ) ; if ( type === undefined ) { return accepts [ 0 ] ; } return type ; } param mime return public isJsonMime ( mime ) { const jsonMime = new RegExp ( '^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$' , 'i' ) ; return mime !== null && ( jsonMime . test ( mime ) || mime . toLowerCase ( ) === 'application/json-patch+json' ) ; } }