From e3ea06fe3ed27f7a347697a1987482d90e20db5c Mon Sep 17 00:00:00 2001 From: AJ Rice <53190766+ajrice6713@users.noreply.github.com> Date: Mon, 27 Sep 2021 15:00:34 -0400 Subject: [PATCH 1/4] DX-2243 Update Machine Detection Model Name --- .../Voice/Models/CreateCallRequest.cs | 4 +- ...st.cs => MachineDetectionConfiguration.cs} | 1172 ++++++++--------- .../Voice/CreateCallTests.cs | 4 +- Bandwidth.sln | 42 +- 4 files changed, 614 insertions(+), 608 deletions(-) rename Bandwidth.Standard/Voice/Models/{MachineDetectionRequest.cs => MachineDetectionConfiguration.cs} (96%) diff --git a/Bandwidth.Standard/Voice/Models/CreateCallRequest.cs b/Bandwidth.Standard/Voice/Models/CreateCallRequest.cs index 20b0705e..b8a22a9f 100644 --- a/Bandwidth.Standard/Voice/Models/CreateCallRequest.cs +++ b/Bandwidth.Standard/Voice/Models/CreateCallRequest.cs @@ -96,7 +96,7 @@ public CreateCallRequest( string disconnectUrl = null, Models.DisconnectMethodEnum? disconnectMethod = null, string tag = null, - Models.MachineDetectionRequest machineDetection = null) + Models.MachineDetectionConfiguration machineDetection = null) { this.From = from; this.To = to; @@ -432,7 +432,7 @@ public string Tag /// Gets or sets MachineDetection. /// [JsonProperty("machineDetection", NullValueHandling = NullValueHandling.Ignore)] - public Models.MachineDetectionRequest MachineDetection { get; set; } + public Models.MachineDetectionConfiguration MachineDetection { get; set; } /// public override string ToString() diff --git a/Bandwidth.Standard/Voice/Models/MachineDetectionRequest.cs b/Bandwidth.Standard/Voice/Models/MachineDetectionConfiguration.cs similarity index 96% rename from Bandwidth.Standard/Voice/Models/MachineDetectionRequest.cs rename to Bandwidth.Standard/Voice/Models/MachineDetectionConfiguration.cs index 91303618..5501fbb7 100644 --- a/Bandwidth.Standard/Voice/Models/MachineDetectionRequest.cs +++ b/Bandwidth.Standard/Voice/Models/MachineDetectionConfiguration.cs @@ -1,587 +1,587 @@ -// -// Copyright (c) APIMatic. All rights reserved. -// -namespace Bandwidth.Standard.Voice.Models -{ - using System; - using System.Collections.Generic; - using System.ComponentModel; - using System.IO; - using System.Linq; - using System.Text; - using System.Threading.Tasks; - using Bandwidth.Standard; - using Bandwidth.Standard.Utilities; - using Newtonsoft.Json; - using Newtonsoft.Json.Converters; - - /// - /// MachineDetectionRequest. - /// - public class MachineDetectionRequest - { - private string callbackUrl; - private Models.CallbackMethodEnum? callbackMethod; - private string fallbackUrl; - private Models.FallbackMethodEnum? fallbackMethod; - private string username; - private string password; - private string fallbackUsername; - private string fallbackPassword; - private Dictionary shouldSerialize = new Dictionary - { - { "callbackUrl", false }, - { "callbackMethod", false }, - { "fallbackUrl", false }, - { "fallbackMethod", false }, - { "username", false }, - { "password", false }, - { "fallbackUsername", false }, - { "fallbackPassword", false }, - }; - - /// - /// Initializes a new instance of the class. - /// - public MachineDetectionRequest() - { - } - - /// - /// Initializes a new instance of the class. - /// - /// mode. - /// detectionTimeout. - /// silenceTimeout. - /// speechThreshold. - /// speechEndThreshold. - /// delayResult. - /// callbackUrl. - /// callbackMethod. - /// fallbackUrl. - /// fallbackMethod. - /// username. - /// password. - /// fallbackUsername. - /// fallbackPassword. - public MachineDetectionRequest( - Models.ModeEnum? mode = null, - double? detectionTimeout = null, - double? silenceTimeout = null, - double? speechThreshold = null, - double? speechEndThreshold = null, - bool? delayResult = null, - string callbackUrl = null, - Models.CallbackMethodEnum? callbackMethod = null, - string fallbackUrl = null, - Models.FallbackMethodEnum? fallbackMethod = null, - string username = null, - string password = null, - string fallbackUsername = null, - string fallbackPassword = null) - { - this.Mode = mode; - this.DetectionTimeout = detectionTimeout; - this.SilenceTimeout = silenceTimeout; - this.SpeechThreshold = speechThreshold; - this.SpeechEndThreshold = speechEndThreshold; - this.DelayResult = delayResult; - if (callbackUrl != null) - { - this.CallbackUrl = callbackUrl; - } - - if (callbackMethod != null) - { - this.CallbackMethod = callbackMethod; - } - - if (fallbackUrl != null) - { - this.FallbackUrl = fallbackUrl; - } - - if (fallbackMethod != null) - { - this.FallbackMethod = fallbackMethod; - } - - if (username != null) - { - this.Username = username; - } - - if (password != null) - { - this.Password = password; - } - - if (fallbackUsername != null) - { - this.FallbackUsername = fallbackUsername; - } - - if (fallbackPassword != null) - { - this.FallbackPassword = fallbackPassword; - } - - } - - /// - /// The machine detection mode. If set to 'async', the detection result will be sent in a 'machineDetectionComplete' callback. If set to 'sync', the 'answer' callback will wait for the machine detection to complete and will include its result. Default is 'async'. - /// - [JsonProperty("mode", ItemConverterType = typeof(StringEnumConverter), NullValueHandling = NullValueHandling.Ignore)] - public Models.ModeEnum? Mode { get; set; } - - /// - /// Total amount of time (in seconds) before giving up. - /// - [JsonProperty("detectionTimeout", NullValueHandling = NullValueHandling.Ignore)] - public double? DetectionTimeout { get; set; } - - /// - /// If no speech is detected in this period, a callback with a 'silence' result is sent. Default is 10 seconds. - /// - [JsonProperty("silenceTimeout", NullValueHandling = NullValueHandling.Ignore)] - public double? SilenceTimeout { get; set; } - - /// - /// When speech has ended and a result couldn't be determined based on the audio content itself, this value is used to determine if the speaker is a machine based on the speech duration. If the length of the speech detected is greater than or equal to this threshold, the result will be 'answering-machine'. If the length of speech detected is below this threshold, the result will be 'human'. Default is 10 seconds. - /// - [JsonProperty("speechThreshold", NullValueHandling = NullValueHandling.Ignore)] - public double? SpeechThreshold { get; set; } - - /// - /// Amount of silence (in seconds) before assuming the callee has finished speaking. - /// - [JsonProperty("speechEndThreshold", NullValueHandling = NullValueHandling.Ignore)] - public double? SpeechEndThreshold { get; set; } - - /// - /// If set to 'true' and if an answering machine is detected, the 'answering-machine' callback will be delayed until the machine is done speaking or until the 'detectionTimeout' is exceeded. If false, the 'answering-machine' result is sent immediately. Default is 'false'. - /// - [JsonProperty("delayResult", NullValueHandling = NullValueHandling.Ignore)] - public bool? DelayResult { get; set; } - - /// - /// The URL to send the 'machineDetectionComplete' callback when the detection is completed. Only for 'async' mode. - /// - [JsonProperty("callbackUrl")] - public string CallbackUrl - { - get - { - return this.callbackUrl; - } - - set - { - this.shouldSerialize["callbackUrl"] = true; - this.callbackUrl = value; - } - } - - /// - /// Gets or sets CallbackMethod. - /// - [JsonProperty("callbackMethod", ItemConverterType = typeof(StringEnumConverter))] - public Models.CallbackMethodEnum? CallbackMethod - { - get - { - return this.callbackMethod; - } - - set - { - this.shouldSerialize["callbackMethod"] = true; - this.callbackMethod = value; - } - } - - /// - /// Gets or sets FallbackUrl. - /// - [JsonProperty("fallbackUrl")] - public string FallbackUrl - { - get - { - return this.fallbackUrl; - } - - set - { - this.shouldSerialize["fallbackUrl"] = true; - this.fallbackUrl = value; - } - } - - /// - /// Gets or sets FallbackMethod. - /// - [JsonProperty("fallbackMethod", ItemConverterType = typeof(StringEnumConverter))] - public Models.FallbackMethodEnum? FallbackMethod - { - get - { - return this.fallbackMethod; - } - - set - { - this.shouldSerialize["fallbackMethod"] = true; - this.fallbackMethod = value; - } - } - - /// - /// Gets or sets Username. - /// - [JsonProperty("username")] - public string Username - { - get - { - return this.username; - } - - set - { - this.shouldSerialize["username"] = true; - this.username = value; - } - } - - /// - /// Gets or sets Password. - /// - [JsonProperty("password")] - public string Password - { - get - { - return this.password; - } - - set - { - this.shouldSerialize["password"] = true; - this.password = value; - } - } - - /// - /// Gets or sets FallbackUsername. - /// - [JsonProperty("fallbackUsername")] - public string FallbackUsername - { - get - { - return this.fallbackUsername; - } - - set - { - this.shouldSerialize["fallbackUsername"] = true; - this.fallbackUsername = value; - } - } - - /// - /// Gets or sets FallbackPassword. - /// - [JsonProperty("fallbackPassword")] - public string FallbackPassword - { - get - { - return this.fallbackPassword; - } - - set - { - this.shouldSerialize["fallbackPassword"] = true; - this.fallbackPassword = value; - } - } - - /// - public override string ToString() - { - var toStringOutput = new List(); - - this.ToString(toStringOutput); - - return $"MachineDetectionRequest : ({string.Join(", ", toStringOutput)})"; - } - - /// - /// Marks the field to not be serailized. - /// - public void UnsetCallbackUrl() - { - this.shouldSerialize["callbackUrl"] = false; - } - - /// - /// Marks the field to not be serailized. - /// - public void UnsetCallbackMethod() - { - this.shouldSerialize["callbackMethod"] = false; - } - - /// - /// Marks the field to not be serailized. - /// - public void UnsetFallbackUrl() - { - this.shouldSerialize["fallbackUrl"] = false; - } - - /// - /// Marks the field to not be serailized. - /// - public void UnsetFallbackMethod() - { - this.shouldSerialize["fallbackMethod"] = false; - } - - /// - /// Marks the field to not be serailized. - /// - public void UnsetUsername() - { - this.shouldSerialize["username"] = false; - } - - /// - /// Marks the field to not be serailized. - /// - public void UnsetPassword() - { - this.shouldSerialize["password"] = false; - } - - /// - /// Marks the field to not be serailized. - /// - public void UnsetFallbackUsername() - { - this.shouldSerialize["fallbackUsername"] = false; - } - - /// - /// Marks the field to not be serailized. - /// - public void UnsetFallbackPassword() - { - this.shouldSerialize["fallbackPassword"] = false; - } - - /// - /// Checks if the field should be serialized or not. - /// - /// A boolean weather the field should be serialized or not. - public bool ShouldSerializeCallbackUrl() - { - return this.shouldSerialize["callbackUrl"]; - } - - /// - /// Checks if the field should be serialized or not. - /// - /// A boolean weather the field should be serialized or not. - public bool ShouldSerializeCallbackMethod() - { - return this.shouldSerialize["callbackMethod"]; - } - - /// - /// Checks if the field should be serialized or not. - /// - /// A boolean weather the field should be serialized or not. - public bool ShouldSerializeFallbackUrl() - { - return this.shouldSerialize["fallbackUrl"]; - } - - /// - /// Checks if the field should be serialized or not. - /// - /// A boolean weather the field should be serialized or not. - public bool ShouldSerializeFallbackMethod() - { - return this.shouldSerialize["fallbackMethod"]; - } - - /// - /// Checks if the field should be serialized or not. - /// - /// A boolean weather the field should be serialized or not. - public bool ShouldSerializeUsername() - { - return this.shouldSerialize["username"]; - } - - /// - /// Checks if the field should be serialized or not. - /// - /// A boolean weather the field should be serialized or not. - public bool ShouldSerializePassword() - { - return this.shouldSerialize["password"]; - } - - /// - /// Checks if the field should be serialized or not. - /// - /// A boolean weather the field should be serialized or not. - public bool ShouldSerializeFallbackUsername() - { - return this.shouldSerialize["fallbackUsername"]; - } - - /// - /// Checks if the field should be serialized or not. - /// - /// A boolean weather the field should be serialized or not. - public bool ShouldSerializeFallbackPassword() - { - return this.shouldSerialize["fallbackPassword"]; - } - - /// - public override bool Equals(object obj) - { - if (obj == null) - { - return false; - } - - if (obj == this) - { - return true; - } - - return obj is MachineDetectionRequest other && - ((this.Mode == null && other.Mode == null) || (this.Mode?.Equals(other.Mode) == true)) && - ((this.DetectionTimeout == null && other.DetectionTimeout == null) || (this.DetectionTimeout?.Equals(other.DetectionTimeout) == true)) && - ((this.SilenceTimeout == null && other.SilenceTimeout == null) || (this.SilenceTimeout?.Equals(other.SilenceTimeout) == true)) && - ((this.SpeechThreshold == null && other.SpeechThreshold == null) || (this.SpeechThreshold?.Equals(other.SpeechThreshold) == true)) && - ((this.SpeechEndThreshold == null && other.SpeechEndThreshold == null) || (this.SpeechEndThreshold?.Equals(other.SpeechEndThreshold) == true)) && - ((this.DelayResult == null && other.DelayResult == null) || (this.DelayResult?.Equals(other.DelayResult) == true)) && - ((this.CallbackUrl == null && other.CallbackUrl == null) || (this.CallbackUrl?.Equals(other.CallbackUrl) == true)) && - ((this.CallbackMethod == null && other.CallbackMethod == null) || (this.CallbackMethod?.Equals(other.CallbackMethod) == true)) && - ((this.FallbackUrl == null && other.FallbackUrl == null) || (this.FallbackUrl?.Equals(other.FallbackUrl) == true)) && - ((this.FallbackMethod == null && other.FallbackMethod == null) || (this.FallbackMethod?.Equals(other.FallbackMethod) == true)) && - ((this.Username == null && other.Username == null) || (this.Username?.Equals(other.Username) == true)) && - ((this.Password == null && other.Password == null) || (this.Password?.Equals(other.Password) == true)) && - ((this.FallbackUsername == null && other.FallbackUsername == null) || (this.FallbackUsername?.Equals(other.FallbackUsername) == true)) && - ((this.FallbackPassword == null && other.FallbackPassword == null) || (this.FallbackPassword?.Equals(other.FallbackPassword) == true)); - } - - /// - public override int GetHashCode() - { - int hashCode = 796471952; - - if (this.Mode != null) - { - hashCode += this.Mode.GetHashCode(); - } - - if (this.DetectionTimeout != null) - { - hashCode += this.DetectionTimeout.GetHashCode(); - } - - if (this.SilenceTimeout != null) - { - hashCode += this.SilenceTimeout.GetHashCode(); - } - - if (this.SpeechThreshold != null) - { - hashCode += this.SpeechThreshold.GetHashCode(); - } - - if (this.SpeechEndThreshold != null) - { - hashCode += this.SpeechEndThreshold.GetHashCode(); - } - - if (this.DelayResult != null) - { - hashCode += this.DelayResult.GetHashCode(); - } - - if (this.CallbackUrl != null) - { - hashCode += this.CallbackUrl.GetHashCode(); - } - - if (this.CallbackMethod != null) - { - hashCode += this.CallbackMethod.GetHashCode(); - } - - if (this.FallbackUrl != null) - { - hashCode += this.FallbackUrl.GetHashCode(); - } - - if (this.FallbackMethod != null) - { - hashCode += this.FallbackMethod.GetHashCode(); - } - - if (this.Username != null) - { - hashCode += this.Username.GetHashCode(); - } - - if (this.Password != null) - { - hashCode += this.Password.GetHashCode(); - } - - if (this.FallbackUsername != null) - { - hashCode += this.FallbackUsername.GetHashCode(); - } - - if (this.FallbackPassword != null) - { - hashCode += this.FallbackPassword.GetHashCode(); - } - - return hashCode; - } - - /// - /// ToString overload. - /// - /// List of strings. - protected void ToString(List toStringOutput) - { - toStringOutput.Add($"this.Mode = {(this.Mode == null ? "null" : this.Mode.ToString())}"); - toStringOutput.Add($"this.DetectionTimeout = {(this.DetectionTimeout == null ? "null" : this.DetectionTimeout.ToString())}"); - toStringOutput.Add($"this.SilenceTimeout = {(this.SilenceTimeout == null ? "null" : this.SilenceTimeout.ToString())}"); - toStringOutput.Add($"this.SpeechThreshold = {(this.SpeechThreshold == null ? "null" : this.SpeechThreshold.ToString())}"); - toStringOutput.Add($"this.SpeechEndThreshold = {(this.SpeechEndThreshold == null ? "null" : this.SpeechEndThreshold.ToString())}"); - toStringOutput.Add($"this.DelayResult = {(this.DelayResult == null ? "null" : this.DelayResult.ToString())}"); - toStringOutput.Add($"this.CallbackUrl = {(this.CallbackUrl == null ? "null" : this.CallbackUrl == string.Empty ? "" : this.CallbackUrl)}"); - toStringOutput.Add($"this.CallbackMethod = {(this.CallbackMethod == null ? "null" : this.CallbackMethod.ToString())}"); - toStringOutput.Add($"this.FallbackUrl = {(this.FallbackUrl == null ? "null" : this.FallbackUrl == string.Empty ? "" : this.FallbackUrl)}"); - toStringOutput.Add($"this.FallbackMethod = {(this.FallbackMethod == null ? "null" : this.FallbackMethod.ToString())}"); - toStringOutput.Add($"this.Username = {(this.Username == null ? "null" : this.Username == string.Empty ? "" : this.Username)}"); - toStringOutput.Add($"this.Password = {(this.Password == null ? "null" : this.Password == string.Empty ? "" : this.Password)}"); - toStringOutput.Add($"this.FallbackUsername = {(this.FallbackUsername == null ? "null" : this.FallbackUsername == string.Empty ? "" : this.FallbackUsername)}"); - toStringOutput.Add($"this.FallbackPassword = {(this.FallbackPassword == null ? "null" : this.FallbackPassword == string.Empty ? "" : this.FallbackPassword)}"); - } - } +// +// Copyright (c) APIMatic. All rights reserved. +// +namespace Bandwidth.Standard.Voice.Models +{ + using System; + using System.Collections.Generic; + using System.ComponentModel; + using System.IO; + using System.Linq; + using System.Text; + using System.Threading.Tasks; + using Bandwidth.Standard; + using Bandwidth.Standard.Utilities; + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + + /// + /// MachineDetectionRequest. + /// + public class MachineDetectionConfiguration + { + private string callbackUrl; + private Models.CallbackMethodEnum? callbackMethod; + private string fallbackUrl; + private Models.FallbackMethodEnum? fallbackMethod; + private string username; + private string password; + private string fallbackUsername; + private string fallbackPassword; + private Dictionary shouldSerialize = new Dictionary + { + { "callbackUrl", false }, + { "callbackMethod", false }, + { "fallbackUrl", false }, + { "fallbackMethod", false }, + { "username", false }, + { "password", false }, + { "fallbackUsername", false }, + { "fallbackPassword", false }, + }; + + /// + /// Initializes a new instance of the class. + /// + public MachineDetectionConfiguration() + { + } + + /// + /// Initializes a new instance of the class. + /// + /// mode. + /// detectionTimeout. + /// silenceTimeout. + /// speechThreshold. + /// speechEndThreshold. + /// delayResult. + /// callbackUrl. + /// callbackMethod. + /// fallbackUrl. + /// fallbackMethod. + /// username. + /// password. + /// fallbackUsername. + /// fallbackPassword. + public MachineDetectionConfiguration( + Models.ModeEnum? mode = null, + double? detectionTimeout = null, + double? silenceTimeout = null, + double? speechThreshold = null, + double? speechEndThreshold = null, + bool? delayResult = null, + string callbackUrl = null, + Models.CallbackMethodEnum? callbackMethod = null, + string fallbackUrl = null, + Models.FallbackMethodEnum? fallbackMethod = null, + string username = null, + string password = null, + string fallbackUsername = null, + string fallbackPassword = null) + { + this.Mode = mode; + this.DetectionTimeout = detectionTimeout; + this.SilenceTimeout = silenceTimeout; + this.SpeechThreshold = speechThreshold; + this.SpeechEndThreshold = speechEndThreshold; + this.DelayResult = delayResult; + if (callbackUrl != null) + { + this.CallbackUrl = callbackUrl; + } + + if (callbackMethod != null) + { + this.CallbackMethod = callbackMethod; + } + + if (fallbackUrl != null) + { + this.FallbackUrl = fallbackUrl; + } + + if (fallbackMethod != null) + { + this.FallbackMethod = fallbackMethod; + } + + if (username != null) + { + this.Username = username; + } + + if (password != null) + { + this.Password = password; + } + + if (fallbackUsername != null) + { + this.FallbackUsername = fallbackUsername; + } + + if (fallbackPassword != null) + { + this.FallbackPassword = fallbackPassword; + } + + } + + /// + /// The machine detection mode. If set to 'async', the detection result will be sent in a 'machineDetectionComplete' callback. If set to 'sync', the 'answer' callback will wait for the machine detection to complete and will include its result. Default is 'async'. + /// + [JsonProperty("mode", ItemConverterType = typeof(StringEnumConverter), NullValueHandling = NullValueHandling.Ignore)] + public Models.ModeEnum? Mode { get; set; } + + /// + /// Total amount of time (in seconds) before giving up. + /// + [JsonProperty("detectionTimeout", NullValueHandling = NullValueHandling.Ignore)] + public double? DetectionTimeout { get; set; } + + /// + /// If no speech is detected in this period, a callback with a 'silence' result is sent. Default is 10 seconds. + /// + [JsonProperty("silenceTimeout", NullValueHandling = NullValueHandling.Ignore)] + public double? SilenceTimeout { get; set; } + + /// + /// When speech has ended and a result couldn't be determined based on the audio content itself, this value is used to determine if the speaker is a machine based on the speech duration. If the length of the speech detected is greater than or equal to this threshold, the result will be 'answering-machine'. If the length of speech detected is below this threshold, the result will be 'human'. Default is 10 seconds. + /// + [JsonProperty("speechThreshold", NullValueHandling = NullValueHandling.Ignore)] + public double? SpeechThreshold { get; set; } + + /// + /// Amount of silence (in seconds) before assuming the callee has finished speaking. + /// + [JsonProperty("speechEndThreshold", NullValueHandling = NullValueHandling.Ignore)] + public double? SpeechEndThreshold { get; set; } + + /// + /// If set to 'true' and if an answering machine is detected, the 'answering-machine' callback will be delayed until the machine is done speaking or until the 'detectionTimeout' is exceeded. If false, the 'answering-machine' result is sent immediately. Default is 'false'. + /// + [JsonProperty("delayResult", NullValueHandling = NullValueHandling.Ignore)] + public bool? DelayResult { get; set; } + + /// + /// The URL to send the 'machineDetectionComplete' callback when the detection is completed. Only for 'async' mode. + /// + [JsonProperty("callbackUrl")] + public string CallbackUrl + { + get + { + return this.callbackUrl; + } + + set + { + this.shouldSerialize["callbackUrl"] = true; + this.callbackUrl = value; + } + } + + /// + /// Gets or sets CallbackMethod. + /// + [JsonProperty("callbackMethod", ItemConverterType = typeof(StringEnumConverter))] + public Models.CallbackMethodEnum? CallbackMethod + { + get + { + return this.callbackMethod; + } + + set + { + this.shouldSerialize["callbackMethod"] = true; + this.callbackMethod = value; + } + } + + /// + /// Gets or sets FallbackUrl. + /// + [JsonProperty("fallbackUrl")] + public string FallbackUrl + { + get + { + return this.fallbackUrl; + } + + set + { + this.shouldSerialize["fallbackUrl"] = true; + this.fallbackUrl = value; + } + } + + /// + /// Gets or sets FallbackMethod. + /// + [JsonProperty("fallbackMethod", ItemConverterType = typeof(StringEnumConverter))] + public Models.FallbackMethodEnum? FallbackMethod + { + get + { + return this.fallbackMethod; + } + + set + { + this.shouldSerialize["fallbackMethod"] = true; + this.fallbackMethod = value; + } + } + + /// + /// Gets or sets Username. + /// + [JsonProperty("username")] + public string Username + { + get + { + return this.username; + } + + set + { + this.shouldSerialize["username"] = true; + this.username = value; + } + } + + /// + /// Gets or sets Password. + /// + [JsonProperty("password")] + public string Password + { + get + { + return this.password; + } + + set + { + this.shouldSerialize["password"] = true; + this.password = value; + } + } + + /// + /// Gets or sets FallbackUsername. + /// + [JsonProperty("fallbackUsername")] + public string FallbackUsername + { + get + { + return this.fallbackUsername; + } + + set + { + this.shouldSerialize["fallbackUsername"] = true; + this.fallbackUsername = value; + } + } + + /// + /// Gets or sets FallbackPassword. + /// + [JsonProperty("fallbackPassword")] + public string FallbackPassword + { + get + { + return this.fallbackPassword; + } + + set + { + this.shouldSerialize["fallbackPassword"] = true; + this.fallbackPassword = value; + } + } + + /// + public override string ToString() + { + var toStringOutput = new List(); + + this.ToString(toStringOutput); + + return $"MachineDetectionRequest : ({string.Join(", ", toStringOutput)})"; + } + + /// + /// Marks the field to not be serailized. + /// + public void UnsetCallbackUrl() + { + this.shouldSerialize["callbackUrl"] = false; + } + + /// + /// Marks the field to not be serailized. + /// + public void UnsetCallbackMethod() + { + this.shouldSerialize["callbackMethod"] = false; + } + + /// + /// Marks the field to not be serailized. + /// + public void UnsetFallbackUrl() + { + this.shouldSerialize["fallbackUrl"] = false; + } + + /// + /// Marks the field to not be serailized. + /// + public void UnsetFallbackMethod() + { + this.shouldSerialize["fallbackMethod"] = false; + } + + /// + /// Marks the field to not be serailized. + /// + public void UnsetUsername() + { + this.shouldSerialize["username"] = false; + } + + /// + /// Marks the field to not be serailized. + /// + public void UnsetPassword() + { + this.shouldSerialize["password"] = false; + } + + /// + /// Marks the field to not be serailized. + /// + public void UnsetFallbackUsername() + { + this.shouldSerialize["fallbackUsername"] = false; + } + + /// + /// Marks the field to not be serailized. + /// + public void UnsetFallbackPassword() + { + this.shouldSerialize["fallbackPassword"] = false; + } + + /// + /// Checks if the field should be serialized or not. + /// + /// A boolean weather the field should be serialized or not. + public bool ShouldSerializeCallbackUrl() + { + return this.shouldSerialize["callbackUrl"]; + } + + /// + /// Checks if the field should be serialized or not. + /// + /// A boolean weather the field should be serialized or not. + public bool ShouldSerializeCallbackMethod() + { + return this.shouldSerialize["callbackMethod"]; + } + + /// + /// Checks if the field should be serialized or not. + /// + /// A boolean weather the field should be serialized or not. + public bool ShouldSerializeFallbackUrl() + { + return this.shouldSerialize["fallbackUrl"]; + } + + /// + /// Checks if the field should be serialized or not. + /// + /// A boolean weather the field should be serialized or not. + public bool ShouldSerializeFallbackMethod() + { + return this.shouldSerialize["fallbackMethod"]; + } + + /// + /// Checks if the field should be serialized or not. + /// + /// A boolean weather the field should be serialized or not. + public bool ShouldSerializeUsername() + { + return this.shouldSerialize["username"]; + } + + /// + /// Checks if the field should be serialized or not. + /// + /// A boolean weather the field should be serialized or not. + public bool ShouldSerializePassword() + { + return this.shouldSerialize["password"]; + } + + /// + /// Checks if the field should be serialized or not. + /// + /// A boolean weather the field should be serialized or not. + public bool ShouldSerializeFallbackUsername() + { + return this.shouldSerialize["fallbackUsername"]; + } + + /// + /// Checks if the field should be serialized or not. + /// + /// A boolean weather the field should be serialized or not. + public bool ShouldSerializeFallbackPassword() + { + return this.shouldSerialize["fallbackPassword"]; + } + + /// + public override bool Equals(object obj) + { + if (obj == null) + { + return false; + } + + if (obj == this) + { + return true; + } + + return obj is MachineDetectionConfiguration other && + ((this.Mode == null && other.Mode == null) || (this.Mode?.Equals(other.Mode) == true)) && + ((this.DetectionTimeout == null && other.DetectionTimeout == null) || (this.DetectionTimeout?.Equals(other.DetectionTimeout) == true)) && + ((this.SilenceTimeout == null && other.SilenceTimeout == null) || (this.SilenceTimeout?.Equals(other.SilenceTimeout) == true)) && + ((this.SpeechThreshold == null && other.SpeechThreshold == null) || (this.SpeechThreshold?.Equals(other.SpeechThreshold) == true)) && + ((this.SpeechEndThreshold == null && other.SpeechEndThreshold == null) || (this.SpeechEndThreshold?.Equals(other.SpeechEndThreshold) == true)) && + ((this.DelayResult == null && other.DelayResult == null) || (this.DelayResult?.Equals(other.DelayResult) == true)) && + ((this.CallbackUrl == null && other.CallbackUrl == null) || (this.CallbackUrl?.Equals(other.CallbackUrl) == true)) && + ((this.CallbackMethod == null && other.CallbackMethod == null) || (this.CallbackMethod?.Equals(other.CallbackMethod) == true)) && + ((this.FallbackUrl == null && other.FallbackUrl == null) || (this.FallbackUrl?.Equals(other.FallbackUrl) == true)) && + ((this.FallbackMethod == null && other.FallbackMethod == null) || (this.FallbackMethod?.Equals(other.FallbackMethod) == true)) && + ((this.Username == null && other.Username == null) || (this.Username?.Equals(other.Username) == true)) && + ((this.Password == null && other.Password == null) || (this.Password?.Equals(other.Password) == true)) && + ((this.FallbackUsername == null && other.FallbackUsername == null) || (this.FallbackUsername?.Equals(other.FallbackUsername) == true)) && + ((this.FallbackPassword == null && other.FallbackPassword == null) || (this.FallbackPassword?.Equals(other.FallbackPassword) == true)); + } + + /// + public override int GetHashCode() + { + int hashCode = 796471952; + + if (this.Mode != null) + { + hashCode += this.Mode.GetHashCode(); + } + + if (this.DetectionTimeout != null) + { + hashCode += this.DetectionTimeout.GetHashCode(); + } + + if (this.SilenceTimeout != null) + { + hashCode += this.SilenceTimeout.GetHashCode(); + } + + if (this.SpeechThreshold != null) + { + hashCode += this.SpeechThreshold.GetHashCode(); + } + + if (this.SpeechEndThreshold != null) + { + hashCode += this.SpeechEndThreshold.GetHashCode(); + } + + if (this.DelayResult != null) + { + hashCode += this.DelayResult.GetHashCode(); + } + + if (this.CallbackUrl != null) + { + hashCode += this.CallbackUrl.GetHashCode(); + } + + if (this.CallbackMethod != null) + { + hashCode += this.CallbackMethod.GetHashCode(); + } + + if (this.FallbackUrl != null) + { + hashCode += this.FallbackUrl.GetHashCode(); + } + + if (this.FallbackMethod != null) + { + hashCode += this.FallbackMethod.GetHashCode(); + } + + if (this.Username != null) + { + hashCode += this.Username.GetHashCode(); + } + + if (this.Password != null) + { + hashCode += this.Password.GetHashCode(); + } + + if (this.FallbackUsername != null) + { + hashCode += this.FallbackUsername.GetHashCode(); + } + + if (this.FallbackPassword != null) + { + hashCode += this.FallbackPassword.GetHashCode(); + } + + return hashCode; + } + + /// + /// ToString overload. + /// + /// List of strings. + protected void ToString(List toStringOutput) + { + toStringOutput.Add($"this.Mode = {(this.Mode == null ? "null" : this.Mode.ToString())}"); + toStringOutput.Add($"this.DetectionTimeout = {(this.DetectionTimeout == null ? "null" : this.DetectionTimeout.ToString())}"); + toStringOutput.Add($"this.SilenceTimeout = {(this.SilenceTimeout == null ? "null" : this.SilenceTimeout.ToString())}"); + toStringOutput.Add($"this.SpeechThreshold = {(this.SpeechThreshold == null ? "null" : this.SpeechThreshold.ToString())}"); + toStringOutput.Add($"this.SpeechEndThreshold = {(this.SpeechEndThreshold == null ? "null" : this.SpeechEndThreshold.ToString())}"); + toStringOutput.Add($"this.DelayResult = {(this.DelayResult == null ? "null" : this.DelayResult.ToString())}"); + toStringOutput.Add($"this.CallbackUrl = {(this.CallbackUrl == null ? "null" : this.CallbackUrl == string.Empty ? "" : this.CallbackUrl)}"); + toStringOutput.Add($"this.CallbackMethod = {(this.CallbackMethod == null ? "null" : this.CallbackMethod.ToString())}"); + toStringOutput.Add($"this.FallbackUrl = {(this.FallbackUrl == null ? "null" : this.FallbackUrl == string.Empty ? "" : this.FallbackUrl)}"); + toStringOutput.Add($"this.FallbackMethod = {(this.FallbackMethod == null ? "null" : this.FallbackMethod.ToString())}"); + toStringOutput.Add($"this.Username = {(this.Username == null ? "null" : this.Username == string.Empty ? "" : this.Username)}"); + toStringOutput.Add($"this.Password = {(this.Password == null ? "null" : this.Password == string.Empty ? "" : this.Password)}"); + toStringOutput.Add($"this.FallbackUsername = {(this.FallbackUsername == null ? "null" : this.FallbackUsername == string.Empty ? "" : this.FallbackUsername)}"); + toStringOutput.Add($"this.FallbackPassword = {(this.FallbackPassword == null ? "null" : this.FallbackPassword == string.Empty ? "" : this.FallbackPassword)}"); + } + } } \ No newline at end of file diff --git a/Bandwidth.StandardTests/Voice/CreateCallTests.cs b/Bandwidth.StandardTests/Voice/CreateCallTests.cs index f40dafa6..028efd8d 100644 --- a/Bandwidth.StandardTests/Voice/CreateCallTests.cs +++ b/Bandwidth.StandardTests/Voice/CreateCallTests.cs @@ -53,7 +53,7 @@ public async Task CreateCallWithMachineDetectionReturnsCreated() var from = TestConstants.From; var applicationId = TestConstants.VoiceApplicationId; var answerUrl = string.Concat(TestConstants.BaseCallbackUrl, "/callbacks/answer"); - var machineDetectionRequest = new MachineDetectionRequest() + var machineDetectionConfiguration = new MachineDetectionConfiguration() { CallbackUrl = string.Concat(TestConstants.BaseCallbackUrl, "/callbacks/machine-detection") }; @@ -64,7 +64,7 @@ public async Task CreateCallWithMachineDetectionReturnsCreated() To = to, From = from, AnswerUrl = answerUrl, - MachineDetection = machineDetectionRequest + MachineDetection = machineDetectionConfiguration }; var createCallResponse = await _client.Voice.APIController.CreateCallAsync(accountId, request); diff --git a/Bandwidth.sln b/Bandwidth.sln index c2bec471..dc02a135 100644 --- a/Bandwidth.sln +++ b/Bandwidth.sln @@ -2,24 +2,30 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 VisualStudioVersion = 15.0.26430.14 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bandwidth.Standard", "Bandwidth.Standard/Bandwidth.Standard.csproj", "{9f9948de-9e6a-4742-8517-97f793554867}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bandwidth.Standard", "Bandwidth.Standard\Bandwidth.Standard.csproj", "{9F9948DE-9E6A-4742-8517-97F793554867}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bandwidth.StandardTests", "Bandwidth.StandardTests\Bandwidth.StandardTests.csproj", "{1CD98BBF-6D9E-4A44-BD0D-03E15575EAA2}" EndProject Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {9f9948de-9e6a-4742-8517-97f793554867}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {9f9948de-9e6a-4742-8517-97f793554867}.Debug|Any CPU.Build.0 = Debug|Any CPU - {9f9948de-9e6a-4742-8517-97f793554867}.Release|Any CPU.ActiveCfg = Release|Any CPU - {9f9948de-9e6a-4742-8517-97f793554867}.Release|Any CPU.Build.0 = Release|Any CPU - {7922bc91-46e9-45e4-aa8f-db2543252b43}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7922bc91-46e9-45e4-aa8f-db2543252b43}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7922bc91-46e9-45e4-aa8f-db2543252b43}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7922bc91-46e9-45e4-aa8f-db2543252b43}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {7922bc91-46e9-45e4-aa8f-db2543252b43}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7922bc91-46e9-45e4-aa8f-db2543252b43}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7922bc91-46e9-45e4-aa8f-db2543252b43}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7922bc91-46e9-45e4-aa8f-db2543252b43}.Release|Any CPU.Build.0 = Release|Any CPU + {9F9948DE-9E6A-4742-8517-97F793554867}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9F9948DE-9E6A-4742-8517-97F793554867}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9F9948DE-9E6A-4742-8517-97F793554867}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9F9948DE-9E6A-4742-8517-97F793554867}.Release|Any CPU.Build.0 = Release|Any CPU + {1CD98BBF-6D9E-4A44-BD0D-03E15575EAA2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1CD98BBF-6D9E-4A44-BD0D-03E15575EAA2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1CD98BBF-6D9E-4A44-BD0D-03E15575EAA2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1CD98BBF-6D9E-4A44-BD0D-03E15575EAA2}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection EndGlobal From 3cb278fc4b788f3f8a9d79a462b74cd9b1b86a3f Mon Sep 17 00:00:00 2001 From: AJ Rice <53190766+ajrice6713@users.noreply.github.com> Date: Mon, 27 Sep 2021 15:10:13 -0400 Subject: [PATCH 2/4] turn on tn lookup tests --- Bandwidth.StandardTests/PhoneNumberLookup/LookupTests.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Bandwidth.StandardTests/PhoneNumberLookup/LookupTests.cs b/Bandwidth.StandardTests/PhoneNumberLookup/LookupTests.cs index 8ecc9ec8..f02ad307 100644 --- a/Bandwidth.StandardTests/PhoneNumberLookup/LookupTests.cs +++ b/Bandwidth.StandardTests/PhoneNumberLookup/LookupTests.cs @@ -21,6 +21,7 @@ public LookupTests() .Build(); } + [Fact] public async Task CreateTnLookupRequestAsync() { var accountId = TestConstants.AccountId; @@ -35,6 +36,7 @@ public async Task CreateTnLookupRequestAsync() Assert.Equal("IN_PROGRESS", response.Data.Status); } + [Fact] public async Task GetTnLookupResultAsync() { var accountId = TestConstants.AccountId; From 7b133e46a4bbfe3715dff300c6bbee9739f2a5e4 Mon Sep 17 00:00:00 2001 From: AJ Rice <53190766+ajrice6713@users.noreply.github.com> Date: Mon, 27 Sep 2021 15:36:37 -0400 Subject: [PATCH 3/4] Update Bandwidth.Standard/Voice/Models/MachineDetectionConfiguration.cs Co-authored-by: Mike Hamer --- .../Voice/Models/MachineDetectionConfiguration.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Bandwidth.Standard/Voice/Models/MachineDetectionConfiguration.cs b/Bandwidth.Standard/Voice/Models/MachineDetectionConfiguration.cs index 5501fbb7..2a3fa6ee 100644 --- a/Bandwidth.Standard/Voice/Models/MachineDetectionConfiguration.cs +++ b/Bandwidth.Standard/Voice/Models/MachineDetectionConfiguration.cs @@ -1,4 +1,4 @@ -// +// // Copyright (c) APIMatic. All rights reserved. // namespace Bandwidth.Standard.Voice.Models From 0b45d1122b61958e0137ee8ecc00a1848419c28f Mon Sep 17 00:00:00 2001 From: AJ Rice <53190766+ajrice6713@users.noreply.github.com> Date: Mon, 27 Sep 2021 15:36:41 -0400 Subject: [PATCH 4/4] Update Bandwidth.Standard/Voice/Models/MachineDetectionConfiguration.cs Co-authored-by: Mike Hamer --- .../Voice/Models/MachineDetectionConfiguration.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Bandwidth.Standard/Voice/Models/MachineDetectionConfiguration.cs b/Bandwidth.Standard/Voice/Models/MachineDetectionConfiguration.cs index 2a3fa6ee..ba40c568 100644 --- a/Bandwidth.Standard/Voice/Models/MachineDetectionConfiguration.cs +++ b/Bandwidth.Standard/Voice/Models/MachineDetectionConfiguration.cs @@ -16,7 +16,7 @@ namespace Bandwidth.Standard.Voice.Models using Newtonsoft.Json.Converters; /// - /// MachineDetectionRequest. + /// MachineDetectionConfiguration. /// public class MachineDetectionConfiguration {