public class OrderBookRequestBuilder extends RequestBuilder
RequestBuilder.Order
Constructor and Description |
---|
OrderBookRequestBuilder(okhttp3.OkHttpClient httpClient,
okhttp3.HttpUrl serverURI) |
Modifier and Type | Method and Description |
---|---|
OrderBookRequestBuilder |
buyingAsset(Asset asset) |
RequestBuilder |
cursor(java.lang.String cursor)
Sets
cursor parameter on the request. |
OrderBookResponse |
execute()
Build and execute request.
|
static OrderBookResponse |
execute(okhttp3.OkHttpClient httpClient,
okhttp3.HttpUrl uri)
Requests specific
uri and returns OrderBookResponse . |
RequestBuilder |
order(RequestBuilder.Order direction)
Sets
order parameter on the request. |
OrderBookRequestBuilder |
sellingAsset(Asset asset) |
SSEStream<OrderBookResponse> |
stream(EventListener<OrderBookResponse> listener)
An overloaded version of
stream(EventListener, long) with default reconnect timeout. |
SSEStream<OrderBookResponse> |
stream(EventListener<OrderBookResponse> listener,
long reconnectTimeout)
Allows to stream SSE events from horizon.
|
limit, setAssetParameter, setAssetsParameter
public OrderBookRequestBuilder(okhttp3.OkHttpClient httpClient, okhttp3.HttpUrl serverURI)
public OrderBookRequestBuilder buyingAsset(Asset asset)
public OrderBookRequestBuilder sellingAsset(Asset asset)
public static OrderBookResponse execute(okhttp3.OkHttpClient httpClient, okhttp3.HttpUrl uri)
uri
and returns OrderBookResponse
.httpClient
- OkHttpClient
to use to send the request.uri
- HttpUrl
URI to send the request to.OrderBookResponse
NetworkException
- All the exceptions below are subclasses of
NetworkErrorBadRequestException
- if the request fails due to a bad request
(4xx)BadResponseException
- if the request fails due to a bad
response from the server (5xx)TooManyRequestsException
- if the request fails due to too many requests sent to the
serverRequestTimeoutException
- When Horizon returns a Timeout
or connection timeout occurredUnknownResponseException
- if the server returns an unknown
status codeConnectionErrorException
- When the request cannot be executed
due to cancellation or connectivity problems, etc.public SSEStream<OrderBookResponse> stream(EventListener<OrderBookResponse> listener, long reconnectTimeout)
listener
- OrderBookResponse
implementation with OrderBookResponse
typereconnectTimeout
- Custom stream connection timeout in msclose()
connection when not needed anymorepublic SSEStream<OrderBookResponse> stream(EventListener<OrderBookResponse> listener)
stream(EventListener, long)
with default reconnect timeout.public OrderBookResponse execute()
OrderBookResponse
NetworkException
- All the exceptions below are subclasses of
NetworkErrorBadRequestException
- if the request fails due to a bad request
(4xx)BadResponseException
- if the request fails due to a bad
response from the server (5xx)TooManyRequestsException
- if the request fails due to too many requests sent to the
serverRequestTimeoutException
- When Horizon returns a Timeout
or connection timeout occurredUnknownResponseException
- if the server returns an unknown
status codeConnectionErrorException
- When the request cannot be executed
due to cancellation or connectivity problems, etc.public RequestBuilder cursor(java.lang.String cursor)
RequestBuilder
cursor
parameter on the request. A cursor is a value that points to a
specific location in a collection of resources. The cursor attribute itself is an opaque value
meaning that users should not try to parse it.cursor
in class RequestBuilder
cursor
- A cursor is a value that points to a specific location in a collection of
resources.public RequestBuilder order(RequestBuilder.Order direction)
RequestBuilder
order
parameter on the request.order
in class RequestBuilder
direction
- RequestBuilder.Order