io.github.jimmydbe.PublishersClient Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of theGamesDbClient Show documentation
Show all versions of theGamesDbClient Show documentation
Java wrapper for the Games DB API.
package io.github.jimmydbe;
import io.github.jimmydbe.entities.BasePublisherResponse;
import io.github.jimmydbe.entities.BaseResponse;
import io.github.jimmydbe.entities.Publisher;
import io.github.jimmydbe.exceptions.GamesDbException;
import io.github.jimmydbe.exceptions.ParsingException;
import kong.unirest.GenericType;
import kong.unirest.HttpResponse;
import kong.unirest.Unirest;
import java.util.List;
import java.util.stream.Collectors;
class PublishersClient extends Client {
protected PublishersClient(String apiKey) {
super(apiKey);
}
protected List getAllPublishers() throws ParsingException, GamesDbException {
final HttpResponse> response = Unirest.get(TheGamesDbClient.BASE_URL + "/v1/Publishers")
.queryString("apikey", getApiKey())
.asObject(new GenericType>() {
});
checkForErrors(response);
return response.getBody()
.getData()
.getPublishers()
.values()
.stream()
.collect(Collectors.toList());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy