1/******************************************************************************
2 * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
3 */
4
5#pragma once
6
7#include <Quotient/converters.h>
8
9namespace Quotient {
10
11struct RequestEmailValidation {
12 /// A unique string generated by the client, and used to identify the
13 /// validation attempt. It must be a string consisting of the characters
14 /// `[0-9a-zA-Z.=_-]`. Its length must not exceed 255 characters and it
15 /// must not be empty.
16 QString clientSecret;
17
18 /// The email address to validate.
19 QString email;
20
21 /// The server will only send an email if the `send_attempt`
22 /// is a number greater than the most recent one which it has seen,
23 /// scoped to that `email` + `client_secret` pair. This is to
24 /// avoid repeatedly sending the same email in the case of request
25 /// retries between the POSTing user and the identity server.
26 /// The client should increment this value if they desire a new
27 /// email (e.g. a reminder) to be sent. If they do not, the server
28 /// should respond with success but not resend the email.
29 int sendAttempt;
30
31 /// Optional. When the validation is completed, the identity server will
32 /// redirect the user to this URL. This option is ignored when submitting
33 /// 3PID validation information through a POST request.
34 QString nextLink{};
35};
36
37template <>
38struct JsonObjectConverter<RequestEmailValidation> {
39 static void dumpTo(QJsonObject& jo, const RequestEmailValidation& pod)
40 {
41 addParam<>(container&: jo, QStringLiteral("client_secret"), value: pod.clientSecret);
42 addParam<>(container&: jo, QStringLiteral("email"), value: pod.email);
43 addParam<>(container&: jo, QStringLiteral("send_attempt"), value: pod.sendAttempt);
44 addParam<IfNotEmpty>(container&: jo, QStringLiteral("next_link"), value: pod.nextLink);
45 }
46 static void fillFrom(const QJsonObject& jo, RequestEmailValidation& pod)
47 {
48 fillFromJson(jv: jo.value(key: "client_secret"_ls), pod&: pod.clientSecret);
49 fillFromJson(jv: jo.value(key: "email"_ls), pod&: pod.email);
50 fillFromJson(jv: jo.value(key: "send_attempt"_ls), pod&: pod.sendAttempt);
51 fillFromJson(jv: jo.value(key: "next_link"_ls), pod&: pod.nextLink);
52 }
53};
54
55} // namespace Quotient
56