public Account GetSubAccount(String friendlyName)
{
_parameters.Clear();
if (String.IsNullOrEmpty(friendlyName))
{
throw new ArgumentNullException("friendlyName");
}
_parameters.Add("FriendlyName", friendlyName);
_twilioResponse = _account.request("Accounts.json", "GET", _parameters);
dynamic data = ParseResponseData(_twilioResponse);
var acct = new Account
{
sid = data.sid,
friendly_name = data.friendly_name,
status = data.status,
auth_token = data.auth_token,
date_created = Convert.ToDateTime(data.date_created),
date_updated = Convert.ToDateTime(data.date_updated),
type = data.type,
uri = data.uri
};
var subresourceUri = new SubresourceUri
{
available_phone_numbers = data.subresource_uris.available_phone_numbers,
calls = data.subresource_uris.calls,
conferences = data.subresource_uris.conferences,
incoming_phone_numbers = data.subresource_uris.incoming_phone_numbers,
notifications = data.subresource_uris.notifications,
outgoing_caller_ids = data.subresource_uris.outgoing_caller_ids,
recordings = data.subresource_uris.recordings,
sandbox = data.subresource_uris.sandbox,
sms_messages = data.subresource_uris.sms_messages,
transcriptions = data.subresource_uris.transcriptions
};
acct.subresource_uris = subresourceUri;
return acct;
}