/// <summary>
        /// Retrieve the context for an Execution Step.
        /// </summary>
        /// <param name="options"> Fetch ExecutionStepContext parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of ExecutionStepContext </returns>
        public static ExecutionStepContextResource Fetch(FetchExecutionStepContextOptions options,
                                                         ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = client.Request(BuildFetchRequest(options, client));

            return(FromJson(response.Content));
        }
        /// <summary>
        /// Retrieve the context for an Execution Step.
        /// </summary>
        /// <param name="pathFlowSid"> The SID of the Flow </param>
        /// <param name="pathExecutionSid"> The SID of the Execution </param>
        /// <param name="pathStepSid"> Step SID </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of ExecutionStepContext </returns>
        public static async System.Threading.Tasks.Task <ExecutionStepContextResource> FetchAsync(string pathFlowSid,
                                                                                                  string pathExecutionSid,
                                                                                                  string pathStepSid,
                                                                                                  ITwilioRestClient client = null)
        {
            var options = new FetchExecutionStepContextOptions(pathFlowSid, pathExecutionSid, pathStepSid);

            return(await FetchAsync(options, client));
        }
        /// <summary>
        /// Retrieve the context for an Execution Step.
        /// </summary>
        /// <param name="pathFlowSid"> The SID of the Flow </param>
        /// <param name="pathExecutionSid"> The SID of the Execution </param>
        /// <param name="pathStepSid"> Step SID </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of ExecutionStepContext </returns>
        public static ExecutionStepContextResource Fetch(string pathFlowSid,
                                                         string pathExecutionSid,
                                                         string pathStepSid,
                                                         ITwilioRestClient client = null)
        {
            var options = new FetchExecutionStepContextOptions(pathFlowSid, pathExecutionSid, pathStepSid);

            return(Fetch(options, client));
        }
 private static Request BuildFetchRequest(FetchExecutionStepContextOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Get,
                Rest.Domain.Studio,
                "/v2/Flows/" + options.PathFlowSid + "/Executions/" + options.PathExecutionSid + "/Steps/" + options.PathStepSid + "/Context",
                queryParams: options.GetParams()
                ));
 }
        /// <summary>
        /// Retrieve the context for an Execution Step.
        /// </summary>
        /// <param name="options"> Fetch ExecutionStepContext parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of ExecutionStepContext </returns>
        public static async System.Threading.Tasks.Task <ExecutionStepContextResource> FetchAsync(FetchExecutionStepContextOptions options,
                                                                                                  ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = await client.RequestAsync(BuildFetchRequest(options, client));

            return(FromJson(response.Content));
        }