public class OffersRequestBuilder extends RequestBuilder
RequestBuilder.Order
Constructor and Description |
---|
OffersRequestBuilder(okhttp3.OkHttpClient httpClient,
okhttp3.HttpUrl serverURI) |
Modifier and Type | Method and Description |
---|---|
OffersRequestBuilder |
cursor(java.lang.String token)
Sets
cursor parameter on the request. |
Page<OfferResponse> |
execute()
Build and execute request.
|
static Page<OfferResponse> |
execute(okhttp3.OkHttpClient httpClient,
okhttp3.HttpUrl uri)
|
OffersRequestBuilder |
forBuyingAsset(Asset asset)
Returns all offers buying an asset.
|
OffersRequestBuilder |
forSeller(java.lang.String seller)
Returns all offers where the given account is the seller.
|
OffersRequestBuilder |
forSellingAsset(Asset asset)
Returns all offers selling an asset.
|
OffersRequestBuilder |
forSponsor(java.lang.String sponsor)
Returns all offers sponsored by a given account.
|
OffersRequestBuilder |
limit(int number)
Sets
limit parameter on the request. |
OfferResponse |
offer(okhttp3.HttpUrl uri)
Requests specific
uri and returns OfferResponse . |
OfferResponse |
offer(long offerId)
The offer details endpoint provides information on a single offer.
|
OffersRequestBuilder |
order(RequestBuilder.Order direction)
Sets
order parameter on the request. |
SSEStream<OfferResponse> |
stream(EventListener<OfferResponse> listener)
An overloaded version of
stream(EventListener, long) with default reconnect timeout. |
SSEStream<OfferResponse> |
stream(EventListener<OfferResponse> listener,
long reconnectTimeout)
Allows to stream SSE events from horizon.
|
setAssetParameter, setAssetsParameter
public OffersRequestBuilder(okhttp3.OkHttpClient httpClient, okhttp3.HttpUrl serverURI)
public OfferResponse offer(okhttp3.HttpUrl uri)
uri
and returns OfferResponse
. This method is helpful
for getting the links.OfferResponse
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 OfferResponse offer(long offerId)
offerId
- specifies which offer to load.OfferResponse
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 OffersRequestBuilder forSponsor(java.lang.String sponsor)
sponsor
- Account ID of the sponsor.OffersRequestBuilder
instancepublic OffersRequestBuilder forSeller(java.lang.String seller)
seller
- Account ID of the offer creator.OffersRequestBuilder
instancepublic OffersRequestBuilder forBuyingAsset(Asset asset)
asset
- The Asset being bought.OffersRequestBuilder
instancepublic OffersRequestBuilder forSellingAsset(Asset asset)
asset
- The Asset being sold.OffersRequestBuilder
instancepublic static Page<OfferResponse> execute(okhttp3.OkHttpClient httpClient, okhttp3.HttpUrl uri)
uri
and returns Page
of OfferResponse
. This
method is helpful for getting the next set of results.httpClient
- OkHttpClient
to use to send the request.uri
- HttpUrl
URI to send the request to.Page
of OfferResponse
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<OfferResponse> stream(EventListener<OfferResponse> listener, long reconnectTimeout)
listener
- EventListener
implementation with OfferResponse
typereconnectTimeout
- Custom stream connection timeout in msclose()
connection when not needed anymorepublic SSEStream<OfferResponse> stream(EventListener<OfferResponse> listener)
stream(EventListener, long)
with default reconnect timeout.public Page<OfferResponse> execute()
Page
of OfferResponse
TooManyRequestsException
- when too many requests were sent to the Horizon server.ConnectionErrorException
- if the request fails due to an
IOException, including but not limited to a timeout, connection failure etc.public OffersRequestBuilder cursor(java.lang.String token)
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
token
- A cursor is a value that points to a specific location in a collection of
resources.public OffersRequestBuilder limit(int number)
RequestBuilder
limit
parameter on the request. It defines maximum number of records to
return. For range and default values check documentation of the endpoint requested.limit
in class RequestBuilder
number
- maxium number of records to returnpublic OffersRequestBuilder order(RequestBuilder.Order direction)
RequestBuilder
order
parameter on the request.order
in class RequestBuilder
direction
- RequestBuilder.Order