diff --git a/README.md b/README.md index 78cb9da..0288ad8 100644 --- a/README.md +++ b/README.md @@ -86,6 +86,9 @@ ZeroBounceSDK.getInstance().initialize(""); ```java ZeroBounceSDK.getInstance().initialize("", timeoutInMillis); ``` +```java +ZeroBounceSDK.getInstance().initialize("", ""); +``` ### Controlling SDK logging @@ -180,6 +183,88 @@ Then you can use any of the SDK methods, for example: ); ``` +* ##### Find the email formats based on a given first name and domain + ```java + ZeroBounceSDK.getInstance().findEmail( + "" + "", + null, + null, + null, + new ZeroBounceSDK.OnSuccessCallback() { + @Override + public void onSuccess(ZBFindEmailResponse response) { + System.out.println("findEmail response=" + response.toString()); + } + }, new ZeroBounceSDK.OnErrorCallback() { + @Override + public void onError(String errorMessage) { + System.out.println("findEmail error=" + errorMessage); + } + }); + ); + ``` + +* ##### Find the email formats based on a given first name and company name + ```java + ZeroBounceSDK.getInstance().findEmail( + "" + null, + "", + null, + null, + new ZeroBounceSDK.OnSuccessCallback() { + @Override + public void onSuccess(ZBFindEmailResponse response) { + System.out.println("findEmail response=" + response.toString()); + } + }, new ZeroBounceSDK.OnErrorCallback() { + @Override + public void onError(String errorMessage) { + System.out.println("findEmail error=" + errorMessage); + } + }); + ); + ``` + +* ##### Find other domain formats based on a given domain + ```java + ZeroBounceSDK.getInstance().findDomain( + "", + null, + new ZeroBounceSDK.OnSuccessCallback() { + @Override + public void onSuccess(ZBFindDomainResponse response) { + System.out.println("findDomain response=" + response.toString()); + } + }, new ZeroBounceSDK.OnErrorCallback() { + @Override + public void onError(String errorMessage) { + System.out.println("findDomain error=" + errorMessage); + } + }); + ); + ``` + +* ##### Find other domain formats based on a given company name + ```java + ZeroBounceSDK.getInstance().findDomain( + null, + "COMPANY_NAME_TO_TEST", + new ZeroBounceSDK.OnSuccessCallback() { + @Override + public void onSuccess(ZBFindDomainResponse response) { + System.out.println("findDomain response=" + response.toString()); + } + }, new ZeroBounceSDK.OnErrorCallback() { + @Override + public void onError(String errorMessage) { + System.out.println("findDomain error=" + errorMessage); + } + }); + ); + ``` + * ##### Check how many credits you have left on your account ```java ZeroBounceSDK.getInstance().getCredits( @@ -399,6 +484,149 @@ Then you can use any of the SDK methods, for example: }); ``` +## Breaking Changes: +**`guessFormat`** has been deprecated. To continue using your existing code, you must migrate to **`findEmail`** or **`findDomain`** . +The change is not a simple one-to-one replacement, as the functionality has been split: +- **If you were finding a person's email format**, use the new **`findEmail()`** method. +- **If you were only determining the domain's general email pattern**, use the new **`findDomain()`** method. +### Migration Example: +- #### Old (Deprecated) + ```java + ZeroBounceSDK.getInstance().guessFormat( + "", + null, + null, + null, + new ZeroBounceSDK.OnSuccessCallback() { + @Override + public void onSuccess(ZBEmailFinderResponse response) { + System.out.println("guessFormat response=" + response.toString()); + } + }, new ZeroBounceSDK.OnErrorCallback() { + @Override + public void onError(String errorMessage) { + System.out.println("guessFormat error=" + errorMessage); + } + }); + ); + +- #### New Methods + - ##### Find the email formats based on a given first name and domain + ```java + ZeroBounceSDK.getInstance().findEmail( + "" + "", + null, + null, + null, + new ZeroBounceSDK.OnSuccessCallback() { + @Override + public void onSuccess(ZBFindEmailResponse response) { + System.out.println("findEmail response=" + response.toString()); + } + }, new ZeroBounceSDK.OnErrorCallback() { + @Override + public void onError(String errorMessage) { + System.out.println("findEmail error=" + errorMessage); + } + }); + ); + ``` + - ##### Find the email formats based on a given first name and company name + ```java + ZeroBounceSDK.getInstance().findEmail( + "" + null, + "", + null, + null, + new ZeroBounceSDK.OnSuccessCallback() { + @Override + public void onSuccess(ZBFindEmailResponse response) { + System.out.println("findEmail response=" + response.toString()); + } + }, new ZeroBounceSDK.OnErrorCallback() { + @Override + public void onError(String errorMessage) { + System.out.println("findEmail error=" + errorMessage); + } + }); + ); + + - ##### Find other domain formats based on a given domain + ```java + ZeroBounceSDK.getInstance().findDomain( + "", + null, + new ZeroBounceSDK.OnSuccessCallback() { + @Override + public void onSuccess(ZBFindDomainResponse response) { + System.out.println("findDomain response=" + response.toString()); + } + }, new ZeroBounceSDK.OnErrorCallback() { + @Override + public void onError(String errorMessage) { + System.out.println("findDomain error=" + errorMessage); + } + }); + ); + ``` + - ##### Find other domain formats based on a given company name + ```java + ZeroBounceSDK.getInstance().findDomain( + null, + "COMPANY_NAME_TO_TEST", + new ZeroBounceSDK.OnSuccessCallback() { + @Override + public void onSuccess(ZBFindDomainResponse response) { + System.out.println("findDomain response=" + response.toString()); + } + }, new ZeroBounceSDK.OnErrorCallback() { + @Override + public void onError(String errorMessage) { + System.out.println("findDomain error=" + errorMessage); + } + }); + ); + +## New Features and Enhancements +### Custom API URL Support +The `ZeroBounceSDK.initialize()` method can now accepts an `apiBaseUrl` parameter. +This allows you to specify a custom base URL for the ZeroBounce API. + +#### Migration / Usage +The existing way of initializing the SDK is still valid. + +- Default Usage (No Change Required). If you don't provide a URL, the SDK will continue to use the standard ZeroBounce API endpoint: +```java +ZeroBounceSDK.getInstance().initialize(""); +``` +```java +ZeroBounceSDK.getInstance().initialize("", timeoutInMillis); +``` +- Initialize the SDK with your API key and URL: +```java +ZeroBounceSDK.getInstance().initialize("", ""); +``` +The SDK now exposes a set of predefined constants for different geographical API endpoints, +allowing for more precise network routing. + +### Available API Endpoints +You can specify a custom API base URL during initialization by using the new optional `apiBaseUrl` +parameter in `initialize()`. For convenience, the following constants are available in the +**`ZBConstants`** class: + +| Constant | URL Value | Description | +|-------------------|------------------------------------|--------------------------------------------------------------------| +| **`API_DEFAULT_URL`** | `https://api.zerobounce.net/v2/` | The global default endpoint. | +| **`API_USA_URL`** | `https://api-us.zerobounce.net/v2/` | The US-specific endpoint for lower latency in the Americas. | +| **`API_EU_URL`** | `https://api-eu.zerobounce.net/v2/` | The EU-specific endpoint for compliance and lower latency in Europe. | + +### Usage Example: +To use the EU endpoint for initialization: +```java +ZeroBounceSDK.getInstance().initialize("", ZBConstants.getInstance().API_EU_URL); +``` ## Documentation You can generate the documentation using your desired IDE or using's maven's javadoc command. diff --git a/local-libs/com/zerobounce/java/zerobouncesdk/1.3.0/zerobouncesdk-1.3.0.jar b/local-libs/com/zerobounce/java/zerobouncesdk/1.3.0/zerobouncesdk-1.3.0.jar new file mode 100644 index 0000000..5b4dceb Binary files /dev/null and b/local-libs/com/zerobounce/java/zerobouncesdk/1.3.0/zerobouncesdk-1.3.0.jar differ diff --git a/local-libs/com/zerobounce/java/zerobouncesdk/1.3.0/zerobouncesdk-1.3.0.pom b/local-libs/com/zerobounce/java/zerobouncesdk/1.3.0/zerobouncesdk-1.3.0.pom new file mode 100644 index 0000000..26c723b --- /dev/null +++ b/local-libs/com/zerobounce/java/zerobouncesdk/1.3.0/zerobouncesdk-1.3.0.pom @@ -0,0 +1,9 @@ + + + 4.0.0 + com.zerobounce.java + zerobouncesdk + 1.3.0 + POM was created from install:install-file + diff --git a/local-libs/com/zerobounce/java/zerobouncesdk/maven-metadata-local.xml b/local-libs/com/zerobounce/java/zerobouncesdk/maven-metadata-local.xml index 7c59908..9ce9852 100644 --- a/local-libs/com/zerobounce/java/zerobouncesdk/maven-metadata-local.xml +++ b/local-libs/com/zerobounce/java/zerobouncesdk/maven-metadata-local.xml @@ -3,7 +3,7 @@ com.zerobounce.java zerobouncesdk - 1.2.1 + 1.3.0 1.1.1 1.1.3 @@ -12,6 +12,7 @@ 1.1.7 1.2.0 1.2.1 + 1.3.0 20250721134252 diff --git a/src/main/java/com/zerobounceexample/zerobouncejavasdksetupmaster/Controller.java b/src/main/java/com/zerobounceexample/zerobouncejavasdksetupmaster/Controller.java index 85c98bf..28e2813 100644 --- a/src/main/java/com/zerobounceexample/zerobouncejavasdksetupmaster/Controller.java +++ b/src/main/java/com/zerobounceexample/zerobouncejavasdksetupmaster/Controller.java @@ -26,6 +26,8 @@ public class Controller { public Button validateBatchButton; public Button guessFormatButton; public Button pickFileButton; + public Button findEmailButton; + public Button findDomainButton; public void initialize() { @@ -51,6 +53,10 @@ public void initialize() { deleteFileButton.setOnAction(event -> deleteFile("")); activityDataButton.setOnAction(event -> getActivityData("")); + + findEmailButton.setOnAction(event -> findEmail("", "")); + + findDomainButton.setOnAction(event -> findDomain("")); } /** @@ -83,6 +89,33 @@ private void validateBatch() { ); } + /** + * Calls the *find email* method of the [ZeroBounceSDK]. + */ + private void findEmail(String firstName, String domain) { + ZeroBounceSDK.getInstance().findEmail( + firstName, + domain, + null, + null, + null, + response -> System.out.println("Controller::guessFormat response=" + response.toString()), + errorMessage -> System.out.println("Controller::guessFormat error=" + errorMessage) + ); + } + + /** + * Calls the *find domain* method of the [ZeroBounceSDK]. + */ + private void findDomain(String domain) { + ZeroBounceSDK.getInstance().findDomain( + domain, + null, + response -> System.out.println("Controller::guessFormat response=" + response.toString()), + errorMessage -> System.out.println("Controller::guessFormat error=" + errorMessage) + ); + } + /** * Calls the *guess format* method of the [ZeroBounceSDK]. */ diff --git a/src/main/resources/com/zerobounceexample/zerobouncejavasdksetupmaster/sample.fxml b/src/main/resources/com/zerobounceexample/zerobouncejavasdksetupmaster/sample.fxml index 6438c91..4cecf81 100644 --- a/src/main/resources/com/zerobounceexample/zerobouncejavasdksetupmaster/sample.fxml +++ b/src/main/resources/com/zerobounceexample/zerobouncejavasdksetupmaster/sample.fxml @@ -30,6 +30,10 @@ GridPane.rowIndex="5"/>