aboutsummaryrefslogtreecommitdiff
path: root/lib/csapi/definitions/push_condition.cpp
blob: 343b4f1ab5ae0663e5d307fc4b6ea86867f785d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/******************************************************************************
 * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
 */

#include "push_condition.h"

using namespace Quotient;

void JsonObjectConverter<PushCondition>::dumpTo(QJsonObject& jo,
                                                const PushCondition& pod)
{
    addParam<>(jo, QStringLiteral("kind"), pod.kind);
    addParam<IfNotEmpty>(jo, QStringLiteral("key"), pod.key);
    addParam<IfNotEmpty>(jo, QStringLiteral("pattern"), pod.pattern);
    addParam<IfNotEmpty>(jo, QStringLiteral("is"), pod.is);
}

void JsonObjectConverter<PushCondition>::fillFrom(const QJsonObject& jo,
                                                  PushCondition& result)
{
    fromJson(jo.value("kind"_ls), result.kind);
    fromJson(jo.value("key"_ls), result.key);
    fromJson(jo.value("pattern"_ls), result.pattern);
    fromJson(jo.value("is"_ls), result.is);
}
lass="n">HttpVerb::Put, SetPresenceJobName, basePath % "/presence/" % userId % "/status") { QJsonObject _data; addParam<>(_data, QStringLiteral("presence"), presence); addParam<IfNotEmpty>(_data, QStringLiteral("status_msg"), statusMsg); setRequestData(_data); } class GetPresenceJob::Private { public: QString presence; Omittable<int> lastActiveAgo; QString statusMsg; Omittable<bool> currentlyActive; }; QUrl GetPresenceJob::makeRequestUrl(QUrl baseUrl, const QString& userId) { return BaseJob::makeRequestUrl(std::move(baseUrl), basePath % "/presence/" % userId % "/status"); } static const auto GetPresenceJobName = QStringLiteral("GetPresenceJob"); GetPresenceJob::GetPresenceJob(const QString& userId) : BaseJob(HttpVerb::Get, GetPresenceJobName, basePath % "/presence/" % userId % "/status") , d(new Private) { } GetPresenceJob::~GetPresenceJob() = default; const QString& GetPresenceJob::presence() const { return d->presence; } Omittable<int> GetPresenceJob::lastActiveAgo() const { return d->lastActiveAgo; } const QString& GetPresenceJob::statusMsg() const { return d->statusMsg; } Omittable<bool> GetPresenceJob::currentlyActive() const { return d->currentlyActive; } BaseJob::Status GetPresenceJob::parseJson(const QJsonDocument& data) { auto json = data.object(); if (!json.contains("presence"_ls)) return { JsonParseError, "The key 'presence' not found in the response" }; fromJson(json.value("presence"_ls), d->presence); fromJson(json.value("last_active_ago"_ls), d->lastActiveAgo); fromJson(json.value("status_msg"_ls), d->statusMsg); fromJson(json.value("currently_active"_ls), d->currentlyActive); return Success; } static const auto ModifyPresenceListJobName = QStringLiteral("ModifyPresenceListJob"); ModifyPresenceListJob::ModifyPresenceListJob(const QString& userId, const QStringList& invite, const QStringList& drop) : BaseJob(HttpVerb::Post, ModifyPresenceListJobName, basePath % "/presence/list/" % userId) { QJsonObject _data; addParam<IfNotEmpty>(_data, QStringLiteral("invite"), invite); addParam<IfNotEmpty>(_data, QStringLiteral("drop"), drop); setRequestData(_data); } class GetPresenceForListJob::Private { public: Events data; }; QUrl GetPresenceForListJob::makeRequestUrl(QUrl baseUrl, const QString& userId) { return BaseJob::makeRequestUrl(std::move(baseUrl), basePath % "/presence/list/" % userId); } static const auto GetPresenceForListJobName = QStringLiteral("GetPresenceForListJob"); GetPresenceForListJob::GetPresenceForListJob(const QString& userId) : BaseJob(HttpVerb::Get, GetPresenceForListJobName, basePath % "/presence/list/" % userId, false) , d(new Private) { } GetPresenceForListJob::~GetPresenceForListJob() = default; Events&& GetPresenceForListJob::data() { return std::move(d->data); } BaseJob::Status GetPresenceForListJob::parseJson(const QJsonDocument& data) { fromJson(data, d->data); return Success; }