/* * MTG RFID Companion - Scryfall API client (Core 0) * * Phase 5: HTTPS card lookups with cJSON parsing and LittleFS caching of * metadata + card art. Runs on the dedicated net_task. */ #pragma once #include "esp_err.h" #include #ifdef __cplusplus extern "C" { #endif #define SCRYFALL_API "https://api.scryfall.com" #define SCRYFALL_CARD_ARTS_URL "/cards/named?exact=" /** * @brief Start the net_task (waits for Wi-Fi, prefetches mapping cache, * then serves fetch requests). Must be called after wifi start. */ esp_err_t scryfall_client_start(void); /** * @brief Queue an async fetch by exact card name (net_task performs it). * @param card_name Exact card name, e.g. "Sol Ring" * @param uid Uppercase hex UID used for cache filenames */ esp_err_t scryfall_fetch_request(const char *card_name, const char *uid); /** * @brief True if net_task finished a fetch attempt since last consumption. */ bool scryfall_has_pending_result(void); /** * @brief True if the last fetch succeeded, false if it failed. */ bool scryfall_last_result_success(void); /** * @brief UID of the most recently fetched card. */ const char *scryfall_last_result_uid(void); /** * @brief Clear the pending-result flag. */ void scryfall_consume_result(void); #ifdef __cplusplus } #endif