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_API_MESSAGING_BADGE_DEFINITION_PROTOCOL_HPP
21#define ORES_DQ_API_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.api/domain/badge_definition.hpp"
29
30namespace ores::dq::messaging {
31
32// ============================================================================
33// Badge Definition Messages
34// ============================================================================
35
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
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
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
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
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
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
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
Visual definition for a badge, including colours, label, and severity.
Definition badge_definition.hpp:41
Request to retrieve all badge definitions.
Definition badge_definition_protocol.hpp:39
Response containing all badge definitions.
Definition badge_definition_protocol.hpp:51
Request to save a badge definition (create or update).
Definition badge_definition_protocol.hpp:65
Response confirming badge definition save operation.
Definition badge_definition_protocol.hpp:79
Result for a single badge definition deletion.
Definition badge_definition_protocol.hpp:94
std::string code
Primary key.
Definition badge_definition_protocol.hpp:95
Request to delete one or more badge definitions.
Definition badge_definition_protocol.hpp:105
std::vector< std::string > codes
Primary keys.
Definition badge_definition_protocol.hpp:106
Response confirming badge definition deletion(s).
Definition badge_definition_protocol.hpp:119
Request to retrieve version history for a badge definition.
Definition badge_definition_protocol.hpp:133
std::string code
Primary key.
Definition badge_definition_protocol.hpp:134
Response containing badge definition version history.
Definition badge_definition_protocol.hpp:147