From 34ba40ca622a7362eb48618deae3c91eac4b6f9a Mon Sep 17 00:00:00 2001 From: Aotrix <9aotrix@protonmail.com> Date: Sun, 1 Feb 2026 02:55:28 +0100 Subject: Download all the cards with API --- battleNetApi/src/main.cpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 battleNetApi/src/main.cpp (limited to 'battleNetApi/src/main.cpp') diff --git a/battleNetApi/src/main.cpp b/battleNetApi/src/main.cpp new file mode 100644 index 0000000..4e3885b --- /dev/null +++ b/battleNetApi/src/main.cpp @@ -0,0 +1,27 @@ +#include "apiUrl.hpp" +#include +#include +#include + +int main(int argc, char *argv[]) { + if (argc < 3) { + // Example of parameters: + // ./build/downloadCards tests/resources/credentials.json build/output.json + throw std::invalid_argument("/ "); + } + std::string aCredentialsFilePath{argv[1]}; + Token aToken(aCredentialsFilePath); + HearthstoneApi aHearthstoneApi(aToken); + std::string aOutputPath{argv[2]}; + const std::string kContentType{"cards"}; + const std::string kRegion{"eu"}; + ApiUrl aApiUrl(kContentType, kRegion); + aApiUrl.setLocale("fr_FR"); + aApiUrl.setGameMode("constructed"); + aApiUrl.setPageSize("100"); + std::cout << "Downloading cards...\n"; + aHearthstoneApi.downloadAllCards(aApiUrl, aOutputPath); + std::cout << "Download done.\n"; + + return 0; +} -- cgit v1.2.3