libkazv
administrative_contact.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"
12 
13 namespace Kazv::Api {
14 
26 class GetAccount3PIDsJob : public BaseJob {
27 public:
28  // Inner data structures
29 
39  {
41  std::string medium;
43  std::string address;
46  std::int_fast64_t validatedAt;
48  std::int_fast64_t addedAt;
49 
50  };
51 
52 
53 
54 class JobResponse : public Response
55 {
56 
57 public:
59  bool success() const;
60 
61  // Result properties
62 
63 
64 
65 
74 immer::array<ThirdPartyIdentifier> threepids() const;
75 
76 };
77  static constexpr auto needsAuth() {
78  return true
79  ;
80  }
81 
82 
83 // Construction/destruction
84 
86  explicit GetAccount3PIDsJob(std::string serverUrl
87  , std::string _accessToken
88 
89 
90  );
91 
92 
94  );
95 
96  static BaseJob::Body buildBody();
97 
98 
99 
100 
101 
104  };
106  }
107  namespace nlohmann
108  {
109  using namespace Kazv;
110  using namespace Kazv::Api;
111  template<>
112  struct adl_serializer<GetAccount3PIDsJob::ThirdPartyIdentifier> {
113 
115  {
116  if (! jo.is_object()) { jo = json::object(); }
117 
118 
119  jo["medium"s] = pod.medium;
120 
121  jo["address"s] = pod.address;
122 
123  jo["validated_at"s] = pod.validatedAt;
124 
125  jo["added_at"s] = pod.addedAt;
126 
127  }
128 
130  {
131 
132  if (jo.contains("medium"s)) {
133  result.medium = jo.at("medium"s);
134  }
135  if (jo.contains("address"s)) {
136  result.address = jo.at("address"s);
137  }
138  if (jo.contains("validated_at"s)) {
139  result.validatedAt = jo.at("validated_at"s);
140  }
141  if (jo.contains("added_at"s)) {
142  result.addedAt = jo.at("added_at"s);
143  }
144 
145  }
146 
147 };
148  }
149 
150  namespace Kazv::Api
151  {
152 
166 class Post3PIDsJob : public BaseJob {
167 public:
168  // Inner data structures
169 
172  {
174  std::string clientSecret;
176  std::string idServer;
180  std::string idAccessToken;
182  std::string sid;
183 
184  };
185 
186 
187 
188 class JobResponse : public Response
189 {
190 
191 public:
193  bool success() const;
194 
195  // Result properties
196 
197 
198 
199 
212 std::optional<std::string> submitUrl() const;
213 
214 };
215  static constexpr auto needsAuth() {
216  return true
217  ;
218  }
219 
220 
221 // Construction/destruction
222 
228  explicit Post3PIDsJob(std::string serverUrl
229  , std::string _accessToken
230  ,
231  ThreePidCredentials threePidCreds
232  );
233 
234 
235  static BaseJob::Query buildQuery(
236  );
237 
238  static BaseJob::Body buildBody(ThreePidCredentials threePidCreds);
239 
240 
241 
242 
243 
244  Post3PIDsJob withData(JsonWrap j) &&;
245  Post3PIDsJob withData(JsonWrap j) const &;
246  };
248  }
249  namespace nlohmann
250  {
251  using namespace Kazv;
252  using namespace Kazv::Api;
253  template<>
254  struct adl_serializer<Post3PIDsJob::ThreePidCredentials> {
255 
256  static void to_json(json& jo, const Post3PIDsJob::ThreePidCredentials &pod)
257  {
258  if (! jo.is_object()) { jo = json::object(); }
259 
260 
261  jo["client_secret"s] = pod.clientSecret;
262 
263  jo["id_server"s] = pod.idServer;
264 
265  jo["id_access_token"s] = pod.idAccessToken;
266 
267  jo["sid"s] = pod.sid;
268 
269  }
270 
271  static void from_json(const json &jo, Post3PIDsJob::ThreePidCredentials& result)
272  {
273 
274  if (jo.contains("client_secret"s)) {
275  result.clientSecret = jo.at("client_secret"s);
276  }
277  if (jo.contains("id_server"s)) {
278  result.idServer = jo.at("id_server"s);
279  }
280  if (jo.contains("id_access_token"s)) {
281  result.idAccessToken = jo.at("id_access_token"s);
282  }
283  if (jo.contains("sid"s)) {
284  result.sid = jo.at("sid"s);
285  }
286 
287  }
288 
289 };
290  }
291 
292  namespace Kazv::Api
293  {
294 
305 class Add3PIDJob : public BaseJob {
306 public:
307 
308 
309 
310 class JobResponse : public Response
311 {
312 
313 public:
315  bool success() const;
316 
317 };
318  static constexpr auto needsAuth() {
319  return true
320  ;
321  }
322 
323 
324 // Construction/destruction
325 
338  explicit Add3PIDJob(std::string serverUrl
339  , std::string _accessToken
340  ,
341  std::string clientSecret , std::string sid , std::optional<AuthenticationData> auth = std::nullopt
342  );
343 
344 
345  static BaseJob::Query buildQuery(
346  );
347 
348  static BaseJob::Body buildBody(std::string clientSecret, std::string sid, std::optional<AuthenticationData> auth);
349 
350 
351 
352 
353 
354  Add3PIDJob withData(JsonWrap j) &&;
355  Add3PIDJob withData(JsonWrap j) const &;
356  };
358  }
359  namespace nlohmann
360  {
361  using namespace Kazv;
362  using namespace Kazv::Api;
363 
364  }
365 
366  namespace Kazv::Api
367  {
368 
379 class Bind3PIDJob : public BaseJob {
380 public:
381 
382 
383 
384 class JobResponse : public Response
385 {
386 
387 public:
389  bool success() const;
390 
391 };
392  static constexpr auto needsAuth() {
393  return true
394  ;
395  }
396 
397 
398 // Construction/destruction
399 
414  explicit Bind3PIDJob(std::string serverUrl
415  , std::string _accessToken
416  ,
417  std::string clientSecret , std::string idServer , std::string idAccessToken , std::string sid
418  );
419 
420 
421  static BaseJob::Query buildQuery(
422  );
423 
424  static BaseJob::Body buildBody(std::string clientSecret, std::string idServer, std::string idAccessToken, std::string sid);
425 
426 
427 
428 
429 
430  Bind3PIDJob withData(JsonWrap j) &&;
431  Bind3PIDJob withData(JsonWrap j) const &;
432  };
434  }
435  namespace nlohmann
436  {
437  using namespace Kazv;
438  using namespace Kazv::Api;
439 
440  }
441 
442  namespace Kazv::Api
443  {
444 
455 public:
456 
457 
458 
459 class JobResponse : public Response
460 {
461 
462 public:
464  bool success() const;
465 
466  // Result properties
467 
468 
469 
470 
477 std::string idServerUnbindResult() const;
478 
479 };
480  static constexpr auto needsAuth() {
481  return true
482  ;
483  }
484 
485 
486 // Construction/destruction
487 
502  explicit Delete3pidFromAccountJob(std::string serverUrl
503  , std::string _accessToken
504  ,
505  std::string medium , std::string address , std::optional<std::string> idServer = std::nullopt
506  );
507 
508 
509  static BaseJob::Query buildQuery(
510  );
511 
512  static BaseJob::Body buildBody(std::string medium, std::string address, std::optional<std::string> idServer);
513 
514 
515 
516 
517 
518  Delete3pidFromAccountJob withData(JsonWrap j) &&;
519  Delete3pidFromAccountJob withData(JsonWrap j) const &;
520  };
522  }
523  namespace nlohmann
524  {
525  using namespace Kazv;
526  using namespace Kazv::Api;
527 
528  }
529 
530  namespace Kazv::Api
531  {
532 
543 public:
544 
545 
546 
547 class JobResponse : public Response
548 {
549 
550 public:
552  bool success() const;
553 
554  // Result properties
555 
556 
557 
558 
564 std::string idServerUnbindResult() const;
565 
566 };
567  static constexpr auto needsAuth() {
568  return true
569  ;
570  }
571 
572 
573 // Construction/destruction
574 
589  explicit Unbind3pidFromAccountJob(std::string serverUrl
590  , std::string _accessToken
591  ,
592  std::string medium , std::string address , std::optional<std::string> idServer = std::nullopt
593  );
594 
595 
596  static BaseJob::Query buildQuery(
597  );
598 
599  static BaseJob::Body buildBody(std::string medium, std::string address, std::optional<std::string> idServer);
600 
601 
602 
603 
604 
605  Unbind3pidFromAccountJob withData(JsonWrap j) &&;
606  Unbind3pidFromAccountJob withData(JsonWrap j) const &;
607  };
609  }
610  namespace nlohmann
611  {
612  using namespace Kazv;
613  using namespace Kazv::Api;
614 
615  }
616 
617  namespace Kazv::Api
618  {
619 
632 public:
633 
634 
635 
636 class JobResponse : public Response
637 {
638 
639 public:
641  bool success() const;
642 
643  // Result properties
644 
645 
649 
651  {
652  return
653  std::move(jsonBody().get()).get<RequestTokenResponse>()
654  ;
655  }
656 
657 
658 };
659  static constexpr auto needsAuth() {
660  return
661  false;
662  }
663 
664 
665 // Construction/destruction
666 
679  explicit RequestTokenTo3PIDEmailJob(std::string serverUrl
680 
681  ,
682  EmailValidationData body
683  );
684 
685 
686  static BaseJob::Query buildQuery(
687  );
688 
689  static BaseJob::Body buildBody(EmailValidationData body);
690 
691 
692 
693 
694 
695  RequestTokenTo3PIDEmailJob withData(JsonWrap j) &&;
696  RequestTokenTo3PIDEmailJob withData(JsonWrap j) const &;
697  };
699  }
700  namespace nlohmann
701  {
702  using namespace Kazv;
703  using namespace Kazv::Api;
704 
705  }
706 
707  namespace Kazv::Api
708  {
709 
722 public:
723 
724 
725 
726 class JobResponse : public Response
727 {
728 
729 public:
731  bool success() const;
732 
733  // Result properties
734 
735 
737 
739  {
740  return
741  std::move(jsonBody().get()).get<RequestTokenResponse>()
742  ;
743  }
744 
745 
746 };
747  static constexpr auto needsAuth() {
748  return
749  false;
750  }
751 
752 
753 // Construction/destruction
754 
767  explicit RequestTokenTo3PIDMSISDNJob(std::string serverUrl
768 
769  ,
771  );
772 
773 
774  static BaseJob::Query buildQuery(
775  );
776 
777  static BaseJob::Body buildBody(MsisdnValidationData body);
778 
779 
780 
781 
782 
783  RequestTokenTo3PIDMSISDNJob withData(JsonWrap j) &&;
784  RequestTokenTo3PIDMSISDNJob withData(JsonWrap j) const &;
785  };
787  }
788  namespace nlohmann
789  {
790  using namespace Kazv;
791  using namespace Kazv::Api;
792 
793  }
794 
795  namespace Kazv::Api
796  {
797 
798 } // namespace Kazv::Api
Definition: administrative_contact.hpp:311
Adds contact information to the user's account.
Definition: administrative_contact.hpp:305
static constexpr auto needsAuth()
Definition: administrative_contact.hpp:318
Definition: administrative_contact.hpp:385
Binds a 3PID to the user's account through an Identity Service.
Definition: administrative_contact.hpp:379
static constexpr auto needsAuth()
Definition: administrative_contact.hpp:392
Definition: administrative_contact.hpp:460
Deletes a third party identifier from the user's account.
Definition: administrative_contact.hpp:454
static constexpr auto needsAuth()
Definition: administrative_contact.hpp:480
Definition: administrative_contact.hpp:55
JobResponse(Response r)
Definition: administrative_contact.cpp:67
bool success() const
Definition: administrative_contact.cpp:70
immer::array< ThirdPartyIdentifier > threepids() const
Gets a list of the third party identifiers that the homeserver has associated with the user's account...
Definition: administrative_contact.cpp:80
Gets a list of a user's third party identifiers.
Definition: administrative_contact.hpp:26
static BaseJob::Body buildBody()
Definition: administrative_contact.cpp:21
GetAccount3PIDsJob withData(JsonWrap j) &&
Definition: administrative_contact.cpp:53
static BaseJob::Query buildQuery()
Definition: administrative_contact.cpp:13
GetAccount3PIDsJob(std::string serverUrl, std::string _accessToken)
Gets a list of a user's third party identifiers.
Definition: administrative_contact.cpp:33
static constexpr auto needsAuth()
Definition: administrative_contact.hpp:77
Definition: administrative_contact.hpp:189
Adds contact information to the user's account.
Definition: administrative_contact.hpp:166
static constexpr auto needsAuth()
Definition: administrative_contact.hpp:215
Definition: administrative_contact.hpp:637
RequestTokenResponse data() const
An email was sent to the given address.
Definition: administrative_contact.hpp:650
Begins the validation process for an email address for association with the user's account.
Definition: administrative_contact.hpp:631
static constexpr auto needsAuth()
Definition: administrative_contact.hpp:659
Definition: administrative_contact.hpp:727
RequestTokenResponse data() const
An SMS message was sent to the given phone number.
Definition: administrative_contact.hpp:738
Begins the validation process for a phone number for association with the user's account.
Definition: administrative_contact.hpp:721
static constexpr auto needsAuth()
Definition: administrative_contact.hpp:747
Definition: administrative_contact.hpp:548
Removes a user's third party identifier from an identity server.
Definition: administrative_contact.hpp:542
static constexpr auto needsAuth()
Definition: administrative_contact.hpp:567
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
nlohmann::json json
Definition: jsonwrap.hpp:20
Definition: location.hpp:27
Definition: request_email_validation.hpp:13
Gets a list of the third party identifiers that the homeserver has associated with the user's account...
Definition: administrative_contact.hpp:39
std::int_fast64_t addedAt
The timestamp, in milliseconds, when the homeserver associated the third party identifier with the us...
Definition: administrative_contact.hpp:48
std::string address
The third party identifier address.
Definition: administrative_contact.hpp:43
std::string medium
The medium of the third party identifier.
Definition: administrative_contact.hpp:41
std::int_fast64_t validatedAt
The timestamp, in milliseconds, when the identifier was validated by the identity server.
Definition: administrative_contact.hpp:46
Definition: request_msisdn_validation.hpp:13
The third party credentials to associate with the account.
Definition: administrative_contact.hpp:172
std::string sid
The session identifier given by the identity server.
Definition: administrative_contact.hpp:182
std::string clientSecret
The client secret used in the session with the identity server.
Definition: administrative_contact.hpp:174
std::string idAccessToken
An access token previously registered with the identity server.
Definition: administrative_contact.hpp:180
std::string idServer
The identity server to use.
Definition: administrative_contact.hpp:176
Definition: request_token_response.hpp:13
Definition: basejob.hpp:50
static void from_json(const json &jo, GetAccount3PIDsJob::ThirdPartyIdentifier &result)
Definition: administrative_contact.hpp:129
static void to_json(json &jo, const GetAccount3PIDsJob::ThirdPartyIdentifier &pod)
Definition: administrative_contact.hpp:114
static void from_json(const json &jo, Post3PIDsJob::ThreePidCredentials &result)
Definition: administrative_contact.hpp:271
static void to_json(json &jo, const Post3PIDsJob::ThreePidCredentials &pod)
Definition: administrative_contact.hpp:256