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

#include "profile.h"

#include <QtCore/QStringBuilder>

using namespace Quotient;

SetDisplayNameJob::SetDisplayNameJob(const QString& userId,
                                     const QString& displayname)
    : BaseJob(HttpVerb::Put, QStringLiteral("SetDisplayNameJob"),
              QStringLiteral("/_matrix/client/r0") % "/profile/" % userId
                  % "/displayname")
{
    QJsonObject _data;
    addParam<>(_data, QStringLiteral("displayname"), displayname);
    setRequestData(std::move(_data));
}

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

GetDisplayNameJob::GetDisplayNameJob(const QString& userId)
    : BaseJob(HttpVerb::Get, QStringLiteral("GetDisplayNameJob"),
              QStringLiteral("/_matrix/client/r0") % "/profile/" % userId
                  % "/displayname",
              false)
{}

SetAvatarUrlJob::SetAvatarUrlJob(const QString& userId, const QUrl& avatarUrl)
    : BaseJob(HttpVerb::Put, QStringLiteral("SetAvatarUrlJob"),
              QStringLiteral("/_matrix/client/r0") % "/profile/" % userId
                  % "/avatar_url")
{
    QJsonObject _data;
    addParam<>(_data, QStringLiteral("avatar_url"), avatarUrl);
    setRequestData(std::move(_data));
}

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

GetAvatarUrlJob::GetAvatarUrlJob(const QString& userId)
    : BaseJob(HttpVerb::Get, QStringLiteral("GetAvatarUrlJob"),
              QStringLiteral("/_matrix/client/r0") % "/profile/" % userId
                  % "/avatar_url",
              false)
{}

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

GetUserProfileJob::GetUserProfileJob(const QString& userId)
    : BaseJob(HttpVerb::Get, QStringLiteral("GetUserProfileJob"),
              QStringLiteral("/_matrix/client/r0") % "/profile/" % userId, false)
{}