com.heroku.api.request
Interface Request<T>

Type Parameters:
T - Response type.
All Known Implementing Classes:
AddonInstall, AddonList, AddonRemove, AppAddonsList, AppClone, AppCreate, AppDestroy, AppExists, AppInfo, AppList, AppRename, BasicAuthLogin, CollabList, ConfigAdd, ConfigList, ConfigRemove, DomainAdd, DomainList, DomainRemove, KeyAdd, KeyList, KeyRemove, KeysRemoveAll, ListReleases, Log, MaintenanceInfo, MaintenanceUpdate, ProcessList, ReleaseInfo, RequestTransformation, Restart, Restart.NamedProcessRestart, Restart.ProcessTypeRestart, Rollback, Run, Scale, SharingAdd, SharingRemove, SharingTransfer, StackList, StackMigrate, UserInfo

public interface Request<T>

Request model for an HTTP request to the Heroku API. Intended for use with a Connection. Models an HTTP request relative to a base URL (e.g. https://api.heroku.com).


Method Summary
 String getBody()
          Value of the request body.
 String getEndpoint()
          Path and query parameters of a URL.
 Map<String,String> getHeaders()
          Map of request-specific HTTP headers.
 Http.Method getHttpMethod()
          HTTP method.
 T getResponse(byte[] bytes, int status)
          Response handler.
 Http.Accept getResponseType()
          HTTP Accept header.
 boolean hasBody()
          Whether or not the request has a body.
 

Method Detail

getHttpMethod

Http.Method getHttpMethod()
HTTP method. e.g. GET, POST, PUT, DELETE

Returns:
The HTTP method used in the request.

getEndpoint

String getEndpoint()
Path and query parameters of a URL.

Returns:
The path and query parameters as a String.

hasBody

boolean hasBody()
Whether or not the request has a body.

Returns:
true if it has a request body, otherwise false

getBody

String getBody()
Value of the request body.

Returns:
Body
Throws:
UnsupportedOperationException - Generally thrown if hasBody() returns false

getResponseType

Http.Accept getResponseType()
HTTP Accept header.

Returns:
The Accept header to be used in the request. Typically "application/json" or "text/xml"
See Also:
Http.Accept

getHeaders

Map<String,String> getHeaders()
Map of request-specific HTTP headers.

Returns:
Name/value pairs of HTTP headers.

getResponse

T getResponse(byte[] bytes,
              int status)
Response handler.

Parameters:
bytes - Data returned from the request.
status - HTTP status code.
Returns:
The type T as specified by an individual request.
Throws:
RequestFailedException - Generally thrown when the HTTP status code is 4XX.


Copyright © 2012. All Rights Reserved.