aboutsummaryrefslogtreecommitdiff
path: root/lib/csapi/notifications.cpp
blob: a38e46f551c32fcbc8159a12afc2ae232308b0c4 (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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/******************************************************************************
 * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
 */

#include "notifications.h"

#include <QtCore/QStringBuilder>

using namespace Quotient;

auto queryToGetNotifications(const QString& from, Omittable<int> limit,
                             const QString& only)
{
    QUrlQuery _q;
    addParam<IfNotEmpty>(_q, QStringLiteral("from"), from);
    addParam<IfNotEmpty>(_q, QStringLiteral("limit"), limit);
    addParam<IfNotEmpty>(_q, QStringLiteral("only"), only);
    return _q;
}

QUrl GetNotificationsJob::makeRequestUrl(QUrl baseUrl, const QString& from,
                                         Omittable<int> limit,
                                         const QString& only)
{
    return BaseJob::makeRequestUrl(std::move(baseUrl),
                                   QStringLiteral("/_matrix/client/r0")
                                       % "/notifications",
                                   queryToGetNotifications(from, limit, only));
}

GetNotificationsJob::GetNotificationsJob(const QString& from,
                                         Omittable<int> limit,
                                         const QString& only)
    : BaseJob(HttpVerb::Get, QStringLiteral("GetNotificationsJob"),
              QStringLiteral("/_matrix/client/r0") % "/notifications",
              queryToGetNotifications(from, limit, only))
{
    addExpectedKey("notifications");
}