Package org.stellar.sdk.requests
Class LiquidityPoolsRequestBuilder
java.lang.Object
org.stellar.sdk.requests.RequestBuilder
org.stellar.sdk.requests.LiquidityPoolsRequestBuilder
Builds requests to the Horizon
/liquidity_pools endpoint.
Retrieves liquidity pools on the Stellar network, with optional filters by reserves or participating account.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.stellar.sdk.requests.RequestBuilder
RequestBuilder.Order -
Constructor Summary
ConstructorsConstructorDescriptionLiquidityPoolsRequestBuilder(okhttp3.OkHttpClient httpClient, okhttp3.HttpUrl serverURI) -
Method Summary
Modifier and TypeMethodDescriptionSetscursorparameter on the request.execute()Build and execute request.static Page<LiquidityPoolResponse> execute(okhttp3.OkHttpClient httpClient, okhttp3.HttpUrl uri) forAccount(String account) Returns all liquidity pools the specified account is participating in.forReserves(String... reserves) Returns all liquidity pools that contain reserves in all specified assets.limit(int number) Setslimitparameter on the request.liquidityPool(String liquidityPoolId) RequestsGET /liquidity_pools/{liquidity_pool_id}liquidityPool(okhttp3.HttpUrl uri) Requests specificuriand returnsLiquidityPoolResponse.order(RequestBuilder.Order direction) Setsorderparameter on the request.stream(EventListener<LiquidityPoolResponse> listener) An overloaded version ofstream(EventListener, long)with default reconnect timeout.stream(EventListener<LiquidityPoolResponse> listener, long reconnectTimeout) Allows to stream SSE events from horizon.Methods inherited from class org.stellar.sdk.requests.RequestBuilder
setAssetParameter, setAssetsParameter
-
Constructor Details
-
LiquidityPoolsRequestBuilder
public LiquidityPoolsRequestBuilder(okhttp3.OkHttpClient httpClient, okhttp3.HttpUrl serverURI)
-
-
Method Details
-
liquidityPool
Requests specificuriand returnsLiquidityPoolResponse. This method is helpful for getting the links.- Parameters:
uri- the Horizon URI to request- Returns:
LiquidityPoolResponse- Throws:
NetworkException- All the exceptions below are subclasses of NetworkExceptionBadRequestException- 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.
-
liquidityPool
RequestsGET /liquidity_pools/{liquidity_pool_id}- Parameters:
liquidityPoolId- Liquidity Pool to fetch- Returns:
LiquidityPoolResponse- Throws:
BadRequestException- if the request fails due to a bad request (4xx)BadResponseException- if the request fails due to a bad response from the server (5xx)ConnectionErrorException- if the request fails due to an IOException, including but not limited to a timeout, connection failure etc.TooManyRequestsException- when too many requests were sent to the Horizon server.- See Also:
-
forReserves
Returns all liquidity pools that contain reserves in all specified assets.- Parameters:
reserves- Reserve assets to filter liquidity pools- Returns:
- current
LiquidityPoolsRequestBuilderinstance - See Also:
-
forAccount
Returns all liquidity pools the specified account is participating in.- Parameters:
account- Account ID to filter liquidity pools- Returns:
- current
LiquidityPoolsRequestBuilderinstance - See Also:
-
execute
public static Page<LiquidityPoolResponse> execute(okhttp3.OkHttpClient httpClient, okhttp3.HttpUrl uri) Requests specificuriand returnsPageofLiquidityPoolResponse. 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:
PageofLiquidityPoolResponse- Throws:
NetworkException- All the exceptions below are subclasses of NetworkExceptionBadRequestException- 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<LiquidityPoolResponse> stream(EventListener<LiquidityPoolResponse> 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-EventListenerimplementation withLiquidityPoolResponsetypereconnectTimeout- 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.- Parameters:
listener- the event listener to receive events- Returns:
- an
SSEStreamfor real-time event streaming
-
execute
- Returns:
PageofLiquidityPoolResponse- Throws:
NetworkException- All the exceptions below are subclasses of NetworkExceptionBadRequestException- 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.
-
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.- Returns:
- this builder instance for chaining
- 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- maximum number of records to return- Returns:
- this builder instance for chaining
-
order
Description copied from class:RequestBuilderSetsorderparameter on the request.- Overrides:
orderin classRequestBuilder- Parameters:
direction-RequestBuilder.Order- Returns:
- this builder instance for chaining
-