ORE Studio 0.0.4
Loading...
Searching...
No Matches
account_history_protocol.hpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 *
3 * Copyright (C) 2025 Marco Craveiro <marco.craveiro@gmail.com>
4 *
5 * This program is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU General Public License as published by the Free Software
7 * Foundation; either version 3 of the License, or (at your option) any later
8 * version.
9 *
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13 * details.
14 *
15 * You should have received a copy of the GNU General Public License along with
16 * this program; if not, write to the Free Software Foundation, Inc., 51
17 * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 *
19 */
20#ifndef ORES_IAM_MESSAGING_ACCOUNT_HISTORY_PROTOCOL_HPP
21#define ORES_IAM_MESSAGING_ACCOUNT_HISTORY_PROTOCOL_HPP
22
23#include <span>
24#include <iosfwd>
25#include <vector>
26#include <expected>
27#include <rfl.hpp>
28#include <rfl/json.hpp>
29#include "ores.comms/messaging/message_types.hpp"
30#include "ores.comms/messaging/message_traits.hpp"
31#include "ores.iam/domain/account_version_history.hpp"
32
34
39 std::string username;
40
44 std::vector<std::byte> serialize() const;
45
49 static std::expected<get_account_history_request, ores::utility::serialization::error_code>
50 deserialize(std::span<const std::byte> data);
51};
52
53std::ostream& operator<<(std::ostream& s, const get_account_history_request& v);
54
59 bool success;
60 std::string message;
62
66 std::vector<std::byte> serialize() const;
67
71 static std::expected<get_account_history_response, ores::utility::serialization::error_code>
72 deserialize(std::span<const std::byte> data);
73};
74
75std::ostream& operator<<(std::ostream& s, const get_account_history_response& v);
76
77}
78
79namespace ores::comms::messaging {
80
84template<>
85struct message_traits<iam::messaging::get_account_history_request> {
88 static constexpr message_type request_message_type =
89 message_type::get_account_history_request;
90};
91
92}
93
94#endif
Contains messaging related infrastructure in the comms library.
Definition assets_protocol.hpp:122
Network messaging infrastructure for the IAM module.
Definition account_history_protocol.hpp:33
Traits template for mapping request types to their response types and message type enum values.
Definition message_traits.hpp:66
Contains the full version history for an account.
Definition account_version_history.hpp:32
Request to retrieve version history for an account.
Definition account_history_protocol.hpp:38
static std::expected< get_account_history_request, ores::utility::serialization::error_code > deserialize(std::span< const std::byte > data)
Deserialize request from bytes.
Definition account_history_protocol.cpp:156
std::vector< std::byte > serialize() const
Serialize request to bytes.
Definition account_history_protocol.cpp:149
Response containing account version history.
Definition account_history_protocol.hpp:58
static std::expected< get_account_history_response, ores::utility::serialization::error_code > deserialize(std::span< const std::byte > data)
Deserialize response from bytes.
Definition account_history_protocol.cpp:191
std::vector< std::byte > serialize() const
Serialize response to bytes.
Definition account_history_protocol.cpp:169