Update README.
This commit is contained in:
parent
fd066e5eef
commit
6e42a67268
@ -28,13 +28,29 @@ This high-level interface handles session sign-in and a cache of
|
||||
remote XO objects. It also automatically reconnect and retry method
|
||||
calls when necessary.
|
||||
|
||||
```javascript
|
||||
// Connect to XO.
|
||||
var xo = new xoLib.Xo('https://xo.company.tld');
|
||||
|
||||
// Must sign in before being able to call any methods (all calls will
|
||||
// be buffered until signed in).
|
||||
xo.signIn({
|
||||
email: 'admin@admin.net',
|
||||
password: 'admin',
|
||||
}).then(function () {
|
||||
console('signed as', xo.user);
|
||||
});
|
||||
```
|
||||
|
||||
The credentials can also be passed directly to the constructor:
|
||||
|
||||
```javascript
|
||||
var xo = new xoLib.Xo({
|
||||
url: 'https://xo.company.tld',
|
||||
auth: {
|
||||
credentials: {
|
||||
email: 'admin@admin.net',
|
||||
password: 'admin',
|
||||
},
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user