public class Soda2Consumer extends Soda2Base
Modifier and Type | Field and Description |
---|---|
static com.sun.jersey.api.client.GenericType<List<Object>> |
HASH_RETURN_TYPE |
SODA_BASE_PATH, SODA_QUERY
Constructor and Description |
---|
Soda2Consumer(HttpLowLevel httpLowLevel)
Constructor
|
Modifier and Type | Method and Description |
---|---|
<T> T |
getById(String resourceId,
String id,
Class<T> cls)
Retrieves an object on a resource based on it's ID.
|
static Soda2Consumer |
newConsumer(String url)
Creates a new Soda2Consumer that had no authentication associated with it.
|
static Soda2Consumer |
newConsumer(String url,
String userName,
String password,
String token)
Creates a new Soda2Consumer with the passed in credentials associated with it.
|
<T> List<T> |
query(String resourceId,
SoqlQuery query,
com.sun.jersey.api.client.GenericType<List<T>> genericType) |
<T> List<T> |
query(String resourceId,
String query,
com.sun.jersey.api.client.GenericType<List<T>> genericType) |
doAdd, doAddObjects, doAddStream, doDelete, doReplaceObjects, doReplaceStream, doTruncate, doUpdate, getById, getHttpLowLevel, query, query
public Soda2Consumer(HttpLowLevel httpLowLevel)
httpLowLevel
- the lower level connection object for using for requests.public static final Soda2Consumer newConsumer(String url)
url
- the URL to the base SODA2 domain.public static final Soda2Consumer newConsumer(String url, String userName, String password, String token)
url
- the base URL for the SODA2 domain to access.userName
- user name to log in aspassword
- password to log in withtoken
- the App Token to use for authorization and usage tracking. If this is null
, no value will be sent.public <T> T getById(String resourceId, String id, Class<T> cls) throws SodaError, InterruptedException
resourceId
- The id of the resource to query. This can either be the resource endpoint name
set in the metadata, or the unique ID given to the resource.id
- Id based on a dataset specific unique column, or the system ID created for each row.cls
- The class object the resulting object should be deserialized as.SodaError
- thrown if there is an error. Investigate the structure for more information.InterruptedException
- throws is the thread is interrupted.public <T> List<T> query(String resourceId, SoqlQuery query, com.sun.jersey.api.client.GenericType<List<T>> genericType) throws SodaError, InterruptedException
T
- the type of object that should be returned in the resulting listresourceId
- The id of the resource to query. This can either be the resource endpoint name
set in the metadata, or the unique ID given to the resource.query
- The query to be executed against the resource.genericType
- the type of objects that should be returned as a result from this querySodaError
- thrown if there is an error. Investigate the structure for more information.InterruptedException
- throws is the thread is interrupted.public <T> List<T> query(String resourceId, String query, com.sun.jersey.api.client.GenericType<List<T>> genericType) throws SodaError, InterruptedException
T
- the type of object that should be returned in the resulting listresourceId
- The id of the resource to query. This can either be the resource endpoint name
set in the metadata, or the unique ID given to the resource.query
- The query string to be executed against the resource.genericType
- the type of objects that should be returned as a result from this querySodaError
- thrown if there is an error. Investigate the structure for more information.InterruptedException
- throws is the thread is interrupted.Copyright © 2013. All Rights Reserved.