Skip to content

Commit b0a258c

Browse files
authored
DX-2651 Add enqueuedTime to SDK (#70)
* DX-2651 Add `enqueuedTime` to SDK * remove unused imports
1 parent e7a19b6 commit b0a258c

File tree

3 files changed

+68
-27
lines changed

3 files changed

+68
-27
lines changed

src/main/java/com/bandwidth/voice/models/CallState.java

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ public class CallState {
4343
@JsonInclude(JsonInclude.Include.NON_NULL)
4444
private LocalDateTime startTime;
4545
@JsonInclude(JsonInclude.Include.NON_NULL)
46+
private LocalDateTime enqueuedTime;
47+
@JsonInclude(JsonInclude.Include.NON_NULL)
4648
private OptionalNullable<LocalDateTime> answerTime;
4749
@JsonInclude(JsonInclude.Include.NON_NULL)
4850
private OptionalNullable<LocalDateTime> endTime;
@@ -74,6 +76,7 @@ public CallState() {
7476
* @param identity String value for identity.
7577
* @param stirShaken Map of String, value for stirShaken.
7678
* @param startTime LocalDateTime value for startTime.
79+
* @param enqueuedTime LocalDateTime value for enqueuedTime.
7780
* @param answerTime LocalDateTime value for answerTime.
7881
* @param endTime LocalDateTime value for endTime.
7982
* @param disconnectCause String value for disconnectCause.
@@ -93,6 +96,7 @@ public CallState(
9396
String identity,
9497
Map<String, String> stirShaken,
9598
LocalDateTime startTime,
99+
LocalDateTime enqueuedTime,
96100
LocalDateTime answerTime,
97101
LocalDateTime endTime,
98102
String disconnectCause,
@@ -110,6 +114,7 @@ public CallState(
110114
this.identity = OptionalNullable.of(identity);
111115
this.stirShaken = stirShaken;
112116
this.startTime = startTime;
117+
this.enqueuedTime = enqueuedTime;
113118
this.answerTime = OptionalNullable.of(answerTime);
114119
this.endTime = OptionalNullable.of(endTime);
115120
this.disconnectCause = OptionalNullable.of(disconnectCause);
@@ -124,7 +129,7 @@ public CallState(
124129
protected CallState(String callId, OptionalNullable<String> parentCallId, String applicationId,
125130
String accountId, String to, String from, String direction, String state,
126131
OptionalNullable<String> identity, Map<String, String> stirShaken,
127-
LocalDateTime startTime, OptionalNullable<LocalDateTime> answerTime,
132+
LocalDateTime startTime, LocalDateTime enqueuedTime, OptionalNullable<LocalDateTime> answerTime,
128133
OptionalNullable<LocalDateTime> endTime, OptionalNullable<String> disconnectCause,
129134
OptionalNullable<String> errorMessage, OptionalNullable<String> errorId,
130135
LocalDateTime lastUpdate) {
@@ -139,6 +144,7 @@ protected CallState(String callId, OptionalNullable<String> parentCallId, String
139144
this.identity = identity;
140145
this.stirShaken = stirShaken;
141146
this.startTime = startTime;
147+
this.enqueuedTime = enqueuedTime;
142148
this.answerTime = answerTime;
143149
this.endTime = endTime;
144150
this.disconnectCause = disconnectCause;
@@ -375,6 +381,14 @@ public LocalDateTime getStartTime() {
375381
return startTime;
376382
}
377383

384+
/**
385+
* Getter for EnqueuedTime
386+
* @return Returns the LocalDateTime
387+
*/
388+
@JsonGetter("enqueuedTime")
389+
@JsonSerialize(using = DateTimeHelper.Rfc8601DateTimeSerializer.class)
390+
public LocalDateTime getEnqueuedTime() { return enqueuedTime; }
391+
378392
/**
379393
* Setter for StartTime.
380394
* @param startTime Value for LocalDateTime
@@ -385,6 +399,16 @@ public void setStartTime(LocalDateTime startTime) {
385399
this.startTime = startTime;
386400
}
387401

402+
/**
403+
* Setter for EnqueuedTime.
404+
* @param enqueuedTime Value for LocalDateTime
405+
*/
406+
@JsonSetter("enqueuedTime")
407+
@JsonDeserialize(using = DateTimeHelper.Rfc8601DateTimeDeserializer.class)
408+
public void setEnqueuedTime(LocalDateTime enqueuedTime) {
409+
this.enqueuedTime = enqueuedTime;
410+
}
411+
388412
/**
389413
* Internal Getter for AnswerTime.
390414
* @return Returns the Internal LocalDateTime
@@ -606,7 +630,7 @@ public String toString() {
606630
return "CallState [" + "callId=" + callId + ", parentCallId=" + parentCallId
607631
+ ", applicationId=" + applicationId + ", accountId=" + accountId + ", to=" + to
608632
+ ", from=" + from + ", direction=" + direction + ", state=" + state + ", identity="
609-
+ identity + ", stirShaken=" + stirShaken + ", startTime=" + startTime
633+
+ identity + ", stirShaken=" + stirShaken + ", startTime=" + startTime + ", enqueuedTime=" + enqueuedTime
610634
+ ", answerTime=" + answerTime + ", endTime=" + endTime + ", disconnectCause="
611635
+ disconnectCause + ", errorMessage=" + errorMessage + ", errorId=" + errorId
612636
+ ", lastUpdate=" + lastUpdate + "]";
@@ -628,6 +652,7 @@ public Builder toBuilder() {
628652
.state(getState())
629653
.stirShaken(getStirShaken())
630654
.startTime(getStartTime())
655+
.enqueuedTime(getEnqueuedTime())
631656
.lastUpdate(getLastUpdate());
632657
builder.parentCallId = internalGetParentCallId();
633658
builder.identity = internalGetIdentity();
@@ -654,6 +679,7 @@ public static class Builder {
654679
private OptionalNullable<String> identity;
655680
private Map<String, String> stirShaken;
656681
private LocalDateTime startTime;
682+
private LocalDateTime enqueuedTime;
657683
private OptionalNullable<LocalDateTime> answerTime;
658684
private OptionalNullable<LocalDateTime> endTime;
659685
private OptionalNullable<String> disconnectCause;
@@ -791,6 +817,16 @@ public Builder startTime(LocalDateTime startTime) {
791817
return this;
792818
}
793819

820+
/**
821+
* Setter for enqueuedTime.
822+
* @param enqueuedTime LocalDateTime value for enqueuedTime.
823+
* @return Builder
824+
*/
825+
public Builder enqueuedTime(LocalDateTime enqueuedTime) {
826+
this.enqueuedTime = enqueuedTime;
827+
return this;
828+
}
829+
794830
/**
795831
* Setter for answerTime.
796832
* @param answerTime LocalDateTime value for answerTime.
@@ -902,7 +938,7 @@ public Builder lastUpdate(LocalDateTime lastUpdate) {
902938
*/
903939
public CallState build() {
904940
return new CallState(callId, parentCallId, applicationId, accountId, to, from,
905-
direction, state, identity, stirShaken, startTime, answerTime, endTime,
941+
direction, state, identity, stirShaken, startTime, enqueuedTime, answerTime, endTime,
906942
disconnectCause, errorMessage, errorId, lastUpdate);
907943
}
908944
}

src/main/java/com/bandwidth/voice/models/CreateCallResponse.java

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public class CreateCallResponse {
3030
private AnswerMethodEnum answerMethod;
3131

3232
@JsonInclude(JsonInclude.Include.NON_NULL)
33-
private LocalDateTime startTime;
33+
private LocalDateTime enqueuedTime;
3434

3535
@JsonInclude(JsonInclude.Include.NON_NULL)
3636
private Double callTimeout;
@@ -82,7 +82,7 @@ public CreateCallResponse() {
8282
* @param answerUrl String value for answerUrl.
8383
* @param answerMethod AnswerMethodEnum value for answerMethod.
8484
* @param disconnectMethod DisconnectMethodEnum value for disconnectMethod.
85-
* @param startTime LocalDateTime value for startTime.
85+
* @param enqueuedTime LocalDateTime value for enqueuedTime.
8686
* @param callTimeout Double value for callTimeout.
8787
* @param callbackTimeout Double value for callbackTimeout.
8888
* @param answerFallbackUrl String value for answerFallbackUrl.
@@ -105,7 +105,7 @@ public CreateCallResponse(
105105
String answerUrl,
106106
AnswerMethodEnum answerMethod,
107107
DisconnectMethodEnum disconnectMethod,
108-
LocalDateTime startTime,
108+
LocalDateTime enqueuedTime,
109109
Double callTimeout,
110110
Double callbackTimeout,
111111
String answerFallbackUrl,
@@ -122,7 +122,7 @@ public CreateCallResponse(
122122
this.applicationId = applicationId;
123123
this.to = to;
124124
this.from = from;
125-
this.startTime = startTime;
125+
this.enqueuedTime = enqueuedTime;
126126
this.callUrl = callUrl;
127127
this.callTimeout = callTimeout;
128128
this.callbackTimeout = callbackTimeout;
@@ -145,7 +145,7 @@ public CreateCallResponse(
145145
*/
146146
protected CreateCallResponse(String accountId, String callId, String applicationId, String to,
147147
String from, String callUrl, String answerUrl, AnswerMethodEnum answerMethod,
148-
DisconnectMethodEnum disconnectMethod, LocalDateTime startTime, Double callTimeout,
148+
DisconnectMethodEnum disconnectMethod, LocalDateTime enqueuedTime, Double callTimeout,
149149
Double callbackTimeout, OptionalNullable<String> answerFallbackUrl,
150150
OptionalNullable<AnswerFallbackMethodEnum> answerFallbackMethod,
151151
OptionalNullable<String> disconnectUrl, OptionalNullable<String> username,
@@ -156,7 +156,7 @@ protected CreateCallResponse(String accountId, String callId, String application
156156
this.applicationId = applicationId;
157157
this.to = to;
158158
this.from = from;
159-
this.startTime = startTime;
159+
this.enqueuedTime = enqueuedTime;
160160
this.callUrl = callUrl;
161161
this.callTimeout = callTimeout;
162162
this.callbackTimeout = callbackTimeout;
@@ -265,23 +265,23 @@ public void setFrom(String from) {
265265
}
266266

267267
/**
268-
* Getter for StartTime.
268+
* Getter for EnqueuedTime.
269269
* @return Returns the LocalDateTime
270270
*/
271-
@JsonGetter("startTime")
271+
@JsonGetter("enqueuedTime")
272272
@JsonSerialize(using = DateTimeHelper.Rfc8601DateTimeSerializer.class)
273-
public LocalDateTime getStartTime() {
274-
return startTime;
273+
public LocalDateTime getEnqueuedTime() {
274+
return enqueuedTime;
275275
}
276276

277277
/**
278-
* Setter for StartTime.
279-
* @param startTime Value for LocalDateTime
278+
* Setter for EnqueuedTime.
279+
* @param enqueuedTime Value for LocalDateTime
280280
*/
281-
@JsonSetter("startTime")
281+
@JsonSetter("enqueuedTime")
282282
@JsonDeserialize(using = DateTimeHelper.Rfc8601DateTimeDeserializer.class)
283-
public void setStartTime(LocalDateTime startTime) {
284-
this.startTime = startTime;
283+
public void setEnqueuedTime(LocalDateTime enqueuedTime) {
284+
this.enqueuedTime = enqueuedTime;
285285
}
286286

287287
/**
@@ -703,8 +703,8 @@ public String toString() {
703703
return "CreateCallResponse [" + "accountId=" + accountId + ", callId=" + callId
704704
+ ", applicationId=" + applicationId + ", to=" + to + ", from=" + from
705705
+ ", callUrl=" + callUrl + ", answerUrl=" + answerUrl + ", answerMethod="
706-
+ answerMethod + ", disconnectMethod=" + disconnectMethod + ", startTime="
707-
+ startTime + ", callTimeout=" + callTimeout + ", callbackTimeout="
706+
+ answerMethod + ", disconnectMethod=" + disconnectMethod + ", enqueuedTime="
707+
+ enqueuedTime + ", callTimeout=" + callTimeout + ", callbackTimeout="
708708
+ callbackTimeout + ", answerFallbackUrl=" + answerFallbackUrl
709709
+ ", answerFallbackMethod=" + answerFallbackMethod + ", disconnectUrl="
710710
+ disconnectUrl + ", username=" + username + ", password=" + password
@@ -720,7 +720,7 @@ public String toString() {
720720
public Builder toBuilder() {
721721
Builder builder = new Builder(accountId, callId, applicationId, to, from, callUrl,
722722
answerUrl, answerMethod, disconnectMethod)
723-
.startTime(getStartTime())
723+
.enqueuedTime(getEnqueuedTime())
724724
.callTimeout(getCallTimeout())
725725
.callbackTimeout(getCallbackTimeout());
726726
builder.answerFallbackUrl = internalGetAnswerFallbackUrl();
@@ -748,7 +748,7 @@ public static class Builder {
748748
private String answerUrl;
749749
private AnswerMethodEnum answerMethod;
750750
private DisconnectMethodEnum disconnectMethod;
751-
private LocalDateTime startTime;
751+
private LocalDateTime enqueuedTime;
752752
private Double callTimeout;
753753
private Double callbackTimeout;
754754
private OptionalNullable<String> answerFallbackUrl;
@@ -885,12 +885,12 @@ public Builder disconnectMethod(DisconnectMethodEnum disconnectMethod) {
885885
}
886886

887887
/**
888-
* Setter for startTime.
889-
* @param startTime LocalDateTime value for startTime.
888+
* Setter for enqueuedTime.
889+
* @param enqueuedTime LocalDateTime value for enqueuedTime.
890890
* @return Builder
891891
*/
892-
public Builder startTime(LocalDateTime startTime) {
893-
this.startTime = startTime;
892+
public Builder enqueuedTime(LocalDateTime enqueuedTime) {
893+
this.enqueuedTime = enqueuedTime;
894894
return this;
895895
}
896896

@@ -1091,7 +1091,7 @@ public Builder unsetPriority() {
10911091
*/
10921092
public CreateCallResponse build() {
10931093
return new CreateCallResponse(accountId, callId, applicationId, to, from, callUrl,
1094-
answerUrl, answerMethod, disconnectMethod, startTime, callTimeout,
1094+
answerUrl, answerMethod, disconnectMethod, enqueuedTime, callTimeout,
10951095
callbackTimeout, answerFallbackUrl, answerFallbackMethod, disconnectUrl,
10961096
username, password, fallbackUsername, fallbackPassword, tag, priority);
10971097
}

src/test/java/com/bandwidth/VoiceApiTest.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
import javax.swing.text.html.Option;
1212

13+
import java.time.LocalDateTime;
1314
import static org.junit.Assert.*;
1415

1516
import static com.bandwidth.TestingEnvironmentVariables.*;
@@ -51,6 +52,8 @@ public void testCreateCallAndGetCallState() throws Exception {
5152
assertEquals("Application ID for create call not equal", VOICE_APPLICATION_ID, createCallResponse.getApplicationId());
5253
assertEquals("To phone number for create call not equal", USER_NUMBER, createCallResponse.getTo());
5354
assertEquals("From phone number for create call not equal", BW_NUMBER, createCallResponse.getFrom());
55+
assertNotNull("enqueuedTime is null", createCallResponse.getEnqueuedTime());
56+
assertEquals("enqueuedTime is not a LocalDateTime object", LocalDateTime.class, createCallResponse.getEnqueuedTime().getClass());
5457

5558
//get call state
5659
Thread.sleep(750); // Wait to get Call because of current system latency issues
@@ -62,6 +65,8 @@ public void testCreateCallAndGetCallState() throws Exception {
6265
assertEquals("To phone number for call state not equal", USER_NUMBER, callStateResponse.getTo());
6366
assertEquals("From phone number for call state not equal", BW_NUMBER, callStateResponse.getFrom());
6467
assertEquals("Call ID not equal", createCallResponse.getCallId(), callStateResponse.getCallId());
68+
assertNotNull("enqueuedTime is null", createCallResponse.getEnqueuedTime());
69+
assertEquals("enqueuedTime is not a LocalDateTime object", LocalDateTime.class, createCallResponse.getEnqueuedTime().getClass());
6570
}
6671

6772
@Test

0 commit comments

Comments
 (0)