-
Notifications
You must be signed in to change notification settings - Fork 8
Task/Update SDK CU-869adq005 #21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
e1a84f2
accept all
cristinabotu b63f600
Added new methods.
cristinabotu ba41b69
Added readme.
cristinabotu 692f1fb
Merged w/ master
cristinabotu 155d53b
Added tests.
cristinabotu 971ac45
Merges.
cristinabotu 1228118
Merge branch 'master' into task/update-sdk
cristinabotu f4fb50d
Little change
cristinabotu 8712bed
Tests.
cristinabotu f955a82
Changes to the Controller
cristinabotu 83bd363
Changes after PR.
cristinabotu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -86,6 +86,9 @@ ZeroBounceSDK.getInstance().initialize("<YOUR_API_KEY>"); | |||||||
| ```java | ||||||||
| ZeroBounceSDK.getInstance().initialize("<YOUR_API_KEY>", timeoutInMillis); | ||||||||
| ``` | ||||||||
| ```java | ||||||||
| ZeroBounceSDK.getInstance().initialize("<YOUR_API_KEY>", "<YOUR_API_BASE_URL>"); | ||||||||
| ``` | ||||||||
|
|
||||||||
|
|
||||||||
| ### 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( | ||||||||
| "<FIRST_NAME_TO_TEST>" | ||||||||
| "<DOMAIN_TO_TEST>", | ||||||||
| null, | ||||||||
| null, | ||||||||
| null, | ||||||||
| new ZeroBounceSDK.OnSuccessCallback<ZBFindEmailResponse>() { | ||||||||
| @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( | ||||||||
| "<FIRST_NAME_TO_TEST>" | ||||||||
| null, | ||||||||
| "<COMPANY_NAME_TO_TEST>", | ||||||||
| null, | ||||||||
| null, | ||||||||
| new ZeroBounceSDK.OnSuccessCallback<ZBFindEmailResponse>() { | ||||||||
| @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( | ||||||||
| "<DOMAIN_TO_TEST>", | ||||||||
| null, | ||||||||
| new ZeroBounceSDK.OnSuccessCallback<ZBFindDomainResponse>() { | ||||||||
| @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<ZBFindDomainResponse>() { | ||||||||
| @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( | ||||||||
| "<DOMAIN_TO_TEST>", | ||||||||
| null, | ||||||||
| null, | ||||||||
| null, | ||||||||
| new ZeroBounceSDK.OnSuccessCallback<ZBEmailFinderResponse>() { | ||||||||
| @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( | ||||||||
| "<FIRST_NAME_TO_TEST>" | ||||||||
| "<DOMAIN_TO_TEST>", | ||||||||
| null, | ||||||||
| null, | ||||||||
| null, | ||||||||
| new ZeroBounceSDK.OnSuccessCallback<ZBFindEmailResponse>() { | ||||||||
| @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( | ||||||||
| "<FIRST_NAME_TO_TEST>" | ||||||||
| null, | ||||||||
| "<COMPANY_NAME_TO_TEST>", | ||||||||
| null, | ||||||||
| null, | ||||||||
| new ZeroBounceSDK.OnSuccessCallback<ZBFindEmailResponse>() { | ||||||||
| @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( | ||||||||
| "<DOMAIN_TO_TEST>", | ||||||||
| null, | ||||||||
| new ZeroBounceSDK.OnSuccessCallback<ZBFindDomainResponse>() { | ||||||||
| @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<ZBFindDomainResponse>() { | ||||||||
| @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: | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
| ```java | ||||||||
| ZeroBounceSDK.getInstance().initialize("<YOUR_API_KEY>"); | ||||||||
| ``` | ||||||||
| ```java | ||||||||
| ZeroBounceSDK.getInstance().initialize("<YOUR_API_KEY>", timeoutInMillis); | ||||||||
| ``` | ||||||||
| - Initialize the SDK with your API key and URL: | ||||||||
| ```java | ||||||||
| ZeroBounceSDK.getInstance().initialize("<YOUR_API_KEY>", "<YOUR_API_BASE_URL>"); | ||||||||
| ``` | ||||||||
| 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("<YOUR_API_KEY>", ZBConstants.getInstance().API_EU_URL); | ||||||||
| ``` | ||||||||
|
|
||||||||
| ## Documentation | ||||||||
| You can generate the documentation using your desired IDE or using's maven's javadoc command. | ||||||||
|
|
||||||||
Binary file added
BIN
+64.1 KB
local-libs/com/zerobounce/java/zerobouncesdk/1.3.0/zerobouncesdk-1.3.0.jar
Binary file not shown.
9 changes: 9 additions & 0 deletions
9
local-libs/com/zerobounce/java/zerobouncesdk/1.3.0/zerobouncesdk-1.3.0.pom
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" | ||
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | ||
| <modelVersion>4.0.0</modelVersion> | ||
| <groupId>com.zerobounce.java</groupId> | ||
| <artifactId>zerobouncesdk</artifactId> | ||
| <version>1.3.0</version> | ||
| <description>POM was created from install:install-file</description> | ||
| </project> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
zero-bounce-sdk/src/main/java/com/zerobounce/ZBConstants.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,14 @@ | ||||||||||||||
| package com.zerobounce; | ||||||||||||||
|
|
||||||||||||||
| /** | ||||||||||||||
| * Defines API endpoint constants. This object is a singleton and provides | ||||||||||||||
| * global access to the constants. | ||||||||||||||
| */ | ||||||||||||||
| public class ZBConstants { | ||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||
|
|
||||||||||||||
| public static final String API_DEFAULT_URL = "https://api.zerobounce.net/v2/"; | ||||||||||||||
|
|
||||||||||||||
| public static final String API_USA_URL = "https://api-us.zerobounce.net/v2/"; | ||||||||||||||
|
|
||||||||||||||
| public static final String API_EU_URL = "https://api-eu.zerobounce.net/v2/"; | ||||||||||||||
| } | ||||||||||||||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.