libQuotient
A Qt library for building matrix clients
request_msisdn_validation.h
Go to the documentation of this file.
1 // THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
2 
3 #pragma once
4 
5 #include <Quotient/converters.h>
6 
7 namespace Quotient {
8 
9 struct QUOTIENT_API MsisdnValidationData {
10  //! A unique string generated by the client, and used to identify the
11  //! validation attempt. It must be a string consisting of the characters
12  //! `[0-9a-zA-Z.=_-]`. Its length must not exceed 255 characters and it
13  //! must not be empty.
14  QString clientSecret;
15 
16  //! The two-letter uppercase ISO-3166-1 alpha-2 country code that the
17  //! number in `phone_number` should be parsed as if it were dialled from.
18  QString country;
19 
20  //! The phone number to validate.
21  QString phoneNumber;
22 
23  //! The server will only send an SMS if the `send_attempt` is a
24  //! number greater than the most recent one which it has seen,
25  //! scoped to that `country` + `phone_number` + `client_secret`
26  //! triple. This is to avoid repeatedly sending the same SMS in
27  //! the case of request retries between the POSTing user and the
28  //! identity server. The client should increment this value if
29  //! they desire a new SMS (e.g. a reminder) to be sent.
30  int sendAttempt;
31 
32  //! Optional. When the validation is completed, the identity server will
33  //! redirect the user to this URL. This option is ignored when submitting
34  //! 3PID validation information through a POST request.
35  QString nextLink{};
36 
37  //! The hostname of the identity server to communicate with. May optionally
38  //! include a port. This parameter is ignored when the homeserver handles
39  //! 3PID verification.
40  //!
41  //! This parameter is deprecated with a plan to be removed in a future specification
42  //! version for `/account/password` and `/register` requests.
43  QString idServer{};
44 
45  //! An access token previously registered with the identity server. Servers
46  //! can treat this as optional to distinguish between r0.5-compatible clients
47  //! and this specification version.
48  //!
49  //! Required if an `id_server` is supplied.
50  QString idAccessToken{};
51 };
52 
53 template <>
54 struct JsonObjectConverter<MsisdnValidationData> {
55  static void dumpTo(QJsonObject& jo, const MsisdnValidationData& pod)
56  {
57  addParam<>(jo, "client_secret"_L1, pod.clientSecret);
58  addParam<>(jo, "country"_L1, pod.country);
59  addParam<>(jo, "phone_number"_L1, pod.phoneNumber);
60  addParam<>(jo, "send_attempt"_L1, pod.sendAttempt);
61  addParam<IfNotEmpty>(jo, "next_link"_L1, pod.nextLink);
62  addParam<IfNotEmpty>(jo, "id_server"_L1, pod.idServer);
63  addParam<IfNotEmpty>(jo, "id_access_token"_L1, pod.idAccessToken);
64  }
65  static void fillFrom(const QJsonObject& jo, MsisdnValidationData& pod)
66  {
67  fillFromJson(jo.value("client_secret"_L1), pod.clientSecret);
68  fillFromJson(jo.value("country"_L1), pod.country);
69  fillFromJson(jo.value("phone_number"_L1), pod.phoneNumber);
70  fillFromJson(jo.value("send_attempt"_L1), pod.sendAttempt);
71  fillFromJson(jo.value("next_link"_L1), pod.nextLink);
72  fillFromJson(jo.value("id_server"_L1), pod.idServer);
73  fillFromJson(jo.value("id_access_token"_L1), pod.idAccessToken);
74  }
75 };
76 
77 } // namespace Quotient