From 9621ce47960891a613489509ea6131a1bdcc410b Mon Sep 17 00:00:00 2001 From: Adam Alcott Date: Fri, 3 Nov 2017 11:02:51 -0500 Subject: [PATCH] add documentation for Device --- ClearBlade.js | 111 +++- out/ClearBlade.Analytics.html | 356 ++++++------ out/ClearBlade.Code.html | 240 ++++---- out/ClearBlade.Collection.html | 354 ++++++------ out/ClearBlade.Device.html | 821 +++++++++++++++++++++++++++ out/ClearBlade.Item.html | 68 +-- out/ClearBlade.Messaging.html | 468 ++++++++-------- out/ClearBlade.MessagingStats.html | 242 ++++---- out/ClearBlade.Query.html | 853 ++++++++++++++++------------- out/ClearBlade.User.html | 234 ++++---- out/ClearBlade.html | 518 ++++++++++-------- out/ClearBlade.js.html | 142 ++++- out/index.html | 10 +- 13 files changed, 2858 insertions(+), 1559 deletions(-) create mode 100644 out/ClearBlade.Device.html diff --git a/ClearBlade.js b/ClearBlade.js index 0fa0748..c9808f1 100644 --- a/ClearBlade.js +++ b/ClearBlade.js @@ -2169,14 +2169,40 @@ n *

{Number} [messagingPort] This is the default port used when connecting return metrics; }; + /** + * Creates a representation of devices + * @class ClearBlade.Device + * @classdesc It does not actually make a connection upon instantiation, but has all the methods necessary to do so. + * @example + * var device = cb.Device(); + */ ClearBlade.prototype.Device = function(){ - var device = {}; + let device = {}; device.user = this.user; device.URI = this.URI; device.systemKey = this.systemKey; device.systemSecret = this.systemSecret; + /** + * Requests the named device from Devices Auth table + * @method ClearBlade.Device.prototype.getDeviceByName + * @param {String} name Used to indicate which device to get + * @param {function} callback Supplies processing for what to do with the data that is returned from the devices + * @return {Object} An object representing the requested device + * @example Fetching data from device + * let returnedData = {}; + * var callback = function (err, data) { + * if (err) { + * throw new Error (data); + * } else { + * returnedData = data; + * } + * }; + * + * device.updateDeviceByName(name, callback); + * //this will give returnedData the value of what ever was returned from the server. + */ device.getDeviceByName = function (name, callback) { var reqOptions = { method: 'GET', @@ -2187,9 +2213,30 @@ n *

{Number} [messagingPort] This is the default port used when connecting ClearBlade.request(reqOptions, callback); }; - device.updateDevice = function (name, object, trigger, callback){ + /** + * Updates a device in the Devices Auth table + * @method ClearBlade.Device.prototype.updateDevice + * @param {String} name Specifies which device to update + * @param {Object} object Supplies which columns in the Devices table to update + * @param {Boolean} trigger Indicates whether or not to enable trigger + * @param {function} callback Supplies processing for what to do with the data that is returned from the devices + * @return {Object} A success attribute + * @example Updating device data + * var object = { + * active_key: "example_active_key", + * allow_key_auth: false + * } + * var callback = function (err, data) { + * if (err) { + * throw new Error (data); + * } + * }; + * + * device.updateDevice(name, object, trigger, callback); + */ + device.updateDevice = function (name, object, trigger, callback) { if (typeof object != "object"){ - throw new Error('Invalid object format'); + throw new Error('Invalid object format'); } object["causeTrigger"] = trigger; var reqOptions = { @@ -2202,6 +2249,64 @@ n *

{Number} [messagingPort] This is the default port used when connecting ClearBlade.request(reqOptions, callback); }; + /** + * Requests all devices defined within a system, unless query specifies one item or a set of items. + * @method ClearBlade.Device.prototype.fetch + * @param {Query} _query Used to request a specific item or subset of items from the devices on the server. Optional. + * @param {function} callback Supplies processing for what to do with the data that is returned from the devices + * @return {Object} An array of JSON objects, whose attributes correspond to columns in the Devices tables + * @example Fetching data from devices + * var returnedData = []; + * var query = ClearBlade.Query(); + * query.equalTo('enabled', 'true'); + * var callback = function (err, data) { + * if (err) { + * throw new Error (data); + * } else { + * returnedData = data; + * } + * }; + * + * device.fetch(query, callback); + * //this will give returnedData the value of what ever was returned from the server, every device whose "enabled" attribute is equal to "true". + */ + device.fetch = function (_query, callback) { + let query; + /* + * The following logic may look funny, but it is intentional. + * I do this because it is typeical for the callback to be the last parameter. + * However, '_query' is an optional parameter, so I have to check if 'callback' is undefined + * in order to see weather or not _query is defined. + */ + if (callback === undefined) { + callback = _query; + query = { + FILTERS: [] + }; + query = 'query='+ _parseQuery(query); + } else { + if (Object.keys(_query) < 1) { + query = ''; + } else { + query = 'query='+ _parseQuery(_query.query); + } + } + + var reqOptions = { + method: 'GET', + user: this.user, + endpoint: "api/v/2/devices/" + this.systemKey, + qs: query, + URI: this.URI + }; + + if (typeof callback === 'function') { + ClearBlade.request(reqOptions, callback); + } else { + logger("No callback was defined!"); + } + }; + return device; }; diff --git a/out/ClearBlade.Analytics.html b/out/ClearBlade.Analytics.html index 15c1fd7..f490474 100644 --- a/out/ClearBlade.Analytics.html +++ b/out/ClearBlade.Analytics.html @@ -28,11 +28,8 @@

Class: Analytics

-

- ClearBlade. - - Analytics -

+

+ ClearBlade.Analytics() → {Object}

@@ -41,26 +38,27 @@

-
- -

new Analytics() → {Object}

- -
-
- +

new Analytics() → {Object}

- - - + + + + + + + + + +
@@ -85,12 +83,14 @@

new Analytic + +
Source:
@@ -102,20 +102,20 @@

new Analytic

- - - - - - -
Returns:
- - + + + + + + +
Returns:
+ +
ClearBlade.Analytics the created Analytics object
@@ -134,10 +134,11 @@
Returns:
- - - + + + +
@@ -148,41 +149,44 @@

Returns:
- + -

Methods

-
- -
-

getCount(topic, start, stop, callback)

+

Methods

+ + -
-
-
- Method to retrieve the average payload size for a topic -
+

getCount(topic, start, stop, callback)

- - +
+ Method to retrieve the average payload size for a topic +
+ + + + + + + + + +
Parameters:
-
Parameters:
- @@ -297,9 +301,10 @@
Parameters:
- - + + +
@@ -324,12 +329,14 @@
Parameters:
+ +
Source:
@@ -341,21 +348,23 @@
Parameters:
- - - - - - + + + + + + + + + +
Example
-
Example
-
cb.MessagingStats().getCount(filter, function(err, body) {
    if(err) {
        //handle error
@@ -364,35 +373,35 @@ 
Example
} });
- -
+ -
- -

getEventList(topic, start, stop, callback)

- -
-
-
- Method to retrieve the average payload size for a topic -
+

getEventList(topic, start, stop, callback)

- - +
+ Method to retrieve the average payload size for a topic +
+ + + + + + + + + +
Parameters:
-
Parameters:
- @@ -507,9 +516,10 @@
Parameters:
- - + + +
@@ -534,12 +544,14 @@
Parameters:
+ +
Source:
@@ -551,21 +563,23 @@
Parameters:
- - - - - - + + + + + + + + + +
Example
-
Example
-
cb.MessagingStats().getEventList(filter, function(err, body) {
    if(err) {
        //handle error
@@ -574,35 +588,35 @@ 
Example
} });
- -
+ -
- -

getEventTotals(topic, start, stop, callback)

- -
-
-
- Method to retrieve the average payload size for a topic -
+

getEventTotals(topic, start, stop, callback)

- - +
+ Method to retrieve the average payload size for a topic +
+ + + + + + + + + +
Parameters:
-
Parameters:
- @@ -717,9 +731,10 @@
Parameters:
- - + + +
@@ -744,12 +759,14 @@
Parameters:
+ +
Source:
@@ -761,21 +778,23 @@
Parameters:
- - - - - - + + + + + + + + + +
Example
-
Example
-
cb.MessagingStats().getEventTotals(filter, function(err, body) {
    if(err) {
        //handle error
@@ -784,35 +803,35 @@ 
Example
} });
- -
+ -
- -

getStorage(topic, start, stop, callback)

- -
-
-
- Method to retrieve the average payload size for a topic -
+

getStorage(topic, start, stop, callback)

- - +
+ Method to retrieve the average payload size for a topic +
+ + + + + + + + + +
Parameters:
-
Parameters:
- @@ -927,9 +946,10 @@
Parameters:
- - + + +
@@ -954,12 +974,14 @@
Parameters:
+ +
Source:
@@ -971,21 +993,23 @@
Parameters:
- - - - - - + + + + + + + + + +
Example
-
Example
-
cb.MessagingStats().getStorage(filter, function(err, body) {
    if(err) {
        //handle error
@@ -994,35 +1018,35 @@ 
Example
} });
- -
+ -
- -

getUserEvents(topic, start, stop, callback)

- -
-
-
- Method to retrieve the average payload size for a topic -
+

getUserEvents(topic, start, stop, callback)

- - +
+ Method to retrieve the average payload size for a topic +
+ + + + + + + + + +
Parameters:
-
Parameters:
- @@ -1137,9 +1161,10 @@
Parameters:
- - + + +
@@ -1164,12 +1189,14 @@
Parameters:
+ +
Source:
@@ -1181,21 +1208,23 @@
Parameters:
- - - - - - + + + + + + + + + +
Example
-
Example
-
cb.MessagingStats().getUserEvents(filter, function(err, body) {
    if(err) {
        //handle error
@@ -1204,10 +1233,9 @@ 
Example
} });
- -
-
+ + @@ -1223,13 +1251,13 @@
Example
-
+
diff --git a/out/ClearBlade.Code.html b/out/ClearBlade.Code.html index c661f23..47eeb61 100644 --- a/out/ClearBlade.Code.html +++ b/out/ClearBlade.Code.html @@ -28,11 +28,8 @@

Class: Code

-

- ClearBlade. - - Code -

+

+ ClearBlade.Code() → {Object}

@@ -41,30 +38,31 @@

-
- -

new Code() → {Object}

- -
-
-
- creates and returns a Code object that can be used to execute ClearBlade Code Services -
+

new Code() → {Object}

- - - +
+ creates and returns a Code object that can be used to execute ClearBlade Code Services +
+ + + + + + + + + + -
@@ -89,6 +87,8 @@

new Codenew Code - - - - - - -
Returns:
- - + + + + + + +
Returns:
+ +
ClearBlade.Code
@@ -138,10 +138,11 @@
Returns:

- - - + + + +
@@ -152,41 +153,44 @@

Returns:
- + -

Methods

-
- -
-

execute(name, params, callback)

+

Methods

+ + -
-
-
- Executes a ClearBlade Code Service -
+

execute(name, params, callback)

- - +
+ Executes a ClearBlade Code Service +
+ + + + + + + + + +
Parameters:
-
Parameters:
- @@ -278,9 +282,10 @@
Parameters:
- - + + +
@@ -305,6 +310,8 @@
Parameters:
+ + @@ -322,21 +329,23 @@
Parameters:
- - - - - - + + + + + + + + + +
Example
-
Example
-
cb.Code().execute("ServiceName", {stringParam: "stringVal", numParam: 1, objParam: {"key": "val"}, arrayParam: ["ClearBlade", "is", "awesome"]}, function(err, body) {
    if(err) {
        //handle error
@@ -345,35 +354,35 @@ 
Example
} })
- -
+ -
- -

getCompletedServices(callback)

- -
-
-
- Retrieves a list of completed services for a system -
+

getCompletedServices(callback)

- - +
+ Retrieves a list of completed services for a system +
+ + + + + + + + + +
Parameters:
-
Parameters:
- @@ -419,9 +428,10 @@
Parameters:
- - + + +
@@ -446,6 +456,8 @@
Parameters:
+ + @@ -463,21 +475,23 @@
Parameters:
- - - - - - + + + + + + + + + +
Example
-
Example
-
cb.Code().getCompletedServices(function(err, body) {
    if(err) {
        //handle error
@@ -486,35 +500,35 @@ 
Example
} })
- -
+ -
- -

getFailedServices(callback)

- -
-
-
- Retrieves a list of failed services for a system -
+

getFailedServices(callback)

- - +
+ Retrieves a list of failed services for a system +
+ + + + + + + + + +
Parameters:
-
Parameters:
- @@ -560,9 +574,10 @@
Parameters:
- - + + +
@@ -587,6 +602,8 @@
Parameters:
+ + @@ -604,21 +621,23 @@
Parameters:
- - - - - - + + + + + + + + + +
Example
-
Example
-
cb.Code().getFailedServices(function(err, body) {
    if(err) {
        //handle error
@@ -627,10 +646,9 @@ 
Example
} })
- -
-
+ + @@ -646,13 +664,13 @@
Example
-
+
diff --git a/out/ClearBlade.Collection.html b/out/ClearBlade.Collection.html index 1b7fa6f..7e8aae0 100644 --- a/out/ClearBlade.Collection.html +++ b/out/ClearBlade.Collection.html @@ -28,11 +28,8 @@

Class: Collection

-

- ClearBlade. - - Collection -

+

+ ClearBlade.Collection(collectionID)

This class represents a server-side collection. It does not actully make a connection upon instantiation, but has all the methods necessary to do so. It also has all the methods necessary to do operations on the server-side collections.
@@ -43,30 +40,33 @@

-
- -

new Collection(collectionID)

- -
-
+

Constructor

+ -
- Creates a new Collection that represents the server-side collection with the specified collection ID -
+

new Collection(collectionID)

- - +
+ Creates a new Collection that represents the server-side collection with the specified collection ID +
+ + + + + + + + + +
Parameters:
-
Parameters:
- @@ -112,9 +112,10 @@
Parameters:
- - + + +
@@ -139,6 +140,8 @@
Parameters:
+ + @@ -156,25 +159,26 @@
Parameters:
- - - - - - + + + + + + + + + +
Example
-
Example
-
var col = cb.Collection("12asd3049qwe834qe23asdf1234");
- -
+
@@ -185,41 +189,44 @@

Example
- + -

Methods

-
- -
-

create(newItem, callback)

+

Methods

+ + -
-
-
- Creates a new item in the collection and returns the created item to the callback -
+

create(newItem, callback)

- - +
+ Creates a new item in the collection and returns the created item to the callback +
+ + + + + + + + + +
Parameters:
-
Parameters:
- @@ -288,9 +295,10 @@
Parameters:
- - + + +
@@ -315,6 +323,8 @@
Parameters:
+ + @@ -332,68 +342,70 @@
Parameters:
- - - - - - + + + + + + + + + +
Example
-
Example
-

Creating a new item in the collection

//This example assumes a collection of items that have the columns: name, height, and age.
 var newPerson = {
-   name: 'Jim',
-   height: 70,
-   age: 32
+    name: 'Jim',
+    height: 70,
+    age: 32
 };
 var callback = function (err, data) {
-   if (err) {
-       throw new Error (data);
-   } else {
-       console.log(data);
-   }
+    if (err) {
+        throw new Error (data);
+    } else {
+        console.log(data);
+    }
 };
 col.create(newPerson, callback);
 //this inserts the the newPerson item into the collection that col represents
- -
+ -
- -

fetch(_query, callback) → {ClearBlade.Item}

- -
-
-
- Reqests an item or a set of items from the collection. -
+

fetch(_query, callback) → {ClearBlade.Item}

- - +
+ Reqests an item or a set of items from the collection. +
+ + + + + + + + + +
Parameters:
-
Parameters:
- @@ -462,9 +474,10 @@
Parameters:
- - + + +
@@ -489,6 +502,8 @@
Parameters:
+ + @@ -506,20 +521,20 @@
Parameters:
- - - - - - -
Returns:
- - + + + + + + +
Returns:
+ +
An array of ClearBlade Items
@@ -538,54 +553,56 @@
Returns:
- + + + + +
Example
-
Example
-

Fetching data from a collection

var returnedData = [];
 var callback = function (err, data) {
-   if (err) {
-       throw new Error (data);
-   } else {
-       returnedData = data;
-   }
+    if (err) {
+        throw new Error (data);
+    } else {
+        returnedData = data;
+    }
 };
 
 col.fetch(query, callback);
 //this will give returnedData the value of what ever was returned from the server.
- - + -
- -

remove(_query, callback)

- -
-
-
- Removes an item or set of items from the specified collection -
+

remove(_query, callback)

- - +
+ Removes an item or set of items from the specified collection +
+ + + + + + + + + +
Parameters:
-
Parameters:
- @@ -654,9 +671,10 @@
Parameters:
- - + + +
@@ -681,6 +699,8 @@
Parameters:
+ + @@ -698,66 +718,68 @@
Parameters:
- - - - - - + + + + + + + + + +
Example
-
Example
-

Removing an item in a collection

//This example assumes that you have a collection with the item whose 'name' attribute is 'John'
 var query = ClearBlade.Query();
 query.equalTo('name', 'John');
 var callback = function (err, data) {
-   if (err) {
-       throw new Error (data);
-   } else {
-       console.log(data);
-   }
+    if (err) {
+        throw new Error (data);
+    } else {
+        console.log(data);
+    }
 };
 
 col.remove(query, callback);
 //removes every item whose 'name' attribute is equal to 'John'
- -
+ -
- -

update(_query, changes, callback)

- -
-
-
- Updates an existing item or set of items -
+

update(_query, changes, callback)

- - +
+ Updates an existing item or set of items +
+ + + + + + + + + +
Parameters:
-
Parameters:
- @@ -849,9 +871,10 @@
Parameters:
- - + + +
@@ -876,6 +899,8 @@
Parameters:
+ + @@ -893,44 +918,45 @@
Parameters:
- - - - - - + + + + + + + + + +
Example
-
Example
-

Updating a set of items

//This example assumes a collection of items that have the columns name and age.
 var query = ClearBlade.Query();
 query.equalTo('name', 'John');
 var changes = {
-   age: 23
+    age: 23
 };
 var callback = function (err, data) {
-   if (err) {
-       throw new Error (data);
-   } else {
-       console.log(data);
-   }
+    if (err) {
+        throw new Error (data);
+    } else {
+        console.log(data);
+    }
 };
 
 col.update(query, changes, callback);
 //sets John's age to 23
- -
- + + @@ -946,13 +972,13 @@
Example
-
+
- Documentation generated by JSDoc 3.3.0-alpha10 on Tue Apr 25 2017 12:03:19 GMT-0500 (CDT) + Documentation generated by JSDoc 3.5.5 on Fri Nov 03 2017 11:01:58 GMT-0500 (CDT)
diff --git a/out/ClearBlade.Device.html b/out/ClearBlade.Device.html new file mode 100644 index 0000000..625475e --- /dev/null +++ b/out/ClearBlade.Device.html @@ -0,0 +1,821 @@ + + + + + JSDoc: Class: Device + + + + + + + + + + +
+ +

Class: Device

+ + + + + + +
+ +
+ +

+ ClearBlade.Device()

+ +
It does not actually make a connection upon instantiation, but has all the methods necessary to do so.
+ + +
+ +
+
+ + + + +

Constructor

+ + + +

new Device()

+ + + + + + +
+ Creates a representation of devices +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
Example
+ +
var device = cb.Device();
+ + + + +
+ + + + + + + + + + + + + + + + +

Methods

+ + + + + + + +

fetch(_query, callback) → {Object}

+ + + + + + +
+ Requests all devices defined within a system, unless query specifies one item or a set of items. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
_query + + +Query + + + + Used to request a specific item or subset of items from the devices on the server. Optional.
callback + + +function + + + + Supplies processing for what to do with the data that is returned from the devices
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+ An array of JSON objects, whose attributes correspond to columns in the Devices tables +
+ + + +
+
+ Type +
+
+ +Object + + +
+
+ + + + + + +
Example
+ +

Fetching data from devices

+ +
var returnedData = [];
+var query = ClearBlade.Query();
+query.equalTo('enabled', 'true');
+var callback = function (err, data) {
+    if (err) {
+        throw new Error (data);
+    } else {
+        returnedData = data;
+    }
+};
+
+device.fetch(query, callback);
+//this will give returnedData the value of what ever was returned from the server, every device whose "enabled" attribute is equal to "true".
+ + + + + + + + + +

getDeviceByName(name, callback) → {Object}

+ + + + + + +
+ Requests the named device from Devices Auth table +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
name + + +String + + + + Used to indicate which device to get
callback + + +function + + + + Supplies processing for what to do with the data that is returned from the devices
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+ An object representing the requested device +
+ + + +
+
+ Type +
+
+ +Object + + +
+
+ + + + + + +
Example
+ +

Fetching data from device

+ +
let returnedData = {};
+var callback = function (err, data) {
+    if (err) {
+        throw new Error (data);
+    } else {
+        returnedData = data;
+    }
+};
+
+device.updateDeviceByName(name, callback);
+//this will give returnedData the value of what ever was returned from the server.
+ + + + + + + + + +

updateDevice(name, object, trigger, callback) → {Object}

+ + + + + + +
+ Updates a device in the Devices Auth table +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
name + + +String + + + + Specifies which device to update
object + + +Object + + + + Supplies which columns in the Devices table to update
trigger + + +Boolean + + + + Indicates whether or not to enable trigger
callback + + +function + + + + Supplies processing for what to do with the data that is returned from the devices
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+ A success attribute +
+ + + +
+
+ Type +
+
+ +Object + + +
+
+ + + + + + +
Example
+ +

Updating device data

+ +
var object = {
+  active_key: "example_active_key",
+  allow_key_auth: false
+}
+var callback = function (err, data) {
+    if (err) {
+        throw new Error (data);
+    }
+};
+
+device.updateDevice(name, object, trigger, callback);
+ + + + + + + + + +
+ +
+ + + + +
+ + + +
+ +
+ Documentation generated by JSDoc 3.5.5 on Fri Nov 03 2017 11:01:58 GMT-0500 (CDT) +
+ + + + + \ No newline at end of file diff --git a/out/ClearBlade.Item.html b/out/ClearBlade.Item.html index 39587b4..c2317e3 100644 --- a/out/ClearBlade.Item.html +++ b/out/ClearBlade.Item.html @@ -28,11 +28,8 @@

Class: Item

-

- ClearBlade. - - Item -

+

+ ClearBlade.Item(data, collection)

@@ -41,30 +38,31 @@

-
- -

new Item(data, collection)

- -
-
-
- Note: This class cannot be used with connections -
+

new Item(data, collection)

- - +
+ Note: This class cannot be used with connections +
+ + + + + + + + + +
Parameters:
-
Parameters:
- @@ -133,9 +131,10 @@
Parameters:
- - + + +
@@ -160,6 +159,8 @@
Parameters:
+ + @@ -177,20 +178,21 @@
Parameters:
- - - - - - - -
+ + + + + + + + +
@@ -201,7 +203,9 @@

Parameters:
- + + + @@ -222,13 +226,13 @@
Parameters:
-
+
- Documentation generated by JSDoc 3.3.0-alpha10 on Tue Apr 25 2017 12:03:19 GMT-0500 (CDT) + Documentation generated by JSDoc 3.5.5 on Fri Nov 03 2017 11:01:58 GMT-0500 (CDT)
diff --git a/out/ClearBlade.Messaging.html b/out/ClearBlade.Messaging.html index feb2aaa..82d4cd6 100644 --- a/out/ClearBlade.Messaging.html +++ b/out/ClearBlade.Messaging.html @@ -28,11 +28,8 @@

Class: Messaging

-

- ClearBlade. - - Messaging -

+

+ ClearBlade.Messaging(options, callback)

@@ -41,30 +38,31 @@

-
- -

new Messaging(options, callback)

- -
-
-
- Initializes the ClearBlade messaging object and connects to a server. -
+

new Messaging(options, callback)

- - +
+ Initializes the ClearBlade messaging object and connects to a server. +
+ + + + + + + + + +
Parameters:
-
Parameters:
- @@ -147,9 +145,10 @@
Parameters:
- - + + +
@@ -174,6 +173,8 @@
Parameters:
+ + @@ -191,31 +192,32 @@
Parameters:
- - - - - - + + + + + + + + + +
Example
-
Example
-

A standard connect

var callback = function (data) {
- console.log(data);
+  console.log(data);
 };
 //A connect with a nonstandard timeout
 var cb = ClearBlade.Messaging({"timeout":15}, callback);
- -
+
@@ -226,41 +228,44 @@

Example
- + -

Methods

-
- -
-

(static) getAndDeleteMessageHistory(topic, last, count, start, stop, callback)

+

Methods

+ + -
-
-
- Gets the message history from a ClearBlade Messaging topic. -
+

(static) getAndDeleteMessageHistory(topic, last, count, start, stop, callback)

- - +
+ Gets the message history from a ClearBlade Messaging topic. +
+ + + + + + + + + +
Parameters:
-
Parameters:
- @@ -421,9 +426,10 @@
Parameters:
- - + + +
@@ -448,12 +454,14 @@
Parameters:
+ +
Source:
@@ -465,47 +473,49 @@
Parameters:
- - - - - - - -
+ + + + + + + + + -
- -

(static) getMessageHistory(topic, last, count, callback)

- -
-
-
- Gets the message history from a ClearBlade Messaging topic. -
+

(static) getMessageHistory(topic, last, count, callback)

- - +
+ Gets the message history from a ClearBlade Messaging topic. +
+ + + + + + + + + +
Parameters:
-
Parameters:
- @@ -620,9 +630,10 @@
Parameters:
- - + + +
@@ -647,12 +658,14 @@
Parameters:
+ +
Source:
@@ -664,47 +677,49 @@
Parameters:
- - - - - - - -
+ + + + + + + + + -
- -

(static) getMessageHistoryWithTimeFrame(topic, last, count, start, stop, callback)

- -
-
-
- Gets the message history from a ClearBlade Messaging topic. -
+

(static) getMessageHistoryWithTimeFrame(topic, last, count, start, stop, callback)

- - +
+ Gets the message history from a ClearBlade Messaging topic. +
+ + + + + + + + + +
Parameters:
-
Parameters:
- @@ -865,9 +880,10 @@
Parameters:
- - + + +
@@ -892,12 +908,14 @@
Parameters:
+ +
Source:
@@ -909,47 +927,49 @@
Parameters:
- - - - - - - -
+ + + + + + + + + -
- -

disconnect()

- -
-
-
- Disconnects from the server. -
+

disconnect()

- - - +
+ Disconnects from the server. +
+ + + + + + + + + + -
@@ -974,12 +994,14 @@

disconnect< + +
Source:
@@ -991,58 +1013,60 @@

disconnect<

- - - - - - + + + + + + + + + +
Example
-
Example
-

How to publish

var callback = function (data) {
- console.log(data);
+  console.log(data);
 };
 var cb = ClearBlade.Messaging({}, callback);
 cb.disconnect()//why leave so soon :(
- -
+ -
- -

publish(topic, payload)

- -
-
-
- Publishes to a topic. -
+

publish(topic, payload)

- - +
+ Publishes to a topic. +
+ + + + + + + + + +
Parameters:
-
Parameters:
- @@ -1114,9 +1138,10 @@
Parameters:
- - + + +
@@ -1141,12 +1166,14 @@
Parameters:
+ +
Source:
@@ -1158,59 +1185,61 @@
Parameters:
- - - - - - + + + + + + + + + +
Example
-
Example
-

How to publish

var callback = function (data) {
- console.log(data);
+  console.log(data);
 };
 var cb = ClearBlade.Messaging({}, callback);
 cb.publish("ClearBlade/is awesome!","Totally rules");
 //Topics can include spaces and punctuation  except "/"
- -
+ -
- -

subscribe(topic, optionsopt, messageCallback)

- -
-
-
- Subscribes to a topic -
+

subscribe(topic, optionsopt, messageCallback)

- - +
+ Subscribes to a topic +
+ + + + + + + + + +
Parameters:
-
Parameters:
- @@ -1335,9 +1364,10 @@
Parameters:
- - + + +
@@ -1362,12 +1392,14 @@
Parameters:
+ +
Source:
@@ -1379,58 +1411,60 @@
Parameters:
- - - - - - + + + + + + + + + +
Example
-
Example
-

How to publish

var callback = function (data) {
- console.log(data);
+  console.log(data);
 };
 var cb = ClearBlade.Messaging({}, callback);
 cb.subscribe("ClearBlade/is awesome!",{});
- -
+ -
- -

unsubscribe(topic, optionsopt)

- -
-
-
- Unsubscribes from a topic -
+

unsubscribe(topic, optionsopt)

- - +
+ Unsubscribes from a topic +
+ + + + + + + + + +
Parameters:
-
Parameters:
- @@ -1520,9 +1554,10 @@
Parameters:
- - + + +
@@ -1547,12 +1582,14 @@
Parameters:
+ +
Source:
@@ -1564,33 +1601,34 @@
Parameters:
- - - - - - + + + + + + + + + +
Example
-
Example
-

How to publish

var callback = function (data) {
- console.log(data);
+  console.log(data);
 };
 var cb = ClearBlade.Messaging({}, callback);
 cb.unsubscribe("ClearBlade/is awesome!",{"onSuccess":function(){console.log("we unsubscribe");});
- -
-
+ + @@ -1606,13 +1644,13 @@
Example
-
+
- Documentation generated by JSDoc 3.3.0-alpha10 on Tue Apr 25 2017 12:03:19 GMT-0500 (CDT) + Documentation generated by JSDoc 3.5.5 on Fri Nov 03 2017 11:01:58 GMT-0500 (CDT)
diff --git a/out/ClearBlade.MessagingStats.html b/out/ClearBlade.MessagingStats.html index 7a43757..de4804a 100644 --- a/out/ClearBlade.MessagingStats.html +++ b/out/ClearBlade.MessagingStats.html @@ -28,11 +28,8 @@

Class: MessagingStats

-

- ClearBlade. - - MessagingStats -

+

+ ClearBlade.MessagingStats() → {Object}

@@ -41,26 +38,27 @@

-
- -

new MessagingStats() → {Object}

- -
-
- +

new MessagingStats() → {Object}

- - - + + + + + + + + + +
@@ -85,12 +83,14 @@

new Mes + +
Source:
@@ -102,20 +102,20 @@

new Mes

- - - - - - -
Returns:
- - + + + + + + +
Returns:
+ +
ClearBlade.MessagingStats the created MessagingStats object
@@ -134,10 +134,11 @@
Returns:
- - - + + + +
@@ -148,41 +149,44 @@

Returns:
- + -

Methods

-
- -
-

getAveragePayloadSize(topic, start, stop, callback)

+

Methods

+ + -
-
-
- Method to retrieve the average payload size for a topic -
+

getAveragePayloadSize(topic, start, stop, callback)

- - +
+ Method to retrieve the average payload size for a topic +
+ + + + + + + + + +
Parameters:
-
Parameters:
- @@ -297,9 +301,10 @@
Parameters:
- - + + +
@@ -324,12 +329,14 @@
Parameters:
+ +
Source:
@@ -341,21 +348,23 @@
Parameters:
- - - - - - + + + + + + + + + +
Example
-
Example
-
cb.MessagingStats().getAveragePayloadSize("mytopic", 1490819666, 1490819676, function(err, body) {
    if(err) {
        //handle error
@@ -365,35 +374,35 @@ 
Example
}); //returns {"payloadsize":28}
- -
+ -
- -

getCurrentSubscribers(topic, callback)

- -
-
-
- Method to retrieve the number of subscribers for a topic -
+

getCurrentSubscribers(topic, callback)

- - +
+ Method to retrieve the number of subscribers for a topic +
+ + + + + + + + + +
Parameters:
-
Parameters:
- @@ -462,9 +471,10 @@
Parameters:
- - + + +
@@ -489,12 +499,14 @@
Parameters:
+ +
Source:
@@ -506,21 +518,23 @@
Parameters:
- - - - - - + + + + + + + + + +
Example
-
Example
-
cb.MessagingStats().getCurrentSubscribers("mytopic", function(err, body) {
    if(err) {
        //handle error
@@ -530,35 +544,35 @@ 
Example
}); //returns {"subscribers": 42}
- -
+ -
- -

getOpenConnections(callback)

- -
-
-
- Method to retrieve the number of MQTT connections for a system -
+

getOpenConnections(callback)

- - +
+ Method to retrieve the number of MQTT connections for a system +
+ + + + + + + + + +
Parameters:
-
Parameters:
- @@ -604,9 +618,10 @@
Parameters:
- - + + +
@@ -631,12 +646,14 @@
Parameters:
+ +
Source:
@@ -648,21 +665,23 @@
Parameters:
- - - - - - + + + + + + + + + +
Example
-
Example
-
cb.MessagingStats().getOpenConnections(function(err, body) {
    if(err) {
        //handle error
@@ -672,10 +691,9 @@ 
Example
}); //returns {"connections":42}
- -
-
+ + @@ -691,13 +709,13 @@
Example
-
+
- Documentation generated by JSDoc 3.3.0-alpha10 on Tue Apr 25 2017 12:03:19 GMT-0500 (CDT) + Documentation generated by JSDoc 3.5.5 on Fri Nov 03 2017 11:01:58 GMT-0500 (CDT)
diff --git a/out/ClearBlade.Query.html b/out/ClearBlade.Query.html index dd28c25..a3abb43 100644 --- a/out/ClearBlade.Query.html +++ b/out/ClearBlade.Query.html @@ -28,11 +28,8 @@

Class: Query

-

- ClearBlade. - - Query -

+

+ ClearBlade.Query(options) → {Object}

@@ -41,30 +38,31 @@

-
- -

new Query(options) → {Object}

- -
-
-
- creates and returns a Query object that can be used in Collection methods or on its own to operate on items on the server -
+

new Query(options) → {Object}

- - +
+ creates and returns a Query object that can be used in Collection methods or on its own to operate on items on the server +
+ + + + + + + + + +
Parameters:
-
Parameters:
- @@ -110,9 +108,10 @@
Parameters:
- - + + +
@@ -137,6 +136,8 @@
Parameters:
+ + @@ -154,20 +155,20 @@
Parameters:
- - - - - - -
Returns:
- - + + + + + + +
Returns:
+ +
Clearblade.Query the created query
@@ -186,10 +187,11 @@
Returns:
- - - + + + +
@@ -200,41 +202,44 @@

Returns:
- + -

Methods

-
- -
-

columns(Columns, callback)

+

Methods

+ + -
-
-
- Gets rows of the specified columns -
+

columns(Columns, callback)

- - +
+ Gets rows of the specified columns +
+ + + + + + + + + +
Parameters:
-
Parameters:
- @@ -303,9 +308,10 @@
Parameters:
- - + + +
@@ -330,6 +336,8 @@
Parameters:
+ + @@ -347,66 +355,68 @@
Parameters:
- - - - - - + + + + + + + + + +
Example
-
Example
-

Getting values of columns

//This example assumes a collection of items that have the columns name and age.
 var query = ClearBlade.Query({'collectionName': 'COLLECTIONNAME'});
 var callback = function (err, data) {
-   if (err) {
-       throw new Error (data);
-   } else {
-       console.log(data);
-   }
+    if (err) {
+        throw new Error (data);
+    } else {
+        console.log(data);
+    }
 };
 
 query.columns(["name","age"]);
 query.fetch(callback);
 //gets values in columns name and age
- -
+ -
- -

equalTo(field, value)

- -
-
-
- Creates an equality clause in the query object -
+

equalTo(field, value)

- - +
+ Creates an equality clause in the query object +
+ + + + + + + + + +
Parameters:
-
Parameters:
- @@ -475,9 +485,10 @@
Parameters:
- - + + +
@@ -502,6 +513,8 @@
Parameters:
+ + @@ -519,57 +532,59 @@
Parameters:
- - - - - - + + + + + + + + + +
Example
-
Example
-

Adding an equality clause to a query

var query = ClearBlade.Query();
 query.equalTo('name', 'John');
 //will only match if an item has an attribute 'name' that is equal to 'John'
- -
+ -
- -

fetch(callback) → {ClearBlade.Item}

- -
-
-
- Reqests an item or a set of items from the query. Requires that -the Query object was initialized with a collection. -
+

fetch(callback) → {ClearBlade.Item}

- - +
+ Reqests an item or a set of items from the query. Requires that +the Query object was initialized with a collection. +
+ + + + + + + + + +
Parameters:
-
Parameters:
- @@ -615,9 +630,10 @@
Parameters:
- - + + +
@@ -642,6 +658,8 @@
Parameters:
+ + @@ -659,20 +677,20 @@
Parameters:
- - - - - - -
Returns:
- - + + + + + + +
Returns:
+ +
An array of ClearBlade Items
@@ -691,52 +709,54 @@
Returns:
- + + + + +
Example
-
Example
-

The typical callback

var query = ClearBlade.Query({'collection': 'COLLECTIONID'});
 var callback = function (err, data) {
-   if (err) {
-       //error handling
-   } else {
-       console.log(data);
-   }
+    if (err) {
+        //error handling
+    } else {
+        console.log(data);
+    }
 };
 query.fetch(callback);
- - + -
- -

greaterThan(field, value)

- -
-
-
- Creates a greater than clause in the query object -
+

greaterThan(field, value)

- - +
+ Creates a greater than clause in the query object +
+ + + + + + + + + +
Parameters:
-
Parameters:
- @@ -805,9 +825,10 @@
Parameters:
- - + + +
@@ -832,6 +853,8 @@
Parameters:
+ + @@ -849,56 +872,58 @@
Parameters:
- - - - - - + + + + + + + + + +
Example
-
Example
-

Adding a greater than clause to a query

var query = ClearBlade.Query();
 query.greaterThan('age', 21);
 //will only match if an item has an attribute 'age' that is greater than 21
- -
+ -
- -

greaterThanEqualTo(field, value)

- -
-
-
- Creates a greater than or equality clause in the query object -
+

greaterThanEqualTo(field, value)

- - +
+ Creates a greater than or equality clause in the query object +
+ + + + + + + + + +
Parameters:
-
Parameters:
- @@ -967,9 +992,10 @@
Parameters:
- - + + +
@@ -994,6 +1020,8 @@
Parameters:
+ + @@ -1011,56 +1039,58 @@
Parameters:
- - - - - - - -
Example
- -

Adding a greater than or equality clause to a query

- -
var query = ClearBlade.Query();
+
+
+
+
+
+
+
+
+
+    
Example
+ +

Adding a greater than or equality clause to a query

+ +
var query = ClearBlade.Query();
 query.greaterThanEqualTo('age', 21);
 //will only match if an item has an attribute 'age' that is greater than or equal to 21
- -
+ -
- -

lessThan(field, value)

- -
-
-
- Creates a less than clause in the query object -
+

lessThan(field, value)

- - +
+ Creates a less than clause in the query object +
+ + + + + + + + + +
Parameters:
-
Parameters:
- @@ -1129,9 +1159,10 @@
Parameters:
- - + + +
@@ -1156,6 +1187,8 @@
Parameters:
+ + @@ -1173,56 +1206,58 @@
Parameters:
- - - - - - + + + + + + + + + +
Example
-
Example
-

Adding a less than clause to a query

var query = ClearBlade.Query();
 query.lessThan('age', 50);
 //will only match if an item has an attribute 'age' that is less than 50
- -
+ -
- -

lessThanEqualTo(field, value)

- -
-
-
- Creates a less than or equality clause in the query object -
+

lessThanEqualTo(field, value)

- - +
+ Creates a less than or equality clause in the query object +
+ + + + + + + + + +
Parameters:
-
Parameters:
- @@ -1291,9 +1326,10 @@
Parameters:
- - + + +
@@ -1318,6 +1354,8 @@
Parameters:
+ + @@ -1335,56 +1373,58 @@
Parameters:
- - - - - - + + + + + + + + + +
Example
-
Example
-

Adding a less than or equality clause to a query

var query = ClearBlade.Query();
 query.lessThanEqualTo('age', 50);
 //will only match if an item has an attribute 'age' that is less than or equal to 50
- -
+ -
- -

matches(field, pattern)

- -
-
-
- Creates an regular expression matching clause in the query object -
+

matches(field, pattern)

- - +
+ Creates an regular expression matching clause in the query object +
+ + + + + + + + + +
Parameters:
-
Parameters:
- @@ -1453,9 +1493,10 @@
Parameters:
- - + + +
@@ -1480,6 +1521,8 @@
Parameters:
+ + @@ -1497,56 +1540,58 @@
Parameters:
- - - - - - + + + + + + + + + +
Example
-
Example
-

Adding an regex matching clause to a query

var query = ClearBlade.Query();
 query.matches('name', 'Smith$');
 //will only match if an item has an attribute 'name' that That ends in 'Smith'
- -
+ -
- -

notEqualTo(field, value)

- -
-
-
- Creates a not equal clause in the query object -
+

notEqualTo(field, value)

- - +
+ Creates a not equal clause in the query object +
+ + + + + + + + + +
Parameters:
-
Parameters:
- @@ -1615,9 +1660,10 @@
Parameters:
- - + + +
@@ -1642,6 +1688,8 @@
Parameters:
+ + @@ -1659,56 +1707,58 @@
Parameters:
- - - - - - + + + + + + + + + +
Example
-
Example
-

Adding a not equal clause to a query

var query = ClearBlade.Query();
 query.notEqualTo('name', 'Jim');
 //will only match if an item has an attribute 'name' that is not equal to 'Jim'
- -
+ -
- -

or(that)

- -
-
-
- chains an existing query object to the Query object in an or -
+

or(that)

- - +
+ chains an existing query object to the Query object in an or +
+ + + + + + + + + +
Parameters:
-
Parameters:
- @@ -1754,9 +1804,10 @@
Parameters:
- - + + +
@@ -1781,6 +1832,8 @@
Parameters:
+ + @@ -1798,21 +1851,23 @@
Parameters:
- - - - - - + + + + + + + + + +
Example
-
Example
-

Chaining two queries together in an or

var query1 = ClearBlade.Query();
@@ -1822,35 +1877,35 @@ 
Example
query1.or(query2); //will match if an item has an attribute 'name' that is equal to 'John' or 'Jim'
- -
+ -
- -

remove(callback)

- -
-
-
- Removes an item or set of items from the Query -
+

remove(callback)

- - +
+ Removes an item or set of items from the Query +
+ + + + + + + + + +
Parameters:
-
Parameters:
- @@ -1896,9 +1951,10 @@
Parameters:
- - + + +
@@ -1923,6 +1979,8 @@
Parameters:
+ + @@ -1940,66 +1998,68 @@
Parameters:
- - - - - - + + + + + + + + + +
Example
-
Example
-

Removing an item in a collection

//This example assumes that you have a collection with the item whose 'name' attribute is 'John'
 var query = ClearBlade.Query({'collection': 'COLLECTIONID'});
 query.equalTo('name', 'John');
 var callback = function (err, data) {
-   if (err) {
-       throw new Error (data);
-   } else {
-       console.log(data);
-   }
+    if (err) {
+        throw new Error (data);
+    } else {
+        console.log(data);
+    }
 };
 
 query.remove(callback);
 //removes every item whose 'name' attribute is equal to 'John'
- -
+ -
- -

setPage(pageSize, pageNum)

- -
-
-
- Set the pagination options for a Query. -
+

setPage(pageSize, pageNum)

- - +
+ Set the pagination options for a Query. +
+ + + + + + + + + +
Parameters:
-
Parameters:
- @@ -2070,9 +2130,10 @@
Parameters:
- - + + +
@@ -2097,6 +2158,8 @@
Parameters:
+ + @@ -2114,48 +2177,50 @@
Parameters:
- - - - - - - -
+ + + + + + + + + -
- -

update(changes, callback)

- -
-
-
- Updates an existing item or set of items. Requires that a collection was -set when the Query was initialized. -
+

update(changes, callback)

- - +
+ Updates an existing item or set of items. Requires that a collection was +set when the Query was initialized. +
+ + + + + + + + + +
Parameters:
-
Parameters:
- @@ -2224,9 +2289,10 @@
Parameters:
- - + + +
@@ -2251,6 +2317,8 @@
Parameters:
+ + @@ -2268,44 +2336,45 @@
Parameters:
- - - - - - + + + + + + + + + +
Example
-
Example
-

Updating a set of items

//This example assumes a collection of items that have the columns name and age.
 var query = ClearBlade.Query({'collection': 'COLLECTIONID'});
 query.equalTo('name', 'John');
 var changes = {
-   age: 23
+    age: 23
 };
 var callback = function (err, data) {
-   if (err) {
-       throw new Error (data);
-   } else {
-       console.log(data);
-   }
+    if (err) {
+        throw new Error (data);
+    } else {
+        console.log(data);
+    }
 };
 
 query.update(changes, callback);
 //sets John's age to 23
- -
- + + @@ -2321,13 +2390,13 @@
Example
-
+
- Documentation generated by JSDoc 3.3.0-alpha10 on Tue Apr 25 2017 12:03:19 GMT-0500 (CDT) + Documentation generated by JSDoc 3.5.5 on Fri Nov 03 2017 11:01:58 GMT-0500 (CDT)
diff --git a/out/ClearBlade.User.html b/out/ClearBlade.User.html index 93677d0..d18144c 100644 --- a/out/ClearBlade.User.html +++ b/out/ClearBlade.User.html @@ -28,11 +28,8 @@

Class: User

-

- ClearBlade. - - User -

+

+ ClearBlade.User() → {Object}

@@ -41,26 +38,27 @@

-
- -

new User() → {Object}

- -
-
- +

new User() → {Object}

- - - + + + + + + + + + +
@@ -85,6 +83,8 @@

new Usernew User - - - - - - -
Returns:
- - + + + + + + +
Returns:
+ +
ClearBlade.User the created User object
@@ -134,10 +134,11 @@
Returns:

- - - + + + +
@@ -148,41 +149,44 @@

Returns:
- + -

Methods

-
- -
-

allUsers(_query, callback)

+

Methods

+ + -
-
-
- Method to retrieve all the users in a system -
+

allUsers(_query, callback)

- - +
+ Method to retrieve all the users in a system +
+ + + + + + + + + +
Parameters:
-
Parameters:
- @@ -251,9 +255,10 @@
Parameters:
- - + + +
@@ -278,6 +283,8 @@
Parameters:
+ + @@ -295,21 +302,23 @@
Parameters:
- - - - - - + + + + + + + + + +
Example
-
Example
-
var user = cb.User();
 var query = cb.Query();
 query.equalTo("name", "John");
@@ -323,35 +332,35 @@ 
Example
}); //returns all the users with a name property equal to "John"
- -
+ -
- -

getUser(callback)

- -
-
-
- Retrieves info on the current user -
+

getUser(callback)

- - +
+ Retrieves info on the current user +
+ + + + + + + + + +
Parameters:
-
Parameters:
- @@ -397,9 +406,10 @@
Parameters:
- - + + +
@@ -424,6 +434,8 @@
Parameters:
+ + @@ -441,21 +453,23 @@
Parameters:
- - - - - - + + + + + + + + + +
Example
-
Example
-
var user = cb.User();
 user.getUser(function(err, body) {
    if(err) {
@@ -465,35 +479,35 @@ 
Example
} });
- -
+ -
- -

setUser(data, callback)

- -
-
-
- Performs a put on the current users row -
+

setUser(data, callback)

- - +
+ Performs a put on the current users row +
+ + + + + + + + + +
Parameters:
-
Parameters:
- @@ -562,9 +576,10 @@
Parameters:
- - + + +
@@ -589,6 +604,8 @@
Parameters:
+ + @@ -606,21 +623,23 @@
Parameters:
- - - - - - + + + + + + + + + +
Example
-
Example
-
var newUserInfo = {
    "name": "newName",
    "age": 76
@@ -634,10 +653,9 @@ 
Example
} });
- -
-
+ + @@ -653,13 +671,13 @@
Example
-
+
- Documentation generated by JSDoc 3.3.0-alpha10 on Tue Apr 25 2017 12:03:19 GMT-0500 (CDT) + Documentation generated by JSDoc 3.5.5 on Fri Nov 03 2017 11:01:58 GMT-0500 (CDT)
diff --git a/out/ClearBlade.html b/out/ClearBlade.html index a4b0f04..0a01b5a 100644 --- a/out/ClearBlade.html +++ b/out/ClearBlade.html @@ -28,9 +28,7 @@

Namespace: ClearBlade

-

- ClearBlade -

+

ClearBlade

@@ -67,6 +65,8 @@

+ + @@ -114,6 +114,9 @@

Classes

Collection
+
Device
+
+
Item
@@ -131,41 +134,44 @@

Classes

- + -

Methods

-
- -
-

(static) getEdges(callback)

+

Methods

+ + -
-
-
- Gets an array of Edges on the system. -
+

(static) getEdges(callback)

- - +
+ Gets an array of Edges on the system. +
+ + + + + + + + + +
Parameters:
-
Parameters:
- @@ -211,9 +217,10 @@
Parameters:
- - + + +
@@ -238,12 +245,14 @@
Parameters:
+ +
Source:
@@ -255,47 +264,49 @@
Parameters:
- - - - - - - -
+ + + + + + + + + -
- -

(static) init(options)

- -
-
-
- This method initializes the ClearBlade module with the values needed to connect to the platform -
+

(static) init(options)

- - +
+ This method initializes the ClearBlade module with the values needed to connect to the platform +
+ + + + + + + + + +
Parameters:
-
Parameters:
- @@ -353,9 +364,10 @@
Parameters:
- - + + +
@@ -380,6 +392,8 @@
Parameters:
+ + @@ -397,47 +411,49 @@
Parameters:
- - - - - - - -
+ + + + + + + + + -
- -

(static) isCurrentUserAuthenticated(callback)

- -
-
-
- Method to check if the current user has an active server session -
+

(static) isCurrentUserAuthenticated(callback)

- - +
+ Method to check if the current user has an active server session +
+ + + + + + + + + +
Parameters:
-
Parameters:
- @@ -483,9 +499,10 @@
Parameters:
- - + + +
@@ -510,6 +527,8 @@
Parameters:
+ + @@ -527,21 +546,23 @@
Parameters:
- - - - - - + + + + + + + + + +
Example
-
Example
-
cb.isCurrentUserAuthenticated(function(err, body) {
    if(err) {
      //handle error
@@ -550,35 +571,35 @@ 
Example
} })
- -
+ -
- -

(static) loginAnon(callback)

- -
-
-
- Method to create an anonymous session with the ClearBlade Platform -
+

(static) loginAnon(callback)

- - +
+ Method to create an anonymous session with the ClearBlade Platform +
+ + + + + + + + + +
Parameters:
-
Parameters:
- @@ -624,9 +645,10 @@
Parameters:
- - + + +
@@ -651,6 +673,8 @@
Parameters:
+ + @@ -668,21 +692,23 @@
Parameters:
- - - - - - + + + + + + + + + +
Example
-
Example
-
cb.loginAnon(function(err, body) {
    if(err) {
        //handle error
@@ -691,35 +717,35 @@ 
Example
} })
- -
+ -
- -

(static) loginUserMqtt(email, password, callback)

- -
-
-
- Method to log user or developer in via MQTT over websockets -
+

(static) loginUserMqtt(email, password, callback)

- - +
+ Method to log user or developer in via MQTT over websockets +
+ + + + + + + + + +
Parameters:
-
Parameters:
- @@ -811,9 +837,10 @@
Parameters:
- - + + +
@@ -838,6 +865,8 @@
Parameters:
+ + @@ -855,21 +884,23 @@
Parameters:
- - - - - - + + + + + + + + + +
Example
-
Example
-
cb.loginUserMqtt("foo@bar.baz","secret_password", function(err, body) {
    if(err) {
        //handle error
@@ -878,35 +909,35 @@ 
Example
} })
- -
+ -
- -

(static) logoutUser(callback)

- -
-
-
- Method to end the server session for the current user -
+

(static) logoutUser(callback)

- - +
+ Method to end the server session for the current user +
+ + + + + + + + + +
Parameters:
-
Parameters:
- @@ -952,9 +983,10 @@
Parameters:
- - + + +
@@ -979,6 +1011,8 @@
Parameters:
+ + @@ -996,21 +1030,23 @@
Parameters:
- - - - - - + + + + + + + + + +
Example
-
Example
-
cb.logoutUser(function(err, body) {
    if(err) {
        //handle error
@@ -1019,35 +1055,35 @@ 
Example
} })
- -
+ -
- -

(static) registerUser(email, password, callback)

- -
-
-
- Method to register a user with the ClearBlade Platform -
+

(static) registerUser(email, password, callback)

- - +
+ Method to register a user with the ClearBlade Platform +
+ + + + + + + + + +
Parameters:
-
Parameters:
- @@ -1139,9 +1175,10 @@
Parameters:
- - + + +
@@ -1166,6 +1203,8 @@
Parameters:
+ + @@ -1183,60 +1222,62 @@
Parameters:
- - - - - - + + + + + + + + + +
Example
-
Example
-

Register User

cb.registerUser("newUser@domain.com", "qwerty", function(err, body) {
-   if(err) {
-     //handle error
-   } else {
-     console.log(body);
-   }
-});
+ if(err) { + //handle error + } else { + console.log(body); + } + });
+ - -
-
- -

(static) sendPush(users, payload, appId, callback)

- -
-
-
- Sends a push notification -
+

(static) sendPush(users, payload, appId, callback)

- - +
+ Sends a push notification +
+ + + + + + + + + +
Parameters:
-
Parameters:
- @@ -1351,9 +1392,10 @@
Parameters:
- - + + +
@@ -1378,12 +1420,14 @@
Parameters:
+ +
Source:
@@ -1395,47 +1439,49 @@
Parameters:
- - - - - - - -
+ + + + + + + + + -
- -

(static) setUser(email, authToken)

- -
-
-
- Used when assuming the role of a user to make subsequent requests -
+

(static) setUser(email, authToken)

- - +
+ Used when assuming the role of a user to make subsequent requests +
+ + + + + + + + + +
Parameters:
-
Parameters:
- @@ -1504,9 +1550,10 @@
Parameters:
- - + + +
@@ -1531,6 +1578,8 @@
Parameters:
+ + @@ -1548,22 +1597,23 @@
Parameters:
- - - - - - - -
-
+ + + + + + + + + + @@ -1579,13 +1629,13 @@
Parameters:
-
+
- Documentation generated by JSDoc 3.3.0-alpha10 on Tue Apr 25 2017 12:03:19 GMT-0500 (CDT) + Documentation generated by JSDoc 3.5.5 on Fri Nov 03 2017 11:01:58 GMT-0500 (CDT)
diff --git a/out/ClearBlade.js.html b/out/ClearBlade.js.html index accfec7..71e2580 100644 --- a/out/ClearBlade.js.html +++ b/out/ClearBlade.js.html @@ -199,11 +199,11 @@

Source: ClearBlade.js

*/ ClearBlade.prototype._callTimeout = options.callTimeout; this._callTimeout = options.callTimeout || 30000; //default to 30 seconds - /** - * This property tells us which port to use for websocket mqtt auth. - * @property messagingAuthPort - * @type Number - */ + /** + * This property tells us which port to use for websocket mqtt auth. + * @property messagingAuthPort + * @type Number + */ this.messagingAuthPort = options.messagingAuthPort || 8907; this.user = null; @@ -484,8 +484,8 @@

Source: ClearBlade.js

var usrid = getString(body); body = body.substring(usrid.length+2); var msgingHost = getString(body); - _this.setUser(email,tok); - _this.messagingURI = msgingHost; + _this.setUser(email,tok.substring(2, tok.length) + "=="); // first 2 bytes are length + // _this.messagingURI = msgingHost; // We will add this back once the backend is fixed. Right now its always "messaging.clearblade.com" success = true; client.disconnect(); callback(false,_this.user); @@ -1735,7 +1735,6 @@

Source: ClearBlade.js

} else { messaging._qos = this.defaultQoS; } - var clientID = Math.floor(Math.random() * 10e12).toString(); messaging.client = new Paho.MQTT.Client(conf.hosts[0],conf.ports[0],clientID);//new Messaging.Client(conf.hosts[0],conf.ports[0],clientID); @@ -1805,7 +1804,7 @@

Source: ClearBlade.js

* @param {function} callback The function to be called upon execution of query -- called with a boolean error and the response */ messaging.getMessageHistory = function(topic, last, count, callback) { - messaging.getMessageHistoryWithTimeFrame(topic, count, last, -1, -1); + messaging.getMessageHistoryWithTimeFrame(topic, count, last, -1, -1, callback); }; /** @@ -2100,10 +2099,10 @@

Source: ClearBlade.js

ClearBlade.request(reqOptions, callback); }; - /** - * Gets an array of Edges on the system. - * @method ClearBlade.getEdges - * @param {function} callback A function like `function (err, data) {}` to handle the response + /** + * Gets an array of Edges on the system. + * @method ClearBlade.getEdges + * @param {function} callback A function like `function (err, data) {}` to handle the response */ ClearBlade.prototype.getEdges = function(callback) { if (!callback || typeof callback !== 'function') { @@ -2198,14 +2197,40 @@

Source: ClearBlade.js

return metrics; }; + /** + * Creates a representation of devices + * @class ClearBlade.Device + * @classdesc It does not actually make a connection upon instantiation, but has all the methods necessary to do so. + * @example + * var device = cb.Device(); + */ ClearBlade.prototype.Device = function(){ - var device = {}; + let device = {}; device.user = this.user; device.URI = this.URI; device.systemKey = this.systemKey; device.systemSecret = this.systemSecret; + /** + * Requests the named device from Devices Auth table + * @method ClearBlade.Device.prototype.getDeviceByName + * @param {String} name Used to indicate which device to get + * @param {function} callback Supplies processing for what to do with the data that is returned from the devices + * @return {Object} An object representing the requested device + * @example <caption>Fetching data from device</caption> + * let returnedData = {}; + * var callback = function (err, data) { + * if (err) { + * throw new Error (data); + * } else { + * returnedData = data; + * } + * }; + * + * device.updateDeviceByName(name, callback); + * //this will give returnedData the value of what ever was returned from the server. + */ device.getDeviceByName = function (name, callback) { var reqOptions = { method: 'GET', @@ -2216,9 +2241,30 @@

Source: ClearBlade.js

ClearBlade.request(reqOptions, callback); }; - device.updateDevice = function (name, object, trigger, callback){ + /** + * Updates a device in the Devices Auth table + * @method ClearBlade.Device.prototype.updateDevice + * @param {String} name Specifies which device to update + * @param {Object} object Supplies which columns in the Devices table to update + * @param {Boolean} trigger Indicates whether or not to enable trigger + * @param {function} callback Supplies processing for what to do with the data that is returned from the devices + * @return {Object} A success attribute + * @example <caption>Updating device data</caption> + * var object = { + * active_key: "example_active_key", + * allow_key_auth: false + * } + * var callback = function (err, data) { + * if (err) { + * throw new Error (data); + * } + * }; + * + * device.updateDevice(name, object, trigger, callback); + */ + device.updateDevice = function (name, object, trigger, callback) { if (typeof object != "object"){ - throw new Error('Invalid object format'); + throw new Error('Invalid object format'); } object["causeTrigger"] = trigger; var reqOptions = { @@ -2231,6 +2277,64 @@

Source: ClearBlade.js

ClearBlade.request(reqOptions, callback); }; + /** + * Requests all devices defined within a system, unless query specifies one item or a set of items. + * @method ClearBlade.Device.prototype.fetch + * @param {Query} _query Used to request a specific item or subset of items from the devices on the server. Optional. + * @param {function} callback Supplies processing for what to do with the data that is returned from the devices + * @return {Object} An array of JSON objects, whose attributes correspond to columns in the Devices tables + * @example <caption>Fetching data from devices</caption> + * var returnedData = []; + * var query = ClearBlade.Query(); + * query.equalTo('enabled', 'true'); + * var callback = function (err, data) { + * if (err) { + * throw new Error (data); + * } else { + * returnedData = data; + * } + * }; + * + * device.fetch(query, callback); + * //this will give returnedData the value of what ever was returned from the server, every device whose "enabled" attribute is equal to "true". + */ + device.fetch = function (_query, callback) { + let query; + /* + * The following logic may look funny, but it is intentional. + * I do this because it is typeical for the callback to be the last parameter. + * However, '_query' is an optional parameter, so I have to check if 'callback' is undefined + * in order to see weather or not _query is defined. + */ + if (callback === undefined) { + callback = _query; + query = { + FILTERS: [] + }; + query = 'query='+ _parseQuery(query); + } else { + if (Object.keys(_query) < 1) { + query = ''; + } else { + query = 'query='+ _parseQuery(_query.query); + } + } + + var reqOptions = { + method: 'GET', + user: this.user, + endpoint: "api/v/2/devices/" + this.systemKey, + qs: query, + URI: this.URI + }; + + if (typeof callback === 'function') { + ClearBlade.request(reqOptions, callback); + } else { + logger("No callback was defined!"); + } + }; + return device; }; @@ -2408,13 +2512,13 @@

Source: ClearBlade.js

-
+
- Documentation generated by JSDoc 3.3.0-alpha10 on Tue Apr 25 2017 12:03:19 GMT-0500 (CDT) + Documentation generated by JSDoc 3.5.5 on Fri Nov 03 2017 11:01:58 GMT-0500 (CDT)
diff --git a/out/index.html b/out/index.html index 67a1466..97c4793 100644 --- a/out/index.html +++ b/out/index.html @@ -2,7 +2,7 @@ - JSDoc: Index + JSDoc: Home @@ -17,7 +17,7 @@
-

Index

+

Home

@@ -50,13 +50,13 @@

-
+
- Documentation generated by JSDoc 3.3.0-alpha10 on Tue Apr 25 2017 12:03:19 GMT-0500 (CDT) + Documentation generated by JSDoc 3.5.5 on Fri Nov 03 2017 11:01:58 GMT-0500 (CDT)