/**
 * Updating an Application to Add an AIM Address
 * The updateApplicationAddress() method can be used to add an AIM account to your application. 
 * The same method can be used to add YAHOO, MSN, JABBER, GTALK and SKYPE.
 * 
 */

var tropowebapi = require('tropo-webapi');
var sys = require('sys');

var userid = '';
var password = '';
var applicationID = '';

var p = new tropowebapi.TropoProvision(userid, password);

p.updateApplicationAddress(applicationID, 'aim', null, null, null, null, null, 'AIMUser01', 'password', null);

p.addListener('responseCode', function(code) {
	sys.puts('Response code: ' + code);
});

p.addListener('responseBody', function(body) {
	sys.puts('Response body: ' + body);
});
 * Use the createApplication() method to add a brand new application. 
 * You can define a voice and messaging URL in the Request Body, but this 
 * method won't assign any addresses. You'll need to update the
 * application once it's created to add a phone number or IM account.
 * 
 */

var tropowebapi = require('tropo-webapi');
var sys = require('sys');

var userid = '';
var password = '';
var name = 'My Awesome Node App';
var voiceURL = 'http://somefakehost.com/tropo/app.json';
var messagingURL = 'http://somefakehost.com/tropo/app.json';
var platform = 'webapi';
var partition = 'staging';

var p = new tropowebapi.TropoProvision(userid, password);

p.createApplication(name, voiceURL, messagingURL, platform, partition);

p.addListener('responseCode', function(code) {
	sys.puts('Response code: ' + code);
});

p.addListener('responseBody', function(body) {
	sys.puts('Response body: ' + body);
});

/**
 * Updating an Application to Add a Number from the Pool
 * the updateApplicationAddress() method can be used to add a number from the pool of available Tropo numbers, 
 * based on a specified prefix.
 * 
 */

var tropowebapi = require('tropo-webapi');
var sys = require('sys');

var userid = '';
var password = '';
var applicationID = '';

var p = new tropowebapi.TropoProvision(userid, password);

p.updateApplicationAddress(applicationID, 'number', '1407', null, null, null, null, null, null, null);

p.addListener('responseCode', function(code) {
	sys.puts('Response code: ' + code);
});

p.addListener('responseBody', function(body) {
	sys.puts('Response body: ' + body);
});
/**
 * Updating an Application to Add a Voice Token
 * The updateApplicationAddress() method can be used to add a voice token to your application; you can add a messaging token just by
 * changing the channel to "messaging" instead of "voice".
 * 
 */

var tropowebapi = require('tropo-webapi');
var sys = require('sys');

var userid = '';
var password = '';
var applicationID = '';

var p = new tropowebapi.TropoProvision(userid, password);

p.updateApplicationAddress(applicationID, 'token', null, null, null, null, 'messaging', null, null, null);

p.addListener('responseCode', function(code) {
	sys.puts('Response code: ' + code);
});

p.addListener('responseBody', function(body) {
	sys.puts('Response body: ' + body);
});