Repos
C++
743 B29 lines Opens in site
Directory
Raw
Download
#pragma once
// Spec: models.md Attachment. fromChatFrame is the lenient variant used by chat socket messages.
#include <cstdint>
#include <optional>
#include <string>
#include "core/Date.hpp"
#include "core/Json.hpp"
namespace dp {
struct Attachment {
std::string id;
std::optional<std::string> filename;
std::string url;
std::optional<std::int64_t> size;
bool isImage = false;
bool isVideo = false;
std::string mimeType;
Date createdAt{};
bool canModify = false;
static Attachment fromJson(const Json& j);
// Chat frame: only uid and url are required; missing is_image/is_video/mime_type/can_modify default,
// missing created_at is `now`.
static Attachment fromChatFrame(const Json& j);
};
} // namespace dp