libkazv
device_management.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"
10 
11 namespace Kazv::Api {
12 
17 class GetDevicesJob : public BaseJob {
18 public:
19 
20 
21 
22 class JobResponse : public Response
23 {
24 
25 public:
27  bool success() const;
28 
29  // Result properties
30 
31 
32 
33 
35 immer::array<Device> devices() const;
36 
37 };
38  static constexpr auto needsAuth() {
39  return true
40  ;
41  }
42 
43 
44 // Construction/destruction
45 
47  explicit GetDevicesJob(std::string serverUrl
48  , std::string _accessToken
49 
50 
51  );
52 
53 
55  );
56 
57  static BaseJob::Body buildBody();
58 
59 
60 
61 
62 
64  GetDevicesJob withData(JsonWrap j) const &;
65  };
67  }
68  namespace nlohmann
69  {
70  using namespace Kazv;
71  using namespace Kazv::Api;
72 
73  }
74 
75  namespace Kazv::Api
76  {
77 
82 class GetDeviceJob : public BaseJob {
83 public:
84 
85 
86 
87 class JobResponse : public Response
88 {
89 
90 public:
92  bool success() const;
93 
94  // Result properties
95 
96 
98 
99  Device data() const
100  {
101  return
102  std::move(jsonBody().get()).get<Device>()
103  ;
104  }
105 
106 
107 };
108  static constexpr auto needsAuth() {
109  return true
110  ;
111  }
112 
113 
114 // Construction/destruction
115 
121  explicit GetDeviceJob(std::string serverUrl
122  , std::string _accessToken
123  ,
124  std::string deviceId
125  );
126 
127 
128  static BaseJob::Query buildQuery(
129  );
130 
131  static BaseJob::Body buildBody(std::string deviceId);
132 
133 
134 
135 
136 
137  GetDeviceJob withData(JsonWrap j) &&;
138  GetDeviceJob withData(JsonWrap j) const &;
139  };
141  }
142  namespace nlohmann
143  {
144  using namespace Kazv;
145  using namespace Kazv::Api;
146 
147  }
148 
149  namespace Kazv::Api
150  {
151 
156 class UpdateDeviceJob : public BaseJob {
157 public:
158 
159 
160 
161 class JobResponse : public Response
162 {
163 
164 public:
166  bool success() const;
167 
168 };
169  static constexpr auto needsAuth() {
170  return true
171  ;
172  }
173 
174 
175 // Construction/destruction
176 
186  explicit UpdateDeviceJob(std::string serverUrl
187  , std::string _accessToken
188  ,
189  std::string deviceId , std::optional<std::string> displayName = std::nullopt
190  );
191 
192 
193  static BaseJob::Query buildQuery(
194  );
195 
196  static BaseJob::Body buildBody(std::string deviceId, std::optional<std::string> displayName);
197 
198 
199 
200 
201 
202  UpdateDeviceJob withData(JsonWrap j) &&;
203  UpdateDeviceJob withData(JsonWrap j) const &;
204  };
206  }
207  namespace nlohmann
208  {
209  using namespace Kazv;
210  using namespace Kazv::Api;
211 
212  }
213 
214  namespace Kazv::Api
215  {
216 
223 class DeleteDeviceJob : public BaseJob {
224 public:
225 
226 
227 
228 class JobResponse : public Response
229 {
230 
231 public:
233  bool success() const;
234 
235 };
236  static constexpr auto needsAuth() {
237  return true
238  ;
239  }
240 
241 
242 // Construction/destruction
243 
253  explicit DeleteDeviceJob(std::string serverUrl
254  , std::string _accessToken
255  ,
256  std::string deviceId , std::optional<AuthenticationData> auth = std::nullopt
257  );
258 
259 
260  static BaseJob::Query buildQuery(
261  );
262 
263  static BaseJob::Body buildBody(std::string deviceId, std::optional<AuthenticationData> auth);
264 
265 
266 
267 
268 
269  DeleteDeviceJob withData(JsonWrap j) &&;
270  DeleteDeviceJob withData(JsonWrap j) const &;
271  };
273  }
274  namespace nlohmann
275  {
276  using namespace Kazv;
277  using namespace Kazv::Api;
278 
279  }
280 
281  namespace Kazv::Api
282  {
283 
290 class DeleteDevicesJob : public BaseJob {
291 public:
292 
293 
294 
295 class JobResponse : public Response
296 {
297 
298 public:
300  bool success() const;
301 
302 };
303  static constexpr auto needsAuth() {
304  return true
305  ;
306  }
307 
308 
309 // Construction/destruction
310 
320  explicit DeleteDevicesJob(std::string serverUrl
321  , std::string _accessToken
322  ,
323  immer::array<std::string> devices , std::optional<AuthenticationData> auth = std::nullopt
324  );
325 
326 
327  static BaseJob::Query buildQuery(
328  );
329 
330  static BaseJob::Body buildBody(immer::array<std::string> devices, std::optional<AuthenticationData> auth);
331 
332 
333 
334 
335 
336  DeleteDevicesJob withData(JsonWrap j) &&;
337  DeleteDevicesJob withData(JsonWrap j) const &;
338  };
340  }
341  namespace nlohmann
342  {
343  using namespace Kazv;
344  using namespace Kazv::Api;
345 
346  }
347 
348  namespace Kazv::Api
349  {
350 
351 } // namespace Kazv::Api
Kazv::Api::GetDeviceJob::JobResponse
Definition: device_management.hpp:87
Kazv::Api::GetDevicesJob
List registered devices for the current user.
Definition: device_management.hpp:19
Kazv::Api::GetDevicesJob::JobResponse::success
bool success() const
Definition: device_management.cpp:72
Kazv::Api::DeleteDeviceJob
Delete a device.
Definition: device_management.hpp:223
Kazv::Api::DeleteDevicesJob::needsAuth
static constexpr auto needsAuth()
Definition: device_management.hpp:303
nlohmann
Definition: location.hpp:26
Kazv::Api::UpdateDeviceJob::needsAuth
static constexpr auto needsAuth()
Definition: device_management.hpp:169
Kazv::Api::GetDeviceJob
Get a single device.
Definition: device_management.hpp:82
Kazv::Api::GetDevicesJob::JobResponse::devices
immer::array< Device > devices() const
A list of all registered devices for this user.
Definition: device_management.cpp:82
Kazv
Definition: location.hpp:10
Kazv::Api::DeleteDeviceJob::needsAuth
static constexpr auto needsAuth()
Definition: device_management.hpp:236
Kazv::BaseJob::Query
Definition: basejob.hpp:90
client_device.hpp
Kazv::Api::GetDevicesJob::withData
GetDevicesJob withData(JsonWrap j) &&
Definition: device_management.cpp:55
Kazv::Api::UpdateDeviceJob::JobResponse
Definition: device_management.hpp:161
Kazv::Api::GetDevicesJob::JobResponse
Definition: device_management.hpp:26
Kazv::Api::GetDevicesJob::GetDevicesJob
GetDevicesJob(std::string serverUrl, std::string _accessToken)
List registered devices for the current user.
Definition: device_management.cpp:35
Kazv::Api
Definition: location.hpp:10
Kazv::Api::Device
A client device.
Definition: client_device.hpp:14
basejob.hpp
Kazv::JsonWrap
Definition: jsonwrap.hpp:22
Kazv::Api::GetDeviceJob::JobResponse::data
Device data() const
Device information.
Definition: device_management.hpp:99
Kazv::Api::GetDevicesJob::needsAuth
static constexpr auto needsAuth()
Definition: device_management.hpp:42
Kazv::BaseJob
Definition: basejob.hpp:76
Kazv::Api::DeleteDevicesJob::JobResponse
Definition: device_management.hpp:295
Kazv::Api::GetDevicesJob::JobResponse::JobResponse
JobResponse(Response r)
Definition: device_management.cpp:69
Kazv::Api::GetDevicesJob::buildBody
static BaseJob::Body buildBody()
Definition: device_management.cpp:23
Kazv::BaseJob::Body
::Kazv::Body Body
Definition: basejob.hpp:100
Kazv::Api::DeleteDeviceJob::JobResponse
Definition: device_management.hpp:228
Kazv::Api::GetDevicesJob::buildQuery
static BaseJob::Query buildQuery()
Definition: device_management.cpp:15
Kazv::Api::UpdateDeviceJob
Update a device.
Definition: device_management.hpp:156
auth_data.hpp
Kazv::Api::DeleteDevicesJob
Bulk deletion of devices.
Definition: device_management.hpp:290
Kazv::Api::GetDeviceJob::needsAuth
static constexpr auto needsAuth()
Definition: device_management.hpp:108
Kazv::Response
Definition: basejob.hpp:50