// Get the main account (The one we used to authenticate the client)
Account mainAccount = client.getAccount();
// Get all accounts including sub accounts
AccountList accountList = client.getAccounts();
// All lists implement an iterable interface, you can use the foreach
// syntax on them
for (Account a : accountList) {
System.out.println(a.getFriendlyName());
}
// You can also iterate manually...
Iterator<Account> itr = accountList.iterator();
while (itr.hasNext()) {
Account a = itr.next();
System.out.println(a.getFriendlyName());
}
// You can also get just the first page of data
accountList = client.getAccounts();
List<Account> accounts = accountList.getPageData();
// Make a call
CallFactory callFactory = mainAccount.getCallFactory();
Map<String, String> callParams = new HashMap<String, String>();
callParams.put("To", "5105551212"); // Replace with a valid phone number