From e79fd521bacd0fca8d550a6045bb9201c58793e9 Mon Sep 17 00:00:00 2001 From: AJ Rice <53190766+ajrice6713@users.noreply.github.com> Date: Fri, 18 Mar 2022 13:23:57 -0400 Subject: [PATCH 1/3] DX-2476 Add `priority` to `createCallRequest` --- .../Voice/Models/CreateCallRequest.cs | 57 ++++++++++++++++++- 1 file changed, 54 insertions(+), 3 deletions(-) diff --git a/Bandwidth.Standard/Voice/Models/CreateCallRequest.cs b/Bandwidth.Standard/Voice/Models/CreateCallRequest.cs index b8a22a9f..83cda35b 100644 --- a/Bandwidth.Standard/Voice/Models/CreateCallRequest.cs +++ b/Bandwidth.Standard/Voice/Models/CreateCallRequest.cs @@ -33,6 +33,7 @@ public class CreateCallRequest private string disconnectUrl; private Models.DisconnectMethodEnum? disconnectMethod; private string tag; + private int? priority; private Dictionary shouldSerialize = new Dictionary { { "uui", false }, @@ -48,6 +49,7 @@ public class CreateCallRequest { "disconnectUrl", false }, { "disconnectMethod", false }, { "tag", false }, + { "priority", false }, }; /// @@ -78,6 +80,7 @@ public CreateCallRequest() /// disconnectMethod. /// tag. /// machineDetection. + /// priority. public CreateCallRequest( string from, string to, @@ -96,7 +99,8 @@ public CreateCallRequest( string disconnectUrl = null, Models.DisconnectMethodEnum? disconnectMethod = null, string tag = null, - Models.MachineDetectionConfiguration machineDetection = null) + Models.MachineDetectionConfiguration machineDetection = null, + int? priority = null) { this.From = from; this.To = to; @@ -168,6 +172,11 @@ public CreateCallRequest( this.ApplicationId = applicationId; this.MachineDetection = machineDetection; + + if (priority != null) + { + this.Priority = priority; + } } /// @@ -422,6 +431,24 @@ public string Tag } } + /// + /// Gets or sets Priority. + /// + [JsonProperty("tag")] + public int? Priority + { + get + { + return this.priority; + } + + set + { + this.shouldSerialize["priority"] = true; + this.priority = value; + } + } + /// /// Gets or sets ApplicationId. /// @@ -548,6 +575,14 @@ public void UnsetTag() this.shouldSerialize["tag"] = false; } + /// + /// Marks the field to not be serailized. + /// + public void UnsetPriority() + { + this.shouldSerialize["priority"] = false; + } + /// /// Checks if the field should be serialized or not. /// @@ -665,6 +700,15 @@ public bool ShouldSerializeTag() return this.shouldSerialize["tag"]; } + /// + /// Checks if the field should be serialized or not. + /// + /// A boolean weather the field should be serialized or not. + public bool ShouldSerializePriority() + { + return this.shouldSerialize["priority"]; + } + /// public override bool Equals(object obj) { @@ -696,7 +740,8 @@ public override bool Equals(object obj) ((this.DisconnectMethod == null && other.DisconnectMethod == null) || (this.DisconnectMethod?.Equals(other.DisconnectMethod) == true)) && ((this.Tag == null && other.Tag == null) || (this.Tag?.Equals(other.Tag) == true)) && ((this.ApplicationId == null && other.ApplicationId == null) || (this.ApplicationId?.Equals(other.ApplicationId) == true)) && - ((this.MachineDetection == null && other.MachineDetection == null) || (this.MachineDetection?.Equals(other.MachineDetection) == true)); + ((this.MachineDetection == null && other.MachineDetection == null) || (this.MachineDetection?.Equals(other.MachineDetection) == true)) && + ((this.Priority == null && other.Priority == null) || (this.Priority?.Equals(other.Priority) == true)); } /// @@ -794,6 +839,11 @@ public override int GetHashCode() hashCode += this.MachineDetection.GetHashCode(); } + if (this.Priority != null) + { + hashCode += this.Priority.GetHashCode(); + } + return hashCode; } @@ -821,6 +871,7 @@ protected void ToString(List toStringOutput) toStringOutput.Add($"this.Tag = {(this.Tag == null ? "null" : this.Tag == string.Empty ? "" : this.Tag)}"); toStringOutput.Add($"this.ApplicationId = {(this.ApplicationId == null ? "null" : this.ApplicationId == string.Empty ? "" : this.ApplicationId)}"); toStringOutput.Add($"this.MachineDetection = {(this.MachineDetection == null ? "null" : this.MachineDetection.ToString())}"); + toStringOutput.Add($"this.Priority = {(this.Priority == null ? "null" : this.Priority.ToString())}"); } } -} \ No newline at end of file +} From 24a21b0160d7b7c0d87e90eb553e61d10eed4d5b Mon Sep 17 00:00:00 2001 From: AJ Rice <53190766+ajrice6713@users.noreply.github.com> Date: Fri, 18 Mar 2022 13:49:24 -0400 Subject: [PATCH 2/3] Update CreateCallResponse.cs --- .../Voice/Models/CreateCallResponse.cs | 57 ++++++++++++++++++- 1 file changed, 54 insertions(+), 3 deletions(-) diff --git a/Bandwidth.Standard/Voice/Models/CreateCallResponse.cs b/Bandwidth.Standard/Voice/Models/CreateCallResponse.cs index 21b74520..5bf72623 100644 --- a/Bandwidth.Standard/Voice/Models/CreateCallResponse.cs +++ b/Bandwidth.Standard/Voice/Models/CreateCallResponse.cs @@ -28,6 +28,7 @@ public class CreateCallResponse private string fallbackUsername; private string fallbackPassword; private string tag; + private int? priority; private Dictionary shouldSerialize = new Dictionary { { "answerFallbackUrl", false }, @@ -38,6 +39,7 @@ public class CreateCallResponse { "fallbackUsername", false }, { "fallbackPassword", false }, { "tag", false }, + { "priority", false } }; /// @@ -70,6 +72,7 @@ public CreateCallResponse() /// fallbackUsername. /// fallbackPassword. /// tag. + /// priority. public CreateCallResponse( string accountId, string callId, @@ -90,7 +93,8 @@ public CreateCallResponse( string password = null, string fallbackUsername = null, string fallbackPassword = null, - string tag = null) + string tag = null, + int? priority = null) { this.AccountId = accountId; this.CallId = callId; @@ -144,6 +148,11 @@ public CreateCallResponse( this.Tag = tag; } + if (priority != null) + { + this.Priority = priority; + } + } /// @@ -363,6 +372,24 @@ public string Tag } } + /// + /// Gets or sets Priority. + /// + [JsonProperty("priority")] + public int? Priority + { + get + { + return this.priority; + } + + set + { + this.shouldSerialize["priority"] = true; + this.priority = value; + } + } + /// public override string ToString() { @@ -437,6 +464,14 @@ public void UnsetTag() this.shouldSerialize["tag"] = false; } + /// + /// Marks the field to not be serailized. + /// + public void UnsetPriority() + { + this.shouldSerialize["priority"] = false; + } + /// /// Checks if the field should be serialized or not. /// @@ -509,6 +544,15 @@ public bool ShouldSerializeTag() return this.shouldSerialize["tag"]; } + /// + /// Checks if the field should be serialized or not. + /// + /// A boolean weather the field should be serialized or not. + public bool ShouldSerializePriority() + { + return this.shouldSerialize["priority"]; + } + /// public override bool Equals(object obj) { @@ -542,7 +586,8 @@ public override bool Equals(object obj) ((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)) && - ((this.Tag == null && other.Tag == null) || (this.Tag?.Equals(other.Tag) == true)); + ((this.Tag == null && other.Tag == null) || (this.Tag?.Equals(other.Tag) == true)) && + ((this.Priority == null && other.Priority == null) || (this.Priority?.Equals(other.Priority) == true)); } /// @@ -647,6 +692,11 @@ public override int GetHashCode() hashCode += this.Tag.GetHashCode(); } + if (this.Priority != null) + { + hashCode += this.Priority.GetHashCode(); + } + return hashCode; } @@ -676,6 +726,7 @@ protected void ToString(List toStringOutput) 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)}"); toStringOutput.Add($"this.Tag = {(this.Tag == null ? "null" : this.Tag == string.Empty ? "" : this.Tag)}"); + toStringOutput.Add($"this.Priority = {(this.Priority == null ? "null" : this.Priority.ToString())}"); } } -} \ No newline at end of file +} From 4e892572dc52203275edc987e54f3b6653781c45 Mon Sep 17 00:00:00 2001 From: AJ Rice <53190766+ajrice6713@users.noreply.github.com> Date: Fri, 18 Mar 2022 13:53:14 -0400 Subject: [PATCH 3/3] Add Test --- .../Voice/Models/CreateCallRequest.cs | 2 +- .../Voice/CreateCallTests.cs | 29 +++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/Bandwidth.Standard/Voice/Models/CreateCallRequest.cs b/Bandwidth.Standard/Voice/Models/CreateCallRequest.cs index 83cda35b..0eaef5f7 100644 --- a/Bandwidth.Standard/Voice/Models/CreateCallRequest.cs +++ b/Bandwidth.Standard/Voice/Models/CreateCallRequest.cs @@ -434,7 +434,7 @@ public string Tag /// /// Gets or sets Priority. /// - [JsonProperty("tag")] + [JsonProperty("priority")] public int? Priority { get diff --git a/Bandwidth.StandardTests/Voice/CreateCallTests.cs b/Bandwidth.StandardTests/Voice/CreateCallTests.cs index 57488e87..26c4a3fe 100644 --- a/Bandwidth.StandardTests/Voice/CreateCallTests.cs +++ b/Bandwidth.StandardTests/Voice/CreateCallTests.cs @@ -81,6 +81,35 @@ public async Task CreateCallWithMachineDetectionReturnsCreated() Assert.Equal(DisconnectMethodEnum.POST, createCallResponse.Data.DisconnectMethod); } + [Fact] + public async Task CreateCallWithPriorityReturnsCreated() + { + var accountId = TestConstants.AccountId; + var to = TestConstants.To; + var from = TestConstants.From; + var applicationId = TestConstants.VoiceApplicationId; + var answerUrl = string.Concat(TestConstants.BaseCallbackUrl, "/callbacks/answer"); + var priority = 4; + + var request = new CreateCallRequest() + { + ApplicationId = applicationId, + To = to, + From = from, + AnswerUrl = answerUrl, + Priority = priority + }; + + var createCallResponse = await _client.Voice.APIController.CreateCallAsync(accountId, request); + + Assert.Equal(201, createCallResponse.StatusCode); + + Assert.Equal(applicationId, createCallResponse.Data.ApplicationId); + Assert.Equal(to, createCallResponse.Data.To); + Assert.Equal(from, createCallResponse.Data.From); + Assert.Equal(priority, createCallResponse.Data.Priority); + } + [Fact] public async Task CreateCallInvalidToPhoneNumberThrows() {