aboutsummaryrefslogtreecommitdiff
path: root/lib/csapi/message_pagination.cpp
blob: 0b2c99cec91a6736991f721048d18a912d51b8b6 (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
40
41
42
/******************************************************************************
 * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
 */

#include "message_pagination.h"

using namespace Quotient;

auto queryToGetRoomEvents(const QString& from, const QString& to,
                          const QString& dir, Omittable<int> limit,
                          const QString& filter)
{
    QUrlQuery _q;
    addParam<IfNotEmpty>(_q, QStringLiteral("from"), from);
    addParam<IfNotEmpty>(_q, QStringLiteral("to"), to);
    addParam<>(_q, QStringLiteral("dir"), dir);
    addParam<IfNotEmpty>(_q, QStringLiteral("limit"), limit);
    addParam<IfNotEmpty>(_q, QStringLiteral("filter"), filter);
    return _q;
}

QUrl GetRoomEventsJob::makeRequestUrl(QUrl baseUrl, const QString& roomId,
                                      const QString& dir, const QString& from,
                                      const QString& to, Omittable<int> limit,
                                      const QString& filter)
{
    return BaseJob::makeRequestUrl(
        std::move(baseUrl),
        makePath("/_matrix/client/v3", "/rooms/", roomId, "/messages"),
        queryToGetRoomEvents(from, to, dir, limit, filter));
}

GetRoomEventsJob::GetRoomEventsJob(const QString& roomId, const QString& dir,
                                   const QString& from, const QString& to,
                                   Omittable<int> limit, const QString& filter)
    : BaseJob(HttpVerb::Get, QStringLiteral("GetRoomEventsJob"),
              makePath("/_matrix/client/v3", "/rooms/", roomId, "/messages"),
              queryToGetRoomEvents(from, to, dir, limit, filter))
{
    addExpectedKey("start");
    addExpectedKey("chunk");
}