Classes
Members
# static getTemplatedScope
Basic common function for templating API scopes to the correct environment
Methods
# static addInterface(apiInterface)
Adds an interface to the list of interfaces to load when this class is initialised.
Parameters:
Name | Type | Description |
---|---|---|
apiInterface |
ApiInterface derivative class (not an instance) to add to load when an ApiManager is created |
# static getTemplatedScope(scope, env) → {string}
Basic common function for templating API scopes to the correct environment
Parameters:
Name | Type | Description |
---|---|---|
scope |
string | The untemplated scope |
env |
string | The environment string to insert into the template |
The new templated scope
# static templateScopes(scopes, data)
Takes an array of scopes and substitutes in template values. Returns new scopes array.
Parameters:
Name | Type | Description |
---|---|---|
scopes |
array of scopes to be templated. |
|
data |
object whose keys are the value to replace, and the value is what to put in place. |
Populated map of original scopes, matched to their templated scopes.
# addInterface(apiInterface)
Helper function for adding an ApiInterface to the ApiManager's library of available APIs. Any API that is required will need to be added to the library prior to being usable.
APIs should be added in the base App.js
, in a place where it will be run BEFORE the app is rendered. This is
important as the OIDC library queries the ApiManagers library of registered APIs to ask for the correct OIDC scopes.
import { ApiManager } from '@jcu/spark'
...
ApiManager.addInterface(TestInterface)
function App() {
...
Parameters:
Name | Type | Description |
---|---|---|
apiInterface |
ApiInterface | The ApiInterface class to add to library |
# checkLoadedInterfaces()
Compare the loaded interfaces against the list of APIs that have had configs loaded
# getApiInterface(apiInterface, version) → {ApiInterface|undefined}
Load an API interface from the library by name and version. Name and version need to be defined (and matching) in two locations: SPA config and the interface class.
Handles instantiating and configuring API interface based on the information defined in the API section of the SPA config.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
apiInterface |
string | The name of the API |
|
version |
string | latest | The version of the API |
The requested ApiInterface object or undefined if it doesn't exist
# updateHeader(header, value)
Provide a new header to propagate to ApiInterface instances
Parameters:
Name | Type | Description |
---|---|---|
header |
Header to set |
|
value |
if not null, sets the header, otherwise clears it. |