libkazv
Loading...
Searching...
No Matches
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
13namespace Kazv::Api {
14
27public:
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
54class JobResponse : public Response
55{
56
57public:
59 bool success() const;
60
61 // Result properties
62
63
64
65
74immer::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
166class Post3PIDsJob : public BaseJob {
167public:
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
188class JobResponse : public Response
189{
190
191public:
193 bool success() const;
194
195 // Result properties
196
197
198
199
212std::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
236 );
237
238 static BaseJob::Body buildBody(ThreePidCredentials threePidCreds);
239
240
241
242
243
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
305class Add3PIDJob : public BaseJob {
306public:
307
308
309
310class JobResponse : public Response
311{
312
313public:
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
346 );
347
348 static BaseJob::Body buildBody(std::string clientSecret, std::string sid, std::optional<AuthenticationData> auth);
349
350
351
352
353
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
379class Bind3PIDJob : public BaseJob {
380public:
381
382
383
384class JobResponse : public Response
385{
386
387public:
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
422 );
423
424 static BaseJob::Body buildBody(std::string clientSecret, std::string idServer, std::string idAccessToken, std::string sid);
425
426
427
428
429
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
455public:
456
457
458
459class JobResponse : public Response
460{
461
462public:
464 bool success() const;
465
466 // Result properties
467
468
469
470
477std::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
510 );
511
512 static BaseJob::Body buildBody(std::string medium, std::string address, std::optional<std::string> idServer);
513
514
515
516
517
520 };
522 }
523 namespace nlohmann
524 {
525 using namespace Kazv;
526 using namespace Kazv::Api;
527
528 }
529
530 namespace Kazv::Api
531 {
532
543public:
544
545
546
547class JobResponse : public Response
548{
549
550public:
552 bool success() const;
553
554 // Result properties
555
556
557
558
564std::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
597 );
598
599 static BaseJob::Body buildBody(std::string medium, std::string address, std::optional<std::string> idServer);
600
601
602
603
604
607 };
609 }
610 namespace nlohmann
611 {
612 using namespace Kazv;
613 using namespace Kazv::Api;
614
615 }
616
617 namespace Kazv::Api
618 {
619
632public:
633
634
635
636class JobResponse : public Response
637{
638
639public:
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 ,
683 );
684
685
687 );
688
690
691
692
693
694
697 };
699 }
700 namespace nlohmann
701 {
702 using namespace Kazv;
703 using namespace Kazv::Api;
704
705 }
706
707 namespace Kazv::Api
708 {
709
722public:
723
724
725
726class JobResponse : public Response
727{
728
729public:
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
775 );
776
778
779
780
781
782
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
bool success() const
Definition administrative_contact.cpp:244
Adds contact information to the user's account.
Definition administrative_contact.hpp:305
static constexpr auto needsAuth()
Definition administrative_contact.hpp:318
Add3PIDJob withData(JsonWrap j) &&
Definition administrative_contact.cpp:227
static BaseJob::Query buildQuery()
Definition administrative_contact.cpp:177
static BaseJob::Body buildBody(std::string clientSecret, std::string sid, std::optional< AuthenticationData > auth)
Definition administrative_contact.cpp:185
Definition administrative_contact.hpp:385
bool success() const
Definition administrative_contact.cpp:324
Binds a 3PID to the user's account through an Identity Service.
Definition administrative_contact.hpp:379
static BaseJob::Body buildBody(std::string clientSecret, std::string idServer, std::string idAccessToken, std::string sid)
Definition administrative_contact.cpp:263
static constexpr auto needsAuth()
Definition administrative_contact.hpp:392
Bind3PIDJob withData(JsonWrap j) &&
Definition administrative_contact.cpp:307
static BaseJob::Query buildQuery()
Definition administrative_contact.cpp:255
Definition administrative_contact.hpp:460
std::string idServerUnbindResult() const
An indicator as to whether or not the homeserver was able to unbind the 3PID from the identity server...
Definition administrative_contact.cpp:413
bool success() const
Definition administrative_contact.cpp:402
Deletes a third party identifier from the user's account.
Definition administrative_contact.hpp:454
static BaseJob::Query buildQuery()
Definition administrative_contact.cpp:335
Delete3pidFromAccountJob withData(JsonWrap j) &&
Definition administrative_contact.cpp:385
static constexpr auto needsAuth()
Definition administrative_contact.hpp:480
static BaseJob::Body buildBody(std::string medium, std::string address, std::optional< std::string > idServer)
Definition administrative_contact.cpp:343
Definition administrative_contact.hpp:55
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
static constexpr auto needsAuth()
Definition administrative_contact.hpp:77
Definition administrative_contact.hpp:189
bool success() const
Definition administrative_contact.cpp:155
std::optional< std::string > submitUrl() const
An optional field containing a URL where the client must submit the validation token to,...
Definition administrative_contact.cpp:165
Adds contact information to the user's account.
Definition administrative_contact.hpp:166
Post3PIDsJob withData(JsonWrap j) &&
Definition administrative_contact.cpp:138
static constexpr auto needsAuth()
Definition administrative_contact.hpp:215
static BaseJob::Body buildBody(ThreePidCredentials threePidCreds)
Definition administrative_contact.cpp:100
static BaseJob::Query buildQuery()
Definition administrative_contact.cpp:92
Definition administrative_contact.hpp:637
RequestTokenResponse data() const
An email was sent to the given address.
Definition administrative_contact.hpp:650
bool success() const
Definition administrative_contact.cpp:573
Begins the validation process for an email address for association with the user's account.
Definition administrative_contact.hpp:631
static BaseJob::Body buildBody(EmailValidationData body)
Definition administrative_contact.cpp:523
static constexpr auto needsAuth()
Definition administrative_contact.hpp:659
static BaseJob::Query buildQuery()
Definition administrative_contact.cpp:515
RequestTokenTo3PIDEmailJob withData(JsonWrap j) &&
Definition administrative_contact.cpp:556
Definition administrative_contact.hpp:727
bool success() const
Definition administrative_contact.cpp:642
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 BaseJob::Query buildQuery()
Definition administrative_contact.cpp:584
static constexpr auto needsAuth()
Definition administrative_contact.hpp:747
static BaseJob::Body buildBody(MsisdnValidationData body)
Definition administrative_contact.cpp:592
RequestTokenTo3PIDMSISDNJob withData(JsonWrap j) &&
Definition administrative_contact.cpp:625
Definition administrative_contact.hpp:548
std::string idServerUnbindResult() const
An indicator as to whether or not the identity server was able to unbind the 3PID.
Definition administrative_contact.cpp:503
bool success() const
Definition administrative_contact.cpp:492
Removes a user's third party identifier from an identity server.
Definition administrative_contact.hpp:542
static BaseJob::Query buildQuery()
Definition administrative_contact.cpp:425
static constexpr auto needsAuth()
Definition administrative_contact.hpp:567
Unbind3pidFromAccountJob withData(JsonWrap j) &&
Definition administrative_contact.cpp:475
static BaseJob::Body buildBody(std::string medium, std::string address, std::optional< std::string > idServer)
Definition administrative_contact.cpp:433
Definition basejob.hpp:94
Definition basejob.hpp:68
::Kazv::Body Body
Definition basejob.hpp:103
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:49
JsonWrap jsonBody() const
Definition basejob.cpp:141
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