Skip to content

Commit 0ec4248

Browse files
fix: deploy package and add more javadoc
1 parent 497ba5a commit 0ec4248

File tree

21 files changed

+465
-49
lines changed

21 files changed

+465
-49
lines changed

.github/workflows/publish-package.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,13 @@ jobs:
2121
server-id: ossrh
2222
server-username: MAVEN_USERNAME
2323
server-password: MAVEN_PASSWORD
24+
- name: Install GPG key
25+
run: cat ${{ secrets.OSSRH_GPG_SECRET_KEY }} | base64 -d | gpg --batch --import
2426
- name: Publish to the Maven Central Repository
25-
run: mvn --batch-mode deploy -Dmaven.test.skip=true
27+
run: mvn --batch-mode \
28+
clean deploy \
29+
-Dmaven.test.skip=true \
30+
-Dgpg.passphrase=${{ secrets.OSSRH_GPG_PASSPHRASE }}
2631
env:
2732
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
2833
MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
@@ -32,6 +37,8 @@ jobs:
3237
java-version: '17'
3338
distribution: 'temurin'
3439
- name: Publish to GitHub Packages
35-
run: mvn --batch-mode deploy -Dmaven.test.skip=true
40+
run: mvn --batch-mode \
41+
clean deploy \
42+
-Dmaven.test.skip=true
3643
env:
3744
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,7 @@ logs
4242
.idea
4343
/src/main/java/net/botlify/brightdata/TestClass.java
4444
/src/main/java/net/botlify/brightdata/TestClass.java
45+
/secret.txt
46+
decode.sh
47+
base64privKey.txt
48+
privKey.pem

Makefile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
## Generic Makefile for Botlify
66
##
77

8-
.PHONY: all test clean fclean re
8+
.PHONY: all test clean fclean re doc
99

1010
#=================================
1111
# Commands
@@ -22,4 +22,7 @@ clean:
2222
mvn clean
2323

2424
finstall:
25-
mvn install -Dmaven.test.skip=true
25+
mvn install -Dmaven.test.skip=true
26+
27+
doc:
28+
mvn javadoc:javadoc

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@ If you want to run the tests, you need to set the API key in the environment var
2929
mvn clean install
3030
```
3131

32+
### How to get the java documentation ?
33+
34+
To generete the site for the java documentation please use the following command:
35+
```bash
36+
mvn javadoc:javadoc
37+
```
38+
3239
### How to use ?
3340

3441
Add the dependency in your pom.xml:

pom.xml

Lines changed: 66 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,14 @@
2525
</license>
2626
</licenses>
2727

28+
<developers>
29+
<developer>
30+
<organization>Botlify</organization>
31+
<url>https://github.com/botlify-net</url>
32+
<timezone>Europe/Paris</timezone>
33+
</developer>
34+
</developers>
35+
2836
<distributionManagement>
2937
<snapshotRepository>
3038
<id>ossrh</id>
@@ -95,6 +103,40 @@
95103

96104
<build>
97105
<plugins>
106+
<plugin>
107+
<!-- Build the JavaDoc -->
108+
<groupId>org.apache.maven.plugins</groupId>
109+
<artifactId>maven-source-plugin</artifactId>
110+
<version>3.2.1</version>
111+
<executions>
112+
<execution>
113+
<id>attach-sources</id>
114+
<goals>
115+
<goal>jar</goal>
116+
</goals>
117+
</execution>
118+
</executions>
119+
</plugin>
120+
121+
<!-- Build the JavaDoc -->
122+
<plugin>
123+
<groupId>org.apache.maven.plugins</groupId>
124+
<artifactId>maven-javadoc-plugin</artifactId>
125+
<version>3.5.0</version>
126+
<configuration>
127+
<source>1.8</source>
128+
</configuration>
129+
<executions>
130+
<execution>
131+
<id>attach-javadocs</id>
132+
<goals>
133+
<goal>jar</goal>
134+
</goals>
135+
</execution>
136+
</executions>
137+
</plugin>
138+
139+
<!-- Maven compiler plugin -->
98140
<plugin>
99141
<groupId>org.apache.maven.plugins</groupId>
100142
<artifactId>maven-compiler-plugin</artifactId>
@@ -104,17 +146,40 @@
104146
<target>1.8</target>
105147
</configuration>
106148
</plugin>
149+
150+
<!-- Sonatype OSSRH -->
107151
<plugin>
108152
<groupId>org.sonatype.plugins</groupId>
109153
<artifactId>nexus-staging-maven-plugin</artifactId>
110-
<version>1.6.7</version>
154+
<version>1.6.13</version>
111155
<extensions>true</extensions>
112156
<configuration>
113157
<serverId>ossrh</serverId>
114158
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
115159
<autoReleaseAfterClose>true</autoReleaseAfterClose>
116160
</configuration>
117161
</plugin>
162+
<!-- Maven GPG plugin -->
163+
<plugin>
164+
<groupId>org.apache.maven.plugins</groupId>
165+
<artifactId>maven-gpg-plugin</artifactId>
166+
<version>3.0.1</version>
167+
<executions>
168+
<execution>
169+
<id>sign-artifacts</id>
170+
<phase>verify</phase>
171+
<configuration>
172+
<gpgArguments>
173+
<arg>--pinentry-mode</arg>
174+
<arg>loopback</arg>
175+
</gpgArguments>
176+
</configuration>
177+
<goals>
178+
<goal>sign</goal>
179+
</goals>
180+
</execution>
181+
</executions>
182+
</plugin>
118183
</plugins>
119184
</build>
120185

src/main/java/net/botlify/brightdata/AccountAPI.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ public class AccountAPI extends SubAPI {
2929
* Link to the documentation
3030
* </a>.
3131
* @return The {@link BalanceResponse} object response.
32+
* @throws IOException If an error occurred during the request.
3233
*/
3334
public @NotNull BalanceResponse getBalance() throws IOException {
3435
final String url = BrightDataAPI.getBrightDataHost() + "/api/customer/balance";

src/main/java/net/botlify/brightdata/BrightDataAPI.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ public class BrightDataAPI {
6262
@NotNull
6363
private final RateLimiter rateLimiter = RateLimiter.create(1.5);
6464

65+
/**
66+
* Construct a new API with the given API key.
67+
* @param apiKey The BrightData API key.
68+
*/
6569
public BrightDataAPI(@NotNull final String apiKey) {
6670
if (apiKey.isEmpty())
6771
throw (new IllegalArgumentException("The API key cannot be empty."));

src/main/java/net/botlify/brightdata/ZoneAPI.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,16 @@ public boolean whitelistAnyIP(@NotNull final String zone) throws IOException {
428428
}
429429
}
430430

431+
/**
432+
* This method will request to remove the specified IP to the specified zone.<br />
433+
* <a href="https://help.brightdata.com/hc/en-us/articles/4419834577041-Remove-Static-Datacenter-ISP-IPs">
434+
* Link to the documentation
435+
* </a>
436+
* @param zoneName The name of the zone to remove IP.
437+
* @param ips The list of IP to remove.
438+
* @return A new list of IP removed from the specified zone.
439+
* @throws IOException A network error occurred.
440+
*/
431441
public @NotNull List<String> removeIpInZone(@NotNull final String zoneName,
432442
@NotNull final String... ips)
433443
throws IOException {

src/main/java/net/botlify/brightdata/enums/BandwidthType.java

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,19 @@
44
import org.jetbrains.annotations.NotNull;
55
import org.jetbrains.annotations.Nullable;
66

7+
/**
8+
* The type of bandwidth used in a zone.
9+
*/
710
public enum BandwidthType {
811

12+
/**
13+
* The bandwidth type pay per usage mode.
14+
*/
915
PAYPERUSAGE("payperusage"),
16+
17+
/**
18+
* The bandwidth type is unlimited. Limited to 100gb.
19+
*/
1020
UNLIMITED("unlimited");
1121

1222
@NotNull @Getter
@@ -16,6 +26,11 @@ public enum BandwidthType {
1626
this.type = type;
1727
}
1828

29+
/**
30+
* Get the bandwidth type from a string.
31+
* @param type The string to parse.
32+
* @return The bandwidth type, or null if not found.
33+
*/
1934
public static @Nullable BandwidthType fromString(@NotNull final String type) {
2035
for (BandwidthType t : BandwidthType.values()) {
2136
if (t.type.equalsIgnoreCase(type))
@@ -24,7 +39,10 @@ public enum BandwidthType {
2439
return (null);
2540
}
2641

27-
42+
/**
43+
* Get the string representation of the bandwidth type.
44+
* @return The string representation of the bandwidth type.
45+
*/
2846
@Override
2947
public @NotNull String toString() {
3048
return (type);

src/main/java/net/botlify/brightdata/enums/IpAllocPresetType.java

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,38 @@
44
import org.jetbrains.annotations.NotNull;
55
import org.jetbrains.annotations.Nullable;
66

7+
/**
8+
* The type of ip allocation preset.
9+
*/
710
public enum IpAllocPresetType {
811

12+
/**
13+
* The ip allocation preset type is shared.
14+
*/
915
SHARED_BLOCK("shared_block"),
16+
17+
/**
18+
* The ip allocation preset type is shared residential.
19+
*/
1020
SHARED_RES_BLOCK("shared_res_block");
1121

1222
@NotNull
1323
@Getter
1424
private final String type;
1525

26+
/**
27+
* Construct an ip allocation preset type.
28+
* @param type The string representation of the ip allocation preset type.
29+
*/
1630
IpAllocPresetType(@NotNull final String type) {
1731
this.type = type;
1832
}
1933

34+
/**
35+
* Get the ip allocation preset type from a string.
36+
* @param type The string to parse.
37+
* @return The ip allocation preset type, or null if not found.
38+
*/
2039
public static @Nullable IpAllocPresetType fromString(@NotNull final String type) {
2140
for (IpAllocPresetType t : IpAllocPresetType.values()) {
2241
if (t.type.equalsIgnoreCase(type))
@@ -26,6 +45,10 @@ public enum IpAllocPresetType {
2645
}
2746

2847

48+
/**
49+
* Get the string representation of the ip allocation preset type.
50+
* @return The string representation of the ip allocation preset type.
51+
*/
2952
@Override
3053
public @NotNull String toString() {
3154
return (type);

0 commit comments

Comments
 (0)