libkazv
tags.hpp
Go to the documentation of this file.
1 /******************************************************************************
2  * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
3  */
4 
5 #pragma once
6 
7 #include "basejob.hpp"
8 
9 
10 namespace Kazv::Api {
11 
16 class GetRoomTagsJob : public BaseJob {
17 public:
18  // Inner data structures
19 
21  struct Tag
22  {
25  std::optional<float> order;
28  };
29 
30 
31 
32 class JobResponse : public Response
33 {
34 
35 public:
37  bool success() const;
38 
39  // Result properties
40 
41 
42 
43 
45 immer::map<std::string, Tag> tags() const;
46 
47 };
48  static constexpr auto needsAuth() {
49  return true
50  ;
51  }
52 
53 
54 // Construction/destruction
55 
65  explicit GetRoomTagsJob(std::string serverUrl
66  , std::string _accessToken
67  ,
68  std::string userId , std::string roomId
69  );
70 
71 
73  );
74 
75  static BaseJob::Body buildBody(std::string userId, std::string roomId);
76 
77 
78 
79 
80 
82  GetRoomTagsJob withData(JsonWrap j) const &;
83  };
85  }
86  namespace nlohmann
87  {
88  using namespace Kazv;
89  using namespace Kazv::Api;
90  template<>
91  struct adl_serializer<GetRoomTagsJob::Tag> {
92 
93  static void to_json(json& jo, const GetRoomTagsJob::Tag &pod)
94  {
95  if (! jo.is_object()) { jo = json::object(); }
96 
98 
99  addToJsonIfNeeded(jo, "order"s, pod.order);
100  }
101 
102  static void from_json(const json &jo, GetRoomTagsJob::Tag& result)
103  {
104 
105  if (jo.contains("order"s)) {
106  result.order = jo.at("order"s);
107  }
108  result.additionalProperties = jo;
109  }
110 
111 };
112  }
113 
114  namespace Kazv::Api
115  {
116 
121 class SetRoomTagJob : public BaseJob {
122 public:
123 
124 
125 
126 class JobResponse : public Response
127 {
128 
129 public:
131  bool success() const;
132 
133 };
134  static constexpr auto needsAuth() {
135  return true
136  ;
137  }
138 
139 
140 // Construction/destruction
141 
161  explicit SetRoomTagJob(std::string serverUrl
162  , std::string _accessToken
163  ,
164  std::string userId , std::string roomId , std::string tag , std::optional<float> order = std::nullopt, JsonWrap additionalProperties = {}
165  );
166 
167 
168  static BaseJob::Query buildQuery(
169  );
170 
171  static BaseJob::Body buildBody(std::string userId, std::string roomId, std::string tag, std::optional<float> order, JsonWrap additionalProperties);
172 
173 
174 
175 
176 
177  SetRoomTagJob withData(JsonWrap j) &&;
178  SetRoomTagJob withData(JsonWrap j) const &;
179  };
181  }
182  namespace nlohmann
183  {
184  using namespace Kazv;
185  using namespace Kazv::Api;
186 
187  }
188 
189  namespace Kazv::Api
190  {
191 
196 class DeleteRoomTagJob : public BaseJob {
197 public:
198 
199 
200 
201 class JobResponse : public Response
202 {
203 
204 public:
206  bool success() const;
207 
208 };
209  static constexpr auto needsAuth() {
210  return true
211  ;
212  }
213 
214 
215 // Construction/destruction
216 
229  explicit DeleteRoomTagJob(std::string serverUrl
230  , std::string _accessToken
231  ,
232  std::string userId , std::string roomId , std::string tag
233  );
234 
235 
236  static BaseJob::Query buildQuery(
237  );
238 
239  static BaseJob::Body buildBody(std::string userId, std::string roomId, std::string tag);
240 
241 
242 
243 
244 
245  DeleteRoomTagJob withData(JsonWrap j) &&;
246  DeleteRoomTagJob withData(JsonWrap j) const &;
247  };
249  }
250  namespace nlohmann
251  {
252  using namespace Kazv;
253  using namespace Kazv::Api;
254 
255  }
256 
257  namespace Kazv::Api
258  {
259 
260 } // namespace Kazv::Api
Remove a tag from the room.
Definition: tags.hpp:196
static constexpr auto needsAuth()
Definition: tags.hpp:209
JobResponse(Response r)
Definition: tags.cpp:67
immer::map< std::string, Tag > tags() const
List the tags set by a user on a room.
Definition: tags.cpp:80
bool success() const
Definition: tags.cpp:70
List the tags for a room.
Definition: tags.hpp:16
static BaseJob::Body buildBody(std::string userId, std::string roomId)
Definition: tags.cpp:21
static BaseJob::Query buildQuery()
Definition: tags.cpp:13
static constexpr auto needsAuth()
Definition: tags.hpp:48
GetRoomTagsJob(std::string serverUrl, std::string _accessToken, std::string userId, std::string roomId)
List the tags for a room.
Definition: tags.cpp:33
GetRoomTagsJob withData(JsonWrap j) &&
Definition: tags.cpp:53
Add a tag to a room.
Definition: tags.hpp:121
static constexpr auto needsAuth()
Definition: tags.hpp:134
Definition: basejob.hpp:91
Definition: basejob.hpp:77
::Kazv::Body Body
Definition: basejob.hpp:100
Definition: jsonwrap.hpp:23
Definition: location.hpp:10
Definition: location.hpp:10
void addToJsonIfNeeded(json &j, std::string name, T &&arg)
Definition: types.hpp:80
void addPropertyMapToJson(json &j, MapT &&arg)
Definition: types.hpp:91
nlohmann::json json
Definition: jsonwrap.hpp:20
Definition: location.hpp:27
List the tags set by a user on a room.
Definition: tags.hpp:22
JsonWrap additionalProperties
List the tags set by a user on a room.
Definition: tags.hpp:27
std::optional< float > order
A number in a range [0,1] describing a relative position of the room under the given tag.
Definition: tags.hpp:25
Definition: basejob.hpp:50
static void to_json(json &jo, const GetRoomTagsJob::Tag &pod)
Definition: tags.hpp:93
static void from_json(const json &jo, GetRoomTagsJob::Tag &result)
Definition: tags.hpp:102