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

            return(FromJson(response.Content));
        }
 private static Request BuildFetchRequest(FetchChallengeOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Get,
                Rest.Domain.Verify,
                "/v2/Services/" + options.PathServiceSid + "/Entities/" + options.PathIdentity + "/Factors/" + options.PathFactorSid + "/Challenges/" + options.PathSid + "",
                queryParams: options.GetParams()
                ));
 }
        /// <summary>
        /// Fetch a specific Challenge.
        /// </summary>
        /// <param name="pathServiceSid"> Service Sid. </param>
        /// <param name="pathIdentity"> Unique identity of the Entity </param>
        /// <param name="pathFactorSid"> Factor Sid. </param>
        /// <param name="pathSid"> A string that uniquely identifies this Challenge, or `latest`. </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of Challenge </returns>
        public static async System.Threading.Tasks.Task <ChallengeResource> FetchAsync(string pathServiceSid,
                                                                                       string pathIdentity,
                                                                                       string pathFactorSid,
                                                                                       string pathSid,
                                                                                       ITwilioRestClient client = null)
        {
            var options = new FetchChallengeOptions(pathServiceSid, pathIdentity, pathFactorSid, pathSid);

            return(await FetchAsync(options, client));
        }
        /// <summary>
        /// Fetch a specific Challenge.
        /// </summary>
        /// <param name="pathServiceSid"> Service Sid. </param>
        /// <param name="pathIdentity"> Unique identity of the Entity </param>
        /// <param name="pathFactorSid"> Factor Sid. </param>
        /// <param name="pathSid"> A string that uniquely identifies this Challenge, or `latest`. </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Challenge </returns>
        public static ChallengeResource Fetch(string pathServiceSid,
                                              string pathIdentity,
                                              string pathFactorSid,
                                              string pathSid,
                                              ITwilioRestClient client = null)
        {
            var options = new FetchChallengeOptions(pathServiceSid, pathIdentity, pathFactorSid, pathSid);

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

            return(FromJson(response.Content));
        }