Skip to content
This repository has been archived by the owner on Sep 27, 2021. It is now read-only.

Latest commit

 

History

History
93 lines (77 loc) · 2.19 KB

README.md

File metadata and controls

93 lines (77 loc) · 2.19 KB

Memes4J

This package is behind used in production by HUGE


You can also get this package for other programming languages:

Packages
Java
Node.js
Deno

Getting started

This package requires Java 9 or higher version.

The static method Memes4J.getRandomMeme() returns a PendingRequest class which can be asynchronously terminated with queue(), submit() or sync with complete()

Get a random meme

getRandomMeme() or getRandomMeme(string).

Create the PendingRequest object

PendingRequest request = Memes4J.getRandomMeme()

Async Consumer/BiConsumer with queue()

request.queue((meme) -> {
    System.out.println(meme.toString());
}, (error) -> {
    error.printStackTrace();
})

Async CompletableFuture with sumbit()

CompletableFuture<Meme> future = request.submit();

future.whenCompleteAsync((meme) -> {
    System.out.println(meme.toString());
}, (throwable) -> {
    throwable.printStackTrace();
})

Sync complete()

try {
    Meme meme = request.complete();
    System.out.println(meme.toString());
} catch(Exception ex) {
    ex.printStackTrace();
}

How to download

With Gradle

allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}
dependencies {
        implementation 'com.github.Blad3Mak3r:Memes4J:0.1.1'
}

With Maven

<repositories>
    <repository>
        <id>jitpack.io</id>
        <url>https://jitpack.io</url>
    </repository>
</repositories>
<dependency>
    <groupId>com.github.Blad3Mak3r</groupId>
    <artifactId>Memes4J</artifactId>
    <version>0.1.1</version>
</dependency>