Klasse Catalog

java.lang.Object
net.dzultra.jsa.catalogs.Catalog

public class Catalog extends Object
Represents a Scryfall catalog request and its resulting response.

A catalog is a predefined dataset provided by the Scryfall API, such as card names, types, or keyword lists. This class performs the HTTP request immediately upon construction and stores the raw response for later processing.

  • Felddetails

    • gson

      protected com.google.gson.Gson gson
      Gson instance used for JSON deserialization.
    • client

      protected final ScryfallClient client
      The Scryfall client used to perform HTTP requests.
    • uri

      public final URI uri
      The full URI used to fetch this catalog.
  • Konstruktordetails

    • Catalog

      public Catalog(ScryfallClient client, CatalogType catalogType)
      Creates and executes a catalog request immediately.

      The request is sent during construction, and the response is stored internally. If the request fails, a CatalogResponseException is thrown.

      Parameter:
      client - the Scryfall client used for HTTP communication
      catalogType - the type of catalog to request
      Löst aus:
      CatalogResponseException - if the request fails or cannot be completed
  • Methodendetails

    • getResponse

      public String getResponse()
      Returns the raw JSON response from the catalog request.
      Gibt zurück:
      the API response as a JSON string
    • getCatalog

      public CatalogResponse getCatalog()
      Parses the catalog response into a structured CatalogResponse.

      Validates the response before deserialization to ensure it matches the expected catalog format.

      Gibt zurück:
      the parsed CatalogResponse
      Löst aus:
      CatalogResponseException - if the response is invalid or cannot be parsed
    • getCatalogType

      public CatalogType getCatalogType()
      Returns the type of catalog that was requested.
      Gibt zurück:
      the CatalogType associated with this request