diff --git a/snippets/numbers/active_update/Snippet.java b/snippets/numbers/active_update/Snippet.java index 00dd79e..a7965d3 100644 --- a/snippets/numbers/active_update/Snippet.java +++ b/snippets/numbers/active_update/Snippet.java @@ -1,11 +1,10 @@ package numbers; -import com.sinch.sdk.domains.numbers.api.v1.ActiveNumberService; import com.sinch.sdk.domains.numbers.api.v1.NumbersService; import com.sinch.sdk.domains.numbers.models.v1.ActiveNumber; import com.sinch.sdk.domains.numbers.models.v1.VoiceConfiguration; import com.sinch.sdk.domains.numbers.models.v1.VoiceConfigurationRTC; -import com.sinch.sdk.domains.numbers.models.v1.active.request.ActiveNumberUpdateRequest; +import com.sinch.sdk.domains.numbers.models.v1.request.ActiveNumberUpdateRequest; import java.util.logging.Logger; public class Snippet { @@ -14,8 +13,6 @@ public class Snippet { static void execute(NumbersService numbersService) { - ActiveNumberService activeNumbersService = numbersService.active(); - String phoneNumber = "YOUR_phone_number_to_be_updated"; String appId = "YOUR_app_id"; String displayName = "Updated from Sinch Java SDK"; @@ -28,7 +25,7 @@ static void execute(NumbersService numbersService) { .setVoiceConfiguration(voiceConfiguration) .build(); - ActiveNumber response = activeNumbersService.update(phoneNumber, updateRequest); + ActiveNumber response = numbersService.update(phoneNumber, updateRequest); LOGGER.info(String.format("Updated number: %s", response)); } diff --git a/snippets/numbers/available_list/Snippet.java b/snippets/numbers/available_list/Snippet.java index 358cc58..56efc89 100644 --- a/snippets/numbers/available_list/Snippet.java +++ b/snippets/numbers/available_list/Snippet.java @@ -1,10 +1,9 @@ package numbers; -import com.sinch.sdk.domains.numbers.api.v1.AvailableNumberService; import com.sinch.sdk.domains.numbers.api.v1.NumbersService; import com.sinch.sdk.domains.numbers.models.v1.NumberType; -import com.sinch.sdk.domains.numbers.models.v1.available.request.AvailableNumberListRequest; -import com.sinch.sdk.domains.numbers.models.v1.available.response.AvailableNumberListResponse; +import com.sinch.sdk.domains.numbers.models.v1.request.AvailableNumberListRequest; +import com.sinch.sdk.domains.numbers.models.v1.response.AvailableNumberListResponse; import java.util.logging.Logger; public class Snippet { @@ -13,18 +12,13 @@ public class Snippet { static void execute(NumbersService numbersService) { - AvailableNumberService availableNumbersService = numbersService.available(); - String regionCode = "US"; NumberType type = NumberType.LOCAL; AvailableNumberListRequest parameters = - AvailableNumberListRequest.builder() - .setRegionCode(regionCode) - .setType(type) - .build(); + AvailableNumberListRequest.builder().setRegionCode(regionCode).setType(type).build(); - AvailableNumberListResponse response = availableNumbersService.list(parameters); + AvailableNumberListResponse response = numbersService.searchForAvailableNumbers(parameters); response .iterator() diff --git a/snippets/numbers/rent/Snippet.java b/snippets/numbers/rent/Snippet.java index 21f3fdb..f0a967c 100644 --- a/snippets/numbers/rent/Snippet.java +++ b/snippets/numbers/rent/Snippet.java @@ -1,10 +1,9 @@ package numbers; -import com.sinch.sdk.domains.numbers.api.v1.AvailableNumberService; import com.sinch.sdk.domains.numbers.api.v1.NumbersService; import com.sinch.sdk.domains.numbers.models.v1.ActiveNumber; import com.sinch.sdk.domains.numbers.models.v1.SmsConfiguration; -import com.sinch.sdk.domains.numbers.models.v1.available.request.AvailableNumberRentRequest; +import com.sinch.sdk.domains.numbers.models.v1.request.AvailableNumberRentRequest; import java.util.logging.Logger; public class Snippet { @@ -13,8 +12,6 @@ public class Snippet { static void execute(NumbersService numbersService) { - AvailableNumberService availableNumbersService = numbersService.available(); - // Available numbers list can be retrieved by using list() function from available service, see: // https://developers.sinch.com/quickstart-getting-started-poc/docs/numbers/getting-started/java-sdk/searchavailable String phoneNumber = "available_phone_number_to_be_rented"; @@ -24,11 +21,9 @@ static void execute(NumbersService numbersService) { SmsConfiguration.builder().setServicePlanId(servicePlanId).build(); AvailableNumberRentRequest rentRequest = - AvailableNumberRentRequest.builder() - .setSmsConfiguration(smsConfiguration) - .build(); + AvailableNumberRentRequest.builder().setSmsConfiguration(smsConfiguration).build(); - ActiveNumber response = availableNumbersService.rent(phoneNumber, rentRequest); + ActiveNumber response = numbersService.rent(phoneNumber, rentRequest); LOGGER.info(String.format("Rented number: %s", response)); } diff --git a/snippets/numbers/rent_any/Snippet.java b/snippets/numbers/rent_any/Snippet.java index 668d557..abf1411 100644 --- a/snippets/numbers/rent_any/Snippet.java +++ b/snippets/numbers/rent_any/Snippet.java @@ -1,12 +1,11 @@ package numbers; -import com.sinch.sdk.domains.numbers.api.v1.AvailableNumberService; import com.sinch.sdk.domains.numbers.api.v1.NumbersService; import com.sinch.sdk.domains.numbers.models.v1.ActiveNumber; import com.sinch.sdk.domains.numbers.models.v1.Capability; import com.sinch.sdk.domains.numbers.models.v1.NumberType; import com.sinch.sdk.domains.numbers.models.v1.SmsConfiguration; -import com.sinch.sdk.domains.numbers.models.v1.available.request.AvailableNumberRentAnyRequest; +import com.sinch.sdk.domains.numbers.models.v1.request.AvailableNumberRentAnyRequest; import java.util.Collections; import java.util.logging.Logger; @@ -16,8 +15,6 @@ public class Snippet { static void execute(NumbersService numbersService) { - AvailableNumberService availableNumbersService = numbersService.available(); - String servicePlanId = "YOUR_service_plan_id"; String regionCode = "YOUR_region_code"; @@ -25,15 +22,13 @@ static void execute(NumbersService numbersService) { NumberType numberType = NumberType.LOCAL; ActiveNumber response = - availableNumbersService.rentAny( + numbersService.rentAny( AvailableNumberRentAnyRequest.builder() .setCapabilities(Collections.singletonList(capability)) .setType(numberType) .setRegionCode(regionCode) .setSmsConfiguration( - SmsConfiguration.builder() - .setServicePlanId(servicePlanId) - .build()) + SmsConfiguration.builder().setServicePlanId(servicePlanId).build()) .build()); LOGGER.info(String.format("Rented number: %s", response));