Octane API Client
Loading...
Searching...
No Matches
api_result_types.h
Go to the documentation of this file.
1
11#ifndef OCTANE_API_CLIENT_API_RESULT_TYPES_H_
12#define OCTANE_API_CLIENT_API_RESULT_TYPES_H_
13
14#include <optional>
15#include <ostream>
16#include <string>
17#include <string_view>
18#include <variant>
19#include <vector>
20
21#include "./result.h"
22
23namespace octane {
28 enum struct Health {
30 Healthy,
34 Faulty,
35 };
41 struct HealthResult {
45 std::optional<std::string> message;
46 };
47 bool operator==(const HealthResult& a, const HealthResult& b);
48 std::ostream& operator<<(std::ostream& stream,
49 const HealthResult& healthResult);
55 struct Response {
57 std::optional<std::string> message;
58 };
65 struct Device {
68 std::string name;
70 std::uint64_t timestamp;
71 };
79 std::string name;
81 std::vector<Device> devices;
83 std::uint64_t id;
84 };
85 bool operator==(const RoomStatus& a, const RoomStatus& b);
86 std::ostream& operator<<(std::ostream& stream, const RoomStatus& roomStatus);
92 enum struct ContentType {
94 File,
99 };
107 std::string device;
109 std::uint64_t timestamp;
113 std::optional<std::string> name;
115 std::string mime;
116 };
117 bool operator==(const ContentStatus& a, const ContentStatus& b);
118 std::ostream& operator<<(std::ostream& stream,
119 const ContentStatus& contentStatus);
120 struct FileInfo {
122 std::string filename;
124 std::vector<std::uint8_t> data;
125 };
126
132 struct Content : Response {
137 std::variant<std::string, std::vector<uint8_t>, std::vector<FileInfo>> data;
138 };
144 struct RoomId : Response {
145 std::uint64_t id;
146 };
147 bool operator==(const RoomId& a, const RoomId& b);
148 std::ostream& operator<<(std::ostream& stream, const RoomId& roomId);
149}; // namespace octane
150#endif // OCTANE_API_CLIENT_API_RESULT_TYPES_H_
Definition: api_client.cpp:20
Health
Enum used in HealthResult, represents the server's status.
Definition: api_result_types.h:28
@ Healthy
The server is working.
@ Degraded
There are incidents happening in the server.
@ Faulty
The server is dead.
std::ostream & operator<<(std::ostream &stream, const HealthResult &healthResult)
Definition: api_result_types.cpp:18
ContentType
Enum used in ContentStatus, represents the type of Content.
Definition: api_result_types.h:92
@ File
Type of Content is file.
@ MultiFile
Type of Content is multi-file.
@ Clipboard
Type of Content is clipboard.
bool operator==(const HealthResult &a, const HealthResult &b)
Definition: api_result_types.cpp:15
Define type to represent the result, inspired by Rust's "Result".
Structure used as result for getContent, has data and ContentStatus and inherits Response.
Definition: api_result_types.h:132
ContentStatus contentStatus
The status of Content.
Definition: api_result_types.h:134
std::variant< std::string, std::vector< uint8_t >, std::vector< FileInfo > > data
The data of Content, is a variant of string, single file binary.
Definition: api_result_types.h:137
Structure used in Content, has the status of Content.
Definition: api_result_types.h:105
std::optional< std::string > name
Optional: If the type is file, then this represents it's name.
Definition: api_result_types.h:113
std::uint64_t timestamp
Timestamp of when did this content get uploaded.
Definition: api_result_types.h:109
ContentType type
Type of Content.
Definition: api_result_types.h:111
std::string mime
MIME.
Definition: api_result_types.h:115
std::string device
Device which uploaded this content.
Definition: api_result_types.h:107
Structure used in RoomStatus's devices, has the information of each device connected to the room.
Definition: api_result_types.h:65
std::string name
An unique name for the device which is connected to the room, such as collodi's fedora linux.
Definition: api_result_types.h:68
std::uint64_t timestamp
Timestamp of when did this device connect to the room.
Definition: api_result_types.h:70
Definition: api_result_types.h:120
std::vector< std::uint8_t > data
binary data of the file
Definition: api_result_types.h:124
std::string filename
file name.
Definition: api_result_types.h:122
Structure used as result for health, has the server's status and message.
Definition: api_result_types.h:41
Health health
Status of the server.
Definition: api_result_types.h:43
std::optional< std::string > message
Message which describe details of the server's status.
Definition: api_result_types.h:45
Structure used/inherited in various methods of ApiClient, has the server's status.
Definition: api_result_types.h:55
std::optional< std::string > message
Definition: api_result_types.h:57
Health health
Definition: api_result_types.h:56
Structure used as result for createRoom, has the room id and inherits Response.
Definition: api_result_types.h:144
std::uint64_t id
Definition: api_result_types.h:145
Structure used as result for getRoomStatus, has the status of the room and inherits Response.
Definition: api_result_types.h:77
std::vector< Device > devices
Information for all of the devices connected to the room.
Definition: api_result_types.h:81
std::string name
Name of the room.
Definition: api_result_types.h:79
std::uint64_t id
Id of the room.
Definition: api_result_types.h:83