#include "model/GistDetail.hpp" #include "core/JsonDecode.hpp" namespace dp { GistDetail GistDetail::fromJson(const Json& j) { using D = JsonDecode; GistDetail g; g.gist = Gist::Data::fromJson(D::child(j, "gist")); g.author = User::fromJson(D::child(j, "author")); g.isOwner = D::req(j, "is_owner"); g.starCount = D::req(j, "star_count"); g.myVote = Vote::fromInt(D::req(j, "my_vote")); g.comments = D::reqModels(j, "comments"); g.attachments = D::reqModels(j, "attachments"); g.bookmarked = D::req(j, "bookmarked"); g.reactions = Reactions::fromJson(D::child(j, "reactions")); return g; } } // namespace dp