#pragma once #include #include #include #include #include "blankie/serializer.h" enum PostSortingMethod { Posts = 0, PostsAndReplies, Media, }; struct Emoji { std::string shortcode; std::string url; }; struct AccountField { std::string name; blankie::html::HTMLString value_html; time_t verified_at; // negative is not verified }; struct Account { std::string id; std::string username; std::string server; bool same_server; std::string display_name; time_t created_at; blankie::html::HTMLString note_html; std::string avatar; std::string avatar_static; std::string header; uint64_t followers_count; uint64_t following_count; uint64_t statuses_count; std::vector emojis; std::vector fields; constexpr std::string acct(bool always_show_domain = true) const { std::string res = this->username; if (always_show_domain || !this->same_server) { res += '@'; res += this->server; } return res; } }; struct Post { std::string id; time_t created_at; std::optional in_reply_to_id; std::optional in_reply_to_account_id; bool sensitive; std::string spoiler_text; uint64_t replies_count; uint64_t reblogs_count; uint64_t favorites_count; time_t edited_at; // negative is not edited blankie::html::HTMLString content; std::unique_ptr reblog; Account account; std::vector emojis; }; void from_json(const nlohmann::json& j, Emoji& emoji); void from_json(const nlohmann::json& j, AccountField& field); void from_json(const nlohmann::json& j, Account& account); void from_json(const nlohmann::json& j, Post& post);