Example #1
0
        /// <summary>
        /// read
        /// </summary>
        ///
        /// <param name="pathAccountSid"> The account_sid </param>
        /// <param name="category"> The category </param>
        /// <param name="startDate"> The start_date </param>
        /// <param name="endDate"> The 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 Yearly </returns>
        public static async System.Threading.Tasks.Task <ResourceSet <YearlyResource> > ReadAsync(string pathAccountSid = null, YearlyResource.CategoryEnum category = null, DateTime?startDate = null, DateTime?endDate = null, int?pageSize = null, long?limit = null, ITwilioRestClient client = null)
        {
            var options = new ReadYearlyOptions {
                PathAccountSid = pathAccountSid, Category = category, StartDate = startDate, EndDate = endDate, PageSize = pageSize, Limit = limit
            };

            return(await ReadAsync(options, client));
        }
Example #2
0
        /// <summary>
        /// read
        /// </summary>
        /// <param name="options"> Read Yearly parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Yearly </returns>
        public static ResourceSet<YearlyResource> Read(ReadYearlyOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = client.Request(BuildReadRequest(options, client));

            var page = Page<YearlyResource>.FromJson("usage_records", response.Content);
            return new ResourceSet<YearlyResource>(page, options, client);
        }
Example #3
0
 private static Request BuildReadRequest(ReadYearlyOptions options, ITwilioRestClient client)
 {
     return new Request(
         HttpMethod.Get,
         Rest.Domain.Api,
         "/2010-04-01/Accounts/" + (options.PathAccountSid ?? client.AccountSid) + "/Usage/Records/Yearly.json",
         queryParams: options.GetParams()
     );
 }
Example #4
0
 /// <summary>
 /// read
 /// </summary>
 /// <param name="pathAccountSid"> The SID of the Account that created the resources to read </param>
 /// <param name="category"> The usage category of the UsageRecord resources to read </param>
 /// <param name="startDate"> Only include usage that has occurred on or after this date </param>
 /// <param name="endDate"> Only include usage that occurred on or before this date </param>
 /// <param name="includeSubaccounts"> Whether to include usage from the master account and all its subaccounts </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 Yearly </returns>
 public static ResourceSet<YearlyResource> Read(string pathAccountSid = null,
                                                YearlyResource.CategoryEnum category = null,
                                                DateTime? startDate = null,
                                                DateTime? endDate = null,
                                                bool? includeSubaccounts = null,
                                                int? pageSize = null,
                                                long? limit = null,
                                                ITwilioRestClient client = null)
 {
     var options = new ReadYearlyOptions(){PathAccountSid = pathAccountSid, Category = category, StartDate = startDate, EndDate = endDate, IncludeSubaccounts = includeSubaccounts, PageSize = pageSize, Limit = limit};
     return Read(options, client);
 }
Example #5
0
        /// <summary>
        /// read
        /// </summary>
        ///
        /// <param name="options"> Read Yearly parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of Yearly </returns>
        public static async System.Threading.Tasks.Task <ResourceSet <YearlyResource> > ReadAsync(ReadYearlyOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = await client.RequestAsync(BuildReadRequest(options, client));

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

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