From 9cdd1d416e76b2a36c0ec32e77a0d2a63f6e7be5 Mon Sep 17 00:00:00 2001 From: hydrabolt Date: Sun, 27 Sep 2015 20:17:54 +0100 Subject: [PATCH] Test --- docs/docs_client.rst | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/docs/docs_client.rst b/docs/docs_client.rst index 181032ab3..4ac734955 100644 --- a/docs/docs_client.rst +++ b/docs/docs_client.rst @@ -102,13 +102,34 @@ An `Array` of Message_ objects the client has received over its uptime. Functions --------- -.. note :: Any functions used here that take callbacks as an optional parameter can also be used as Promises_. For example, you can do: +.. note :: Any functions used here that take callbacks as an optional parameter can also be used as Promises_. Promises take the exact same parameters for each use case, except errors are moved to catch statements instead of then. For example, you can do: + .. code-block:: js bot.login(email, password).then(success).catch(err); + function success(token){ + + } + + function err(error){ + + } + // OR use callbacks: - bot.login(email, password, function(err, token){ + bot.login(email, password, function(error, token){ - }); \ No newline at end of file + }); + +----- + +login(email, password, `callback`) +~~~~~ + +``Parameters``: +- `email` - A `String` which is the email you want to sign in with. +- `password` - A `String` which is the password you want to sign in with. +- `callback` - A `function` that can take the following parameters: + - `error` - null if there was no error, otherwise it is set. + - `token` - if successful, it is the received authorisation token. \ No newline at end of file