Skip to content

Commit 76cabe5

Browse files
committed
Update getCallState model and add test
1 parent 34078af commit 76cabe5

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

Bandwidth.Standard/Voice/Models/CallState.cs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ public CallState()
5858
/// <param name="state">state.</param>
5959
/// <param name="identity">identity.</param>
6060
/// <param name="stirShaken">stirShaken.</param>
61+
/// <param name="enqueuedTime">enqueuedTime.</param>
6162
/// <param name="startTime">startTime.</param>
6263
/// <param name="answerTime">answerTime.</param>
6364
/// <param name="endTime">endTime.</param>
@@ -76,6 +77,7 @@ public CallState(
7677
string state = null,
7778
string identity = null,
7879
Dictionary<string, string> stirShaken = null,
80+
DateTime? enqueuedTime = null,
7981
DateTime? startTime = null,
8082
DateTime? answerTime = null,
8183
DateTime? endTime = null,
@@ -102,6 +104,7 @@ public CallState(
102104
}
103105

104106
this.StirShaken = stirShaken;
107+
this.EnqueuedTime = enqueuedTime;
105108
this.StartTime = startTime;
106109
if (answerTime != null)
107110
{
@@ -215,6 +218,13 @@ public string Identity
215218
[JsonProperty("stirShaken", NullValueHandling = NullValueHandling.Ignore)]
216219
public Dictionary<string, string> StirShaken { get; set; }
217220

221+
/// <summary>
222+
/// Gets or sets EnqueuedTime.
223+
/// </summary>
224+
[JsonConverter(typeof(IsoDateTimeConverter))]
225+
[JsonProperty("enqueuedTime", NullValueHandling = NullValueHandling.Ignore)]
226+
public DateTime? EnqueuedTime { get; set; }
227+
218228
/// <summary>
219229
/// Gets or sets StartTime.
220230
/// </summary>
@@ -474,6 +484,7 @@ public override bool Equals(object obj)
474484
((this.State == null && other.State == null) || (this.State?.Equals(other.State) == true)) &&
475485
((this.Identity == null && other.Identity == null) || (this.Identity?.Equals(other.Identity) == true)) &&
476486
((this.StirShaken == null && other.StirShaken == null) || (this.StirShaken?.Equals(other.StirShaken) == true)) &&
487+
((this.EnqueuedTime == null && other.EnqueuedTime == null) || this.EnqueuedTime?.Equals(other.EnqueuedTime) == true) &&
477488
((this.StartTime == null && other.StartTime == null) || (this.StartTime?.Equals(other.StartTime) == true)) &&
478489
((this.AnswerTime == null && other.AnswerTime == null) || (this.AnswerTime?.Equals(other.AnswerTime) == true)) &&
479490
((this.EndTime == null && other.EndTime == null) || (this.EndTime?.Equals(other.EndTime) == true)) &&
@@ -538,6 +549,11 @@ public override int GetHashCode()
538549
hashCode += this.StirShaken.GetHashCode();
539550
}
540551

552+
if (this.EnqueuedTime != null)
553+
{
554+
hashCode += this.EnqueuedTime.GetHashCode();
555+
}
556+
541557
if (this.StartTime != null)
542558
{
543559
hashCode += this.StartTime.GetHashCode();
@@ -592,6 +608,7 @@ protected void ToString(List<string> toStringOutput)
592608
toStringOutput.Add($"this.State = {(this.State == null ? "null" : this.State == string.Empty ? "" : this.State)}");
593609
toStringOutput.Add($"this.Identity = {(this.Identity == null ? "null" : this.Identity == string.Empty ? "" : this.Identity)}");
594610
toStringOutput.Add($"StirShaken = {(this.StirShaken == null ? "null" : this.StirShaken.ToString())}");
611+
toStringOutput.Add($"this.EnqueuedTime = {(this.EnqueuedTime == null ? "null" : this.EnqueuedTime.ToString())}");
595612
toStringOutput.Add($"this.StartTime = {(this.StartTime == null ? "null" : this.StartTime.ToString())}");
596613
toStringOutput.Add($"this.AnswerTime = {(this.AnswerTime == null ? "null" : this.AnswerTime.ToString())}");
597614
toStringOutput.Add($"this.EndTime = {(this.EndTime == null ? "null" : this.EndTime.ToString())}");
@@ -601,4 +618,4 @@ protected void ToString(List<string> toStringOutput)
601618
toStringOutput.Add($"this.LastUpdate = {(this.LastUpdate == null ? "null" : this.LastUpdate.ToString())}");
602619
}
603620
}
604-
}
621+
}

Bandwidth.StandardTests/Voice/GetCallTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ public async Task GetCallReturnsOk()
6464
Assert.True(getCallStateResponse.Data.State == "initiated" || getCallStateResponse.Data.State == "disconnected");
6565
Assert.Null(getCallStateResponse.Data.Identity);
6666
Assert.Empty(getCallStateResponse.Data.StirShaken);
67+
Assert.IsType<DateTime>(getCallStateResponse.Data.EnqueuedTime);
6768
Assert.IsType<DateTime>(getCallStateResponse.Data.StartTime);
6869
Assert.Null(getCallStateResponse.Data.AnswerTime);
6970
Assert.True(getCallStateResponse.Data.DisconnectCause == null || getCallStateResponse.Data.DisconnectCause == "busy");
@@ -86,4 +87,4 @@ public async Task GetCallReturnsOk()
8687
while (retries > 0);
8788
}
8889
}
89-
}
90+
}

0 commit comments

Comments
 (0)