pixwhile/pixivmodels.h

60 lines
1.3 KiB
C
Raw Normal View History

#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;
const std::string& thumbnail_or_original() const;
};
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> romaji;
std::optional<std::string> english;
};
struct Illust {
std::string username;
std::string display_name;
uint64_t user_id;
Images user_profile_pictures;
uint64_t illust_id;
std::string title;
bool ai_generated;
time_t upload_time;
std::optional<std::string> comment_html;
std::vector<Tag> tags;
std::vector<Images> images;
};
struct Illusts {
std::vector<Illust> illusts;
size_t total_illusts;
size_t total_pages;
};
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);
void from_json(const nlohmann::json& j, Illusts& illusts);