#pragma once #include #include "pixivmodels.h" #include #include class PixivClient { public: PixivClient(); User get_user(uint64_t user_id); std::vector get_illusts(uint64_t user_id); private: nlohmann::json _handle_result(httplib::Result res); httplib::Client _www_pixiv_net_client{"https://www.pixiv.net"}; }; class HTTPLibException : public std::exception { public: HTTPLibException(httplib::Error error) { this->_message = httplib::to_string(error); } const constexpr char* what() const noexcept { return this->_message.c_str(); } private: std::string _message; }; class PixivException : public std::exception { public: PixivException(int status_, std::string message) : status(status_), _message(std::move(message)) {} const constexpr char* what() const noexcept { return this->_message.c_str(); } int status; private: std::string _message; };