File

src/lib/services/sz-configuration.service.ts

Description

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/';
Example :
this.apiconf.parametersChanged.subscribe( (params) => { console.log('api connection params changed.', params); })

Index

Properties
Methods
Accessors

Constructor

constructor(apiConfiguration: SzRestConfiguration, prefs: SzPrefsService)
Parameters :
Name Type Optional
apiConfiguration SzRestConfiguration No
prefs SzPrefsService No

Methods

Public addHeaderToApiRequests
addHeaderToApiRequests(header: literal type)

add an additional header to all outgoing API requests

Parameters :
Name Type Optional
header literal type No
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 :
Name Type Optional
value SzRestConfigurationParameters No
Returns : void
Public removeHeaderFromApiRequests
removeHeaderFromApiRequests(header: literal type | string)

remove an additional header from all outgoing API requests

Parameters :
Name Type Optional
header literal type | string No
Returns : void

Properties

Public apiConfiguration
Type : SzRestConfiguration
Decorators :
@Inject(SzRestConfiguration)
Public prefs
Type : SzPrefsService

Accessors

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 :
Name Type Optional
value literal type | undefined No
Returns : void
apiKeys
setapiKeys(value: literal type)

apiKeys to use when connnecting to Api Server

Parameters :
Name Type Optional
value literal type No
Returns : void
username
setusername(value: string)

Username to use when using challenge response authentication.

Parameters :
Name Type Optional
value string No
Returns : void
password
setpassword(value: string)

password used for challenge respose.

Parameters :
Name Type Optional
value string No
Returns : void
accessToken
setaccessToken(value: string | )
Parameters :
Name Type Optional
value string | No
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 :
Name Type Optional
value string No
Returns : void
withCredentials
setwithCredentials(value: boolean)

whether or not to use CORs for api requests

Parameters :
Name Type Optional
value boolean No
Returns : void

results matching ""

    No results matching ""