/// <summary>
        /// Fetch a specific Success Rate.
        /// </summary>
        /// <param name="options"> Fetch SuccessRate parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of SuccessRate </returns>
        public static SuccessRateResource Fetch(FetchSuccessRateOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = client.Request(BuildFetchRequest(options, client));

            return(FromJson(response.Content));
        }
 private static Request BuildFetchRequest(FetchSuccessRateOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Get,
                Rest.Domain.Preview,
                "/TrustedComms/Businesses/" + options.PathBusinessSid + "/Insights/SuccessRate",
                client.Region,
                queryParams: options.GetParams()
                ));
 }
        /// <summary>
        /// Fetch a specific Success Rate.
        /// </summary>
        /// <param name="pathBusinessSid"> Business Sid. </param>
        /// <param name="brandSid"> Brand Sid. </param>
        /// <param name="brandedChannelSid"> Branded Channel Sid. </param>
        /// <param name="phoneNumberSid"> Phone Number Sid. </param>
        /// <param name="country"> Country 2-letter ISO 3166 code. </param>
        /// <param name="start"> The start date that for this Success Rate. </param>
        /// <param name="end"> The end date that for this Success Rate. </param>
        /// <param name="interval"> The Interval of this Success Rate. </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of SuccessRate </returns>
        public static async System.Threading.Tasks.Task <SuccessRateResource> FetchAsync(string pathBusinessSid,
                                                                                         string brandSid          = null,
                                                                                         string brandedChannelSid = null,
                                                                                         string phoneNumberSid    = null,
                                                                                         string country           = null,
                                                                                         DateTime?start           = null,
                                                                                         DateTime?end             = null,
                                                                                         SuccessRateResource.IntervalsEnum interval = null,
                                                                                         ITwilioRestClient client = null)
        {
            var options = new FetchSuccessRateOptions(pathBusinessSid)
            {
                BrandSid = brandSid, BrandedChannelSid = brandedChannelSid, PhoneNumberSid = phoneNumberSid, Country = country, Start = start, End = end, Interval = interval
            };

            return(await FetchAsync(options, client));
        }
        /// <summary>
        /// Fetch a specific Success Rate.
        /// </summary>
        /// <param name="options"> Fetch SuccessRate parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of SuccessRate </returns>
        public static async System.Threading.Tasks.Task <SuccessRateResource> FetchAsync(FetchSuccessRateOptions options,
                                                                                         ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = await client.RequestAsync(BuildFetchRequest(options, client));

            return(FromJson(response.Content));
        }