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