src/lib/services/sz-configuration.service.ts
Provides a service injectable that can be used to dynamically change the global values that are passed throughout all components for API connection requests.
This service is provided for advanced usage where the connection parameters have to change dynamically through the application lifecycle(ie changing request namespace from 'http://api.mydomain.com' to 'http://api.mydomain.com/SUBSECTION').
If your application just needs its values initialized that should be done by passing in a config factory to the SenzingSdkModule method.
Example :this.apiconf.basePath = 'http://apis.mydomain.com/';
this.apiconf.parametersChanged.subscribe( (params) => { console.log('api connection params changed.', params); })
Properties |
|
Methods |
|
Accessors |
constructor(apiConfiguration: SzRestConfiguration, prefs: SzPrefsService)
|
|||||||||
Parameters :
|
Public addHeaderToApiRequests | ||||||
addHeaderToApiRequests(header: literal type)
|
||||||
add an additional header to all outgoing API requests
Parameters :
Returns :
void
|
Public asConfigurationParameters |
asConfigurationParameters()
|
bulk fetch of sdk configuration parameters.
Returns :
SzRestConfigurationParameters
|
Public fromParameters | ||||||
fromParameters(value: SzRestConfigurationParameters)
|
||||||
bulk runtime set of sdk configuration
Parameters :
Returns :
void
|
Public removeHeaderFromApiRequests | ||||||
removeHeaderFromApiRequests(header: literal type | string)
|
||||||
remove an additional header from all outgoing API requests
Parameters :
Returns :
void
|
Public apiConfiguration |
Type : SzRestConfiguration
|
Decorators :
@Inject(SzRestConfiguration)
|
Public prefs |
Type : SzPrefsService
|
additionalApiRequestHeaders | ||||||
getadditionalApiRequestHeaders()
|
||||||
additional http/https request headers that will be added by default to all outbound api server requests.
Returns :
literal type | undefined
|
||||||
setadditionalApiRequestHeaders(value: literal type | undefined)
|
||||||
set additional http/https request headers to be added by default to all outbound api server requests. most commonly used for adding custom or required non-standard headers like jwt session tokens, auth id etc.
Parameters :
Returns :
void
|
apiKeys | ||||||
setapiKeys(value: literal type)
|
||||||
apiKeys to use when connnecting to Api Server
Parameters :
Returns :
void
|
username | ||||||
setusername(value: string)
|
||||||
Username to use when using challenge response authentication.
Parameters :
Returns :
void
|
password | ||||||
setpassword(value: string)
|
||||||
password used for challenge respose.
Parameters :
Returns :
void
|
accessToken | ||||||
setaccessToken(value: string | )
|
||||||
Parameters :
Returns :
void
|
basePath | ||||||
getbasePath()
|
||||||
setbasePath(value: string)
|
||||||
prefix all api requests with this value. most commonly a http or https protocol://hostname:port string that your api server can be accessed through
Parameters :
Returns :
void
|
withCredentials | ||||||
setwithCredentials(value: boolean)
|
||||||
whether or not to use CORs for api requests
Parameters :
Returns :
void
|