#include "model/MessagesInbox.hpp" #include "core/JsonDecode.hpp" namespace dp { MessagesInbox MessagesInbox::fromJson(const Json& j) { using D = JsonDecode; MessagesInbox m; m.conversations = D::reqModels(j, "conversations"); m.messages = D::reqModels(j, "messages"); if (const Json* other = JsonRead::child(j, "other_user")) m.otherUser = User::fromJson(*other); m.currentConversation = D::opt(j, "current_conversation"); m.search = D::req(j, "search"); m.otherOnline = D::req(j, "other_online"); m.otherLastSeen = D::opt(j, "other_last_seen"); return m; } } // namespace dp