|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.apache.commons.httpclient.HttpClient
com.betfair.games.ApiAdapter
public class ApiAdapter
The Java ApiAdapter is a subclass of HttpClient. It is designed to connect to the Betfair Exchange Games API. It provides a simple GET and POST methods to wrap the communication. The ApiAdapter also handles the XML used. the GET and POST method only returns Objects thats are instances of class from the betfair.games.api.v1 package (a JAXB compiled set of classes build from the gamex API schema XSD.
| Constructor Summary | |
|---|---|
ApiAdapter(ApiApplication app)
Constructs a new ApiAdapter to be used in a specified application. |
|
| Method Summary | |
|---|---|
static java.lang.String |
createAgentInstanceID(java.lang.String gamexAPIAgent)
Static method to be used where a Agent Instance has to be created as it is specified in the Betfair Gamex API documentation. |
betfair.games.api.v1.Api |
get()
When the get method is called without parameters it returns the root element (the API service list) by sending a GET request using the base URL for the API Server as specified by the application. |
java.lang.Object |
get(java.lang.String url)
Returns an Object object that is an instance of the responseType Class,
as defined by the API XML. |
java.lang.String |
getParam(java.lang.String name)
Returns the value of the parameter with the specified name, or null if this map contains no mapping for the name. |
java.lang.String |
getVersion()
Returns version information for the ApiAdapter. |
java.lang.Object |
post(java.lang.String url,
java.lang.Object bodyobject)
Returns an Object object that is an instance of the responseType Class,
as defined by the API XML. |
void |
putParam(java.lang.String name,
java.lang.String value)
Adds a parameter to the query string sent to the Api server when using the get() or post() methods of the adapter. |
| Methods inherited from class org.apache.commons.httpclient.HttpClient |
|---|
executeMethod, executeMethod, executeMethod, getHost, getHostConfiguration, getHttpConnectionManager, getParams, getPort, getState, isStrictMode, setConnectionTimeout, setHostConfiguration, setHttpConnectionFactoryTimeout, setHttpConnectionManager, setParams, setState, setStrictMode, setTimeout |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ApiAdapter(ApiApplication app)
throws ApiAdapterException
app - The application using the ApiAdapter. The ApiApplication is
forced to provide the adapter with user and application data as specified
by the ApiApplication interface.
ApiAdapterException - if the construction of the ApiAdapter fails.| Method Detail |
|---|
public void putParam(java.lang.String name,
java.lang.String value)
name - name of query parameter with which the specified value is to be associatedvalue - query parameter value to be associated with the specified namepublic java.lang.String getParam(java.lang.String name)
name - name of the query parameter whose associated value is to be returned
public betfair.games.api.v1.Api get()
throws ApiAdapterException
Api
ApiAdapterException - if there is an error when trying to retrieve the
list of API services.
public java.lang.Object get(java.lang.String url)
throws ApiAdapterException
Object object that is an instance of the responseType Class,
as defined by the API XML. The returned object must be cast before it can be
used.
url - api server url to be called
Object object that is an instance of the responseType Class
ApiAdapterException - if anything fails in the process of requesting the
XML and create instances using the JAXB classes.
public java.lang.Object post(java.lang.String url,
java.lang.Object bodyobject)
throws ApiAdapterException
Object object that is an instance of the responseType Class,
as defined by the API XML. The returned object must be cast before it can be
used.
url - api server url to be called
Object object that is an instance of the responseType Class
ApiAdapterException - if anything fails in the process of requesting the
XML and create instances using the JAXB classes.public static java.lang.String createAgentInstanceID(java.lang.String gamexAPIAgent)
gamexAPIAgent - the unique name and version of the application
public java.lang.String getVersion()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||