Implement get account names function.

This commit is contained in:
Valverde Antonio
2014-07-30 16:05:17 +09:00
parent fe05777e9b
commit 4c5ca95396
8 changed files with 69 additions and 1 deletions

View File

@@ -490,6 +490,21 @@ module.exports = syrup.serial()
})
}
plugin.getAccounts = function(type) {
return runServiceCommand(
apk.wire.MessageType.GET_ACCOUNTS
, new apk.wire.GetAccountsRequest(type)
)
.timeout(15000)
.then(function(data) {
var response = apk.wire.GetAccountsResponse.decode(data)
if (response.success) {
return response.accounts
}
throw new Error('No accounts returned')
})
}
plugin.removeAccount = function(data) {
return runServiceCommand(
apk.wire.MessageType.DO_REMOVE_ACCOUNT