#pragma once // Spec: models.md Gist. Wire wrapper: gist, author?, my_vote, comment_count, recent_comments. #include #include #include #include #include "core/Date.hpp" #include "core/Json.hpp" #include "model/Comment.hpp" #include "model/User.hpp" #include "model/Vote.hpp" namespace dp { struct Gist { struct Data { std::string id; std::string slug; std::string userId; std::string title; std::string description; std::string sourceCode; std::string language; std::int64_t stars = 0; Date createdAt{}; std::optional updatedAt; static Data fromJson(const Json& j); }; Data data; std::optional author; Vote myVote; std::int64_t commentCount = 0; std::vector recentComments; static Gist fromJson(const Json& j); std::string id() const { return "gist:" + data.id; } }; } // namespace dp