diff --git a/.github/workflows/java-compilation.yml b/.github/workflows/java-compilation.yml
index 728d92f..3c9453e 100644
--- a/.github/workflows/java-compilation.yml
+++ b/.github/workflows/java-compilation.yml
@@ -14,4 +14,6 @@ jobs:
java-version: '17'
distribution: 'temurin'
- name: Compilation with Maven
- run: mvn compile
\ No newline at end of file
+ run: mvn compile
+ - name: JavaDoc
+ run: mvn javadoc:javadoc
\ No newline at end of file
diff --git a/.github/workflows/publish-package.yml b/.github/workflows/publish-package.yml
index 52bcc73..059ca71 100644
--- a/.github/workflows/publish-package.yml
+++ b/.github/workflows/publish-package.yml
@@ -12,7 +12,24 @@ jobs:
contents: read
packages: write
steps:
- - uses: actions/checkout@v3
+ ##########################################
+ # 1 - PUSH TO MAVEN CENTRAL
+ ##########################################
+ # STEP 1: Install GPG key
+ - name: Install GPG key
+ run: |
+ echo "Installing GNUPG..."
+ sudo apt-get install gnupg
+ echo "Importing GPG key..."
+ echo -n "${{ secrets.OSSRH_GPG_PRIVATE_KEY }}" | base64 -d | gpg --batch --import
+ echo "GPG key imported."
+ # STEP 2: Register key to Ubuntu Keyserver
+ - name: Register key to Ubuntu Keyserver
+ run: gpg --keyserver keyserver.ubuntu.com --send-keys ${{ secrets.OSSRH_GPG_KEY_ID }}
+ # STEP 3: Pull the code from the repository
+ - name: Pull the code from the repository
+ uses: actions/checkout@v3
+ # STEP 4: Set up Java for publishing to Maven Central Repository
- name: Set up Java for publishing to Maven Central Repository
uses: actions/setup-java@v3
with:
@@ -21,24 +38,24 @@ jobs:
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
- - name: Install GPG key
- run: cat ${{ secrets.OSSRH_GPG_SECRET_KEY }} | base64 -d | gpg --batch --import
+ # STEP 5: Publish to the Maven Central Repository
- name: Publish to the Maven Central Repository
- run: mvn --batch-mode \
- clean deploy \
- -Dmaven.test.skip=true \
- -Dgpg.passphrase=${{ secrets.OSSRH_GPG_PASSPHRASE }}
+ run: mvn --batch-mode deploy -Dmaven.test.skip=true -Dgpg.passphrase=${{ secrets.OSSRH_GPG_PASSPHRASE }}
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
- - name: Set up Java for publishing to GitHub Packages
+ ##########################################
+ # 2 - PUSH TO GITHUB PACKAGE
+ ##########################################
+ # STEP 1: Set up Java for publishing to Maven Central Repository
+ - name: Set up Java for publishing to GitHub Package
uses: actions/setup-java@v3
with:
java-version: '17'
- distribution: 'temurin'
+ distribution: 'adopt'
+ server-id: github
+ # STEP 2: Publish to GitHub Packages
- name: Publish to GitHub Packages
- run: mvn --batch-mode \
- clean deploy \
- -Dmaven.test.skip=true
+ run: mvn --batch-mode deploy -Dmaven.test.skip=true -P "github"
env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
\ No newline at end of file
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml
index 17f50d2..62df24b 100644
--- a/.github/workflows/publish-release.yml
+++ b/.github/workflows/publish-release.yml
@@ -15,11 +15,12 @@ jobs:
- name: Pull the code from the repository
uses: actions/checkout@v3
# Set up JDK 17 for the build (maven included).
- - name: Set up JDK 17
+ - name: Set up Java for publishing to GitHub Package
uses: actions/setup-java@v3
with:
java-version: '17'
- distribution: 'temurin'
+ distribution: 'adopt'
+ server-id: github
# Build the project with Maven.
- name: Compilation with Maven
run: mvn compile
diff --git a/.gitignore b/.gitignore
index 3bc1aed..3e4938c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -45,4 +45,7 @@ logs
/secret.txt
decode.sh
base64privKey.txt
+privKey.pem
+pubKey
+private.pgp
privKey.pem
\ No newline at end of file
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c4c4c51..3e5ea29 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,2 @@
-Features:
-- Add zone management to the API.
-- Add the request to get account balance to the account api.
\ No newline at end of file
+Fix:
+- Set CreateZoneRequest to return the instance of the request on the setters.
\ No newline at end of file
diff --git a/Makefile b/Makefile
index 8cc26ef..14ecc6c 100644
--- a/Makefile
+++ b/Makefile
@@ -5,7 +5,7 @@
## Generic Makefile for Botlify
##
-.PHONY: all test clean fclean re doc
+.PHONY: all test clean fclean install finstall re doc
#=================================
# Commands
@@ -21,8 +21,14 @@ test:
clean:
mvn clean
+fclean:
+ rm -rf target
+
+install:
+ mvn install
+
finstall:
mvn install -Dmaven.test.skip=true
doc:
- mvn javadoc:javadoc
\ No newline at end of file
+ mvn javadoc:javadoc
diff --git a/README.md b/README.md
index 12e4c05..4c206b9 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
# Bright-data API
-[](https://github.com/botlify-io/bright-data-api/releases/latest)
-[](https://github.com/botlify-io/guava/bright-data-api/actions)
+[](https://github.com/botlify-net/bright-data-api/releases/latest)
+[](https://github.com/botlify-net/bright-data-api/actions)
This project is a Java client for the BrightData API, which allows you to access the
BrightData API from your Java application without having to deal with the HTTP requests.
diff --git a/pom.xml b/pom.xml
index 60bd5d6..c40cacf 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,186 +1,220 @@
- 4.0.0
- net.botlify.brightdata
- bright-data-api
+ 4.0.0
+ net.botlify.brightdata
+ bright-data-api
+ 1.1
- BrightData API
- 1.0
- https://github.com/botlify-io/bright-data-api
- An interface to communicate simpler with brightdata.com
+ BrightData API
+ https://github.com/botlify-io/bright-data-api
+ An interface to communicate simpler with brightdata.com
-
- Botlify
- https://github.com/botlify-io
-
+
+ Botlify
+ https://github.com/botlify-io
+
-
-
- Apache License, Version 2.0
- https://www.apache.org/licenses/LICENSE-2.0.txt
- repo
-
-
+
+
+ Apache License, Version 2.0
+ https://www.apache.org/licenses/LICENSE-2.0.txt
+ repo
+
+
-
-
- Botlify
- https://github.com/botlify-net
- Europe/Paris
-
-
+
+
+ Botlify
+ https://github.com/botlify-net
+ Europe/Paris
+
+
-
-
- ossrh
- https://s01.oss.sonatype.org/content/repositories/snapshots
-
-
- ossrh
- https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/
-
-
+
+
+ ossrh
+
+ true
+
+
+
+ ossrh
+ Maven Central
+ https://s01.oss.sonatype.org/content/repositories/snapshots
+
+
+ ossrh
+ Maven Central
+ https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/
+
+
+
+
+
+
+ org.sonatype.plugins
+ nexus-staging-maven-plugin
+ 1.6.13
+ true
+
+ ossrh
+ https://s01.oss.sonatype.org/
+ true
+
+
+
+
+ org.apache.maven.plugins
+ maven-gpg-plugin
+ 3.0.1
+
+
+ sign-artifacts
+ verify
+
+
+ --pinentry-mode
+ loopback
+
+
+
+ sign
+
+
+
+
+
+
+
+
+ github
+
+
+ github
+ GitHub
+ https://maven.pkg.github.com/botlify-net/bright-data-api
+
+
+ github
+ GitHub
+ https://maven.pkg.github.com/botlify-net/bright-data-api
+
+
+
+
-
- scm:github:https://github.com/botlify-io/bright-data-api
- scm:github:https://github.com/botlify-io/bright-data-api
- https://github.com/botlify-io/bright-data-api
- master
-
+
+ scm:github:https://github.com/botlify-net/bright-data-api
+ scm:github:https://github.com/botlify-net/bright-data-api
+ https://github.com/botlify-net/bright-data-api
+ master
+
-
- UTF-8
- UTF-8
-
+
+ UTF-8
+ UTF-8
+
-
-
- org.projectlombok
- lombok
- 1.18.26
- compile
-
-
- com.squareup.okhttp3
- okhttp
- 5.0.0-alpha.11
-
-
- org.apache.logging.log4j
- log4j-core
- 2.20.0
-
-
- org.apache.logging.log4j
- log4j-api
- 2.20.0
-
-
- org.jetbrains
- annotations
- 24.0.1
-
-
- org.json
- json
- 20230227
-
-
- org.junit.jupiter
- junit-jupiter-engine
- 5.9.2
- test
-
-
- com.google.guava
- guava
- 31.1-jre
-
-
+
+
+ org.projectlombok
+ lombok
+ 1.18.26
+ compile
+
+
+ com.squareup.okhttp3
+ okhttp
+ 5.0.0-alpha.11
+
+
+ org.apache.logging.log4j
+ log4j-core
+ 2.20.0
+
+
+ org.apache.logging.log4j
+ log4j-api
+ 2.20.0
+
+
+ org.jetbrains
+ annotations
+ 24.0.1
+
+
+ org.json
+ json
+ 20230227
+
+
+ org.junit.jupiter
+ junit-jupiter-engine
+ 5.9.2
+ test
+
+
+ com.google.guava
+ guava
+ 31.1-jre
+
+
-
-
-
-
- org.apache.maven.plugins
- maven-source-plugin
- 3.2.1
-
-
- attach-sources
-
- jar
-
-
-
-
+
+
+
+
+ org.apache.maven.plugins
+ maven-source-plugin
+ 3.2.1
+
+
+ attach-sources
+
+ jar
+
+
+
+
-
-
- org.apache.maven.plugins
- maven-javadoc-plugin
- 3.5.0
-
- 1.8
-
-
-
- attach-javadocs
-
- jar
-
-
-
-
+
+
+ org.apache.maven.plugins
+ maven-javadoc-plugin
+ 3.5.0
+
+ 1.8
+ true
+ true
+
+
+
+
+ true
+ true
+
+ attach-javadocs
+
+ jar
+
+
+
+
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
- 3.11.0
-
- 1.8
- 1.8
-
-
-
-
-
- org.sonatype.plugins
- nexus-staging-maven-plugin
- 1.6.13
- true
-
- ossrh
- https://s01.oss.sonatype.org/
- true
-
-
-
-
- org.apache.maven.plugins
- maven-gpg-plugin
- 3.0.1
-
-
- sign-artifacts
- verify
-
-
- --pinentry-mode
- loopback
-
-
-
- sign
-
-
-
-
-
-
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.11.0
+
+ 1.8
+ 1.8
+
+
+
+
diff --git a/src/main/java/net/botlify/brightdata/ZoneAPI.java b/src/main/java/net/botlify/brightdata/ZoneAPI.java
index 778f572..d6b3925 100644
--- a/src/main/java/net/botlify/brightdata/ZoneAPI.java
+++ b/src/main/java/net/botlify/brightdata/ZoneAPI.java
@@ -10,7 +10,6 @@
import okhttp3.RequestBody;
import okhttp3.Response;
import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.Range;
import org.json.JSONArray;
import org.json.JSONObject;
@@ -56,7 +55,7 @@ public class ZoneAPI extends SubAPI {
.addHeader(authorizationHeader.name.utf8(), authorizationHeader.value.utf8())
.build();
- try (final Response response = client.newCall(request).execute()) {
+ try (Response response = client.newCall(request).execute()) {
final String body = response.body().string();
brightDataAPI.assertResponse(response.code(), body);
return (new ZoneInformation(new JSONObject(body)));
@@ -81,7 +80,7 @@ public boolean isZoneExist(@NotNull final String zoneName) throws IOException {
.addHeader(authorizationHeader.name.utf8(), authorizationHeader.value.utf8())
.build();
- try (final Response response = client.newCall(request).execute()) {
+ try (Response response = client.newCall(request).execute()) {
return (response.code() == 200);
}
}
diff --git a/src/main/java/net/botlify/brightdata/request/CreateZoneRequest.java b/src/main/java/net/botlify/brightdata/request/CreateZoneRequest.java
index 78f4161..a6283b8 100644
--- a/src/main/java/net/botlify/brightdata/request/CreateZoneRequest.java
+++ b/src/main/java/net/botlify/brightdata/request/CreateZoneRequest.java
@@ -31,97 +31,97 @@ public class CreateZoneRequest {
/**
* The type of ips to use.
*/
- @Nullable @Getter @Setter(AccessLevel.PUBLIC)
+ @Nullable @Getter
private IpType ipsType;
/**
* The bandwidth type.
*/
- @Nullable @Getter @Setter(AccessLevel.PUBLIC)
+ @Nullable @Getter
private BandwidthType bandwidthType;
/**
* The ip allocation preset type.
*/
- @Nullable @Getter @Setter(AccessLevel.PUBLIC)
+ @Nullable @Getter
private IpAllocPresetType ipAllocPresetType;
/**
* The number of ip to allocate.
*/
- @Nullable @Getter @Setter(AccessLevel.PUBLIC)
+ @Nullable @Getter
private Integer ipToAllocate;
/**
* The country code of the zone ips.
*/
- @Nullable @Getter @Setter(AccessLevel.PUBLIC)
+ @Nullable @Getter
private String country;
/**
* The country city of the zone ips.
*/
- @Nullable @Getter @Setter(AccessLevel.PUBLIC)
+ @Nullable @Getter
private String countryCity;
/**
* The boolean to use mobile ips.
*/
- @Nullable @Getter @Setter(AccessLevel.PUBLIC)
+ @Nullable @Getter
private Boolean mobile;
/**
* The serp boolean.
*/
- @Nullable @Getter @Setter(AccessLevel.PUBLIC)
+ @Nullable @Getter
private Boolean serp;
/**
* The city targeting permission boolean.
*/
- @Nullable @Getter @Setter(AccessLevel.PUBLIC)
+ @Nullable @Getter
private Boolean cityTargetingPermission;
/**
* The asn targeting permission boolean.
*/
- @Nullable @Getter @Setter(AccessLevel.PUBLIC)
+ @Nullable @Getter
private Boolean enablingAsnTargetingPermission;
/**
* The boolean to use vip ips.
*/
- @Nullable @Getter @Setter(AccessLevel.PUBLIC)
+ @Nullable @Getter
private Boolean vip;
/**
* The vip type.
*/
- @Nullable @Getter @Setter(AccessLevel.PUBLIC)
+ @Nullable @Getter
private VipsType vipsType;
/**
* The number of vip ips to use.
*/
- @Nullable @Getter @Setter(AccessLevel.PUBLIC)
+ @Nullable @Getter
private Integer vips;
/**
* The list of domains to whitelist.
*/
- @Nullable @Getter @Setter(AccessLevel.PUBLIC)
- private List domainWitelist;
+ @Nullable @Getter
+ private List domainWhitelist;
/**
* The vip country code.
*/
- @Nullable @Getter @Setter(AccessLevel.PUBLIC)
+ @Nullable @Getter
private String vipCountry;
/**
* The vip country city.
*/
- @Nullable @Getter @Setter(AccessLevel.PUBLIC)
+ @Nullable @Getter
private String vipCountryCity;
/**
@@ -174,8 +174,8 @@ public CreateZoneRequest(@NotNull final String name,
plan.put("vips_type", vipsType.toString());
if (vips != null)
plan.put("vips", vips);
- if (domainWitelist != null)
- plan.put("domain_whitelist", domainWitelist);
+ if (domainWhitelist != null)
+ plan.put("domain_whitelist", domainWhitelist);
if (vipCountry != null)
plan.put("vip_country", vipCountry);
if (vipCountryCity != null)
@@ -184,4 +184,164 @@ public CreateZoneRequest(@NotNull final String name,
return (result);
}
+ /**
+ * Set the country code of the zone ips.
+ * @param ipsType The country code of the zone ips.
+ * @return This request.
+ */
+ public @NotNull CreateZoneRequest setIpsType(@Nullable final IpType ipsType) {
+ this.ipsType = ipsType;
+ return (this);
+ }
+
+ /**
+ * Set the bandwidth type.
+ * @param bandwidthType The bandwidth type.
+ * @return This request.
+ */
+ public @NotNull CreateZoneRequest setBandwidthType(@Nullable final BandwidthType bandwidthType) {
+ this.bandwidthType = bandwidthType;
+ return (this);
+ }
+
+ /**
+ * Set the ip allocation preset type.
+ * @param ipAllocPresetType The ip allocation preset type.
+ * @return This request.
+ */
+ public @NotNull CreateZoneRequest setIpAllocPresetType(@Nullable final IpAllocPresetType ipAllocPresetType) {
+ this.ipAllocPresetType = ipAllocPresetType;
+ return (this);
+ }
+
+ /**
+ * Set the number of ip to allocate.
+ * @param ipToAllocate The number of ip to allocate.
+ * @return This request.
+ */
+ public @NotNull CreateZoneRequest setIpToAllocate(@Nullable final Integer ipToAllocate) {
+ this.ipToAllocate = ipToAllocate;
+ return (this);
+ }
+
+ /**
+ * Set the country code.
+ * @param country The country code.
+ * @return This request.
+ */
+ public @NotNull CreateZoneRequest setCountry(@Nullable final String country) {
+ this.country = country;
+ return (this);
+ }
+
+ /**
+ * Set the country city.
+ * @param countryCity The country city.
+ * @return This request.
+ */
+ public @NotNull CreateZoneRequest setCountryCity(@Nullable final String countryCity) {
+ this.countryCity = countryCity;
+ return (this);
+ }
+
+ /**
+ * Set the mobile boolean.
+ * @param mobile The mobile boolean.
+ * @return This request.
+ */
+ public @NotNull CreateZoneRequest setMobile(@Nullable final Boolean mobile) {
+ this.mobile = mobile;
+ return (this);
+ }
+
+ /**
+ * Set the serp boolean.
+ * @param serp The serp boolean.
+ * @return This request.
+ */
+ public @NotNull CreateZoneRequest setSerp(@Nullable final Boolean serp) {
+ this.serp = serp;
+ return (this);
+ }
+
+ /**
+ * Set the city targeting permission boolean.
+ * @param cityTargetingPermission The city targeting permission boolean.
+ * @return This request.
+ */
+ public @NotNull CreateZoneRequest setCityTargetingPermission(@Nullable final Boolean cityTargetingPermission) {
+ this.cityTargetingPermission = cityTargetingPermission;
+ return (this);
+ }
+
+ /**
+ * Set the asn targeting permission boolean.
+ * @param enablingAsnTargetingPermission The asn targeting permission boolean.
+ * @return This request.
+ */
+ public @NotNull CreateZoneRequest setEnablingAsnTargetingPermission(@Nullable final Boolean enablingAsnTargetingPermission) {
+ this.enablingAsnTargetingPermission = enablingAsnTargetingPermission;
+ return (this);
+ }
+
+ /**
+ * Set the domain whitelist.
+ * @param vip The boolean to use vip ips.
+ * @return This request.
+ */
+ public @NotNull CreateZoneRequest setVip(@Nullable final Boolean vip) {
+ this.vip = vip;
+ return (this);
+ }
+
+ /**
+ * Set the vip type.
+ * @param vipsType The vip type.
+ * @return This request.
+ */
+ public @NotNull CreateZoneRequest setVipsType(@Nullable final VipsType vipsType) {
+ this.vipsType = vipsType;
+ return (this);
+ }
+
+ /**
+ * Set the number of vip ips to use.
+ * @param vips The number of vip ips to use.
+ * @return This request.
+ */
+ public @NotNull CreateZoneRequest setVips(@Nullable final Integer vips) {
+ this.vips = vips;
+ return (this);
+ }
+
+ /**
+ * Set the domain whitelist.
+ * @param domainWhitelist The domain whitelist.
+ * @return This request.
+ */
+ public @NotNull CreateZoneRequest setDomainWhitelist(@Nullable final List domainWhitelist) {
+ this.domainWhitelist = domainWhitelist;
+ return (this);
+ }
+
+ /**
+ * Set the vip country.
+ * @param vipCountry The vip country.
+ * @return This request.
+ */
+ public @NotNull CreateZoneRequest setVipCountry(@Nullable final String vipCountry) {
+ this.vipCountry = vipCountry;
+ return (this);
+ }
+
+ /**
+ * Set the vip country city.
+ * @param vipCountryCity The vip country city.
+ * @return This request.
+ */
+ public @NotNull CreateZoneRequest setVipCountryCity(@Nullable final String vipCountryCity) {
+ this.vipCountryCity = vipCountryCity;
+ return (this);
+ }
+
}