Package org.stellar.sdk.requests
Class OperationsRequestBuilder
java.lang.Object
org.stellar.sdk.requests.RequestBuilder
org.stellar.sdk.requests.OperationsRequestBuilder
Builds requests connected to operations.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.stellar.sdk.requests.RequestBuilder
RequestBuilder.Order -
Constructor Summary
ConstructorsConstructorDescriptionOperationsRequestBuilder(okhttp3.OkHttpClient httpClient, okhttp3.HttpUrl serverURI) -
Method Summary
Modifier and TypeMethodDescriptionSetscursorparameter on the request.execute()Build and execute request.static Page<OperationResponse> execute(okhttp3.OkHttpClient httpClient, okhttp3.HttpUrl uri) forAccount(@NonNull String account) Builds request toGET /accounts/{account}/operationsforClaimableBalance(@NonNull String claimableBalance) Builds request toGET /claimable_balances/{claimable_balance_id}/operationsforLedger(long ledgerSeq) Builds request toGET /ledgers/{ledgerSeq}/operationsforLiquidityPool(String liquidityPoolId) Builds request toGET /liquidity_pools/{poolID}/operationsforTransaction(@NonNull String transactionId) Builds request toGET /transactions/{transactionId}/operationsincludeFailed(boolean value) Adds a parameter defining whether to include operations of failed transactions.includeTransactions(boolean include) Adds a parameter defining whether to include transactions in the response.limit(int number) Setslimitparameter on the request.operation(long operationId) RequestsGET /operations/{operationId}operation(okhttp3.HttpUrl uri) Requests specificuriand returnsOperationResponse.order(RequestBuilder.Order direction) Setsorderparameter on the request.stream(EventListener<OperationResponse> listener) An overloaded version ofstream(EventListener, long)with default reconnect timeout.stream(EventListener<OperationResponse> listener, long reconnectTimeout) Allows to stream SSE events from horizon.Methods inherited from class org.stellar.sdk.requests.RequestBuilder
setAssetParameter, setAssetsParameter
-
Constructor Details
-
OperationsRequestBuilder
public OperationsRequestBuilder(okhttp3.OkHttpClient httpClient, okhttp3.HttpUrl serverURI)
-
-
Method Details
-
operation
Requests specificuriand returnsOperationResponse. This method is helpful for getting the links.- Returns:
OperationResponse- Throws:
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 aTimeoutor connection timeout occurredUnknownResponseException- if the server returns an unknown status codeConnectionErrorException- When the request cannot be executed due to cancellation or connectivity problems, etc.
-
operation
RequestsGET /operations/{operationId}- Parameters:
operationId- Operation to fetch- Returns:
OperationResponse- Throws:
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 aTimeoutor connection timeout occurredUnknownResponseException- if the server returns an unknown status codeConnectionErrorException- When the request cannot be executed due to cancellation or connectivity problems, etc.- See Also:
-
forAccount
Builds request toGET /accounts/{account}/operations- Parameters:
account- Account for which to get operations- See Also:
-
forClaimableBalance
Builds request toGET /claimable_balances/{claimable_balance_id}/operations- Parameters:
claimableBalance- Claimable Balance for which to get operations- See Also:
-
forLedger
Builds request toGET /ledgers/{ledgerSeq}/operations- Parameters:
ledgerSeq- Ledger for which to get operations- See Also:
-
forTransaction
Builds request toGET /transactions/{transactionId}/operations- Parameters:
transactionId- Transaction ID for which to get operations- See Also:
-
forLiquidityPool
Builds request toGET /liquidity_pools/{poolID}/operations- Parameters:
liquidityPoolId- Liquidity pool for which to get operations- See Also:
-
includeFailed
Adds a parameter defining whether to include operations of failed transactions. By default only operations of successful transactions are returned.- Parameters:
value- Set totrueto include operations of failed transactions.
-
includeTransactions
Adds a parameter defining whether to include transactions in the response. By default transaction data is not included.- Parameters:
include- Set totrueto include transaction data in the operations response.
-
execute
Requests specificuriand returnsPageofOperationResponse. This method is helpful for getting the next set of results.- Parameters:
httpClient-OkHttpClientto use to send the request.uri-HttpUrlURI to send the request to.- Returns:
PageofOperationResponse- Throws:
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 aTimeoutor connection timeout occurredUnknownResponseException- if the server returns an unknown status codeConnectionErrorException- When the request cannot be executed due to cancellation or connectivity problems, etc.
-
stream
public SSEStream<OperationResponse> stream(EventListener<OperationResponse> listener, long reconnectTimeout) Allows to stream SSE events from horizon. Certain endpoints in Horizon can be called in streaming mode using Server-Sent Events. This mode will keep the connection to horizon open and horizon will continue to return responses as ledgers close.- Parameters:
listener-OperationResponseimplementation withOperationResponsetypereconnectTimeout- Custom stream connection timeout in ms- Returns:
- EventSource object, so you can
close()connection when not needed anymore - See Also:
-
stream
An overloaded version ofstream(EventListener, long)with default reconnect timeout. -
execute
Build and execute request.- Returns:
PageofOperationResponse- Throws:
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.
-
cursor
Description copied from class:RequestBuilderSetscursorparameter 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.- Overrides:
cursorin classRequestBuilder- Parameters:
token- A cursor is a value that points to a specific location in a collection of resources.- See Also:
-
limit
Description copied from class:RequestBuilderSetslimitparameter on the request. It defines maximum number of records to return. For range and default values check documentation of the endpoint requested.- Overrides:
limitin classRequestBuilder- Parameters:
number- maxium number of records to return
-
order
Description copied from class:RequestBuilderSetsorderparameter on the request.- Overrides:
orderin classRequestBuilder- Parameters:
direction-RequestBuilder.Order
-