Ejemplo n.º 1
0
        /// <summary>
        /// Retrieve a list of usage-records belonging to the account used to make the request
        /// </summary>
        ///
        /// <param name="pathAccountSid"> The account_sid </param>
        /// <param name="category"> Only include usage of a given category </param>
        /// <param name="startDate"> Filter by start date </param>
        /// <param name="endDate"> Filter by end date </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 Record </returns>
        public static async System.Threading.Tasks.Task <ResourceSet <RecordResource> > ReadAsync(string pathAccountSid = null, RecordResource.CategoryEnum category = null, DateTime?startDate = null, DateTime?endDate = null, int?pageSize = null, long?limit = null, ITwilioRestClient client = null)
        {
            var options = new ReadRecordOptions {
                PathAccountSid = pathAccountSid, Category = category, StartDate = startDate, EndDate = endDate, PageSize = pageSize, Limit = limit
            };

            return(await ReadAsync(options, client));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Retrieve a list of usage-records belonging to the account used to make the request
        /// </summary>
        /// <param name="options"> Read Record parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Record </returns>
        public static ResourceSet <RecordResource> Read(ReadRecordOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = client.Request(BuildReadRequest(options, client));

            var page = Page <RecordResource> .FromJson("usage_records", response.Content);

            return(new ResourceSet <RecordResource>(page, options, client));
        }
Ejemplo n.º 3
0
 private static Request BuildReadRequest(ReadRecordOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Get,
                Rest.Domain.Api,
                "/2010-04-01/Accounts/" + (options.PathAccountSid ?? client.AccountSid) + "/Usage/Records.json",
                queryParams: options.GetParams()
                ));
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Retrieve a list of usage-records belonging to the account used to make the request
        /// </summary>
        /// <param name="pathAccountSid"> The account_sid </param>
        /// <param name="category"> Only include usage of a given category </param>
        /// <param name="startDate"> Filter by start date </param>
        /// <param name="endDate"> Filter by end date </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 Record </returns>
        public static ResourceSet <RecordResource> Read(string pathAccountSid = null,
                                                        RecordResource.CategoryEnum category = null,
                                                        DateTime?startDate       = null,
                                                        DateTime?endDate         = null,
                                                        int?pageSize             = null,
                                                        long?limit               = null,
                                                        ITwilioRestClient client = null)
        {
            var options = new ReadRecordOptions()
            {
                PathAccountSid = pathAccountSid, Category = category, StartDate = startDate, EndDate = endDate, PageSize = pageSize, Limit = limit
            };

            return(Read(options, client));
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Retrieve a list of usage-records belonging to the account used to make the request
        /// </summary>
        /// <param name="options"> Read Record parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of Record </returns>
        public static async System.Threading.Tasks.Task <ResourceSet <RecordResource> > ReadAsync(ReadRecordOptions options,
                                                                                                  ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = await client.RequestAsync(BuildReadRequest(options, client));

            var page = Page <RecordResource> .FromJson("usage_records", response.Content);

            return(new ResourceSet <RecordResource>(page, options, client));
        }