2023-04-08 07:41:34 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
#include <optional>
|
|
|
|
#include <utility>
|
|
|
|
|
|
|
|
#include <nlohmann/json.hpp>
|
|
|
|
|
|
|
|
struct Images {
|
|
|
|
std::optional<std::string> original;
|
|
|
|
std::vector<std::string> thumbnails;
|
|
|
|
|
|
|
|
const std::string& original_or_thumbnail() const;
|
2023-04-09 13:50:44 +00:00
|
|
|
const std::string& thumbnail_or_original(size_t back = 0) const;
|
2023-04-08 07:41:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct User {
|
|
|
|
std::string username;
|
|
|
|
std::string display_name;
|
|
|
|
uint64_t user_id;
|
|
|
|
|
|
|
|
std::optional<Images> cover_images;
|
|
|
|
Images profile_pictures;
|
|
|
|
std::vector<std::pair<std::string, std::string>> links;
|
|
|
|
};
|
|
|
|
|
2023-04-08 16:06:56 +00:00
|
|
|
struct Tag {
|
|
|
|
std::string japanese;
|
|
|
|
std::optional<std::string> english;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Illust {
|
|
|
|
std::string username;
|
2023-04-09 13:31:50 +00:00
|
|
|
std::string user_display_name;
|
2023-04-08 16:06:56 +00:00
|
|
|
uint64_t user_id;
|
|
|
|
Images user_profile_pictures;
|
|
|
|
|
|
|
|
uint64_t illust_id;
|
|
|
|
std::string title;
|
|
|
|
bool ai_generated;
|
|
|
|
time_t upload_time;
|
|
|
|
|
2023-04-09 15:15:53 +00:00
|
|
|
std::optional<std::string> comment;
|
2023-04-08 16:06:56 +00:00
|
|
|
std::vector<Tag> tags;
|
|
|
|
std::vector<Images> images;
|
2023-05-05 16:28:33 +00:00
|
|
|
size_t page_count;
|
2023-04-08 16:06:56 +00:00
|
|
|
};
|
|
|
|
|
2023-04-08 16:27:45 +00:00
|
|
|
struct Illusts {
|
|
|
|
std::vector<Illust> illusts;
|
|
|
|
size_t total_illusts;
|
|
|
|
size_t total_pages;
|
|
|
|
};
|
|
|
|
|
2023-05-01 04:10:15 +00:00
|
|
|
struct SearchResults {
|
|
|
|
Illusts illusts;
|
|
|
|
std::unordered_map<std::string, std::string> tag_translations;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct SearchSuggestion {
|
|
|
|
std::string tag;
|
|
|
|
std::optional<std::string> english_tag;
|
|
|
|
};
|
|
|
|
|
2023-04-08 07:41:34 +00:00
|
|
|
void from_json(const nlohmann::json& j, User& user);
|
2023-04-08 16:06:56 +00:00
|
|
|
void from_json(const nlohmann::json& j, Tag& tag);
|
|
|
|
void from_json(const nlohmann::json& j, Illust& illust);
|
2023-04-08 16:27:45 +00:00
|
|
|
void from_json(const nlohmann::json& j, Illusts& illusts);
|
2023-05-01 04:10:15 +00:00
|
|
|
void from_json(const nlohmann::json& j, SearchResults& search_results);
|
|
|
|
void from_json(const nlohmann::json& j, SearchSuggestion& search_suggestion);
|