Package org.stellar.sdk.requests
Class AccountsRequestBuilder
java.lang.Object
org.stellar.sdk.requests.RequestBuilder
org.stellar.sdk.requests.AccountsRequestBuilder
Builds requests connected to accounts.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.stellar.sdk.requests.RequestBuilder
RequestBuilder.Order -
Constructor Summary
ConstructorsConstructorDescriptionAccountsRequestBuilder(okhttp3.OkHttpClient httpClient, okhttp3.HttpUrl serverURI) -
Method Summary
Modifier and TypeMethodDescriptionRequestsGET /accounts/{account}account(okhttp3.HttpUrl uri) Requests specificuriand returnsAccountResponse.Setscursorparameter on the request.execute()Build and execute request.static Page<AccountResponse> execute(okhttp3.OkHttpClient httpClient, okhttp3.HttpUrl uri) forAsset(AssetTypeCreditAlphaNum asset) Returns all accounts who are trustees to a specific asset.forLiquidityPool(String liquidityPoolId) Returns all accounts who have trustlines to the specified liquidity pool.Returns all accounts that contain a specific signer.forSponsor(String sponsor) Returns all accounts who are sponsored by a given account or have subentries which are sponsored by a given account.limit(int number) Setslimitparameter on the request.order(RequestBuilder.Order direction) Setsorderparameter on the request.stream(EventListener<AccountResponse> listener) An overloaded version ofstream(EventListener, long)with default reconnect timeout.stream(EventListener<AccountResponse> listener, long reconnectTimeout) Allows to stream SSE events from horizon.Methods inherited from class org.stellar.sdk.requests.RequestBuilder
setAssetParameter, setAssetsParameter
-
Constructor Details
-
AccountsRequestBuilder
public AccountsRequestBuilder(okhttp3.OkHttpClient httpClient, okhttp3.HttpUrl serverURI)
-
-
Method Details
-
account
Requests specificuriand returnsAccountResponse. This method is helpful for getting the links.- 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.
-
account
RequestsGET /accounts/{account}- Parameters:
account- Account to fetch- 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:
-
forSigner
Returns all accounts that contain a specific signer.- Parameters:
signer- Account ID- Returns:
- current
AccountsRequestBuilderinstance - See Also:
-
forAsset
Returns all accounts who are trustees to a specific asset.- Parameters:
asset- An issued asset- Returns:
- current
AccountsRequestBuilderinstance - See Also:
-
forLiquidityPool
Returns all accounts who have trustlines to the specified liquidity pool.- Parameters:
liquidityPoolId- Liquidity Pool ID- Returns:
- current
AccountsRequestBuilderinstance - See Also:
-
forSponsor
Returns all accounts who are sponsored by a given account or have subentries which are sponsored by a given account.- Parameters:
sponsor- Account ID- Returns:
- current
AccountsRequestBuilderinstance - See Also:
-
execute
Requests specificuriand returnsPageofAccountResponse. This method is helpful for getting the next set of results.- Returns:
PageofAccountResponse- 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<AccountResponse> stream(EventListener<AccountResponse> 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 withAccountResponsetypereconnectTimeout- 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
- Returns:
PageofAccountResponse- 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.
-
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
-