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

            return(FromJson(response.Content));
        }
 private static Request BuildUpdateRequest(UpdateChallengeOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Post,
                Rest.Domain.Authy,
                "/v1/Services/" + options.PathServiceSid + "/Entities/" + options.PathIdentity + "/Factors/" + options.PathFactorSid + "/Challenges/" + options.PathSid + "",
                postParams: options.GetParams()
                ));
 }
        /// <summary>
        /// Verify 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="authPayload"> Optional payload to verify the Challenge </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> UpdateAsync(string pathServiceSid,
                                                                                        string pathIdentity,
                                                                                        string pathFactorSid,
                                                                                        string pathSid,
                                                                                        string authPayload       = null,
                                                                                        ITwilioRestClient client = null)
        {
            var options = new UpdateChallengeOptions(pathServiceSid, pathIdentity, pathFactorSid, pathSid)
            {
                AuthPayload = authPayload
            };

            return(await UpdateAsync(options, client));
        }
        /// <summary>
        /// Verify 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="authPayload"> Optional payload to verify the Challenge </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Challenge </returns>
        public static ChallengeResource Update(string pathServiceSid,
                                               string pathIdentity,
                                               string pathFactorSid,
                                               string pathSid,
                                               string authPayload       = null,
                                               ITwilioRestClient client = null)
        {
            var options = new UpdateChallengeOptions(pathServiceSid, pathIdentity, pathFactorSid, pathSid)
            {
                AuthPayload = authPayload
            };

            return(Update(options, client));
        }
        /// <summary>
        /// Verify a specific Challenge.
        /// </summary>
        /// <param name="options"> Update 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> UpdateAsync(UpdateChallengeOptions options,
                                                                                        ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = await client.RequestAsync(BuildUpdateRequest(options, client));

            return(FromJson(response.Content));
        }