diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2017-12-07 11:40:46 +0900 |
---|---|---|
committer | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2017-12-07 12:53:02 +0900 |
commit | b1dd0e7ea87842fb5ff9deb14beb3474136b06f3 (patch) | |
tree | 1d25030a5355f1e065cfa00272672c9b9cc07b46 /jobs/generated/administrative_contact.cpp | |
parent | 0c5a042104eaa6f8efb0dfc1c0eacca161d5787f (diff) | |
download | libquotient-b1dd0e7ea87842fb5ff9deb14beb3474136b06f3.tar.gz libquotient-b1dd0e7ea87842fb5ff9deb14beb3474136b06f3.zip |
New generated jobs for: room directory, 3PIDs, redactions, typing notifications and others
Closes #128 (the issue has the full list of jobs arriving herewith).
Diffstat (limited to 'jobs/generated/administrative_contact.cpp')
-rw-r--r-- | jobs/generated/administrative_contact.cpp | 119 |
1 files changed, 119 insertions, 0 deletions
diff --git a/jobs/generated/administrative_contact.cpp b/jobs/generated/administrative_contact.cpp new file mode 100644 index 00000000..705c5d54 --- /dev/null +++ b/jobs/generated/administrative_contact.cpp @@ -0,0 +1,119 @@ +/****************************************************************************** + * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN + */ + + +#include "administrative_contact.h" + +#include "converters.h" + +#include <QtCore/QStringBuilder> + +using namespace QMatrixClient; + +static const auto basePath = QStringLiteral("/_matrix/client/r0"); + +GetAccount3PIDsJob::ThirdPartyIdentifier::operator QJsonObject() const +{ + QJsonObject o; + o.insert("medium", toJson(medium)); + o.insert("address", toJson(address)); + + return o; +} +namespace QMatrixClient +{ + template <> struct FromJson<GetAccount3PIDsJob::ThirdPartyIdentifier> + { + GetAccount3PIDsJob::ThirdPartyIdentifier operator()(QJsonValue jv) + { + QJsonObject o = jv.toObject(); + GetAccount3PIDsJob::ThirdPartyIdentifier result; + result.medium = + fromJson<QString>(o.value("medium")); + result.address = + fromJson<QString>(o.value("address")); + + return result; + } + }; +} // namespace QMatrixClient + +class GetAccount3PIDsJob::Private +{ + public: + QVector<ThirdPartyIdentifier> threepids; +}; + +GetAccount3PIDsJob::GetAccount3PIDsJob() + : BaseJob(HttpVerb::Get, "GetAccount3PIDsJob", + basePath % "/account/3pid", + Query { } + ), d(new Private) +{ } + +GetAccount3PIDsJob::~GetAccount3PIDsJob() +{ + delete d; +} + +const QVector<GetAccount3PIDsJob::ThirdPartyIdentifier>& GetAccount3PIDsJob::threepids() const +{ + return d->threepids; +} + +BaseJob::Status GetAccount3PIDsJob::parseJson(const QJsonDocument& data) +{ + auto json = data.object(); + d->threepids = fromJson<QVector<ThirdPartyIdentifier>>(json.value("threepids")); + return Success; +} + +Post3PIDsJob::ThreePidCredentials::operator QJsonObject() const +{ + QJsonObject o; + o.insert("client_secret", toJson(clientSecret)); + o.insert("id_server", toJson(idServer)); + o.insert("sid", toJson(sid)); + + return o; +} +namespace QMatrixClient +{ + template <> struct FromJson<Post3PIDsJob::ThreePidCredentials> + { + Post3PIDsJob::ThreePidCredentials operator()(QJsonValue jv) + { + QJsonObject o = jv.toObject(); + Post3PIDsJob::ThreePidCredentials result; + result.clientSecret = + fromJson<QString>(o.value("client_secret")); + result.idServer = + fromJson<QString>(o.value("id_server")); + result.sid = + fromJson<QString>(o.value("sid")); + + return result; + } + }; +} // namespace QMatrixClient + +Post3PIDsJob::Post3PIDsJob(const ThreePidCredentials& threePidCreds, bool bind) + : BaseJob(HttpVerb::Post, "Post3PIDsJob", + basePath % "/account/3pid", + Query { } + ) +{ + QJsonObject _data; + _data.insert("three_pid_creds", toJson(threePidCreds)); + _data.insert("bind", toJson(bind)); + setRequestData(_data); +} + +RequestTokenTo3PIDJob::RequestTokenTo3PIDJob() + : BaseJob(HttpVerb::Post, "RequestTokenTo3PIDJob", + basePath % "/account/3pid/email/requestToken", + Query { }, Data { }, false + ) +{ } + |