aboutsummaryrefslogtreecommitdiff
path: root/lib/csapi/relations.cpp
blob: 1d8febccb277d842d4f796a494044736e4e3da1a (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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
/******************************************************************************
 * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
 */

#include "relations.h"

using namespace Quotient;

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

QUrl GetRelatingEventsJob::makeRequestUrl(QUrl baseUrl, const QString& roomId,
                                          const QString& eventId,
                                          const QString& from, const QString& to,
                                          Omittable<int> limit,
                                          const QString& dir)
{
    return BaseJob::makeRequestUrl(std::move(baseUrl),
                                   makePath("/_matrix/client/v1", "/rooms/",
                                            roomId, "/relations/", eventId),
                                   queryToGetRelatingEvents(from, to, limit,
                                                            dir));
}

GetRelatingEventsJob::GetRelatingEventsJob(
    const QString& roomId, const QString& eventId, const QString& from,
    const QString& to, Omittable<int> limit, const QString& dir)
    : BaseJob(HttpVerb::Get, QStringLiteral("GetRelatingEventsJob"),
              makePath("/_matrix/client/v1", "/rooms/", roomId, "/relations/",
                       eventId),
              queryToGetRelatingEvents(from, to, limit, dir))
{
    addExpectedKey("chunk");
}

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

QUrl GetRelatingEventsWithRelTypeJob::makeRequestUrl(
    QUrl baseUrl, const QString& roomId, const QString& eventId,
    const QString& relType, const QString& from, const QString& to,
    Omittable<int> limit, const QString& dir)
{
    return BaseJob::makeRequestUrl(
        std::move(baseUrl),
        makePath("/_matrix/client/v1", "/rooms/", roomId, "/relations/",
                 eventId, "/", relType),
        queryToGetRelatingEventsWithRelType(from, to, limit, dir));
}

GetRelatingEventsWithRelTypeJob::GetRelatingEventsWithRelTypeJob(
    const QString& roomId, const QString& eventId, const QString& relType,
    const QString& from, const QString& to, Omittable<int> limit,
    const QString& dir)
    : BaseJob(HttpVerb::Get, QStringLiteral("GetRelatingEventsWithRelTypeJob"),
              makePath("/_matrix/client/v1", "/rooms/", roomId, "/relations/",
                       eventId, "/", relType),
              queryToGetRelatingEventsWithRelType(from, to, limit, dir))
{
    addExpectedKey("chunk");
}

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

QUrl GetRelatingEventsWithRelTypeAndEventTypeJob::makeRequestUrl(
    QUrl baseUrl, const QString& roomId, const QString& eventId,
    const QString& relType, const QString& eventType, const QString& from,
    const QString& to, Omittable<int> limit, const QString& dir)
{
    return BaseJob::makeRequestUrl(
        std::move(baseUrl),
        makePath("/_matrix/client/v1", "/rooms/", roomId, "/relations/",
                 eventId, "/", relType, "/", eventType),
        queryToGetRelatingEventsWithRelTypeAndEventType(from, to, limit, dir));
}

GetRelatingEventsWithRelTypeAndEventTypeJob::
    GetRelatingEventsWithRelTypeAndEventTypeJob(
        const QString& roomId, const QString& eventId, const QString& relType,
        const QString& eventType, const QString& from, const QString& to,
        Omittable<int> limit, const QString& dir)
    : BaseJob(HttpVerb::Get,
              QStringLiteral("GetRelatingEventsWithRelTypeAndEventTypeJob"),
              makePath("/_matrix/client/v1", "/rooms/", roomId, "/relations/",
                       eventId, "/", relType, "/", eventType),
              queryToGetRelatingEventsWithRelTypeAndEventType(from, to, limit,
                                                              dir))
{
    addExpectedKey("chunk");
}