Skip to content
Repos

DevPlaceApp

C++ 663 B31 lines Opens in site

Directory Raw Download

#pragma once
// Spec: models.md GistDetail.
#include <cstdint>
#include <vector>

#include "core/Json.hpp"
#include "model/Attachment.hpp"
#include "model/Comment.hpp"
#include "model/Gist.hpp"
#include "model/Reactions.hpp"
#include "model/User.hpp"
#include "model/Vote.hpp"

namespace dp {

struct GistDetail {
  Gist::Data gist;
  User author;
  bool isOwner = false;
  std::int64_t starCount = 0;
  Vote myVote;
  std::vector<Comment> comments;
  std::vector<Attachment> attachments;
  bool bookmarked = false;
  Reactions reactions;

  static GistDetail fromJson(const Json& j);
  std::string id() const { return "gist:" + gist.id; }
};

}  // namespace dp
33.9ms