/// <summary> /// Retrieve a list of messages belonging to the account used to make the request /// </summary> /// /// <param name="pathAccountSid"> The account_sid </param> /// <param name="to"> Filter by messages to this number </param> /// <param name="from"> Filter by from number </param> /// <param name="dateSentBefore"> Filter by date sent </param> /// <param name="dateSent"> Filter by date sent </param> /// <param name="dateSentAfter"> Filter by date sent </param> /// <param name="pageSize"> Page size </param> /// <param name="limit"> Record limit </param> /// <param name="client"> Client to make requests to Twilio </param> /// <returns> Task that resolves to A single instance of Message </returns> public static async System.Threading.Tasks.Task <ResourceSet <MessageResource> > ReadAsync(string pathAccountSid = null, Types.PhoneNumber to = null, Types.PhoneNumber from = null, DateTime?dateSentBefore = null, DateTime?dateSent = null, DateTime?dateSentAfter = null, int?pageSize = null, long?limit = null, ITwilioRestClient client = null) { var options = new ReadMessageOptions { PathAccountSid = pathAccountSid, To = to, From = from, DateSentBefore = dateSentBefore, DateSent = dateSent, DateSentAfter = dateSentAfter, PageSize = pageSize, Limit = limit }; return(await ReadAsync(options, client)); }
/// <summary> /// Retrieve a list of messages belonging to the account used to make the request /// </summary> /// <param name="options"> Read Message parameters </param> /// <param name="client"> Client to make requests to Twilio </param> /// <returns> A single instance of Message </returns> public static ResourceSet<MessageResource> Read(ReadMessageOptions options, ITwilioRestClient client = null) { client = client ?? TwilioClient.GetRestClient(); var response = client.Request(BuildReadRequest(options, client)); var page = Page<MessageResource>.FromJson("messages", response.Content); return new ResourceSet<MessageResource>(page, options, client); }
private static Request BuildReadRequest(ReadMessageOptions options, ITwilioRestClient client) { return(new Request( HttpMethod.Get, Rest.Domain.Api, "/2010-04-01/Accounts/" + (options.PathAccountSid ?? client.AccountSid) + "/Messages.json", queryParams: options.GetParams() )); }
/// <summary> /// Retrieve a list of messages belonging to the account used to make the request /// </summary> /// <param name="pathAccountSid"> The SID of the Account that created the resources to read </param> /// <param name="to"> Filter by messages sent to this number </param> /// <param name="from"> Filter by from number </param> /// <param name="dateSentBefore"> Filter by date sent </param> /// <param name="dateSent"> Filter by date sent </param> /// <param name="dateSentAfter"> Filter by date sent </param> /// <param name="pageSize"> Page size </param> /// <param name="limit"> Record limit </param> /// <param name="client"> Client to make requests to Twilio </param> /// <returns> A single instance of Message </returns> public static ResourceSet<MessageResource> Read(string pathAccountSid = null, Types.PhoneNumber to = null, Types.PhoneNumber from = null, DateTime? dateSentBefore = null, DateTime? dateSent = null, DateTime? dateSentAfter = null, int? pageSize = null, long? limit = null, ITwilioRestClient client = null) { var options = new ReadMessageOptions(){PathAccountSid = pathAccountSid, To = to, From = from, DateSentBefore = dateSentBefore, DateSent = dateSent, DateSentAfter = dateSentAfter, PageSize = pageSize, Limit = limit}; return Read(options, client); }
/// <summary> /// Retrieve a list of messages belonging to the account used to make the request /// </summary> /// /// <param name="options"> Read Message parameters </param> /// <param name="client"> Client to make requests to Twilio </param> /// <returns> Task that resolves to A single instance of Message </returns> public static async System.Threading.Tasks.Task <ResourceSet <MessageResource> > ReadAsync(ReadMessageOptions options, ITwilioRestClient client = null) { client = client ?? TwilioClient.GetRestClient(); var response = await client.RequestAsync(BuildReadRequest(options, client)); var page = Page <MessageResource> .FromJson("messages", response.Content); return(new ResourceSet <MessageResource>(page, options, client)); }