74 using SearchCallback = std::function<void(
const std::vector<HLTBSearchResult>&)>;
103 static std::vector<HLTBSearchResult>
search(
const std::string& query,
int maxResults = 10);
123 int maxResults = 10);
139 const std::function<
void(
int completed,
int total)>& progressCallback =
nullptr);
157 static std::string httpPost(
const std::string& url,
const std::string& body,
158 const std::string& contentType);
159 static std::string urlEncode(
const std::string& str);
162 static std::vector<HLTBSearchResult> parseSearchResponse(
const std::string&
json);
166 static double calculateSimilarity(
const std::string& a,
const std::string& b);
167 static std::string normalizeTitle(
const std::string& title);
Service for fetching game time estimates from HowLongToBeat.
static void getGameInfoAsync(const std::string &gameName, const InfoCallback &callback)
Get game info asynchronously.
std::function< void(const HowLongToBeatInfo &)> InfoCallback
static HowLongToBeatInfo getGameInfoById(int hltbId)
Get time estimates by HLTB game ID.
static std::vector< HLTBSearchResult > search(const std::string &query, int maxResults=10)
Search for games on HLTB.
static void clearCache()
Clear the HLTB cache.
static void batchFetch(std::vector< Game * > &games, const std::function< void(int completed, int total)> &progressCallback=nullptr)
Fetch HLTB info for multiple games.
static HowLongToBeatInfo getGameInfo(const std::string &gameName)
Get time estimates for a game by name.
std::function< void(const std::vector< HLTBSearchResult > &)> SearchCallback
static LRUCache< std::string, HowLongToBeatInfo >::Stats getCacheStats()
Get cache statistics.
static void searchAsync(const std::string &query, const SearchCallback &callback, int maxResults=10)
Search asynchronously.
A single search result from HowLongToBeat.
std::string imageUrl
Cover image URL.
double completionist
100% completion time
double similarity
How well the name matches (0-1).
std::string name
Game name on HLTB.
int releaseYear
Release year.
double allStyles
Average across all styles.
double mainStory
Main story time.
double mainExtras
Main + extras time.
Time-to-beat estimates from HowLongToBeat.com.