|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.codeforamerica.open311.facade.APIWrapper
public class APIWrapper
Base class of the API. This is the entry point to the system. You can build
objects of this class using the APIWrapperFactory
class.
Method Summary | |
---|---|
Cache |
getCache()
Returns the cache used by the wrapper. |
String |
getEndpointUrl()
|
ServiceDefinition |
getServiceDefinition(String serviceCode)
Gets the service definition of a concrete service. |
List<Service> |
getServiceList()
Gets a list of services from the endpoint. |
ServiceRequest |
getServiceRequest(String serviceRequestId)
GET Service Request operation. |
ServiceRequestIdResponse |
getServiceRequestIdFromToken(String token)
This function is useful when the POST Service Request returns a token. |
List<ServiceRequest> |
getServiceRequests(GETServiceRequestsFilter operationData)
Retrieves all the service requests which accord to the given data. |
String |
getWrapperInfo()
Returns a string with some info. |
protected String |
networkGet(URL url)
Tries to perform an HTTP GET operation and returns the result. |
protected String |
networkPost(URL url,
Map<String,String> parameters)
Tries to perform an HTTP POST operation and returns the result. |
POSTServiceRequestResponse |
postServiceRequest(POSTServiceRequestData operationData)
Performs a POST Service Request operation. |
void |
setFormat(Format format)
Updates the format of the wrapper. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public String getEndpointUrl()
public String getWrapperInfo()
public Cache getCache()
public void setFormat(Format format)
URLBuilder
will be
instantiated.
format
- New format.public List<Service> getServiceList() throws APIWrapperException
APIWrapperException
- If there was any problem (data parsing, I/O...).public ServiceDefinition getServiceDefinition(String serviceCode) throws APIWrapperException
serviceCode
- Code of the service of interest.
APIWrapperException
- If there was any problem (data parsing, I/O...).public ServiceRequestIdResponse getServiceRequestIdFromToken(String token) throws APIWrapperException
token
- Given token.
APIWrapperException
- If there was any problem.public List<ServiceRequest> getServiceRequests(GETServiceRequestsFilter operationData) throws APIWrapperException
operationData
- An object with all the desired optional filtering parameters
to send.
APIWrapperException
- If there was any problem.public ServiceRequest getServiceRequest(String serviceRequestId) throws APIWrapperException
serviceRequestId
- ID of the request to be fetched.
APIWrapperException
- If there was any problem.public POSTServiceRequestResponse postServiceRequest(POSTServiceRequestData operationData) throws APIWrapperException
operationData
- An object with all the desired parameters and attributes to be
sent.
APIWrapperException
- If there was any problem.protected String networkGet(URL url) throws APIWrapperException
url
- Target.
APIWrapperException
- If there was any problem with the request.protected String networkPost(URL url, Map<String,String> parameters) throws APIWrapperException
url
- Target.parameters
- Parameters of the request.
APIWrapperException
- If there was any problem with the request.public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |