Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/khurozov/jokeapi-java

Java wrapper for JokeApi of Sv443
https://github.com/khurozov/jokeapi-java

Last synced: 13 days ago
JSON representation

Java wrapper for JokeApi of Sv443

Awesome Lists containing this project

README

        

JokeAPI Java
=====

Java wrapper for [JokeApi](https://v2.jokeapi.dev/) of [Sv443](https://sv443.net/)

## Installation

Add Maven dependency
```xml

uz.khurozov
jokeapi-java
1.0

```

## Usage example

``` java
JokeApi jokeApi = new JokeApi();

// Forming filter:

JokeFilter filter = new JokeFilter.Builder()
.category(Category.Programming)
.blacklistFlags(Set.of(Flag.nsfw, Flag.racist))
.lang(Lang.en)
.idRange(0, 305)
.contains("Java")
.type(Type.twopart)
.build();

// Requesting joke(s):

Joke joke = jokeApi.getJoke(filter);
// or
List jokes = jokeApi.getJokes(filter, 2);

// Printing joke:

System.out.println(joke.jokeString());
```