Repos
C++
698 B22 lines Opens in site
Directory
Raw
Download
#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<bool>(j, "is_owner");
g.starCount = D::req<std::int64_t>(j, "star_count");
g.myVote = Vote::fromInt(D::req<std::int64_t>(j, "my_vote"));
g.comments = D::reqModels<Comment>(j, "comments");
g.attachments = D::reqModels<Attachment>(j, "attachments");
g.bookmarked = D::req<bool>(j, "bookmarked");
g.reactions = Reactions::fromJson(D::child(j, "reactions"));
return g;
}
} // namespace dp