REST Components

Most of the code under the Components folder in NebulaRnD.TwilioServer was adapted from the Twilio WCF Client project. These classes expose data de-serialized from Twilio responses to REST calls. For example, to get information about recent phone calls, a REST query is created (URL is built) and a connection to the server is made. The XML response is then parsed into a strongly typed collection of singular objects. You can then use these objects for any purpose you wish - all of the "housekeeping" related to creating the query and parsing the results is completely hidden in TSL.NET.

The Account.cs file has classes AccountList and Account.
  • AccountList derives from PagedList<Account>
    • PagedList<T> is under Components\Base and itself derives from List<T>. This class defines collections where result sets can be paged back from the Twilio server.
  • The Account class derives from BaseFriendlyNameInfo.
    • All components derive from the same base class. Each derived class inherits the common features of the base class, and adds its own unique fields.
    • BaseFriendlyNameInfo itself derives from BaseAccountInfo (note more account related), which derives from BaseInfo, which itself is abstract with some simple implementation. BaseInfo represents information common to all Twilio API responses.
  • A second partial Account class definition in Account.cs includes a Save method, allowing applications to save account changes back to the Twilio server.

Notification.cs has NotificationList, Notification, and NotificationFilter.
  • The *Filter classes are used to refine Account queries, to return specific data.
  • NotificationFilter specifically allows queries to limit responses to a specific log, or to a range of message dates.

SmsMessageList, SmsMessage, and SmsMessageFilter were added in v0.2.0 which now fully supports SMS.

The structure of the following files is identical to the Account classes except with no Save method:
  • IncomingPhoneNumber.cs has classes IncomingPhoneNumberList and IncomingPhoneNumber.
  • OutgoingCallerId.cs has a list and a singular class.
  • Transcription.cs has a list and a singular class.
  • Recording.cs and PhoneCall.cs have a list, singular, and filter classes.

Last edited Jun 21, 2010 at 5:54 AM by TonyGravagno, version 2


No comments yet.