Skip to content

Commit

Permalink
refactor: Align 'checkAvailability' function name for numbers availab…
Browse files Browse the repository at this point in the history
…le to SDKs naming (#12)
  • Loading branch information
JPPortier authored Nov 17, 2023
1 parent 5313997 commit ff6f785
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,13 @@ AvailableNumberListResponse list(AvailableNumberListAllRequestParameters paramet
/**
* Get available number information by phone number
*
* <p>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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
70 changes: 35 additions & 35 deletions sample-app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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) | |
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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);
}
Expand Down

0 comments on commit ff6f785

Please sign in to comment.