/// <summary> /// Triggers a new Execution for the Flow /// </summary> /// <param name="options"> Create Execution parameters </param> /// <param name="client"> Client to make requests to Twilio </param> /// <returns> A single instance of Execution </returns> public static ExecutionResource Create(CreateExecutionOptions options, ITwilioRestClient client = null) { client = client ?? TwilioClient.GetRestClient(); var response = client.Request(BuildCreateRequest(options, client)); return(FromJson(response.Content)); }
private static Request BuildCreateRequest(CreateExecutionOptions options, ITwilioRestClient client) { return(new Request( HttpMethod.Post, Rest.Domain.Studio, "/v2/Flows/" + options.PathFlowSid + "/Executions", postParams: options.GetParams() )); }
/// <summary> /// Triggers a new Execution for the Flow /// </summary> /// <param name="pathFlowSid"> The SID of the Flow </param> /// <param name="to"> The Contact phone number to start a Studio Flow Execution </param> /// <param name="from"> The Twilio phone number to send messages or initiate calls from during the Flow Execution /// </param> /// <param name="parameters"> JSON data that will be added to the Flow's context </param> /// <param name="client"> Client to make requests to Twilio </param> /// <returns> Task that resolves to A single instance of Execution </returns> public static async System.Threading.Tasks.Task <ExecutionResource> CreateAsync(string pathFlowSid, Types.PhoneNumber to, Types.PhoneNumber from, object parameters = null, ITwilioRestClient client = null) { var options = new CreateExecutionOptions(pathFlowSid, to, from) { Parameters = parameters }; return(await CreateAsync(options, client)); }
/// <summary> /// Triggers a new Execution for the Flow /// </summary> /// <param name="pathFlowSid"> The SID of the Flow </param> /// <param name="to"> The Contact phone number to start a Studio Flow Execution </param> /// <param name="from"> The Twilio phone number to send messages or initiate calls from during the Flow Execution /// </param> /// <param name="parameters"> JSON data that will be added to the Flow's context </param> /// <param name="client"> Client to make requests to Twilio </param> /// <returns> A single instance of Execution </returns> public static ExecutionResource Create(string pathFlowSid, Types.PhoneNumber to, Types.PhoneNumber from, object parameters = null, ITwilioRestClient client = null) { var options = new CreateExecutionOptions(pathFlowSid, to, from) { Parameters = parameters }; return(Create(options, client)); }
/// <summary> /// Triggers a new Execution for the Flow /// </summary> /// <param name="options"> Create Execution parameters </param> /// <param name="client"> Client to make requests to Twilio </param> /// <returns> Task that resolves to A single instance of Execution </returns> public static async System.Threading.Tasks.Task <ExecutionResource> CreateAsync(CreateExecutionOptions options, ITwilioRestClient client = null) { client = client ?? TwilioClient.GetRestClient(); var response = await client.RequestAsync(BuildCreateRequest(options, client)); return(FromJson(response.Content)); }