IdentityServer
Identity server
Constructor Summary
| Public Constructor | ||
| public |
constructor(options: Object) IdentityServer constructor |
|
Member Summary
| Public Members | ||
| public |
config: * |
|
Method Summary
| Public Methods | ||
| public |
Makes an Identity server API call |
|
| public |
getCallUrl(path: string): string Returns an Identity Call URL with specified path |
|
| public |
Returns a SDK URL with specified path |
|
| public |
Requests specified path (or URL) and returns a Promise of JSON parsed response body |
|
| public |
Requests a response from an SDK path |
|
| public |
Set the config in the server scope |
|
Public Constructors
public constructor(options: Object) source
IdentityServer constructor
Params:
| Name | Type | Attribute | Description |
| options | Object |
|
Options |
| options.env | string |
|
Environment to use, e.g: dev/stage/.. |
| options.idmVersion | string |
|
Identity server API version |
| options.sdkVersion | string |
|
Identity server API version |
| options.timeout | number |
|
Default request timeout in seconds (0 to disable) |
Public Members
public config: * source
Public Methods
public call(path: string, options: Object): Promise source
Makes an Identity server API call
This adds some standard headers and then requests specified path (e.g: endpoint).
See IdentityServer#getSdkUrl for details on the URL that is used. See IdentityServer#request for further supported options etc.
public getCallUrl(path: string): string source
Returns an Identity Call URL with specified path
This defaults to using the server url as base, but uses a special proxy instead when we are cross origin. Note: This proxy currently only supports envs: dev and stage TODO: Get rid of this workaround once Akamai supports adding /index.html and we can use *-id.nbc.com/sdk/
Params:
| Name | Type | Attribute | Description |
| path | string |
|
Identity Call path |
public getSdkUrl(path: String, customBase: String): String source
Returns a SDK URL with specified path
This defaults to using the server url + /sdk as base, but uses the s3-website instead when we are cross origin.
This also adds the SDK version to the URL to serve as a cache buster.
See IdentityServer#request for supported options etc.
public request(pathOrUrl: string, options: Object): Promise source
Requests specified path (or URL) and returns a Promise of JSON parsed response body
If response is not OK the returned Promise is rejected.
If the returned Promise is rejected, the associated Error instance is decorated with status (number), statusText (string) and retry (function) properties. The retry function can be called to retry the request.
If a body is specified it will be JSON stringified and a Content-Type: application/json header will be added.
If a timeout is specified that will be used, otherwise the default IdentityServer timeout will be used.
Besides these options, standard fetch init properties (e.g: method) are supported as options as well.
public sdk(path: String, customBase: String, options: Object): Promise source
Requests a response from an SDK path
See IdentityServer#getSdkUrl for details on the URL that is used. See IdentityServer#request for supported options etc.
Manual
Reference
Source
Test
