Example Application

Java API client for The Internet Chuck Norris Database (http://www.icndb.com/)

License

License

Categories

Categories

Java Languages Net
GroupId

GroupId

net.joningi
ArtifactId

ArtifactId

icndb-java-api
Last Version

Last Version

1.0
Release Date

Release Date

Type

Type

jar
Description

Description

Example Application
Java API client for The Internet Chuck Norris Database (http://www.icndb.com/)
Project URL

Project URL

https://github.com/joningis/icndb-java-api
Source Code Management

Source Code Management

https://github.com/joningis/icndb-java-api

Download icndb-java-api

How to add to project

<!-- https://jarcasting.com/artifacts/net.joningi/icndb-java-api/ -->
<dependency>
    <groupId>net.joningi</groupId>
    <artifactId>icndb-java-api</artifactId>
    <version>1.0</version>
</dependency>
// https://jarcasting.com/artifacts/net.joningi/icndb-java-api/
implementation 'net.joningi:icndb-java-api:1.0'
// https://jarcasting.com/artifacts/net.joningi/icndb-java-api/
implementation ("net.joningi:icndb-java-api:1.0")
'net.joningi:icndb-java-api:jar:1.0'
<dependency org="net.joningi" name="icndb-java-api" rev="1.0">
  <artifact name="icndb-java-api" type="jar" />
</dependency>
@Grapes(
@Grab(group='net.joningi', module='icndb-java-api', version='1.0')
)
libraryDependencies += "net.joningi" % "icndb-java-api" % "1.0"
[net.joningi/icndb-java-api "1.0"]

Dependencies

compile (3)

Group / Artifact Type Version
com.google.guava : guava jar 16.+
com.google.code.gson : gson jar 2.+
org.glassfish.jersey.core : jersey-client jar 2.+

test (1)

Group / Artifact Type Version
junit : junit jar 4.11

Project Modules

There are no modules declared in this project.

icndb-java-api

Overview

Java API client for The Internet Chuck Norris Database (http://www.icndb.com/)

Usage

Init

Everyting depend on ICNDBClient client object

import net.joningi.icndb.ICNDBClient;

....

final ICNDBClient client = new ICNDBClient();

Get single joke by ID

import net.joningi.icndb.Joke;

...

Joke joke = client.getById(15);
System.out.println(joke.getId() + ": " + joke.getJoke());

Get single random joke

Joke randomJoke = client.getRandom();

Get n random joke

for (Joke j : client.getRandom(10)) {
	System.out.println(j.getId() + ": " + j.getJoke());
}

Changing the name of the main character

client.setFirstName("Bill");
client.setLastName("Clinton");

Joke randomJoke = client.getRandom();

client.clearName();

Fetching the number of jokes

System.out.println(client.getCount());

Fetching the list of joke categories

for (String category : client.getCategories()) {
	System.out.println(category);
}

Limiting categories

client.setExclude(Lists.newArrayList("explicit", "nerdy"));
Joke randomJoke = client.getRandom();
client.clearLimitAndExclude();

client.setLimitTo(Lists.newArrayList("explicit", "nerdy"));
Joke randomJoke = client.getRandom();
client.clearLimitAndExclude();

Versions

Version
1.0