Update README for application model
This commit is contained in:
parent
7c4737f397
commit
a47317de0d
|
@ -1,6 +1,7 @@
|
||||||
# Application
|
# Application
|
||||||
|
|
||||||
Application model captures the metadata for a loopback application.
|
Application model represents the metadata for a client application that has its
|
||||||
|
own identity and associated configuration with the LoopBack server.
|
||||||
|
|
||||||
## Each application has the following basic properties:
|
## Each application has the following basic properties:
|
||||||
|
|
||||||
|
@ -25,7 +26,8 @@ Application model captures the metadata for a loopback application.
|
||||||
|
|
||||||
## Security keys
|
## Security keys
|
||||||
|
|
||||||
The following keys are automatically generated by the application creation process. They can be reset upon request.
|
The following keys are automatically generated by the application creation
|
||||||
|
process. They can be reset upon request.
|
||||||
|
|
||||||
* clientKey: Secret for mobile clients
|
* clientKey: Secret for mobile clients
|
||||||
* javaScriptKey: Secret for JavaScript clients
|
* javaScriptKey: Secret for JavaScript clients
|
||||||
|
@ -40,49 +42,51 @@ The application can be configured to support multiple methods of push notificati
|
||||||
* pushSettings
|
* pushSettings
|
||||||
|
|
||||||
|
|
||||||
{
|
pushSettings: {
|
||||||
pushSettings: [
|
apns: {
|
||||||
{ "platform": "apns",
|
certData: config.apnsCertData,
|
||||||
"apns": {
|
keyData: config.apnsKeyData,
|
||||||
"pushOptions": {
|
production: false, // Development mode
|
||||||
"gateway": "gateway.sandbox.push.apple.com",
|
pushOptions: {
|
||||||
"cert": "credentials/apns_cert_dev.pem",
|
// Extra options can go here for APN
|
||||||
"key": "credentials/apns_key_dev.pem"
|
},
|
||||||
},
|
feedbackOptions: {
|
||||||
|
batchFeedback: true,
|
||||||
"feedbackOptions": {
|
interval: 300
|
||||||
"gateway": "feedback.sandbox.push.apple.com",
|
}
|
||||||
"cert": "credentials/apns_cert_dev.pem",
|
},
|
||||||
"key": "credentials/apns_key_dev.pem",
|
gcm: {
|
||||||
"batchFeedback": true,
|
serverApiKey: config.gcmServerApiKey
|
||||||
"interval": 300
|
}
|
||||||
}
|
}
|
||||||
}}
|
|
||||||
]}
|
|
||||||
|
|
||||||
|
|
||||||
## Authentication schemes
|
## Authentication schemes
|
||||||
|
|
||||||
|
|
||||||
* authenticationEnabled
|
* authenticationEnabled
|
||||||
* anonymousAllowed
|
* anonymousAllowed
|
||||||
* authenticationSchemes
|
* authenticationSchemes
|
||||||
|
|
||||||
### Authentication scheme settings
|
### Authentication scheme settings
|
||||||
|
|
||||||
* scheme: Name of the authentication scheme, such as local, facebook, google, twitter, linkedin, github
|
* scheme: Name of the authentication scheme, such as local, facebook, google,
|
||||||
|
twitter, linkedin, github
|
||||||
* credential: Scheme-specific credentials
|
* credential: Scheme-specific credentials
|
||||||
|
|
||||||
## APIs for Application model
|
## APIs for Application model
|
||||||
|
|
||||||
In addition to the CRUD methods, the Application model also has the following apis:
|
In addition to the CRUD methods, the Application model also has the following
|
||||||
|
apis:
|
||||||
|
|
||||||
### Register a new application
|
### Register a new application
|
||||||
|
|
||||||
You can register a new application by providing the owner user id, applicaiton name, and other properties in the options object.
|
You can register a new application by providing the owner user id, application
|
||||||
|
name, and other properties in the options object.
|
||||||
|
|
||||||
Application.register('rfeng', 'MyApp1', {description: 'My first loopback application'}, function (err, result) {
|
Application.register('rfeng', 'MyApp1',
|
||||||
var app = result;
|
{description: 'My first loopback application'},
|
||||||
|
function (err, result) {
|
||||||
|
var app = result;
|
||||||
...
|
...
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -97,7 +101,9 @@ You can reset keys for a given application by id.
|
||||||
|
|
||||||
### Authenticate by appId and key
|
### Authenticate by appId and key
|
||||||
|
|
||||||
You can authenticate an application by id and one of the keys. If successful, it calls back with the key name in the result argument. Otherwise, the keyName is null.
|
You can authenticate an application by id and one of the keys. If successful,
|
||||||
|
it calls back with the key name in the result argument. Otherwise, the
|
||||||
|
keyName is null.
|
||||||
|
|
||||||
Application.authenticate(appId, clientKey, function (err, keyName) {
|
Application.authenticate(appId, clientKey, function (err, keyName) {
|
||||||
assert.equal(keyName, 'clientKey');
|
assert.equal(keyName, 'clientKey');
|
||||||
|
@ -105,21 +111,3 @@ You can authenticate an application by id and one of the keys. If successful, it
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
# Installation
|
|
||||||
|
|
||||||
Installation captures the installation of the application on devices.
|
|
||||||
|
|
||||||
Each record of installation has the following properties:
|
|
||||||
|
|
||||||
* id: Generated id that uniquely identifies the installation
|
|
||||||
* appId: Application id
|
|
||||||
* appVersion: Application version
|
|
||||||
* userId: The current user id that logs into the application
|
|
||||||
* deviceToken: Device token
|
|
||||||
* deviceType: Device type, such as apns
|
|
||||||
* subscriptions: An Array of tags that represents subscriptions of notifications
|
|
||||||
* status: Status of the application, production/sandbox/disabled
|
|
||||||
* created: Timestamp of the recored being created
|
|
||||||
* modified: Timestamp of the recored being modified
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue