MobileBackend
Represents a mobile backend in Oracle Mobile Hub
and provides access to all capabilities of the backend.
Callers should use mcs's mobileBackend property...
- Source:
Extends
Members
(readonly) analytics :Analytics
Returns the Analytics object that enables capture of mobile analytics events.
Type:
- Inherited From:
- Source:
(readonly) appConfig :object
Returns an instance of the application configuration object.
Callers can download the configuration from the service by invoking loadAppConfig().
Type:
- object
- Inherited From:
- Source:
(readonly) authorization :Authorization
Returns the Authorization object used to authorize a mobile user
against Oracle Mobile Hub.
Please use mcs#mobileBackend#setAuthenticationType to initialize this property.
Type:
- Inherited From:
- Source:
(readonly) customCode :CustomCode
Returns the CustomCode object that enables calls to custom APIs.
Type:
- Inherited From:
- Source:
(readonly) diagnostics :Diagnostics
Get diagnostic object.
Returns the Diagnostics object that enables end-end debugging across application and cloud.
Type:
- Inherited From:
- Source:
(readonly) name :string
The name of the MobileBackend as read from the configuration.
Type:
- string
- Inherited From:
- Source:
(readonly) notifications :Notifications
Get notifications object.
Returns the Notifications object that provides notification capabilities.
Type:
- Source:
(readonly) storage :Storage
Returns the Storage object that provides cloud-based object storage capabilities.
Type:
- Inherited From:
- Source:
(readonly) synchronization :Synchronization
Returns the Synchronization object that provides caching and synchronization capabilities.
Type:
- Inherited From:
- Source:
Methods
getAuthenticationType() → {string}
Use this method to retrieve current authentication type.
- Inherited From:
- Source:
Returns:
Authentication type
- Type
- string
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. |
- Inherited From:
- Source:
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. |
- Inherited From:
- Source:
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. |
- Inherited From:
- Source:
Returns:
The full URL.
- Type
- string
loadAppConfig() → {Promise.<NetworkResponse>}
Downloads the configuration from the service.
The AppConfig property will contain the downloaded configuration.
- Inherited From:
- Source:
Returns:
- Type
- Promise.<NetworkResponse>
setAuthenticationType(type) → {Authorization}
Set authentication type for mobile backend.
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. For External token authentication, you would specify "token" to use External Token Authentication security schema. For Facebook authentication, you would specify "facebook" to use Facebook Authentication security schema. |
- Overrides:
- Backend#setAuthenticationType
- Source:
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");
// Facebook Authorization schema
mcs.mobileBackend.setAuthenticationType("facebook");
// Token Exchange Authorization schema
mcs.mobileBackend.setAuthenticationType("token");