diff options
Diffstat (limited to 'lib/identity')
-rw-r--r-- | lib/identity/definitions/request_email_validation.cpp | 3 | ||||
-rw-r--r-- | lib/identity/definitions/request_email_validation.h | 58 | ||||
-rw-r--r-- | lib/identity/definitions/request_msisdn_validation.cpp | 3 | ||||
-rw-r--r-- | lib/identity/definitions/request_msisdn_validation.h | 65 | ||||
-rw-r--r-- | lib/identity/definitions/sid.cpp | 7 | ||||
-rw-r--r-- | lib/identity/definitions/sid.h | 32 |
6 files changed, 83 insertions, 85 deletions
diff --git a/lib/identity/definitions/request_email_validation.cpp b/lib/identity/definitions/request_email_validation.cpp index 47463a8b..131b9488 100644 --- a/lib/identity/definitions/request_email_validation.cpp +++ b/lib/identity/definitions/request_email_validation.cpp @@ -7,7 +7,7 @@ using namespace QMatrixClient; void JsonObjectConverter<RequestEmailValidation>::dumpTo( - QJsonObject& jo, const RequestEmailValidation& pod) + QJsonObject& jo, const RequestEmailValidation& pod) { addParam<>(jo, QStringLiteral("client_secret"), pod.clientSecret); addParam<>(jo, QStringLiteral("email"), pod.email); @@ -23,4 +23,3 @@ void JsonObjectConverter<RequestEmailValidation>::fillFrom( fromJson(jo.value("send_attempt"_ls), result.sendAttempt); fromJson(jo.value("next_link"_ls), result.nextLink); } - diff --git a/lib/identity/definitions/request_email_validation.h b/lib/identity/definitions/request_email_validation.h index eb7d8ed6..2496d7f5 100644 --- a/lib/identity/definitions/request_email_validation.h +++ b/lib/identity/definitions/request_email_validation.h @@ -6,37 +6,37 @@ #include "converters.h" -#include "converters.h" - namespace QMatrixClient { - // Data structures - struct RequestEmailValidation - { - /// A unique string generated by the client, and used to identify the - /// validation attempt. It must be a string consisting of the characters - /// ``[0-9a-zA-Z.=_-]``. Its length must not exceed 255 characters and it - /// must not be empty. - QString clientSecret; - /// The email address to validate. - QString email; - /// The server will only send an email if the ``send_attempt`` - /// is a number greater than the most recent one which it has seen, - /// scoped to that ``email`` + ``client_secret`` pair. This is to - /// avoid repeatedly sending the same email in the case of request - /// retries between the POSTing user and the identity server. - /// The client should increment this value if they desire a new - /// email (e.g. a reminder) to be sent. - int sendAttempt; - /// Optional. When the validation is completed, the identity - /// server will redirect the user to this URL. - QString nextLink; - }; - template <> struct JsonObjectConverter<RequestEmailValidation> - { - static void dumpTo(QJsonObject& jo, const RequestEmailValidation& pod); - static void fillFrom(const QJsonObject& jo, RequestEmailValidation& pod); - }; +// Data structures + +struct RequestEmailValidation +{ + /// A unique string generated by the client, and used to identify + /// thevalidation attempt. It must be a string consisting of the + /// characters``[0-9a-zA-Z.=_-]``. Its length must not exceed 255 characters + /// and itmust not be empty. + QString clientSecret; + /// The email address to validate. + QString email; + /// The server will only send an email if the ``send_attempt``is a number + /// greater than the most recent one which it has seen,scoped to that + /// ``email`` + ``client_secret`` pair. This is toavoid repeatedly sending + /// the same email in the case of requestretries between the POSTing user + /// and the identity server.The client should increment this value if they + /// desire a newemail (e.g. a reminder) to be sent. + int sendAttempt; + /// Optional. When the validation is completed, the identityserver will + /// redirect the user to this URL. + QString nextLink; +}; + +template <> +struct JsonObjectConverter<RequestEmailValidation> +{ + static void dumpTo(QJsonObject& jo, const RequestEmailValidation& pod); + static void fillFrom(const QJsonObject& jo, RequestEmailValidation& pod); +}; } // namespace QMatrixClient diff --git a/lib/identity/definitions/request_msisdn_validation.cpp b/lib/identity/definitions/request_msisdn_validation.cpp index a123d326..0087d202 100644 --- a/lib/identity/definitions/request_msisdn_validation.cpp +++ b/lib/identity/definitions/request_msisdn_validation.cpp @@ -7,7 +7,7 @@ using namespace QMatrixClient; void JsonObjectConverter<RequestMsisdnValidation>::dumpTo( - QJsonObject& jo, const RequestMsisdnValidation& pod) + QJsonObject& jo, const RequestMsisdnValidation& pod) { addParam<>(jo, QStringLiteral("client_secret"), pod.clientSecret); addParam<>(jo, QStringLiteral("country"), pod.country); @@ -25,4 +25,3 @@ void JsonObjectConverter<RequestMsisdnValidation>::fillFrom( fromJson(jo.value("send_attempt"_ls), result.sendAttempt); fromJson(jo.value("next_link"_ls), result.nextLink); } - diff --git a/lib/identity/definitions/request_msisdn_validation.h b/lib/identity/definitions/request_msisdn_validation.h index b48ed6d5..f8060cfc 100644 --- a/lib/identity/definitions/request_msisdn_validation.h +++ b/lib/identity/definitions/request_msisdn_validation.h @@ -6,40 +6,41 @@ #include "converters.h" -#include "converters.h" - namespace QMatrixClient { - // Data structures - struct RequestMsisdnValidation - { - /// A unique string generated by the client, and used to identify the - /// validation attempt. It must be a string consisting of the characters - /// ``[0-9a-zA-Z.=_-]``. Its length must not exceed 255 characters and it - /// must not be empty. - QString clientSecret; - /// The two-letter uppercase ISO country code that the number in - /// ``phone_number`` should be parsed as if it were dialled from. - QString country; - /// The phone number to validate. - QString phoneNumber; - /// The server will only send an SMS if the ``send_attempt`` is a - /// number greater than the most recent one which it has seen, - /// scoped to that ``country`` + ``phone_number`` + ``client_secret`` - /// triple. This is to avoid repeatedly sending the same SMS in - /// the case of request retries between the POSTing user and the - /// identity server. The client should increment this value if - /// they desire a new SMS (e.g. a reminder) to be sent. - int sendAttempt; - /// Optional. When the validation is completed, the identity - /// server will redirect the user to this URL. - QString nextLink; - }; - template <> struct JsonObjectConverter<RequestMsisdnValidation> - { - static void dumpTo(QJsonObject& jo, const RequestMsisdnValidation& pod); - static void fillFrom(const QJsonObject& jo, RequestMsisdnValidation& pod); - }; +// Data structures + +struct RequestMsisdnValidation +{ + /// A unique string generated by the client, and used to identify + /// thevalidation attempt. It must be a string consisting of the + /// characters``[0-9a-zA-Z.=_-]``. Its length must not exceed 255 characters + /// and itmust not be empty. + QString clientSecret; + /// The two-letter uppercase ISO country code that the number + /// in``phone_number`` should be parsed as if it were dialled from. + QString country; + /// The phone number to validate. + QString phoneNumber; + /// The server will only send an SMS if the ``send_attempt`` is anumber + /// greater than the most recent one which it has seen,scoped to that + /// ``country`` + ``phone_number`` + ``client_secret``triple. This is to + /// avoid repeatedly sending the same SMS inthe case of request retries + /// between the POSTing user and theidentity server. The client should + /// increment this value ifthey desire a new SMS (e.g. a reminder) to be + /// sent. + int sendAttempt; + /// Optional. When the validation is completed, the identityserver will + /// redirect the user to this URL. + QString nextLink; +}; + +template <> +struct JsonObjectConverter<RequestMsisdnValidation> +{ + static void dumpTo(QJsonObject& jo, const RequestMsisdnValidation& pod); + static void fillFrom(const QJsonObject& jo, RequestMsisdnValidation& pod); +}; } // namespace QMatrixClient diff --git a/lib/identity/definitions/sid.cpp b/lib/identity/definitions/sid.cpp index 1ba4b3b5..cc6973f2 100644 --- a/lib/identity/definitions/sid.cpp +++ b/lib/identity/definitions/sid.cpp @@ -6,15 +6,12 @@ using namespace QMatrixClient; -void JsonObjectConverter<Sid>::dumpTo( - QJsonObject& jo, const Sid& pod) +void JsonObjectConverter<Sid>::dumpTo(QJsonObject& jo, const Sid& pod) { addParam<>(jo, QStringLiteral("sid"), pod.sid); } -void JsonObjectConverter<Sid>::fillFrom( - const QJsonObject& jo, Sid& result) +void JsonObjectConverter<Sid>::fillFrom(const QJsonObject& jo, Sid& result) { fromJson(jo.value("sid"_ls), result.sid); } - diff --git a/lib/identity/definitions/sid.h b/lib/identity/definitions/sid.h index ac8c4130..752d62bb 100644 --- a/lib/identity/definitions/sid.h +++ b/lib/identity/definitions/sid.h @@ -6,23 +6,25 @@ #include "converters.h" - namespace QMatrixClient { - // Data structures - struct Sid - { - /// The session ID. Session IDs are opaque strings generated by the identity - /// server. They must consist entirely of the characters - /// ``[0-9a-zA-Z.=_-]``. Their length must not exceed 255 characters and they - /// must not be empty. - QString sid; - }; - template <> struct JsonObjectConverter<Sid> - { - static void dumpTo(QJsonObject& jo, const Sid& pod); - static void fillFrom(const QJsonObject& jo, Sid& pod); - }; +// Data structures + +struct Sid +{ + /// The session ID. Session IDs are opaque strings generated by the + /// identityserver. They must consist entirely of the + /// characters``[0-9a-zA-Z.=_-]``. Their length must not exceed 255 + /// characters and theymust not be empty. + QString sid; +}; + +template <> +struct JsonObjectConverter<Sid> +{ + static void dumpTo(QJsonObject& jo, const Sid& pod); + static void fillFrom(const QJsonObject& jo, Sid& pod); +}; } // namespace QMatrixClient |