private void AddEventListOptions(EventListRequest options, RestRequest request) { if (options.StartDate.HasValue) { request.AddParameter("StartDate", options.StartDate.Value.ToString("yyyy-MM-ddTHH:mm:ssK")); } if (options.EndDate.HasValue) { request.AddParameter("EndDate", options.EndDate.Value.ToString("yyyy-MM-ddTHH:mm:ssK")); } if (options.ActorSid.HasValue()) { request.AddParameter("ActorSid", options.ActorSid); } if (options.SourceIpAddress.HasValue()) { request.AddParameter("SourceIpAddress", options.SourceIpAddress); } if (options.ResourceSid.HasValue()) { request.AddParameter("ResourceSid", options.ResourceSid); } if (options.EventType.HasValue()) { request.AddParameter("EventType", options.EventType); } if (options.PageToken.HasValue()) { request.AddParameter("PageToken", options.PageToken); } if (options.Count.HasValue) { request.AddParameter("PageSize", options.Count.Value); } }
/// <summary> /// Lists the events. /// </summary> public virtual void ListEvents(EventListRequest options, Action<EventResult> callback) { var request = new RestRequest(); request.Resource = "Events"; AddEventListOptions(options, request); ExecuteAsync<EventResult>(request, callback); }
/// <summary> /// Lists the events. /// </summary> /// <param name="options">Options.</param> public virtual EventResult ListEvents(EventListRequest options) { var request = new RestRequest(); request.Resource = "Events"; AddEventListOptions(options, request); return Execute<EventResult>(request); }
/// <summary> /// Lists the events. /// </summary> /// <param name="options">Options.</param> public virtual async Task<EventResult> ListEventsAsync(EventListRequest options) { var request = new RestRequest(); request.Resource = "Events"; AddEventListOptions(options, request); return await Execute<EventResult>(request); }
/// <summary> /// Lists the events. /// </summary> public virtual void ListEvents(EventListRequest options, Action <EventResult> callback) { var request = new RestRequest(); request.Resource = "Events"; AddEventListOptions(options, request); ExecuteAsync <EventResult>(request, callback); }
/// <summary> /// Lists the events. /// </summary> /// <param name="options">Options.</param> public virtual EventResult ListEvents(EventListRequest options) { var request = new RestRequest(); request.Resource = "Events"; AddEventListOptions(options, request); return(Execute <EventResult>(request)); }
static void Main(string[] args) { // Find your Account Sid and Auth Token at twilio.com/user/account string AccountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; string AuthToken = "your_auth_token"; var monitor = new MonitorClient(AccountSid, AuthToken); var options = new EventListRequest(); options.ResourceSid = "PN4aa51b930717ea83c91971b86d99018f"; var events = monitor.ListEvents(options); foreach (var e in events.Events) { Console.WriteLine(e.Description); } }
static void Main(string[] args) { // Find your Account Sid and Auth Token at twilio.com/user/account string AccountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; string AuthToken = "your_auth_token"; var monitor = new MonitorClient(AccountSid, AuthToken); var options = new EventListRequest(); options.StartDate = new DateTime(2015, 3, 1); options.EndDate = new DateTime(2015, 4, 1); var events = monitor.ListEvents(options); foreach (var e in events.Events) { Console.WriteLine(e.Description); } }