public class OperationsRequestBuilder extends RequestBuilder
RequestBuilder.Order
Constructor and Description |
---|
OperationsRequestBuilder(okhttp3.OkHttpClient httpClient,
okhttp3.HttpUrl serverURI) |
Modifier and Type | Method and Description |
---|---|
OperationsRequestBuilder |
cursor(java.lang.String token)
Sets
cursor parameter on the request. |
Page<OperationResponse> |
execute()
Build and execute request.
|
static Page<OperationResponse> |
execute(okhttp3.OkHttpClient httpClient,
okhttp3.HttpUrl uri)
|
OperationsRequestBuilder |
forAccount(@NonNull java.lang.String account)
Builds request to
GET /accounts/{account}/operations |
OperationsRequestBuilder |
forClaimableBalance(@NonNull java.lang.String claimableBalance)
Builds request to
GET /claimable_balances/{claimable_balance_id}/operations |
OperationsRequestBuilder |
forLedger(long ledgerSeq)
Builds request to
GET /ledgers/{ledgerSeq}/operations |
OperationsRequestBuilder |
forLiquidityPool(java.lang.String liquidityPoolId)
Builds request to
GET /liquidity_pools/{poolID}/operations |
OperationsRequestBuilder |
forTransaction(@NonNull java.lang.String transactionId)
Builds request to
GET /transactions/{transactionId}/operations |
OperationsRequestBuilder |
includeFailed(boolean value)
Adds a parameter defining whether to include operations of failed transactions.
|
OperationsRequestBuilder |
includeTransactions(boolean include)
Adds a parameter defining whether to include transactions in the response.
|
OperationsRequestBuilder |
limit(int number)
Sets
limit parameter on the request. |
OperationResponse |
operation(okhttp3.HttpUrl uri)
Requests specific
uri and returns OperationResponse . |
OperationResponse |
operation(long operationId)
Requests
GET /operations/{operationId} |
OperationsRequestBuilder |
order(RequestBuilder.Order direction)
Sets
order parameter on the request. |
SSEStream<OperationResponse> |
stream(EventListener<OperationResponse> listener)
An overloaded version of
stream(EventListener, long) with default reconnect timeout. |
SSEStream<OperationResponse> |
stream(EventListener<OperationResponse> listener,
long reconnectTimeout)
Allows to stream SSE events from horizon.
|
setAssetParameter, setAssetsParameter
public OperationsRequestBuilder(okhttp3.OkHttpClient httpClient, okhttp3.HttpUrl serverURI)
public OperationResponse operation(okhttp3.HttpUrl uri)
uri
and returns OperationResponse
. This method is
helpful for getting the links.OperationResponse
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 OperationResponse operation(long operationId)
GET /operations/{operationId}
operationId
- Operation to fetchOperationResponse
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 OperationsRequestBuilder forAccount(@NonNull @NonNull java.lang.String account)
GET /accounts/{account}/operations
account
- Account for which to get operationspublic OperationsRequestBuilder forClaimableBalance(@NonNull @NonNull java.lang.String claimableBalance)
GET /claimable_balances/{claimable_balance_id}/operations
claimableBalance
- Claimable Balance for which to get operationspublic OperationsRequestBuilder forLedger(long ledgerSeq)
GET /ledgers/{ledgerSeq}/operations
ledgerSeq
- Ledger for which to get operationspublic OperationsRequestBuilder forTransaction(@NonNull @NonNull java.lang.String transactionId)
GET /transactions/{transactionId}/operations
transactionId
- Transaction ID for which to get operationspublic OperationsRequestBuilder forLiquidityPool(java.lang.String liquidityPoolId)
GET /liquidity_pools/{poolID}/operations
liquidityPoolId
- Liquidity pool for which to get operationspublic OperationsRequestBuilder includeFailed(boolean value)
value
- Set to true
to include operations of failed transactions.public OperationsRequestBuilder includeTransactions(boolean include)
include
- Set to true
to include transaction data in the operations response.public static Page<OperationResponse> execute(okhttp3.OkHttpClient httpClient, okhttp3.HttpUrl uri)
uri
and returns Page
of OperationResponse
. 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 OperationResponse
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<OperationResponse> stream(EventListener<OperationResponse> listener, long reconnectTimeout)
listener
- OperationResponse
implementation with OperationResponse
typereconnectTimeout
- Custom stream connection timeout in msclose()
connection when not needed anymorepublic SSEStream<OperationResponse> stream(EventListener<OperationResponse> listener)
stream(EventListener, long)
with default reconnect timeout.public Page<OperationResponse> execute()
Page
of OperationResponse
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 OperationsRequestBuilder 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 OperationsRequestBuilder 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 OperationsRequestBuilder order(RequestBuilder.Order direction)
RequestBuilder
order
parameter on the request.order
in class RequestBuilder
direction
- RequestBuilder.Order