Skip to content

Instantly share code, notes, and snippets.

@aaronksaunders
Created October 28, 2011 02:46
Show Gist options
  • Save aaronksaunders/1321510 to your computer and use it in GitHub Desktop.
Save aaronksaunders/1321510 to your computer and use it in GitHub Desktop.
example app using appcelerator stackmob module
//
// APPCELERATOR - STACKMOB IOS MODULE
//
// [email protected]
// blog.clearlyinnovative.com
//
// http://stackmob.com
//
var window = Ti.UI.createWindow({
backgroundColor: 'white'
});
var label = Ti.UI.createLabel();
window.add(label);
window.open();
// TODO: write your module tests here
var stackmob = require('clearlyinnovative.stackmob');
Ti.API.info("module is => " + stackmob);
stackmob.init_manager(function(e) {
// ============================================================
// UPLOAD PHOTO FOR USER
var f = Ti.Filesystem.getFile("yellow.png");
stackmob.doPostQuery("photo", {
data: f.read()
},
function(d) {
if ( d.success ) {
Ti.API.info("doPostQuery " + JSON.stringify(d));
} else {
Ti.API.error("doPostQuery ERROR" + JSON.stringify(d));
}
});
// ============================================================
// GET A USER by USERNAME FIELD
stackmob.doGetQuery("user", {
username: "[email protected]"
},
function(d) {
Ti.API.info(JSON.stringify(d))
});
// ============================================================
// USER LOGIN
stackmob.login("[email protected]", "--THE PASSWORD--", function(d) {
Ti.API.info(JSON.stringify(d))
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment