This is an API wrapper for https://whats-th.is/ written in Java. This wrapper requires Java 7 or above to function, it has also been confirmed working with Android (Minimum version is Marshmallow, because of Java 7).
Replace
VERSIONwith a specific version. The latest version can be found at the top of the readme Maven:
<dependencies>
<dependency>
<groupId>me.bramhaag</groupId>
<artifactId>owo-java</artifactId>
<version>VERSION</version>
</dependency>
</dependencies>Gradle:
repositories {
jcenter()
}
dependencies {
compile 'me.bramhaag:owo-java:VERSION'
}Or you can build the jar yourself (see below)
To get started, create an OwO object using the Builder class.
REQUIREDTOKENshould be replaced with your own unique OwO API key
(OPTIONAL)You can setendpointto use a custom endpoint, default endpoint ishttps://api.awau.moe/
(OPTIONAL)You can setuploadUrlto use a custom upload url, default upload URL ishttps://owo.whats-th.is/
(OPTIONAL)You can setshortenUrlto use a custom shorten url, default upload URL ishttps://awau.moe/
OwO owo = new OwO.Builder()
.setKey("TOKEN")
.setUploadUrl("https://owo.whats-th.is/")
.setShortenUrl("https://thats-a.link/")
.build();Next, we can use our newly created owo object to upload files and shorten urls
OwO#uploadandOwO#shortenboth returnOwoActions, these can be executed async using theexecutemethod, but can also be executed sync using theexecuteSyncmethod
owo.shorten("http://my_domain.com").execute(url -> System.out.println("Shortened link: " + url));
owo.upload(new File("my_image.png")).execute(file -> System.out.println("Image URL: " + file.getUrl()));This code can throw an exception when something goes wrong, to handle this
exception we can add an extra throwable argument to the execute method
owo.shorten("http://my_domain.com").execute(url -> System.out.println("Shortened link: " + url), throwable -> /* handle error */);
owo.upload(new File("my_image.png")).execute(file -> System.out.println("Image URL: " + file.getUrl()), throwable -> /* handle error */);- Run
gradlew shadowJarin project's root. - The file is located in
build/lib.
- Run
gradlew buildin project's root. - The file is located in
build/lib.
Pull requests are accepted, but please make sure your code actually works.
The contents of this repository are licensed under the MIT license. A copy of the MIT license can be found in LICENSE.