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
Kazv::Api::GetRoomTagsJob::buildBody
static BaseJob::Body buildBody(std::string userId, std::string roomId)
Definition: tags.cpp:23
Kazv::Api::SetRoomTagJob
Add a tag to a room.
Definition: tags.hpp:121
Kazv::Api::GetRoomTagsJob
List the tags for a room.
Definition: tags.hpp:18
Kazv::Api::GetRoomTagsJob::Tag::additionalProperties
JsonWrap additionalProperties
List the tags set by a user on a room.
Definition: tags.hpp:33
nlohmann
Definition: location.hpp:26
Kazv::Api::SetRoomTagJob::JobResponse
Definition: tags.hpp:126
Kazv::Api::GetRoomTagsJob::withData
GetRoomTagsJob withData(JsonWrap j) &&
Definition: tags.cpp:55
Kazv::Api::SetRoomTagJob::needsAuth
static constexpr auto needsAuth()
Definition: tags.hpp:134
Kazv
Definition: location.hpp:10
Kazv::Api::GetRoomTagsJob::JobResponse
Definition: tags.hpp:36
Kazv::addPropertyMapToJson
void addPropertyMapToJson(json &j, MapT &&arg)
Definition: types.hpp:91
Kazv::Api::DeleteRoomTagJob
Remove a tag from the room.
Definition: tags.hpp:196
Kazv::BaseJob::Query
Definition: basejob.hpp:90
nlohmann::adl_serializer< GetRoomTagsJob::Tag >::to_json
static void to_json(json &jo, const GetRoomTagsJob::Tag &pod)
Definition: tags.hpp:93
Kazv::Api::GetRoomTagsJob::needsAuth
static constexpr auto needsAuth()
Definition: tags.hpp:52
Kazv::Api::GetRoomTagsJob::Tag::order
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:31
Kazv::Api::GetRoomTagsJob::JobResponse::success
bool success() const
Definition: tags.cpp:72
Kazv::Api::GetRoomTagsJob::JobResponse::tags
immer::map< std::string, Tag > tags() const
List the tags set by a user on a room.
Definition: tags.cpp:82
Kazv::json
nlohmann::json json
Definition: jsonwrap.hpp:20
Kazv::Api::GetRoomTagsJob::buildQuery
static BaseJob::Query buildQuery()
Definition: tags.cpp:15
Kazv::Api
Definition: location.hpp:10
Kazv::Api::GetRoomTagsJob::GetRoomTagsJob
GetRoomTagsJob(std::string serverUrl, std::string _accessToken, std::string userId, std::string roomId)
List the tags for a room.
Definition: tags.cpp:35
Kazv::addToJsonIfNeeded
void addToJsonIfNeeded(json &j, std::string name, T &&arg)
Definition: types.hpp:80
basejob.hpp
Kazv::JsonWrap
Definition: jsonwrap.hpp:22
Kazv::BaseJob
Definition: basejob.hpp:76
nlohmann::adl_serializer< GetRoomTagsJob::Tag >::from_json
static void from_json(const json &jo, GetRoomTagsJob::Tag &result)
Definition: tags.hpp:102
Kazv::Api::GetRoomTagsJob::JobResponse::JobResponse
JobResponse(Response r)
Definition: tags.cpp:69
Kazv::BaseJob::Body
::Kazv::Body Body
Definition: basejob.hpp:100
Kazv::Api::DeleteRoomTagJob::needsAuth
static constexpr auto needsAuth()
Definition: tags.hpp:209
Kazv::Api::GetRoomTagsJob::Tag
List the tags set by a user on a room.
Definition: tags.hpp:25
Kazv::Api::DeleteRoomTagJob::JobResponse
Definition: tags.hpp:201
Kazv::Response
Definition: basejob.hpp:50