public final class HttpClient extends java.lang.Object implements Client
Client that wraps a HttpClient to interact with the RuneScape web-services API.| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
WEB_SERVICES_URL
The URL to the RuneScape public web-services.
|
CSV_FORMAT| Constructor and Description |
|---|
HttpClient() |
| Modifier and Type | Method and Description |
|---|---|
ImmutableList<CSVRecord> |
fromCSV(java.lang.String url)
Deserializes a CSV file from a specified URL into an
ImmutableList of CSVRecords. |
<T> java.util.Optional<T> |
fromJson(java.lang.String url,
java.lang.Class<T> classOfT)
Deserializes a JSON file from a specified URL into an object of the specified type.
|
<T> java.util.Optional<T> |
fromJson(java.lang.String url,
java.lang.reflect.Type typeOfT)
Deserializes a JSON file from a specified URL into an object of the specified type.
|
public static final java.lang.String WEB_SERVICES_URL
public <T> java.util.Optional<T> fromJson(java.lang.String url,
java.lang.reflect.Type typeOfT)
throws java.io.IOException
fromJson in interface ClientT - The type of the desired objecturl - The URL to deserialize from.typeOfT - The specific genericized type of src.Optional containing object of type T from the json, or Optional.empty() if the URL could not be deserialized.java.io.IOException - If an I/O error occurs.public <T> java.util.Optional<T> fromJson(java.lang.String url,
java.lang.Class<T> classOfT)
throws java.io.IOException
fromJson in interface ClientT - The type of the desired objecturl - The URL to deserialize from.classOfT - The class of T.Optional.empty() if the URL could not be deserialized.java.io.IOException - If an I/O error occurs.public ImmutableList<CSVRecord> fromCSV(java.lang.String url) throws java.io.IOException
ImmutableList of CSVRecords.fromCSV in interface Clienturl - The URL to deserialize from.ImmutableList of CSVRecords.java.io.IOException - If an I/O error occurs.