Java API for Nekos.Life API v2
Maven:
<dependency>
<groupId>pw.aru.api</groupId>
<artifactId>nekos4j</artifactId>
<version>VERSION</version>
<type>pom</type>
</dependency>
Gradle:
compile 'pw.aru.api:nekos4j:VERSION'
You can find the latest version here
To get started, you need an instance of Nekos4J
Nekos4J api = new Nekos4J.Builder().build();
ImageProvider imageProvider = api.getImageProvider();
//blocking call
Image image = imageProvider.getRandomImage("pat").execute();
try {
//futures are supported too
byte[] bytes = image.download().submit().get();
System.out.println("Downloaded image " + image.getId() + ", with " + bytes.length + " bytes");
} catch(InterruptedException|ExecutionException e) {
e.printStackTrace();
}
TextProvider textProvider = api.getTextProvider();
textProvider.owoifyText("hello, how are you?").async(text->{
System.out.println("OwOified Text: " + text);
});
textProvider.getRandom8Ball().async(data->{
System.out.println("8ball: " + data.getResponse());
});
Additional info can be found on the javadocs for the Nekos4J class and on the official Discord server.