From ff6f785f7b9d845ce2f5334e71545a1ff9796d94 Mon Sep 17 00:00:00 2001 From: Jean-Pierre Portier <141755467+JPPortier@users.noreply.github.com> Date: Fri, 17 Nov 2023 10:20:22 +0100 Subject: [PATCH] refactor: Align 'checkAvailability' function name for numbers available to SDKs naming (#12) --- .../numbers/AvailableNumberService.java | 4 +- .../adapters/AvailableNumberService.java | 2 +- .../adapters/AvailableNumberServiceTest.java | 2 +- sample-app/README.md | 70 +++++++++---------- .../sinch/sample/numbers/active/Release.java | 2 +- .../{Get.java => CheckAvailability.java} | 12 ++-- 6 files changed, 47 insertions(+), 45 deletions(-) rename sample-app/src/main/java/com/sinch/sample/numbers/available/{Get.java => CheckAvailability.java} (53%) diff --git a/client/src/main/com/sinch/sdk/domains/numbers/AvailableNumberService.java b/client/src/main/com/sinch/sdk/domains/numbers/AvailableNumberService.java index 63b628a8..8ead73bc 100644 --- a/client/src/main/com/sinch/sdk/domains/numbers/AvailableNumberService.java +++ b/client/src/main/com/sinch/sdk/domains/numbers/AvailableNumberService.java @@ -36,11 +36,13 @@ AvailableNumberListResponse list(AvailableNumberListAllRequestParameters paramet /** * Get available number information by phone number * + *

This endpoint allows you to enter a specific phone number to check if it's available for use + * * @param phoneNumber Phone number * @return Available number information * @since 1.0 */ - AvailableNumber get(String phoneNumber) throws ApiException; + AvailableNumber checkAvailability(String phoneNumber) throws ApiException; /** * Activate a new phone number diff --git a/client/src/main/com/sinch/sdk/domains/numbers/adapters/AvailableNumberService.java b/client/src/main/com/sinch/sdk/domains/numbers/adapters/AvailableNumberService.java index c5662b6b..f158c800 100644 --- a/client/src/main/com/sinch/sdk/domains/numbers/adapters/AvailableNumberService.java +++ b/client/src/main/com/sinch/sdk/domains/numbers/adapters/AvailableNumberService.java @@ -80,7 +80,7 @@ public AvailableNumberListResponse list(AvailableNumberListAllRequestParameters return new AvailableNumberListResponse(entities); } - public AvailableNumber get(String phoneNumber) throws ApiException { + public AvailableNumber checkAvailability(String phoneNumber) throws ApiException { AvailableNumberDto response = getApi().numberServiceGetAvailableNumber(configuration.getProjectId(), phoneNumber); return AvailableNumberDtoConverter.convert(response); diff --git a/client/src/test/java/com/sinch/sdk/domains/numbers/adapters/AvailableNumberServiceTest.java b/client/src/test/java/com/sinch/sdk/domains/numbers/adapters/AvailableNumberServiceTest.java index b4396163..b22489cd 100644 --- a/client/src/test/java/com/sinch/sdk/domains/numbers/adapters/AvailableNumberServiceTest.java +++ b/client/src/test/java/com/sinch/sdk/domains/numbers/adapters/AvailableNumberServiceTest.java @@ -136,7 +136,7 @@ void get() { when(api.numberServiceGetAvailableNumber(eq(configuration.getProjectId()), eq("foo"))) .thenReturn(getNumberDto); - AvailableNumber response = service.get("foo"); + AvailableNumber response = service.checkAvailability("foo"); AvailableNumber expected = AvailableNumber.builder() diff --git a/sample-app/README.md b/sample-app/README.md index c4d5bb0e..b51dfed9 100644 --- a/sample-app/README.md +++ b/sample-app/README.md @@ -49,38 +49,38 @@ See https://developers.sinch.com for details about these parameters ## Available samples classes -| API | Service | Sample | Class | Notes | -|---------|----------------|-----------------------|---------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------| -| Numbers | Available | - Get | [com.sinch.sample.numbers.available.Get](src/main/java/com/sinch/sample/numbers/available/Get.java) | Require `PHONE_NUMBER` parameter | -| | | - ListAll | [com.sinch.sample.numbers.available.ListAll](src/main/java/com/sinch/sample/numbers/available/ListAll.java) | | -| | | - Rent | [com.sinch.sample.numbers.available.Rent](src/main/java/com/sinch/sample/numbers/available/Rent.java) | Require `PHONE_NUMBER` parameter | -| | | - RentAny | [com.sinch.sample.numbers.available.RentAny](src/main/java/com/sinch/sample/numbers/available/RentAny.java) | | -| | Active | - Get | [com.sinch.sample.numbers.active.Get](src/main/java/com/sinch/sample/numbers/active/Get.java) | Require `PHONE_NUMBER` parameter | -| | | - List | [com.sinch.sample.numbers.active.List](src/main/java/com/sinch/sample/numbers/active/List.java) | | -| | | - Release | [com.sinch.sample.numbers.active.Release](src/main/java/com/sinch/sample/numbers/active/Release.java) | Require `PHONE_NUMBER` parameter | -| | | - Update | [com.sinch.sample.numbers.active.Update](src/main/java/com/sinch/sample/numbers/active/Update.java) | Require `PHONE_NUMBER` parameter | -| | Callback | - Get | [com.sinch.sample.numbers.callback.Get](src/main/java/com/sinch/sample/numbers/callback/Get.java) | | -| | | - Update | [com.sinch.sample.numbers.callback.Update](src/main/java/com/sinch/sample/numbers/callback/Get.java) | | -| | Regions | - ListAll | [com.sinch.sample.numbers.regions.ListAll](src/main/java/com/sinch/sample/numbers/regions/ListAll.java) | | -| SMS | Batches | - Get | [com.sinch.sample.sms.batches.Get](src/main/java/com/sinch/sample/sms/batches/Get.java) | Require `BATCH_ID` parameter | -| | | - List | [com.sinch.sample.sms.batches.List](src/main/java/com/sinch/sample/sms/batches/List.java) | | -| | | - Send | [com.sinch.sample.sms.batches.Send](src/main/java/com/sinch/sample/sms/batches/Send.java) | | -| | | - Replace | [com.sinch.sample.sms.batches.Replace](src/main/java/com/sinch/sample/sms/batches/Replace.java) | Require `BATCH_ID` parameter | -| | | - Update | [com.sinch.sample.sms.batches.Update](src/main/java/com/sinch/sample/sms/batches/Update.java) | Require `BATCH_ID` parameter | -| | | - DryRun | [com.sinch.sample.sms.batches.DryRun](src/main/java/com/sinch/sample/sms/batches/dryRun.java) | | -| | | - Cancel | [com.sinch.sample.sms.batches.Cancel](src/main/java/com/sinch/sample/sms/batches/Cancel.java) | Require `BATCH_ID` parameter | -| | | - SendDeliveryFeedback | [com.sinch.sample.sms.batches.SendDeliveryFeedback](src/main/java/com/sinch/sample/sms/batches/SendDeliveryFeedback.java) | Require `BATCH_ID` parameter | -| | DeliveryReport | - Get | [com.sinch.sample.sms.deliveryReports.Get](src/main/java/com/sinch/sample/sms/deliveryReports/Get.java) | Require `BATCH_ID` parameter | -| | | - GetForNumber | [com.sinch.sample.sms.deliveryReports.GetForNumber](src/main/java/com/sinch/sample/sms/deliveryReports/GetForNumber.java) | Require `BATCH_ID` and `PHONE_NUMBER` parameters | -| | | - List | [com.sinch.sample.sms.deliveryReports.List](src/main/java/com/sinch/sample/sms/deliveryReports/List.java) | | -| | Groups | - Create | [com.sinch.sample.sms.groups.Create](src/main/java/com/sinch/sample/sms/groups/Create.java) | | -| | | - Get | [com.sinch.sample.sms.groups.Get](src/main/java/com/sinch/sample/sms/groups/Get.java) | | -| | | - Delete | [com.sinch.sample.sms.groups.Delete](src/main/java/com/sinch/sample/sms/groups/Delete.java) | | -| | | - List | [com.sinch.sample.sms.groups.List](src/main/java/com/sinch/sample/sms/groups/List.java) | | -| | | - ListMembers | [com.sinch.sample.sms.groups.ListMembers](src/main/java/com/sinch/sample/sms/groups/ListMembers.java) | | -| | | - Replace | [com.sinch.sample.sms.groups.Replace](src/main/java/com/sinch/sample/sms/groups/Replace.java) | | -| | | - Update | [com.sinch.sample.sms.groups.Update](src/main/java/com/sinch/sample/sms/groups/Update.java) | | -| | Inbounds | - Get | [com.sinch.sample.sms.inbounds.Get](src/main/java/com/sinch/sample/sms/inbounds/Get.java) | | -| | | - List | [com.sinch.sample.sms.inbounds.List](src/main/java/com/sinch/sample/sms/inbounds/List.java) | | -| | WebHooks | - DeliveryReport | [com.sinch.sample.sms.webhooks.DeliveryReport](src/main/java/com/sinch/sample/sms/webhooks/DeliveryReport.java) | | -| | | - IncomingSMSReport | [com.sinch.sample.sms.webhooks.IncomingSMS](src/main/java/com/sinch/sample/sms/webhooks/IncomingSMS.java) | | +| API | Service | Sample | Class | Notes | +|---------|----------------|------------------------|---------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------| +| Numbers | Available | - CheckAvailability | [com.sinch.sample.numbers.available.CheckAvailability](src/main/java/com/sinch/sample/numbers/available/CheckAvailability.java) | Require `PHONE_NUMBER` parameter | +| | | - ListAll | [com.sinch.sample.numbers.available.ListAll](src/main/java/com/sinch/sample/numbers/available/ListAll.java) | | +| | | - Rent | [com.sinch.sample.numbers.available.Rent](src/main/java/com/sinch/sample/numbers/available/Rent.java) | Require `PHONE_NUMBER` parameter | +| | | - RentAny | [com.sinch.sample.numbers.available.RentAny](src/main/java/com/sinch/sample/numbers/available/RentAny.java) | | +| | Active | - Get | [com.sinch.sample.numbers.active.Get](src/main/java/com/sinch/sample/numbers/active/Get.java) | Require `PHONE_NUMBER` parameter | +| | | - List | [com.sinch.sample.numbers.active.List](src/main/java/com/sinch/sample/numbers/active/List.java) | | +| | | - Release | [com.sinch.sample.numbers.active.Release](src/main/java/com/sinch/sample/numbers/active/Release.java) | Require `PHONE_NUMBER` parameter | +| | | - Update | [com.sinch.sample.numbers.active.Update](src/main/java/com/sinch/sample/numbers/active/Update.java) | Require `PHONE_NUMBER` parameter | +| | Callback | - Get | [com.sinch.sample.numbers.callback.Get](src/main/java/com/sinch/sample/numbers/callback/Get.java) | | +| | | - Update | [com.sinch.sample.numbers.callback.Update](src/main/java/com/sinch/sample/numbers/callback/Get.java) | | +| | Regions | - ListAll | [com.sinch.sample.numbers.regions.ListAll](src/main/java/com/sinch/sample/numbers/regions/ListAll.java) | | +| SMS | Batches | - Get | [com.sinch.sample.sms.batches.Get](src/main/java/com/sinch/sample/sms/batches/Get.java) | Require `BATCH_ID` parameter | +| | | - List | [com.sinch.sample.sms.batches.List](src/main/java/com/sinch/sample/sms/batches/List.java) | | +| | | - Send | [com.sinch.sample.sms.batches.Send](src/main/java/com/sinch/sample/sms/batches/Send.java) | | +| | | - Replace | [com.sinch.sample.sms.batches.Replace](src/main/java/com/sinch/sample/sms/batches/Replace.java) | Require `BATCH_ID` parameter | +| | | - Update | [com.sinch.sample.sms.batches.Update](src/main/java/com/sinch/sample/sms/batches/Update.java) | Require `BATCH_ID` parameter | +| | | - DryRun | [com.sinch.sample.sms.batches.DryRun](src/main/java/com/sinch/sample/sms/batches/dryRun.java) | | +| | | - Cancel | [com.sinch.sample.sms.batches.Cancel](src/main/java/com/sinch/sample/sms/batches/Cancel.java) | Require `BATCH_ID` parameter | +| | | - SendDeliveryFeedback | [com.sinch.sample.sms.batches.SendDeliveryFeedback](src/main/java/com/sinch/sample/sms/batches/SendDeliveryFeedback.java) | Require `BATCH_ID` parameter | +| | DeliveryReport | - Get | [com.sinch.sample.sms.deliveryReports.Get](src/main/java/com/sinch/sample/sms/deliveryReports/Get.java) | Require `BATCH_ID` parameter | +| | | - GetForNumber | [com.sinch.sample.sms.deliveryReports.GetForNumber](src/main/java/com/sinch/sample/sms/deliveryReports/GetForNumber.java) | Require `BATCH_ID` and `PHONE_NUMBER` parameters | +| | | - List | [com.sinch.sample.sms.deliveryReports.List](src/main/java/com/sinch/sample/sms/deliveryReports/List.java) | | +| | Groups | - Create | [com.sinch.sample.sms.groups.Create](src/main/java/com/sinch/sample/sms/groups/Create.java) | | +| | | - Get | [com.sinch.sample.sms.groups.Get](src/main/java/com/sinch/sample/sms/groups/Get.java) | | +| | | - Delete | [com.sinch.sample.sms.groups.Delete](src/main/java/com/sinch/sample/sms/groups/Delete.java) | | +| | | - List | [com.sinch.sample.sms.groups.List](src/main/java/com/sinch/sample/sms/groups/List.java) | | +| | | - ListMembers | [com.sinch.sample.sms.groups.ListMembers](src/main/java/com/sinch/sample/sms/groups/ListMembers.java) | | +| | | - Replace | [com.sinch.sample.sms.groups.Replace](src/main/java/com/sinch/sample/sms/groups/Replace.java) | | +| | | - Update | [com.sinch.sample.sms.groups.Update](src/main/java/com/sinch/sample/sms/groups/Update.java) | | +| | Inbounds | - Get | [com.sinch.sample.sms.inbounds.Get](src/main/java/com/sinch/sample/sms/inbounds/Get.java) | | +| | | - List | [com.sinch.sample.sms.inbounds.List](src/main/java/com/sinch/sample/sms/inbounds/List.java) | | +| | WebHooks | - DeliveryReport | [com.sinch.sample.sms.webhooks.DeliveryReport](src/main/java/com/sinch/sample/sms/webhooks/DeliveryReport.java) | | +| | | - IncomingSMSReport | [com.sinch.sample.sms.webhooks.IncomingSMS](src/main/java/com/sinch/sample/sms/webhooks/IncomingSMS.java) | | diff --git a/sample-app/src/main/java/com/sinch/sample/numbers/active/Release.java b/sample-app/src/main/java/com/sinch/sample/numbers/active/Release.java index 07aca0d8..c5674951 100644 --- a/sample-app/src/main/java/com/sinch/sample/numbers/active/Release.java +++ b/sample-app/src/main/java/com/sinch/sample/numbers/active/Release.java @@ -21,7 +21,7 @@ public static void main(String[] args) { public void run() { - LOGGER.info("Get for :" + phoneNumber); + LOGGER.info("Release for: " + phoneNumber); ActiveNumber value = client.numbers().active().release(phoneNumber); diff --git a/sample-app/src/main/java/com/sinch/sample/numbers/available/Get.java b/sample-app/src/main/java/com/sinch/sample/numbers/available/CheckAvailability.java similarity index 53% rename from sample-app/src/main/java/com/sinch/sample/numbers/available/Get.java rename to sample-app/src/main/java/com/sinch/sample/numbers/available/CheckAvailability.java index 24074603..f5aa2d50 100644 --- a/sample-app/src/main/java/com/sinch/sample/numbers/available/Get.java +++ b/sample-app/src/main/java/com/sinch/sample/numbers/available/CheckAvailability.java @@ -5,14 +5,14 @@ import java.io.IOException; import java.util.logging.Logger; -public class Get extends BaseApplication { - private static final Logger LOGGER = Logger.getLogger(Get.class.getName()); +public class CheckAvailability extends BaseApplication { + private static final Logger LOGGER = Logger.getLogger(CheckAvailability.class.getName()); - public Get() throws IOException {} + public CheckAvailability() throws IOException {} public static void main(String[] args) { try { - new Get().run(); + new CheckAvailability().run(); } catch (Exception e) { LOGGER.severe(e.getMessage()); e.printStackTrace(); @@ -21,9 +21,9 @@ public static void main(String[] args) { public void run() { - LOGGER.info("Get for :" + phoneNumber); + LOGGER.info("CheckAvailability for: " + phoneNumber); - AvailableNumber value = client.numbers().available().get(phoneNumber); + AvailableNumber value = client.numbers().available().checkAvailability(phoneNumber); LOGGER.info("Response :" + value); }