aboutsummaryrefslogtreecommitdiff
path: root/lib/csapi/knocking.cpp
blob: 4b56130071f085579e4f8e171e1c2fd84d86b95e (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
/******************************************************************************
 * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
 */

#include "knocking.h"

#include <QtCore/QStringBuilder>

using namespace Quotient;

auto queryToKnockRoom(const QStringList& serverName)
{
    BaseJob::Query _q;
    addParam<IfNotEmpty>(_q, QStringLiteral("server_name"), serverName);
    return _q;
}

KnockRoomJob::KnockRoomJob(const QString& roomIdOrAlias,
                           const QStringList& serverName, const QString& reason)
    : BaseJob(HttpVerb::Post, QStringLiteral("KnockRoomJob"),
              QStringLiteral("/_matrix/client/r0") % "/knock/" % roomIdOrAlias,
              queryToKnockRoom(serverName))
{
    QJsonObject _data;
    addParam<IfNotEmpty>(_data, QStringLiteral("reason"), reason);
    setRequestData(std::move(_data));
    addExpectedKey("room_id");
}