ORE Studio 0.0.4
Loading...
Searching...
No Matches
assets_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_ASSETS_MESSAGING_ASSETS_PROTOCOL_HPP
21#define ORES_ASSETS_MESSAGING_ASSETS_PROTOCOL_HPP
22
23#include <chrono>
24#include <cstddef>
25#include <optional>
26#include <string>
27#include <string_view>
28#include <vector>
29#include "ores.assets.api/domain/image.hpp"
30
31namespace ores::assets::messaging {
32
36constexpr std::size_t MAX_IMAGES_PER_REQUEST = 50;
37
41struct image_info {
42 std::string image_id;
43 std::string key;
44 std::string description;
45};
46
47struct get_images_request {
48 using response_type = struct get_images_response;
49 static constexpr std::string_view nats_subject = "assets.v1.images.get";
50 std::vector<std::string> image_ids;
51};
52
53struct get_images_response {
54 bool success = true;
55 std::string message;
56 std::vector<ores::assets::domain::image> images;
57};
58
59struct list_images_request {
60 using response_type = struct list_images_response;
61 static constexpr std::string_view nats_subject = "assets.v1.images.list";
62 std::optional<std::chrono::system_clock::time_point> modified_since;
63};
64
71 bool success = true;
72 std::string message;
73 std::vector<image_info> images;
74};
75
76struct save_image_request {
77 using response_type = struct save_image_response;
78 static constexpr std::string_view nats_subject = "assets.v1.images.save";
80};
81
82struct save_image_response {
83 bool success = false;
84 std::string message;
85};
86
87}
88
89#endif
Represents a dynamically loaded image (typically SVG).
Definition image.hpp:34
Lightweight image metadata (no SVG data) for list responses.
Definition assets_protocol.hpp:41
Response for list_images_request.
Definition assets_protocol.hpp:70