Package org.stellar.sdk.requests
Class AssetsRequestBuilder
java.lang.Object
org.stellar.sdk.requests.RequestBuilder
org.stellar.sdk.requests.AssetsRequestBuilder
Builds requests to the Horizon
/assets endpoint.
Allows filtering by asset code and asset issuer, with support for cursor-based pagination.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.stellar.sdk.requests.RequestBuilder
RequestBuilder.Order -
Constructor Summary
ConstructorsConstructorDescriptionAssetsRequestBuilder(okhttp3.OkHttpClient httpClient, okhttp3.HttpUrl serverURI) -
Method Summary
Modifier and TypeMethodDescriptionFilters the results to only include assets with the given asset code.assetIssuer(String assetIssuer) Filters the results to only include assets issued by the given account.Setscursorparameter on the request.execute()Build and execute request.static Page<AssetResponse> execute(okhttp3.OkHttpClient httpClient, okhttp3.HttpUrl uri) limit(int number) Setslimitparameter on the request.order(RequestBuilder.Order direction) Setsorderparameter on the request.Methods inherited from class org.stellar.sdk.requests.RequestBuilder
setAssetParameter, setAssetsParameter
-
Constructor Details
-
AssetsRequestBuilder
public AssetsRequestBuilder(okhttp3.OkHttpClient httpClient, okhttp3.HttpUrl serverURI)
-
-
Method Details
-
assetCode
Filters the results to only include assets with the given asset code.- Parameters:
assetCode- the asset code to filter by (e.g."USD")- Returns:
- this builder instance for chaining
-
assetIssuer
Filters the results to only include assets issued by the given account.- Parameters:
assetIssuer- the issuer account ID to filter by- Returns:
- this builder instance for chaining
-
execute
Requests specificuriand returnsPageofAssetResponse. 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:
PageofAssetResponse- 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.
-
execute
Build and execute request.- Returns:
PageofAssetResponse- 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
-