Skip to content

tronalddump-io/client-java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Official tronalddump.io api client for Java

Maven Central Javadocs Apache 2.0 License

Tronalddump.io is a free api and web archive for the dumbest things Donald Trump has ever said ...

Installation

Add the dependency to your project:

Maven:

<dependency>
  <groupId>io.tronalddump</groupId>
  <artifactId>client-java</artifactId>
  <version>1.0.0</version>
</dependency>

Gradle:

dependencies {
    compile "io.tronalddump:client-java:1.0.0"
}

Usage

// Create the Tronald client
TronaldClient client = new TronaldClient();

// Retrieve a Tronald quote by its id
Quote quote = client.getQuote("wAgIgzV1S9OARKhfun3f0A");
System.out.println(quote.getValue());

// Retrieve a random Tronald quote
Quote quote = client.getRandomQuote();
System.out.println(quote.getValue());

// Retrieve a random Tronald quote tagged with "Hillary Clinton"
Quote quote = client.getRandomQuote("Hillary Clinton");
System.out.println(quote.getValue());

// Perform a free text search
Page<Quote> page = client.search("clinton");
for (Quote quote : page) {
    System.out.println(quote.getValue());
}

// Retrieve the next page in the search result 
if (page.hasNext() {
    Page<quote> nextPage = client.search("clinton", page.nextPageable());
    ..
}

// Perform a free text search with a different page size
Page<Quote> page = client.search("clinton", 10);
for (Quote quote : page) {
    System.out.println(quote.getValue());
}

// Or even customize the pagination completely with the PageableBuilder
import static io.tronalddump.client.Pageable.PageableBuilder.aPageable;

Page<Quote> page = client.search("clinton", aPageable().withPage(1).withSize(5).build());
for (Quote quote : page) {
    System.out.println(quote.getValue());
}

License

This software is released under version 2.0 of the Apache License.

About

tronalddump.io API client library for java.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages