An API wrapper for wg-easy written in Java by @megoRU
https://jitpack.io/#megoRU/wg-easy-wrapper
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependency>
<groupId>com.github.megoRU</groupId>
<artifactId>wg-easy-wrapper</artifactId>
<version>v3.2</version>
</dependency>
public class Main {
public static void main(String[] args) {
WgEasyAPI api = new WgEasyAPI.Builder()
.password("password")
.host("http://222.222.222.222:55222")
.build();
try {
Clients[] client = api.getClients();
for (Clients client : client) {
System.out.println(client.getId()); //139987fc-266a-45bb-b3c4-3e1d8d2e180c
// ...
}
} catch (UnsuccessfulHttpException e) {
System.out.println(e.getMessage());
}
}
}
public class Main {
public static void main(String[] args) {
WgEasyAPI api = new WgEasyAPI.Builder()
.password("password")
.host("http://222.222.222.222:55222")
.build();
try {
Status status = api.disableClient("139987fc-266a-45bb-b3c4-3e1d8d2e180c");
} catch (UnsuccessfulHttpException e) {
System.out.println(e.getMessage());
}
}
}
public class Main {
public static void main(String[] args) {
WgEasyAPI api = new WgEasyAPI.Builder()
.password("password")
.host("http://222.222.222.222:55222")
.build();
try {
Create create = api.createClient("mego");
System.out.println(create.getCreatedAt()); //2023-01-12T18:20:12
} catch (UnsuccessfulHttpException e) {
System.out.println(e.getMessage());
}
}
}