This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Setting query parameters in javascript. | |
| //Begin with initializing your client | |
| var client = new Usergrid.Client({ | |
| "orgName":"", | |
| "appName":"" | |
| }); | |
| //Setup an options object that contains the query language you'd | |
| //like to filter your data with. This query will look for all |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Geolocation query against a restaurants collection. | |
| //Geolocation queries are just another subset of queries | |
| //that can be done in App Services. There aren't any differences | |
| //in how you perform a geolocation query and other queries/ | |
| //Remember that the distance is in meters! | |
| var client = new Usergrid.Client({ | |
| "appName":"", | |
| "orgName":"" | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //We want to fred to follow barney! | |
| //Intialize your client | |
| var client = new Usergrid.client({ | |
| "orgName":"", | |
| "appName":"" | |
| }); | |
| //Setup entity retrieval options. | |
| //Here we are going to get the user named fred. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Getting all of fred's followers | |
| var client = new Usergrid.Client({ | |
| "appName":"", | |
| "orgName":"" | |
| }); | |
| client.getLoggedInUser(function(error, data, fred){ | |
| //Get the "followers" connection here! | |
| fred.getConnections("followers", function(error, data, connections){ | |
| for(var i = 0; i < connections.length; i++) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Connecting fred likes dino the dog! | |
| var client = new Usergrid.Client({ | |
| "appName":"", | |
| "orgName":"" | |
| }); | |
| var options = { | |
| "type":"dog", | |
| "dogName":"Dino" | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var extension = Usergrid.Client.prototype.getEntity; | |
| function logGetEntity(options){ | |
| console.log("In get entity"); | |
| console.log(JSON.stringify(options)); | |
| } | |
| Usergrid.Client.prototype.getEntity = function(options, callback){ | |
| extension.apply(this, arguments); | |
| logGetEntity(options); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var sub = Usergrid.Client.prototype.getFeedForUser; | |
| Usergrid.Client.prototype.getFeedForUser = function(user, callback){ | |
| sub.call(this, user, function(err, data, acts){ | |
| console.log("err:"+err); | |
| console.log("data:"+data); | |
| console.log("acts:"+acts); | |
| callback(err, data, acts); | |
| }); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var createCollection = Usergrid.Client.prototype.createCollection; | |
| Usergrid.Client.prototype.createCollection = function(options, callback){ | |
| createCollection.call(this, options, function(err, entityCollection){ | |
| //Here is where we access the callback results | |
| callback(err, entityCollection); | |
| }); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| .DS_Store | |
| *.mode1v3 | |
| *.pbxuser | |
| *.perspective | |
| *.perspectivev3 | |
| *.pyc | |
| *~.nib/ | |
| build/* | |
| xcuserdata |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| UGClientResponse *response = [self.client createEntity:book]; | |
| //Lets check if our response was accepted by the server, and add the created object to a collection called _objects | |
| if (response.transactionState == kUGClientResponseSuccess) { | |
| [_objects insertObject:response.response[@"entities"][0] atIndex:0]; | |
| } |