#include "oro/api.hpp" #include "orotool_config.hpp" #include "SQLiteCpp/SQLiteCpp.h" #include int main(int argc, char* argv[]) { if (2 != argc) { std::cerr << "Please provide your API key\n"; return 2; } oro::Api oro_api(duck::g_base_url, argv[1], "RESTC_CPP", "Testing"); auto ping = oro_api.ping(); std::cout << "date: " << ping.first.date << '\n'; std::cout << "rate limit: " << ping.first.rate_limit << '\n'; std::cout << "remaining: " << ping.first.rate_limit_remaining << '\n'; std::cout << "reset: " << ping.first.rate_limit_reset << '\n'; std::cout << "retry after: " << ping.first.retry_after << '\n'; std::cout << "server: " << ping.first.server << '\n'; std::cout << "-----\n"; std::cout << "timestamp: " << ping.second.generation_timestamp << '\n'; std::cout << "answer: " << ping.second.message << '\n'; std::cout << "version: " << ping.second.version << '\n'; { auto whoami = oro_api.who_am_i(); std::cout << "master id: " << whoami.second.master_id << '\n'; } { auto items = oro_api.items_list(); std::cout << "Total items in DB: " << items.second.items.size() << '\n'; } { auto icons = oro_api.items_icons(); std::cout << "Total icons in DB: " << icons.second.icons.size() << '\n'; } { auto shops = oro_api.market_list(); for (const auto& shop : shops.second.shops) { std::cout << "Shop \"" << shop.title << "\" by " << shop.owner << " in " << shop.location.map << " at <" << shop.location.x << ", " << shop.location.y << "> "; if (shop.type == oro::ShopType::Buying) std::cout << "buying "; else std::cout << "selling "; std::cout << shop.items.size() << " items\n"; } } { auto fame = oro_api.fame_list(); std::cout << "Forgers: "; for (const auto& forger : fame.second.forgers) { std::cout << forger.name << ", "; } std::cout << '\n'; std::cout << "Brewers: "; for (const auto& brewer : fame.second.brewers) { std::cout << brewer.name << ", "; } std::cout << '\n'; } return 0; }