From 6e42a67268fd467ef37f9b62513fa39998232bbd Mon Sep 17 00:00:00 2001 From: Julien Fontanet Date: Mon, 23 Feb 2015 12:25:30 +0100 Subject: [PATCH] Update README. --- packages/xo-lib/README.md | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/packages/xo-lib/README.md b/packages/xo-lib/README.md index 6e29a1b3d..789014e37 100644 --- a/packages/xo-lib/README.md +++ b/packages/xo-lib/README.md @@ -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', - }, + } }); ```