Class: User

ClearBlade. User

new User() → {Object}

Source:
Returns:
ClearBlade.User the created User object
Type
Object

Methods

allUsers(_query, callback)

Method to retrieve all the users in a system
Parameters:
Name Type Description
_query ClearBlade.Query ClearBlade query used to filter users
callback function
Source:
Example
var user = cb.User();
var query = cb.Query();
query.equalTo("name", "John");
query.setPage(0,0);
user.allUsers(query, function(err, body) {
   if(err) {
       //handle error
   } else {
       console.log(body);
   }
});
//returns all the users with a name property equal to "John"

getUser(callback)

Retrieves info on the current user
Parameters:
Name Type Description
callback function
Source:
Example
var user = cb.User();
user.getUser(function(err, body) {
   if(err) {
       //handle error
   } else {
       //do stuff with user info
   }
});

setUser(data, callback)

Performs a put on the current users row
Parameters:
Name Type Description
data Object Object containing the data to update
callback function
Source:
Example
var newUserInfo = {
   "name": "newName",
   "age": 76
}
var user = cb.User();
user.setUser(newUserInfo, function(err, body) {
   if(err) {
       //handle error
   } else {
       console.log(body);
   }
});