Klasse CardRequester

java.lang.Object
net.dzultra.jsa.cards.CardRequester

public class CardRequester extends Object
High-level service for querying Magic: The Gathering card data from the Scryfall API.

This class provides multiple convenience methods for retrieving cards by search query, name lookup, set information, autocomplete suggestions, random cards, and identifiers. It delegates request execution and response parsing to CardSearchExecutor.

  • Felddetails

    • gson

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

      public final ScryfallClient client
      The Scryfall client used for HTTP communication.
  • Konstruktordetails

    • CardRequester

      public CardRequester(ScryfallClient client)
      Constructs a new CardRequester.
      Parameter:
      client - the Scryfall client used for API requests
  • Methodendetails

    • getCardsByQuery

      public CardList getCardsByQuery(String query)
      Searches for cards using a Scryfall query string.
      Parameter:
      query - the search query (Scryfall syntax)
      Gibt zurück:
      a CardList containing matching cards
    • getCardsByQuery

      public CardList getCardsByQuery(String query, @Nullable @Nullable UniqueMode uniqueMode, @Nullable @Nullable OrderMode orderMode, @Nullable @Nullable SortMode sortMode)
      Searches for cards using a query string with additional search options.
      Parameter:
      query - the search query (Scryfall syntax)
      uniqueMode - optional uniqueness filtering mode
      orderMode - optional ordering mode
      sortMode - optional sort direction
      Gibt zurück:
      a CardList containing matching cards
    • getCardByName

      public Card getCardByName(@NotNull @NotNull String name, @Nullable @Nullable String set, boolean fuzzy)
      Retrieves a single card by name using exact or fuzzy matching.
      Parameter:
      name - the card name
      set - optional set code restriction; may be null
      fuzzy - whether to use fuzzy matching instead of exact matching
      Gibt zurück:
      the matching Card
    • getCardByName

      public Card getCardByName(@NotNull @NotNull String name, @Nullable @Nullable MTGSet set, boolean fuzzy)
      Retrieves a single card by name with optional set filtering.
      Parameter:
      name - the card name
      set - optional MTG set; may be null
      fuzzy - whether to use fuzzy matching instead of exact matching
      Gibt zurück:
      the matching Card
    • getCardNamesByQuery

      public CardNameList getCardNamesByQuery(String query)
      Retrieves card name suggestions based on a partial query.
      Parameter:
      query - partial card name input
      Gibt zurück:
      a CardNameList containing matching suggestions
    • getCardNamesByQuery

      public CardNameList getCardNamesByQuery(String query, boolean includeExtras)
      Retrieves card name suggestions with optional extra results included.
      Parameter:
      query - partial card name input
      includeExtras - whether to include additional non-standard results
      Gibt zurück:
      a CardNameList containing matching suggestions
    • getRandomCard

      public Card getRandomCard()
      Retrieves a completely random card.
      Gibt zurück:
      a random Card
    • getRandomCard

      public Card getRandomCard(String query)
      Retrieves a random card matching a search query.
      Parameter:
      query - optional search query filter (Scryfall syntax); may be null or empty for no filtering
      Gibt zurück:
      a random matching Card
    • getCardBySetAndNumber

      public Card getCardBySetAndNumber(String setCode, String collectorNumber)
      Retrieves a card by set code and collector number.
      Parameter:
      setCode - the set code
      collectorNumber - the collector number within the set
      Gibt zurück:
      the matching Card
    • getCardBySetAndNumber

      public Card getCardBySetAndNumber(String setCode, String collectorNumber, Language lang)
      Retrieves a localized card by set, collector number, and language.
      Parameter:
      setCode - the set code
      collectorNumber - the collector number
      lang - the card language
      Gibt zurück:
      the matching Card
    • getCardBySetAndNumber

      public Card getCardBySetAndNumber(MTGSet set, String collectorNumber)
      Retrieves a card by set object and collector number.
      Parameter:
      set - the MTG set
      collectorNumber - the collector number
      Gibt zurück:
      the matching Card
    • getCardBySetAndNumber

      public Card getCardBySetAndNumber(MTGSet set, String collectorNumber, Language lang)
      Retrieves a localized card by set object, collector number, and language.
      Parameter:
      set - the MTG set
      collectorNumber - the collector number
      lang - the card language
      Gibt zurück:
      the matching Card
    • getCardById

      public Card getCardById(String id, CardIDType idType)
      Retrieves a card by its unique identifier.
      Parameter:
      id - the card identifier
      idType - the type of identifier used
      Gibt zurück:
      the matching Card