libQuotient
A Qt library for building matrix clients
request_email_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 EmailValidationData {
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 email address to validate.
17  QString email;
18 
19  //! The server will only send an email if the `send_attempt`
20  //! is a number greater than the most recent one which it has seen,
21  //! scoped to that `email` + `client_secret` pair. This is to
22  //! avoid repeatedly sending the same email in the case of request
23  //! retries between the POSTing user and the identity server.
24  //! The client should increment this value if they desire a new
25  //! email (e.g. a reminder) to be sent. If they do not, the server
26  //! should respond with success but not resend the email.
27  int sendAttempt;
28 
29  //! Optional. When the validation is completed, the identity server will
30  //! redirect the user to this URL. This option is ignored when submitting
31  //! 3PID validation information through a POST request.
32  QString nextLink{};
33 
34  //! The hostname of the identity server to communicate with. May optionally
35  //! include a port. This parameter is ignored when the homeserver handles
36  //! 3PID verification.
37  //!
38  //! This parameter is deprecated with a plan to be removed in a future specification
39  //! version for `/account/password` and `/register` requests.
40  QString idServer{};
41 
42  //! An access token previously registered with the identity server. Servers
43  //! can treat this as optional to distinguish between r0.5-compatible clients
44  //! and this specification version.
45  //!
46  //! Required if an `id_server` is supplied.
47  QString idAccessToken{};
48 };
49 
50 template <>
51 struct JsonObjectConverter<EmailValidationData> {
52  static void dumpTo(QJsonObject& jo, const EmailValidationData& pod)
53  {
54  addParam<>(jo, "client_secret"_L1, pod.clientSecret);
55  addParam<>(jo, "email"_L1, pod.email);
56  addParam<>(jo, "send_attempt"_L1, pod.sendAttempt);
57  addParam<IfNotEmpty>(jo, "next_link"_L1, pod.nextLink);
58  addParam<IfNotEmpty>(jo, "id_server"_L1, pod.idServer);
59  addParam<IfNotEmpty>(jo, "id_access_token"_L1, pod.idAccessToken);
60  }
61  static void fillFrom(const QJsonObject& jo, EmailValidationData& pod)
62  {
63  fillFromJson(jo.value("client_secret"_L1), pod.clientSecret);
64  fillFromJson(jo.value("email"_L1), pod.email);
65  fillFromJson(jo.value("send_attempt"_L1), pod.sendAttempt);
66  fillFromJson(jo.value("next_link"_L1), pod.nextLink);
67  fillFromJson(jo.value("id_server"_L1), pod.idServer);
68  fillFromJson(jo.value("id_access_token"_L1), pod.idAccessToken);
69  }
70 };
71 
72 } // namespace Quotient