diff --git a/CHANGELOG.md b/CHANGELOG.md index 4ee5c55..0374150 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,11 @@ All notable changes to the library will be documented in this file. The format of the file is based on [Keep a Changelog](http://keepachangelog.com/) and this library adheres to [Semantic Versioning](http://semver.org/) as mentioned in [README.md][readme] file. +## [ [6.4.1](https://github.com/infobip/infobip-api-java-client/releases/tag/6.4.1) ] - 2026-05-05 + +### Fixed +* Fixed `getCampaignNetworkStatuses` response type to return a list instead of a single object. + ## [ [6.4.0](https://github.com/infobip/infobip-api-java-client/releases/tag/6.4.0) ] - 2026-03-31 ⚠️ **IMPORTANT NOTE:** This release contains compile time breaking changes. diff --git a/README.md b/README.md index 7cadea0..9e7a4c3 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ Simply add the following in your project's POM file under `dependencies` tag: com.infobip infobip-api-java-client - 6.4.0 + 6.4.1 ``` diff --git a/pom.xml b/pom.xml index eb4a98a..d0a0821 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.infobip infobip-api-java-client - 6.4.0 + 6.4.1 jar infobip-api-java-client diff --git a/src/main/java/com/infobip/RequestFactory.java b/src/main/java/com/infobip/RequestFactory.java index 91e4225..c6392e8 100644 --- a/src/main/java/com/infobip/RequestFactory.java +++ b/src/main/java/com/infobip/RequestFactory.java @@ -26,7 +26,7 @@ */ final class RequestFactory { - private static final String USER_AGENT_HEADER_VALUE = "infobip-api-client-java/6.4.0"; + private static final String USER_AGENT_HEADER_VALUE = "infobip-api-client-java/6.4.1"; private final ApiKey apiKey; private final BaseUrl baseUrl; diff --git a/src/main/java/com/infobip/api/NumbersApi.java b/src/main/java/com/infobip/api/NumbersApi.java index 6e225be..80576ed 100644 --- a/src/main/java/com/infobip/api/NumbersApi.java +++ b/src/main/java/com/infobip/api/NumbersApi.java @@ -1943,13 +1943,13 @@ private GetCampaignNetworkStatusesRequest(UUID campaignId) { /** * Executes the getCampaignNetworkStatuses request. * - * @return NumbersNetworkStatus The deserialized response. + * @return List<NumbersNetworkStatus> The deserialized response. * @throws ApiException If the API call fails or an error occurs during the request or response processing. */ - public NumbersNetworkStatus execute() throws ApiException { + public List execute() throws ApiException { RequestDefinition getCampaignNetworkStatusesDefinition = getCampaignNetworkStatusesDefinition(campaignId); return apiClient.execute( - getCampaignNetworkStatusesDefinition, new TypeReference() {}.getType()); + getCampaignNetworkStatusesDefinition, new TypeReference>() {}.getType()); } /** @@ -1958,11 +1958,11 @@ public NumbersNetworkStatus execute() throws ApiException { * @param callback The {@link ApiCallback} to be invoked. * @return The {@link okhttp3.Call} associated with the API request. */ - public okhttp3.Call executeAsync(ApiCallback callback) { + public okhttp3.Call executeAsync(ApiCallback> callback) { RequestDefinition getCampaignNetworkStatusesDefinition = getCampaignNetworkStatusesDefinition(campaignId); return apiClient.executeAsync( getCampaignNetworkStatusesDefinition, - new TypeReference() {}.getType(), + new TypeReference>() {}.getType(), callback); } } diff --git a/src/test/java/com/infobip/RequestFactoryTest.java b/src/test/java/com/infobip/RequestFactoryTest.java index 36088ee..6dad135 100644 --- a/src/test/java/com/infobip/RequestFactoryTest.java +++ b/src/test/java/com/infobip/RequestFactoryTest.java @@ -38,7 +38,7 @@ class RequestFactoryTest { private static final String GIVEN_API_KEY_VALUE = "apiKeyValue"; private static final ApiKey GIVEN_API_KEY = ApiKey.from(GIVEN_API_KEY_VALUE); - private static final String EXPECTED_USER_AGENT_HEADER_VALUE = "infobip-api-client-java/6.4.0"; + private static final String EXPECTED_USER_AGENT_HEADER_VALUE = "infobip-api-client-java/6.4.1"; private final OkHttpClient client = new OkHttpClient(); private final JSON json = new JSON(); diff --git a/src/test/java/com/infobip/api/NumbersApiTest.java b/src/test/java/com/infobip/api/NumbersApiTest.java index 5619a32..2da6c51 100644 --- a/src/test/java/com/infobip/api/NumbersApiTest.java +++ b/src/test/java/com/infobip/api/NumbersApiTest.java @@ -4641,18 +4641,28 @@ void shouldGetCampaignNetworkStatuses() { NumbersNetworkState givenState1 = NumbersNetworkState.ACTIVE; String givenMessageClass1 = "A"; Integer givenThroughput1 = 4500; + NumbersNetwork givenNetwork2 = NumbersNetwork.T_MOBILE; + NumbersNetworkState givenState2 = NumbersNetworkState.ACTIVE; + String givenMessageClass2 = "20"; + Integer givenThroughput2 = 2000; + String givenBrandTier2 = "LOW"; - String givenResponse = "{\n" - + " \"network\": \"ATT\",\n" - + " \"state\": \"ACTIVE\",\n" - + " \"messageClass\": \"" - + givenMessageClass1 - + "\",\n" - + " \"throughput\": " - + givenThroughput1 - + ",\n" - + " \"brandTier\": null\n" - + "}\n"; + String givenResponse = "[\n" + + " {\n" + + " \"network\": \"ATT\",\n" + + " \"state\": \"ACTIVE\",\n" + + " \"messageClass\": \"A\",\n" + + " \"throughput\": 4500,\n" + + " \"brandTier\": null\n" + + " },\n" + + " {\n" + + " \"network\": \"T_MOBILE\",\n" + + " \"state\": \"ACTIVE\",\n" + + " \"messageClass\": \"20\",\n" + + " \"throughput\": 2000,\n" + + " \"brandTier\": \"LOW\"\n" + + " }\n" + + "]\n"; setUpSuccessGetRequest( CAMPAIGN_NETWORK_STATUSES.replace("{campaignId}", givenCampaignId.toString()), Map.of(), givenResponse); @@ -4661,13 +4671,21 @@ void shouldGetCampaignNetworkStatuses() { var call = api.getCampaignNetworkStatuses(givenCampaignId); - Consumer assertions = response -> { + Consumer> assertions = response -> { then(response).isNotNull(); - then(response.getNetwork()).isEqualTo(givenNetwork1); - then(response.getState()).isEqualTo(givenState1); - then(response.getMessageClass()).isEqualTo(givenMessageClass1); - then(response.getThroughput()).isEqualTo(givenThroughput1); - then(response.getBrandTier()).isNull(); + then(response).hasSize(2); + NumbersNetworkStatus status1 = response.get(0); + then(status1.getNetwork()).isEqualTo(givenNetwork1); + then(status1.getState()).isEqualTo(givenState1); + then(status1.getMessageClass()).isEqualTo(givenMessageClass1); + then(status1.getThroughput()).isEqualTo(givenThroughput1); + then(status1.getBrandTier()).isNull(); + NumbersNetworkStatus status2 = response.get(1); + then(status2.getNetwork()).isEqualTo(givenNetwork2); + then(status2.getState()).isEqualTo(givenState2); + then(status2.getMessageClass()).isEqualTo(givenMessageClass2); + then(status2.getThroughput()).isEqualTo(givenThroughput2); + then(status2.getBrandTier()).isEqualTo(givenBrandTier2); }; testSuccessfulCall(call::execute, assertions);