MobileBackend
Represents a mobile backend in Oracle Mobile Cloud Enterprise
and provides access to all capabilities of the backend.
Callers should use mcs's mobileBackend property...
Members
(readonly) analytics :Analytics
Returns the Analytics object that enables capture of mobile analytics events.
Type:
(readonly) appConfig :object
Returns an instance of the application configuration object.
Callers can download the configuration from the service by invoking loadAppConfig().
Type:
- object
(readonly) authorization :Authorization
Returns the Authorization object used to authorize a mobile user
against Oracle Mobile Cloud Enterprise.
Please use mcs#mobileBackend#setAuthenticationType to initialize this property.
Type:
(readonly) customCode :CustomCode
Returns the CustomCode object that enables calls to custom APIs.
Type:
(readonly) diagnostics :Diagnostics
Returns the Diagnostics object that enables end-end debugging across application and cloud.
Type:
(readonly) name :string
The name of the MobileBackend as read from the configuration.
Type:
- string
(readonly) notifications :Notifications
Returns the Notifications object that provides notification capabilities.
Type:
(readonly) storage :Storage
Returns the Storage object that provides cloud-based object storage capabilities.
Type:
(readonly) synchronization :Synchronization
Returns the Synchronization object that provides caching and synchronization capabilities.
Type:
Methods
getCustomCodeUrl(path) → {string}
Constructs a full URL by prepending the prefix for custom API REST endpoints
to the given endpoint path.
Parameters:
Name | Type | Description |
---|---|---|
path |
string | The relative path of the endpoint following the platform prefix, i.e. {BaseUrl}/mobile/custom. |
Returns:
The full URL.
- Type
- string
getHttpHeaders(headersopt) → {Headers}
Populates auth and diagnostics HTTP headers for making REST calls to a mobile backend.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
headers |
Headers |
<optional> |
An optional object with which to populate with the headers. |
Returns:
The headers parameter that is passed in.
If not provided, a new object with the populated headers
as properties of that object is created.
- Type
- Headers
getPlatformUrl(path) → {string}
Constructs a full URL by pre-pending the prefix for platform API REST endpoints
to the given endpoint path.
Parameters:
Name | Type | Description |
---|---|---|
path |
string | The relative path of the endpoint following the platform prefix, i.e. /mobile/platform. |
Returns:
The full URL.
- Type
- string
loadAppConfig() → {Promise.<NetworkResponse>}
Downloads the configuration from the service.
The AppConfig property will contain the downloaded configuration.
Returns:
- Type
- Promise.<NetworkResponse>
setAuthenticationType(type) → {Authorization}
Initialize and returns the Authorization object
that provides authorization capabilities and access to user properties.
Parameters:
Name | Type | Description |
---|---|---|
type |
string | For Basic authentication,
you would specify "basic" to use the Basic Authentication security schema. For OAuth authentication, you would specify "oauth" to use OAuth Authentication security schema. |
Throws:
When unrecognized authentication type provided,
this method will throw an Exception stating that the type of Authentication that you provided
is not supported at this time.
Returns:
- Type
- Authorization
Examples
// Basic Authorization schema
mcs.mobileBackend.setAuthenticationType('basic');
// OAuth Authorization schema
mcs.mobileBackend.setAuthenticationType('oauth');