Skip to content

Commit f533942

Browse files
committed
refactor!: Use List in CallInfoPage
1 parent 49e24d7 commit f533942

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
2929
- Renamed `com.vonage.client.voice.Endpoint` to `CallEndpoint`
3030
- Renamed `com.vonage.client.voice.ncco.Endpoint` to `ConnectEndpoint`
3131
- Refactored `CallInfoPage` to be aligned with other HAL responses (now extends `HalPageResponse`)
32+
- Now returns the embedded calls directly as a list rather than array
3233
- Added `get` prefix to `VideoStream` and `HlsSettings` accessors
3334
- `NumbersClient#listNumbers` now returns `List<OwnedNumber>` instead of `ListNumbersResponse`
3435
- `NumbersClient#linkNumber` now assigns the number to the application by ID

src/main/java/com/vonage/client/voice/CallInfoPage.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717

1818
import com.fasterxml.jackson.annotation.JsonIgnore;
1919
import com.fasterxml.jackson.annotation.JsonProperty;
20-
import com.fasterxml.jackson.databind.util.ArrayIterator;
2120
import com.vonage.client.JsonableBaseObject;
2221
import com.vonage.client.common.HalPageResponse;
2322
import java.util.Iterator;
23+
import java.util.List;
2424

2525
/**
2626
* Response from {@link VoiceClient#listCalls(CallsFilter)}.
@@ -31,7 +31,7 @@ public class CallInfoPage extends HalPageResponse implements Iterable<CallInfo>
3131
@JsonProperty("_embedded") private Embedded embedded;
3232

3333
static class Embedded extends JsonableBaseObject {
34-
@JsonProperty("calls") private CallInfo[] callInfos;
34+
@JsonProperty("calls") private List<CallInfo> callInfos;
3535
}
3636

3737
/**
@@ -62,17 +62,17 @@ public Integer getRecordIndex() {
6262
/**
6363
* Gets the call details.
6464
*
65-
* @return The CallInfos from the embedded object as an array.
65+
* @return The list of CallInfos from the embedded object.
6666
*
6767
* @since 9.0.0
6868
*/
6969
@JsonIgnore
70-
public CallInfo[] getCallInfos() {
70+
public List<CallInfo> getCallInfos() {
7171
return embedded.callInfos;
7272
}
7373

7474
@Override
7575
public Iterator<CallInfo> iterator() {
76-
return new ArrayIterator<>(getCallInfos());
76+
return getCallInfos().iterator();
7777
}
7878
}

src/test/java/com/vonage/client/voice/CallInfoPageTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public void testBasics() {
9595
assertEquals("/v1/calls?page_size=10", links.getFirstUrl().toString());
9696
assertEquals("/v1/calls?page_size=10&record_index=20&order=asc", links.getSelfUrl().toString());
9797
assertEquals("/v1/calls/1452dad1b27b4e71a90fb18af2656948", links.getPrevUrl().toString());
98-
assertEquals("447700900549", page.getCallInfos()[0].getTo().toLog());
98+
assertEquals("447700900549", page.getCallInfos().getFirst().getTo().toLog());
9999
assertEquals(10, page.getPageSize());
100100
assertEquals(0, page.getRecordIndex());
101101
}

0 commit comments

Comments
 (0)