Adds a java wrapper around the GoT API
Get the instance of the gameOfThronesClient
public static void main(String[] args){
GameOfThronesClient gotClient = getClient();
}
You can get a version of the client with automatic caching instead if you want.
This will cache all the calls to whatever directory you supply as the cacheFile.
public static void main(String[] args){
File cacheFile = new File("cacheFile");
int cacheSize = 10 * 1024 * 1024; // 10 MB
GameOfThronesClient gotClient = getClientWithCache(cacheFile, cacheSize);
}
Those two clients are interchangable. All the method calls to them work exactly the same
Every endpoint of the GoT API is available through these methods.
Take a look at the gameOfThronesClient javadocs for the methods available to you.
Whenever you use one of those methods, your either going get a list Models or just a Model itself.
These models have various getters on them for easily retreiving information.
Take a look at these model javadocs
public static void main(String[] args) throws IOException {
GameOfThronesClient gotClient = getClient();
List<Book> allBooks = gotClient.getAllBooks(); //Returns a list of Book objects
// loop through each book
// you have access to multiple getters to get information
for(Book book: allBooks){
System.out.println(book.getName());
System.out.println(book.getCharacters());
// and so on...
}
}
public static void main(String[] args) throws IOException {
GameOfThronesClient gotClient = getClient();
Character character = gotClient.getCharacter(100); //Returns a single character
// use various getters to get information about this character
System.out.println(character.getBorn());
System.out.println(character.getAllegiances());
}
Pass in null to search values you do not care for. Applies to all House, and Character searches as well.
In this case I only cared that the book Im searching for was made after 1990-01-01 and before 2002-01-01.
I did not care for the name.
public static void main(String[] args) throws IOException {
GameOfThronesClient gotClient = getClient();
List<Book> bookList = gotClient.searchBooks(null, "1990-01-01", "2002-01-01");
for(Book book: bookList){
System.out.println(book.getName());
System.out.println(book.getReleased());
}
}
Javadocs link can be found here