Skip to content
Repos

DevPlaceApp

C++ 1.6 KB57 lines Opens in site

Directory Raw Download

#pragma once
// Spec: models.md Profile. Wire key for the user is profile_user. Undocumented keys (achievements, heatmap,
// activities, ...) are ignored. xp_progress_pct defaults to 0, rank stays optional.
#include <cstdint>
#include <optional>
#include <string>
#include <vector>

#include "core/Json.hpp"
#include "model/Badge.hpp"
#include "model/Gist.hpp"
#include "model/Media.hpp"
#include "model/Post.hpp"
#include "model/Project.hpp"
#include "model/User.hpp"

namespace dp {

struct Profile {
  User user;
  std::vector<Post> posts;
  std::vector<Badge> badges;
  std::int64_t badgeTotal = 0;
  std::int64_t badgeEarned = 0;
  std::vector<Project::Data> projects;
  std::vector<Gist> gists;
  std::string currentTab;
  std::int64_t postsCount = 0;
  bool isFollowing = false;
  bool isBlocked = false;
  bool isMuted = false;
  bool isOwner = false;
  bool canViewApiKey = false;
  std::string apiKey;
  bool aiCorrectionEnabled = false;
  bool aiCorrectionSync = false;
  std::optional<std::string> aiCorrectionPrompt;
  bool aiModifierEnabled = false;
  bool aiModifierSync = false;
  std::optional<std::string> aiModifierPrompt;
  bool telegramPaired = false;
  bool notifTelegramPaired = false;
  bool canManageCustomization = false;
  bool custDisableGlobal = false;
  bool custDisablePagetype = false;
  std::optional<std::int64_t> rank;
  std::int64_t followersCount = 0;
  std::int64_t followingCount = 0;
  bool viewerIsAdmin = false;
  std::vector<Media> media;
  std::int64_t xpProgressPercent = 0;

  static Profile fromJson(const Json& j);
  std::string id() const { return "profile:" + user.id; }
};

}  // namespace dp
55.9ms