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

#include "presence.h"

#include <QtCore/QStringBuilder>

using namespace Quotient;

SetPresenceJob::SetPresenceJob(const QString& userId, const QString& presence,
                               const QString& statusMsg)
    : BaseJob(HttpVerb::Put, QStringLiteral("SetPresenceJob"),
              QStringLiteral("/_matrix/client/r0") % "/presence/" % userId
                  % "/status")
{
    QJsonObject _data;
    addParam<>(_data, QStringLiteral("presence"), presence);
    addParam<IfNotEmpty>(_data, QStringLiteral("status_msg"), statusMsg);
    setRequestData(std::move(_data));
}

QUrl GetPresenceJob::makeRequestUrl(QUrl baseUrl, const QString& userId)
{
    return BaseJob::makeRequestUrl(std::move(baseUrl),
                                   QStringLiteral("/_matrix/client/r0")
                                       % "/presence/" % userId % "/status");
}

GetPresenceJob::GetPresenceJob(const QString& userId)
    : BaseJob(HttpVerb::Get, QStringLiteral("GetPresenceJob"),
              QStringLiteral("/_matrix/client/r0") % "/presence/" % userId
                  % "/status")
{
    addExpectedKey("presence");
}