Class AssetsRequestBuilder

java.lang.Object
org.stellar.sdk.requests.RequestBuilder
org.stellar.sdk.requests.AssetsRequestBuilder

public class AssetsRequestBuilder extends RequestBuilder
Builds requests to the Horizon /assets endpoint.

Allows filtering by asset code and asset issuer, with support for cursor-based pagination.

See Also:
  • Constructor Details

    • AssetsRequestBuilder

      public AssetsRequestBuilder(okhttp3.OkHttpClient httpClient, okhttp3.HttpUrl serverURI)
  • Method Details

    • assetCode

      public AssetsRequestBuilder assetCode(String 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

      public AssetsRequestBuilder assetIssuer(String 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

      public static Page<AssetResponse> execute(okhttp3.OkHttpClient httpClient, okhttp3.HttpUrl uri)
      Requests specific uri and returns Page of AssetResponse. This * method is helpful for getting the next set of results.
      Parameters:
      httpClient - OkHttpClient to use to send the request.
      uri - HttpUrl URI to send the request to.
      Returns:
      Page of AssetResponse
      Throws:
      NetworkException - All the exceptions below are subclasses of NetworkException
      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)
      TooManyRequestsException - if the request fails due to too many requests sent to the server
      RequestTimeoutException - When Horizon returns a Timeout or connection timeout occurred
      UnknownResponseException - if the server returns an unknown status code
      ConnectionErrorException - When the request cannot be executed due to cancellation or connectivity problems, etc.
    • execute

      public Page<AssetResponse> execute()
      Build and execute request.
      Returns:
      Page of AssetResponse
      Throws:
      NetworkException - All the exceptions below are subclasses of NetworkException
      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)
      TooManyRequestsException - if the request fails due to too many requests sent to the server
      RequestTimeoutException - When Horizon returns a Timeout or connection timeout occurred
      UnknownResponseException - if the server returns an unknown status code
      ConnectionErrorException - When the request cannot be executed due to cancellation or connectivity problems, etc.
    • cursor

      public AssetsRequestBuilder cursor(String token)
      Description copied from class: RequestBuilder
      Sets 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.
      Overrides:
      cursor in class RequestBuilder
      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

      public AssetsRequestBuilder limit(int number)
      Description copied from class: RequestBuilder
      Sets limit parameter on the request. It defines maximum number of records to return. For range and default values check documentation of the endpoint requested.
      Overrides:
      limit in class RequestBuilder
      Parameters:
      number - maximum number of records to return
      Returns:
      this builder instance for chaining
    • order

      public AssetsRequestBuilder order(RequestBuilder.Order direction)
      Description copied from class: RequestBuilder
      Sets order parameter on the request.
      Overrides:
      order in class RequestBuilder
      Parameters:
      direction - RequestBuilder.Order
      Returns:
      this builder instance for chaining