From f4815b27c86ef1b3bf3150da4d36b551da260924 Mon Sep 17 00:00:00 2001 From: Evan Fossier Date: Thu, 22 Mar 2018 17:09:05 -0700 Subject: [PATCH] [Librarian] Regenerated @ 0d6397ea462cf38ccee74f7de204ee1261bb0d8f --- CHANGES.md | 12 ++ .../Rest/Lookups/V1/PhoneNumberResource.cs | 5 - .../Understand/Service/ModelBuildResource.cs | 10 ++ .../Engagement/EngagementContextOptions.cs | 51 ++++++ .../Engagement/EngagementContextResource.cs | 147 +++++++++++++++++ .../Engagement/Step/StepContextOptions.cs | 57 +++++++ .../Engagement/Step/StepContextResource.cs | 156 ++++++++++++++++++ .../Studio/V1/Flow/Engagement/StepResource.cs | 5 + .../Rest/Studio/V1/Flow/EngagementResource.cs | 10 +- .../Lookups/V1/PhoneNumberResourceTest.cs | 2 +- .../Service/ModelBuildResourceTest.cs | 8 +- .../EngagementContextResourceTest.cs | 60 +++++++ .../Step/StepContextResourceTest.cs | 60 +++++++ .../V1/Flow/Engagement/StepResourceTest.cs | 2 +- .../Studio/V1/Flow/EngagementResourceTest.cs | 4 +- 15 files changed, 571 insertions(+), 18 deletions(-) create mode 100644 src/Twilio/Rest/Studio/V1/Flow/Engagement/EngagementContextOptions.cs create mode 100644 src/Twilio/Rest/Studio/V1/Flow/Engagement/EngagementContextResource.cs create mode 100644 src/Twilio/Rest/Studio/V1/Flow/Engagement/Step/StepContextOptions.cs create mode 100644 src/Twilio/Rest/Studio/V1/Flow/Engagement/Step/StepContextResource.cs create mode 100644 test/Twilio.Test/Rest/Studio/V1/Flow/Engagement/EngagementContextResourceTest.cs create mode 100644 test/Twilio.Test/Rest/Studio/V1/Flow/Engagement/Step/StepContextResourceTest.cs diff --git a/CHANGES.md b/CHANGES.md index 0bddadea2..48f896a04 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,18 @@ twilio-csharp Changelog ======================= +[2018-03-22] Version 5.10.0 +---------------------------- +**Lookups** +- Disable support for `fraud` lookups *(breaking change)* + +**Preview** +- Add `BuildDuration` and `ErrorCode` to Understand ModelBuild + +**Studio** +- Add new /Context endpoint for step and engagement resources. + + [2018-03-09] Version 5.9.8 --------------------------- **Api** diff --git a/src/Twilio/Rest/Lookups/V1/PhoneNumberResource.cs b/src/Twilio/Rest/Lookups/V1/PhoneNumberResource.cs index 39822b241..bc3edda90 100644 --- a/src/Twilio/Rest/Lookups/V1/PhoneNumberResource.cs +++ b/src/Twilio/Rest/Lookups/V1/PhoneNumberResource.cs @@ -164,11 +164,6 @@ public static PhoneNumberResource FromJson(string json) [JsonProperty("carrier")] public Dictionary Carrier { get; private set; } /// - /// The fraud - /// - [JsonProperty("fraud")] - public Dictionary Fraud { get; private set; } - /// /// The add_ons /// [JsonProperty("add_ons")] diff --git a/src/Twilio/Rest/Preview/Understand/Service/ModelBuildResource.cs b/src/Twilio/Rest/Preview/Understand/Service/ModelBuildResource.cs index b96ca6b1e..0e8812a08 100644 --- a/src/Twilio/Rest/Preview/Understand/Service/ModelBuildResource.cs +++ b/src/Twilio/Rest/Preview/Understand/Service/ModelBuildResource.cs @@ -530,6 +530,16 @@ public static ModelBuildResource FromJson(string json) /// [JsonProperty("url")] public Uri Url { get; private set; } + /// + /// The build_duration + /// + [JsonProperty("build_duration")] + public int? BuildDuration { get; private set; } + /// + /// The error_code + /// + [JsonProperty("error_code")] + public int? ErrorCode { get; private set; } private ModelBuildResource() { diff --git a/src/Twilio/Rest/Studio/V1/Flow/Engagement/EngagementContextOptions.cs b/src/Twilio/Rest/Studio/V1/Flow/Engagement/EngagementContextOptions.cs new file mode 100644 index 000000000..90f800091 --- /dev/null +++ b/src/Twilio/Rest/Studio/V1/Flow/Engagement/EngagementContextOptions.cs @@ -0,0 +1,51 @@ +/// This code was generated by +/// \ / _ _ _| _ _ +/// | (_)\/(_)(_|\/| |(/_ v1.0.0 +/// / / + +using System; +using System.Collections.Generic; +using Twilio.Base; +using Twilio.Converters; + +namespace Twilio.Rest.Studio.V1.Flow.Engagement +{ + + /// + /// PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution. + /// + /// FetchEngagementContextOptions + /// + public class FetchEngagementContextOptions : IOptions + { + /// + /// The flow_sid + /// + public string PathFlowSid { get; } + /// + /// The engagement_sid + /// + public string PathEngagementSid { get; } + + /// + /// Construct a new FetchEngagementContextOptions + /// + /// The flow_sid + /// The engagement_sid + public FetchEngagementContextOptions(string pathFlowSid, string pathEngagementSid) + { + PathFlowSid = pathFlowSid; + PathEngagementSid = pathEngagementSid; + } + + /// + /// Generate the necessary parameters + /// + public List> GetParams() + { + var p = new List>(); + return p; + } + } + +} \ No newline at end of file diff --git a/src/Twilio/Rest/Studio/V1/Flow/Engagement/EngagementContextResource.cs b/src/Twilio/Rest/Studio/V1/Flow/Engagement/EngagementContextResource.cs new file mode 100644 index 000000000..3d113e767 --- /dev/null +++ b/src/Twilio/Rest/Studio/V1/Flow/Engagement/EngagementContextResource.cs @@ -0,0 +1,147 @@ +/// This code was generated by +/// \ / _ _ _| _ _ +/// | (_)\/(_)(_|\/| |(/_ v1.0.0 +/// / / +/// +/// PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution. +/// +/// EngagementContextResource +/// + +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using Twilio.Base; +using Twilio.Clients; +using Twilio.Converters; +using Twilio.Exceptions; +using Twilio.Http; + +namespace Twilio.Rest.Studio.V1.Flow.Engagement +{ + + public class EngagementContextResource : Resource + { + private static Request BuildFetchRequest(FetchEngagementContextOptions options, ITwilioRestClient client) + { + return new Request( + HttpMethod.Get, + Rest.Domain.Studio, + "/v1/Flows/" + options.PathFlowSid + "/Engagements/" + options.PathEngagementSid + "/Context", + client.Region, + queryParams: options.GetParams() + ); + } + + /// + /// fetch + /// + /// Fetch EngagementContext parameters + /// Client to make requests to Twilio + /// A single instance of EngagementContext + public static EngagementContextResource Fetch(FetchEngagementContextOptions options, ITwilioRestClient client = null) + { + client = client ?? TwilioClient.GetRestClient(); + var response = client.Request(BuildFetchRequest(options, client)); + return FromJson(response.Content); + } + + #if !NET35 + /// + /// fetch + /// + /// Fetch EngagementContext parameters + /// Client to make requests to Twilio + /// Task that resolves to A single instance of EngagementContext + public static async System.Threading.Tasks.Task FetchAsync(FetchEngagementContextOptions options, + ITwilioRestClient client = null) + { + client = client ?? TwilioClient.GetRestClient(); + var response = await client.RequestAsync(BuildFetchRequest(options, client)); + return FromJson(response.Content); + } + #endif + + /// + /// fetch + /// + /// The flow_sid + /// The engagement_sid + /// Client to make requests to Twilio + /// A single instance of EngagementContext + public static EngagementContextResource Fetch(string pathFlowSid, + string pathEngagementSid, + ITwilioRestClient client = null) + { + var options = new FetchEngagementContextOptions(pathFlowSid, pathEngagementSid); + return Fetch(options, client); + } + + #if !NET35 + /// + /// fetch + /// + /// The flow_sid + /// The engagement_sid + /// Client to make requests to Twilio + /// Task that resolves to A single instance of EngagementContext + public static async System.Threading.Tasks.Task FetchAsync(string pathFlowSid, + string pathEngagementSid, + ITwilioRestClient client = null) + { + var options = new FetchEngagementContextOptions(pathFlowSid, pathEngagementSid); + return await FetchAsync(options, client); + } + #endif + + /// + /// Converts a JSON string into a EngagementContextResource object + /// + /// Raw JSON string + /// EngagementContextResource object represented by the provided JSON + public static EngagementContextResource FromJson(string json) + { + // Convert all checked exceptions to Runtime + try + { + return JsonConvert.DeserializeObject(json); + } + catch (JsonException e) + { + throw new ApiException(e.Message, e); + } + } + + /// + /// The account_sid + /// + [JsonProperty("account_sid")] + public string AccountSid { get; private set; } + /// + /// The context + /// + [JsonProperty("context")] + public object Context { get; private set; } + /// + /// The engagement_sid + /// + [JsonProperty("engagement_sid")] + public string EngagementSid { get; private set; } + /// + /// The flow_sid + /// + [JsonProperty("flow_sid")] + public string FlowSid { get; private set; } + /// + /// The url + /// + [JsonProperty("url")] + public Uri Url { get; private set; } + + private EngagementContextResource() + { + + } + } + +} \ No newline at end of file diff --git a/src/Twilio/Rest/Studio/V1/Flow/Engagement/Step/StepContextOptions.cs b/src/Twilio/Rest/Studio/V1/Flow/Engagement/Step/StepContextOptions.cs new file mode 100644 index 000000000..cababec3b --- /dev/null +++ b/src/Twilio/Rest/Studio/V1/Flow/Engagement/Step/StepContextOptions.cs @@ -0,0 +1,57 @@ +/// This code was generated by +/// \ / _ _ _| _ _ +/// | (_)\/(_)(_|\/| |(/_ v1.0.0 +/// / / + +using System; +using System.Collections.Generic; +using Twilio.Base; +using Twilio.Converters; + +namespace Twilio.Rest.Studio.V1.Flow.Engagement.Step +{ + + /// + /// PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution. + /// + /// FetchStepContextOptions + /// + public class FetchStepContextOptions : IOptions + { + /// + /// The flow_sid + /// + public string PathFlowSid { get; } + /// + /// The engagement_sid + /// + public string PathEngagementSid { get; } + /// + /// The step_sid + /// + public string PathStepSid { get; } + + /// + /// Construct a new FetchStepContextOptions + /// + /// The flow_sid + /// The engagement_sid + /// The step_sid + public FetchStepContextOptions(string pathFlowSid, string pathEngagementSid, string pathStepSid) + { + PathFlowSid = pathFlowSid; + PathEngagementSid = pathEngagementSid; + PathStepSid = pathStepSid; + } + + /// + /// Generate the necessary parameters + /// + public List> GetParams() + { + var p = new List>(); + return p; + } + } + +} \ No newline at end of file diff --git a/src/Twilio/Rest/Studio/V1/Flow/Engagement/Step/StepContextResource.cs b/src/Twilio/Rest/Studio/V1/Flow/Engagement/Step/StepContextResource.cs new file mode 100644 index 000000000..fa17f19f2 --- /dev/null +++ b/src/Twilio/Rest/Studio/V1/Flow/Engagement/Step/StepContextResource.cs @@ -0,0 +1,156 @@ +/// This code was generated by +/// \ / _ _ _| _ _ +/// | (_)\/(_)(_|\/| |(/_ v1.0.0 +/// / / +/// +/// PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution. +/// +/// StepContextResource +/// + +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using Twilio.Base; +using Twilio.Clients; +using Twilio.Converters; +using Twilio.Exceptions; +using Twilio.Http; + +namespace Twilio.Rest.Studio.V1.Flow.Engagement.Step +{ + + public class StepContextResource : Resource + { + private static Request BuildFetchRequest(FetchStepContextOptions options, ITwilioRestClient client) + { + return new Request( + HttpMethod.Get, + Rest.Domain.Studio, + "/v1/Flows/" + options.PathFlowSid + "/Engagements/" + options.PathEngagementSid + "/Steps/" + options.PathStepSid + "/Context", + client.Region, + queryParams: options.GetParams() + ); + } + + /// + /// fetch + /// + /// Fetch StepContext parameters + /// Client to make requests to Twilio + /// A single instance of StepContext + public static StepContextResource Fetch(FetchStepContextOptions options, ITwilioRestClient client = null) + { + client = client ?? TwilioClient.GetRestClient(); + var response = client.Request(BuildFetchRequest(options, client)); + return FromJson(response.Content); + } + + #if !NET35 + /// + /// fetch + /// + /// Fetch StepContext parameters + /// Client to make requests to Twilio + /// Task that resolves to A single instance of StepContext + public static async System.Threading.Tasks.Task FetchAsync(FetchStepContextOptions options, + ITwilioRestClient client = null) + { + client = client ?? TwilioClient.GetRestClient(); + var response = await client.RequestAsync(BuildFetchRequest(options, client)); + return FromJson(response.Content); + } + #endif + + /// + /// fetch + /// + /// The flow_sid + /// The engagement_sid + /// The step_sid + /// Client to make requests to Twilio + /// A single instance of StepContext + public static StepContextResource Fetch(string pathFlowSid, + string pathEngagementSid, + string pathStepSid, + ITwilioRestClient client = null) + { + var options = new FetchStepContextOptions(pathFlowSid, pathEngagementSid, pathStepSid); + return Fetch(options, client); + } + + #if !NET35 + /// + /// fetch + /// + /// The flow_sid + /// The engagement_sid + /// The step_sid + /// Client to make requests to Twilio + /// Task that resolves to A single instance of StepContext + public static async System.Threading.Tasks.Task FetchAsync(string pathFlowSid, + string pathEngagementSid, + string pathStepSid, + ITwilioRestClient client = null) + { + var options = new FetchStepContextOptions(pathFlowSid, pathEngagementSid, pathStepSid); + return await FetchAsync(options, client); + } + #endif + + /// + /// Converts a JSON string into a StepContextResource object + /// + /// Raw JSON string + /// StepContextResource object represented by the provided JSON + public static StepContextResource FromJson(string json) + { + // Convert all checked exceptions to Runtime + try + { + return JsonConvert.DeserializeObject(json); + } + catch (JsonException e) + { + throw new ApiException(e.Message, e); + } + } + + /// + /// The account_sid + /// + [JsonProperty("account_sid")] + public string AccountSid { get; private set; } + /// + /// The context + /// + [JsonProperty("context")] + public object Context { get; private set; } + /// + /// The engagement_sid + /// + [JsonProperty("engagement_sid")] + public string EngagementSid { get; private set; } + /// + /// The flow_sid + /// + [JsonProperty("flow_sid")] + public string FlowSid { get; private set; } + /// + /// The step_sid + /// + [JsonProperty("step_sid")] + public string StepSid { get; private set; } + /// + /// The url + /// + [JsonProperty("url")] + public Uri Url { get; private set; } + + private StepContextResource() + { + + } + } + +} \ No newline at end of file diff --git a/src/Twilio/Rest/Studio/V1/Flow/Engagement/StepResource.cs b/src/Twilio/Rest/Studio/V1/Flow/Engagement/StepResource.cs index 33b6910f8..e1403aebb 100644 --- a/src/Twilio/Rest/Studio/V1/Flow/Engagement/StepResource.cs +++ b/src/Twilio/Rest/Studio/V1/Flow/Engagement/StepResource.cs @@ -314,6 +314,11 @@ public static StepResource FromJson(string json) /// [JsonProperty("url")] public Uri Url { get; private set; } + /// + /// The links + /// + [JsonProperty("links")] + public Dictionary Links { get; private set; } private StepResource() { diff --git a/src/Twilio/Rest/Studio/V1/Flow/EngagementResource.cs b/src/Twilio/Rest/Studio/V1/Flow/EngagementResource.cs index 553d5b6f0..f50326cda 100644 --- a/src/Twilio/Rest/Studio/V1/Flow/EngagementResource.cs +++ b/src/Twilio/Rest/Studio/V1/Flow/EngagementResource.cs @@ -369,17 +369,17 @@ public static EngagementResource FromJson(string json) [JsonProperty("contact_channel_address")] public string ContactChannelAddress { get; private set; } /// + /// The context + /// + [JsonProperty("context")] + public object Context { get; private set; } + /// /// The status /// [JsonProperty("status")] [JsonConverter(typeof(StringEnumConverter))] public EngagementResource.StatusEnum Status { get; private set; } /// - /// The context - /// - [JsonProperty("context")] - public object Context { get; private set; } - /// /// The date_created /// [JsonProperty("date_created")] diff --git a/test/Twilio.Test/Rest/Lookups/V1/PhoneNumberResourceTest.cs b/test/Twilio.Test/Rest/Lookups/V1/PhoneNumberResourceTest.cs index 75817655b..b690dd035 100644 --- a/test/Twilio.Test/Rest/Lookups/V1/PhoneNumberResourceTest.cs +++ b/test/Twilio.Test/Rest/Lookups/V1/PhoneNumberResourceTest.cs @@ -49,7 +49,7 @@ public void TestFetchResponse() twilioRestClient.Request(Arg.Any()) .Returns(new Response( System.Net.HttpStatusCode.OK, - "{\"caller_name\": {\"caller_name\": \"Delicious Cheese Cake\",\"caller_type\": \"CONSUMER\",\"error_code\": null},\"carrier\": {\"error_code\": null,\"mobile_country_code\": \"310\",\"mobile_network_code\": \"456\",\"name\": \"verizon\",\"type\": \"mobile\"},\"fraud\": {\"error_code\": null,\"advanced_line_type\": \"voip\",\"is_prepaid\": false,\"mobile_country_code\": \"310\",\"mobile_network_code\": \"456\",\"carrier_name\": \"verizon\",\"caller_name\": \"Delicious Cheese Cake\",\"caller_type\": \"CONSUMER\"},\"country_code\": \"US\",\"national_format\": \"(510) 867-5309\",\"phone_number\": \"+15108675309\",\"add_ons\": {\"status\": \"successful\",\"message\": null,\"code\": null,\"results\": {}},\"url\": \"https://lookups.twilio.com/v1/PhoneNumbers/phone_number\"}" + "{\"caller_name\": {\"caller_name\": \"Delicious Cheese Cake\",\"caller_type\": \"CONSUMER\",\"error_code\": null},\"carrier\": {\"error_code\": null,\"mobile_country_code\": \"310\",\"mobile_network_code\": \"456\",\"name\": \"verizon\",\"type\": \"mobile\"},\"country_code\": \"US\",\"national_format\": \"(510) 867-5309\",\"phone_number\": \"+15108675309\",\"add_ons\": {\"status\": \"successful\",\"message\": null,\"code\": null,\"results\": {}},\"url\": \"https://lookups.twilio.com/v1/PhoneNumbers/phone_number\"}" )); var response = PhoneNumberResource.Fetch(new Twilio.Types.PhoneNumber("+15017122661"), client: twilioRestClient); diff --git a/test/Twilio.Test/Rest/Preview/Understand/Service/ModelBuildResourceTest.cs b/test/Twilio.Test/Rest/Preview/Understand/Service/ModelBuildResourceTest.cs index baf4ee637..a8cb6bc3d 100644 --- a/test/Twilio.Test/Rest/Preview/Understand/Service/ModelBuildResourceTest.cs +++ b/test/Twilio.Test/Rest/Preview/Understand/Service/ModelBuildResourceTest.cs @@ -49,7 +49,7 @@ public void TestFetchResponse() twilioRestClient.Request(Arg.Any()) .Returns(new Response( System.Net.HttpStatusCode.OK, - "{\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"date_updated\": \"2015-07-30T20:00:00Z\",\"url\": \"https://preview.twilio.com/understand/Services/UAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ModelBuilds/UGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"status\": \"enqueued\",\"service_sid\": \"UAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"date_created\": \"2015-07-30T20:00:00Z\",\"sid\": \"UGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"unique_name\": \"unique_name\"}" + "{\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"date_updated\": \"2015-07-30T20:00:00Z\",\"url\": \"https://preview.twilio.com/understand/Services/UAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ModelBuilds/UGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"status\": \"enqueued\",\"service_sid\": \"UAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"date_created\": \"2015-07-30T20:00:00Z\",\"sid\": \"UGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"unique_name\": \"unique_name\",\"build_duration\": null,\"error_code\": null}" )); var response = ModelBuildResource.Fetch("UAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "UGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", client: twilioRestClient); @@ -100,7 +100,7 @@ public void TestReadFullResponse() twilioRestClient.Request(Arg.Any()) .Returns(new Response( System.Net.HttpStatusCode.OK, - "{\"meta\": {\"page\": 0,\"key\": \"model_builds\",\"url\": \"https://preview.twilio.com/understand/Services/UAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ModelBuilds?PageSize=50&Page=0\",\"first_page_url\": \"https://preview.twilio.com/understand/Services/UAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ModelBuilds?PageSize=50&Page=0\",\"next_page_url\": null,\"previous_page_url\": null,\"page_size\": 50},\"model_builds\": [{\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"date_updated\": \"2015-07-30T20:00:00Z\",\"url\": \"https://preview.twilio.com/understand/Services/UAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ModelBuilds/UGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"status\": \"enqueued\",\"service_sid\": \"UAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"date_created\": \"2015-07-30T20:00:00Z\",\"sid\": \"UGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"unique_name\": \"unique_name\"}]}" + "{\"meta\": {\"page\": 0,\"key\": \"model_builds\",\"url\": \"https://preview.twilio.com/understand/Services/UAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ModelBuilds?PageSize=50&Page=0\",\"first_page_url\": \"https://preview.twilio.com/understand/Services/UAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ModelBuilds?PageSize=50&Page=0\",\"next_page_url\": null,\"previous_page_url\": null,\"page_size\": 50},\"model_builds\": [{\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"date_updated\": \"2015-07-30T20:00:00Z\",\"url\": \"https://preview.twilio.com/understand/Services/UAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ModelBuilds/UGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"status\": \"failed\",\"service_sid\": \"UAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"date_created\": \"2015-07-30T20:00:00Z\",\"sid\": \"UGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"unique_name\": \"unique_name\",\"build_duration\": null,\"error_code\": 23001}]}" )); var response = ModelBuildResource.Read("UAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", client: twilioRestClient); @@ -136,7 +136,7 @@ public void TestCreateResponse() twilioRestClient.Request(Arg.Any()) .Returns(new Response( System.Net.HttpStatusCode.Created, - "{\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"date_updated\": \"2015-07-30T20:00:00Z\",\"url\": \"https://preview.twilio.com/understand/Services/UAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ModelBuilds/UGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"status\": \"enqueued\",\"service_sid\": \"UAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"date_created\": \"2015-07-30T20:00:00Z\",\"sid\": \"UGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"unique_name\": \"unique_name\"}" + "{\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"date_updated\": \"2015-07-30T20:00:00Z\",\"url\": \"https://preview.twilio.com/understand/Services/UAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ModelBuilds/UGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"status\": \"enqueued\",\"service_sid\": \"UAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"date_created\": \"2015-07-30T20:00:00Z\",\"sid\": \"UGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"unique_name\": \"unique_name\",\"build_duration\": null,\"error_code\": null}" )); var response = ModelBuildResource.Create("UAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", client: twilioRestClient); @@ -172,7 +172,7 @@ public void TestUpdateResponse() twilioRestClient.Request(Arg.Any()) .Returns(new Response( System.Net.HttpStatusCode.OK, - "{\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"date_updated\": \"2015-07-30T20:00:00Z\",\"url\": \"https://preview.twilio.com/understand/Services/UAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ModelBuilds/UGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"status\": \"enqueued\",\"service_sid\": \"UAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"date_created\": \"2015-07-30T20:00:00Z\",\"sid\": \"UGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"unique_name\": \"unique_name\"}" + "{\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"date_updated\": \"2015-07-30T20:00:00Z\",\"url\": \"https://preview.twilio.com/understand/Services/UAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ModelBuilds/UGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"status\": \"completed\",\"service_sid\": \"UAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"date_created\": \"2015-07-30T20:00:00Z\",\"sid\": \"UGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"unique_name\": \"unique_name\",\"build_duration\": 100,\"error_code\": null}" )); var response = ModelBuildResource.Update("UAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "UGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", client: twilioRestClient); diff --git a/test/Twilio.Test/Rest/Studio/V1/Flow/Engagement/EngagementContextResourceTest.cs b/test/Twilio.Test/Rest/Studio/V1/Flow/Engagement/EngagementContextResourceTest.cs new file mode 100644 index 000000000..522a02546 --- /dev/null +++ b/test/Twilio.Test/Rest/Studio/V1/Flow/Engagement/EngagementContextResourceTest.cs @@ -0,0 +1,60 @@ +/// This code was generated by +/// \ / _ _ _| _ _ +/// | (_)\/(_)(_|\/| |(/_ v1.0.0 +/// / / + +using NSubstitute; +using NSubstitute.ExceptionExtensions; +using NUnit.Framework; +using System; +using System.Collections.Generic; +using Twilio.Clients; +using Twilio.Converters; +using Twilio.Exceptions; +using Twilio.Http; +using Twilio.Rest.Studio.V1.Flow.Engagement; + +namespace Twilio.Tests.Rest.Studio.V1.Flow.Engagement +{ + + [TestFixture] + public class EngagementContextTest : TwilioTest + { + [Test] + public void TestFetchRequest() + { + var twilioRestClient = Substitute.For(); + var request = new Request( + HttpMethod.Get, + Twilio.Rest.Domain.Studio, + "/v1/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Engagements/FNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Context", + "" + ); + twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content")); + + try + { + EngagementContextResource.Fetch("FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "FNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", client: twilioRestClient); + Assert.Fail("Expected TwilioException to be thrown for 500"); + } + catch (ApiException) {} + twilioRestClient.Received().Request(request); + } + + [Test] + public void TestFetchResponse() + { + var twilioRestClient = Substitute.For(); + twilioRestClient.AccountSid.Returns("ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); + twilioRestClient.Request(Arg.Any()) + .Returns(new Response( + System.Net.HttpStatusCode.OK, + "{\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"context\": {\"foo\": \"bar\"},\"flow_sid\": \"FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"engagement_sid\": \"FNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"url\": \"https://studio.twilio.com/v1/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Engagements/FNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Context\"}" + )); + + var response = EngagementContextResource.Fetch("FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "FNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", client: twilioRestClient); + Assert.NotNull(response); + } + } + +} \ No newline at end of file diff --git a/test/Twilio.Test/Rest/Studio/V1/Flow/Engagement/Step/StepContextResourceTest.cs b/test/Twilio.Test/Rest/Studio/V1/Flow/Engagement/Step/StepContextResourceTest.cs new file mode 100644 index 000000000..9ac4421fe --- /dev/null +++ b/test/Twilio.Test/Rest/Studio/V1/Flow/Engagement/Step/StepContextResourceTest.cs @@ -0,0 +1,60 @@ +/// This code was generated by +/// \ / _ _ _| _ _ +/// | (_)\/(_)(_|\/| |(/_ v1.0.0 +/// / / + +using NSubstitute; +using NSubstitute.ExceptionExtensions; +using NUnit.Framework; +using System; +using System.Collections.Generic; +using Twilio.Clients; +using Twilio.Converters; +using Twilio.Exceptions; +using Twilio.Http; +using Twilio.Rest.Studio.V1.Flow.Engagement.Step; + +namespace Twilio.Tests.Rest.Studio.V1.Flow.Engagement.Step +{ + + [TestFixture] + public class StepContextTest : TwilioTest + { + [Test] + public void TestFetchRequest() + { + var twilioRestClient = Substitute.For(); + var request = new Request( + HttpMethod.Get, + Twilio.Rest.Domain.Studio, + "/v1/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Engagements/FNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Steps/FTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Context", + "" + ); + twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content")); + + try + { + StepContextResource.Fetch("FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "FNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "FTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", client: twilioRestClient); + Assert.Fail("Expected TwilioException to be thrown for 500"); + } + catch (ApiException) {} + twilioRestClient.Received().Request(request); + } + + [Test] + public void TestFetchResponse() + { + var twilioRestClient = Substitute.For(); + twilioRestClient.AccountSid.Returns("ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); + twilioRestClient.Request(Arg.Any()) + .Returns(new Response( + System.Net.HttpStatusCode.OK, + "{\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"context\": {\"foo\": \"bar\"},\"flow_sid\": \"FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"engagement_sid\": \"FNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"step_sid\": \"FTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"url\": \"https://studio.twilio.com/v1/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Engagements/FNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Steps/FTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Context\"}" + )); + + var response = StepContextResource.Fetch("FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "FNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "FTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", client: twilioRestClient); + Assert.NotNull(response); + } + } + +} \ No newline at end of file diff --git a/test/Twilio.Test/Rest/Studio/V1/Flow/Engagement/StepResourceTest.cs b/test/Twilio.Test/Rest/Studio/V1/Flow/Engagement/StepResourceTest.cs index 1951d5dde..62c2f8f68 100644 --- a/test/Twilio.Test/Rest/Studio/V1/Flow/Engagement/StepResourceTest.cs +++ b/test/Twilio.Test/Rest/Studio/V1/Flow/Engagement/StepResourceTest.cs @@ -85,7 +85,7 @@ public void TestFetchResponse() twilioRestClient.Request(Arg.Any()) .Returns(new Response( System.Net.HttpStatusCode.OK, - "{\"sid\": \"FTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"flow_sid\": \"FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"engagement_sid\": \"FNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"name\": \"incomingRequest\",\"context\": {},\"transitioned_from\": \"Trigger\",\"transitioned_to\": \"Ended\",\"date_created\": \"2017-11-06T12:00:00Z\",\"date_updated\": null,\"url\": \"https://studio.twilio.com/v1/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Engagements/FNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Steps/FTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"}" + "{\"sid\": \"FTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"flow_sid\": \"FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"engagement_sid\": \"FNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"name\": \"incomingRequest\",\"context\": {},\"transitioned_from\": \"Trigger\",\"transitioned_to\": \"Ended\",\"date_created\": \"2017-11-06T12:00:00Z\",\"date_updated\": null,\"url\": \"https://studio.twilio.com/v1/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Engagements/FNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Steps/FTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"links\": {\"step_context\": \"https://studio.twilio.com/v1/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Engagements/FNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Steps/FTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Context\"}}" )); var response = StepResource.Fetch("FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "FNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "FTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", client: twilioRestClient); diff --git a/test/Twilio.Test/Rest/Studio/V1/Flow/EngagementResourceTest.cs b/test/Twilio.Test/Rest/Studio/V1/Flow/EngagementResourceTest.cs index 71745a075..96a761994 100644 --- a/test/Twilio.Test/Rest/Studio/V1/Flow/EngagementResourceTest.cs +++ b/test/Twilio.Test/Rest/Studio/V1/Flow/EngagementResourceTest.cs @@ -85,7 +85,7 @@ public void TestFetchResponse() twilioRestClient.Request(Arg.Any()) .Returns(new Response( System.Net.HttpStatusCode.OK, - "{\"sid\": \"FNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"flow_sid\": \"FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"contact_sid\": \"FCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"contact_channel_address\": \"+14155555555\",\"status\": \"ended\",\"context\": {},\"date_created\": \"2017-11-06T12:00:00Z\",\"date_updated\": null,\"url\": \"https://studio.twilio.com/v1/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Engagements/FNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"links\": {\"steps\": \"https://studio.twilio.com/v1/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Engagements/FNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Steps\"}}" + "{\"sid\": \"FNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"flow_sid\": \"FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"contact_sid\": \"FCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"contact_channel_address\": \"+14155555555\",\"status\": \"ended\",\"context\": {},\"date_created\": \"2017-11-06T12:00:00Z\",\"date_updated\": null,\"url\": \"https://studio.twilio.com/v1/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Engagements/FNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"links\": {\"steps\": \"https://studio.twilio.com/v1/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Engagements/FNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Steps\",\"engagement_context\": \"https://studio.twilio.com/v1/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Engagements/FNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Context\"}}" )); var response = EngagementResource.Fetch("FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "FNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", client: twilioRestClient); @@ -123,7 +123,7 @@ public void TestCreateResponse() twilioRestClient.Request(Arg.Any()) .Returns(new Response( System.Net.HttpStatusCode.Created, - "{\"url\": \"https://studio.twilio.com/v1/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Engagements/FNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"sid\": \"FNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"flow_sid\": \"FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"context\": {\"flow\": {\"first_name\": \"Foo\"}},\"contact_sid\": \"FCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"contact_channel_address\": \"+18001234567\",\"status\": \"active\",\"date_created\": \"2015-07-30T20:00:00Z\",\"date_updated\": \"2015-07-30T20:00:00Z\",\"links\": {\"steps\": \"https://studio.twilio.com/v1/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Engagements/FNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Steps\"}}" + "{\"url\": \"https://studio.twilio.com/v1/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Engagements/FNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"sid\": \"FNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"flow_sid\": \"FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"context\": {},\"contact_sid\": \"FCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"contact_channel_address\": \"+18001234567\",\"status\": \"active\",\"date_created\": \"2015-07-30T20:00:00Z\",\"date_updated\": \"2015-07-30T20:00:00Z\",\"links\": {\"steps\": \"https://studio.twilio.com/v1/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Engagements/FNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Steps\",\"engagement_context\": \"https://studio.twilio.com/v1/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Engagements/FNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Context\"}}" )); var response = EngagementResource.Create("FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", new Twilio.Types.PhoneNumber("+15017122661"), new Twilio.Types.PhoneNumber("+15017122661"), client: twilioRestClient);