|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jakewharton.apibuilder.ApiService
com.jakewharton.trakt.TraktApiService
public abstract class TraktApiService
Trakt-specific API service extension which facilitates provides helper methods for performing remote method calls as well as deserializing the corresponding JSON responses.
Field Summary |
---|
Fields inherited from class com.jakewharton.apibuilder.ApiService |
---|
CONTENT_ENCODING |
Constructor Summary | |
---|---|
TraktApiService()
Create a new Trakt service with our proper default values. |
Method Summary | ||
---|---|---|
com.google.gson.JsonElement |
get(String url)
Execute request using HTTP GET. |
|
com.google.gson.JsonElement |
post(String url,
String postBody)
Execute request using HTTP POST. |
|
void |
setApiKey(String value)
Set API key to use for client authentication by Trakt. |
|
void |
setAuthentication(String username,
String password_sha)
Set email and password to use for HTTP basic authentication. |
|
void |
setMediaCenterDate(String mediaCenterDate)
Set the media center build date debug string. |
|
void |
setMediaCenterVersion(String mediaCenterVersion)
Set the media center version debug string. |
|
void |
setPluginVersion(String pluginVersion)
Set the plugin version debug string. |
|
void |
setUseSsl(boolean useSsl)
Set whether or not to use the SSL API endpoint. |
|
protected com.google.gson.JsonElement |
unmarshall(InputStream jsonContent)
Read the entirety of an input stream and parse to a JSON object. |
|
protected
|
unmarshall(com.google.gson.reflect.TypeToken<T> typeToken,
com.google.gson.JsonElement response)
Use GSON to deserialize a JSON object to a native class representation. |
|
protected
|
unmarshall(com.google.gson.reflect.TypeToken<T> typeToken,
String reponse)
Use GSON to deserialize a JSON string to a native class representation. |
Methods inherited from class com.jakewharton.apibuilder.ApiService |
---|
acceptGzip, addRequestHeader, closeConnection, closeStream, convertStreamToString, executeDelete, executeDelete, executeGet, executeGet, executeMethod, executePost, executePost, getConnectTimeout, getParametersString, getReadTimeout, getRequestHeader, getRequestHeaderNames, getWrappedInputStream, removeRequestHeader, setConnectTimeout, setReadTimeout |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TraktApiService()
Method Detail |
---|
public com.google.gson.JsonElement get(String url)
url
- URL to request.
public com.google.gson.JsonElement post(String url, String postBody)
url
- URL to request.postBody
- String to use as the POST body.
public void setAuthentication(String username, String password_sha)
username
- Username.password_sha
- Password SHA1.public void setApiKey(String value)
value
- Value.public void setPluginVersion(String pluginVersion)
pluginVersion
- Value.public void setMediaCenterVersion(String mediaCenterVersion)
mediaCenterVersion
- Value.public void setMediaCenterDate(String mediaCenterDate)
mediaCenterDate
- Value.public void setUseSsl(boolean useSsl)
useSsl
- Value.protected <T> T unmarshall(com.google.gson.reflect.TypeToken<T> typeToken, com.google.gson.JsonElement response)
T
- Native class type.typeToken
- Native class type wrapper.response
- Serialized JSON object.
protected <T> T unmarshall(com.google.gson.reflect.TypeToken<T> typeToken, String reponse)
T
- Native class type.typeToken
- Native class type wrapper.reponse
- Serialized JSON string.
protected com.google.gson.JsonElement unmarshall(InputStream jsonContent)
jsonContent
- JSON content input stream.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |