ORE Studio 0.0.4
Loading...
Searching...
No Matches
badge_definition_protocol.hpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 *
3 * Copyright (C) 2026 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_DQ_MESSAGING_BADGE_DEFINITION_PROTOCOL_HPP
21#define ORES_DQ_MESSAGING_BADGE_DEFINITION_PROTOCOL_HPP
22
23#include <span>
24#include <iosfwd>
25#include <vector>
26#include <expected>
27#include "ores.utility/serialization/error_code.hpp"
28#include "ores.dq/domain/badge_definition.hpp"
29
30namespace ores::dq::messaging {
31
32// ============================================================================
33// Badge Definition Messages
34// ============================================================================
35
39struct get_badge_definitions_request final {
40 std::vector<std::byte> serialize() const;
41 static std::expected<get_badge_definitions_request,
42 ores::utility::serialization::error_code>
43 deserialize(std::span<const std::byte> data);
44};
45
46std::ostream& operator<<(std::ostream& s, const get_badge_definitions_request& v);
47
51struct get_badge_definitions_response final {
52 std::vector<domain::badge_definition> definitions;
53
54 std::vector<std::byte> serialize() const;
55 static std::expected<get_badge_definitions_response,
56 ores::utility::serialization::error_code>
57 deserialize(std::span<const std::byte> data);
58};
59
60std::ostream& operator<<(std::ostream& s, const get_badge_definitions_response& v);
61
65struct save_badge_definition_request final {
66 domain::badge_definition definition;
67
68 std::vector<std::byte> serialize() const;
69 static std::expected<save_badge_definition_request,
70 ores::utility::serialization::error_code>
71 deserialize(std::span<const std::byte> data);
72};
73
74std::ostream& operator<<(std::ostream& s, const save_badge_definition_request& v);
75
79struct save_badge_definition_response final {
80 bool success;
81 std::string message;
82
83 std::vector<std::byte> serialize() const;
84 static std::expected<save_badge_definition_response,
85 ores::utility::serialization::error_code>
86 deserialize(std::span<const std::byte> data);
87};
88
89std::ostream& operator<<(std::ostream& s, const save_badge_definition_response& v);
90
95 std::string code;
96 bool success;
97 std::string message;
98};
99
100std::ostream& operator<<(std::ostream& s, const delete_badge_definition_result& v);
101
106 std::vector<std::string> codes;
107
108 std::vector<std::byte> serialize() const;
109 static std::expected<delete_badge_definition_request,
110 ores::utility::serialization::error_code>
111 deserialize(std::span<const std::byte> data);
112};
113
114std::ostream& operator<<(std::ostream& s, const delete_badge_definition_request& v);
115
119struct delete_badge_definition_response final {
120 std::vector<delete_badge_definition_result> results;
121
122 std::vector<std::byte> serialize() const;
123 static std::expected<delete_badge_definition_response,
124 ores::utility::serialization::error_code>
125 deserialize(std::span<const std::byte> data);
126};
127
128std::ostream& operator<<(std::ostream& s, const delete_badge_definition_response& v);
129
133struct get_badge_definition_history_request final {
134 std::string code;
135
136 std::vector<std::byte> serialize() const;
137 static std::expected<get_badge_definition_history_request,
138 ores::utility::serialization::error_code>
139 deserialize(std::span<const std::byte> data);
140};
141
142std::ostream& operator<<(std::ostream& s, const get_badge_definition_history_request& v);
143
147struct get_badge_definition_history_response final {
148 bool success;
149 std::string message;
150 std::vector<domain::badge_definition> versions;
151
152 std::vector<std::byte> serialize() const;
153 static std::expected<get_badge_definition_history_response,
154 ores::utility::serialization::error_code>
155 deserialize(std::span<const std::byte> data);
156};
157
158std::ostream& operator<<(std::ostream& s, const get_badge_definition_history_response& v);
159
160}
161
162#endif
Request to delete one or more badge definitions.
Definition badge_protocol.hpp:175
std::vector< std::string > codes
Primary keys.
Definition badge_protocol.hpp:178
std::string code
Primary key.
Definition badge_protocol.hpp:189
Result for a single badge definition deletion.
Definition badge_definition_protocol.hpp:94
std::string code
Primary key.
Definition badge_definition_protocol.hpp:95