aboutsummaryrefslogtreecommitdiff
path: root/jobs/generated/profile.cpp
blob: 9d20a480071adb7ad5434752f75ee5c9471e5e7c (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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
/******************************************************************************
 * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
 */


#include "profile.h"

#include "jobs/converters.h"
#include <QtCore/QStringBuilder>

using namespace QMatrixClient;

static const auto basePath = QStringLiteral("/_matrix/client/r0");

SetDisplayNameJob::SetDisplayNameJob(QString userId, QString displayname)
    : BaseJob(HttpVerb::Put, "SetDisplayNameJob",
        basePath % "/profile/" % userId % "/displayname",
        Query { },
        Data {
            { "displayname", toJson(displayname) }
        }
    )
{ }

class GetDisplayNameJob::Private
{
    public:
        QString displayname;
        
};

GetDisplayNameJob::GetDisplayNameJob(QString userId)
    : BaseJob(HttpVerb::Get, "GetDisplayNameJob",
        basePath % "/profile/" % userId % "/displayname",
        Query { },
        Data { }
    ), d(new Private)
{ }

GetDisplayNameJob::~GetDisplayNameJob()
{
    delete d;
}

const QString& GetDisplayNameJob::displayname() const
{
    return d->displayname;
}

BaseJob::Status GetDisplayNameJob::parseJson(const QJsonDocument& data)
{
    auto json = data.object();
    
    d->displayname = fromJson<QString>(json.value("displayname"));

    return Success;
}

SetAvatarUrlJob::SetAvatarUrlJob(QString userId, QString avatar_url)
    : BaseJob(HttpVerb::Put, "SetAvatarUrlJob",
        basePath % "/profile/" % userId % "/avatar_url",
        Query { },
        Data {
            { "avatar_url", toJson(avatar_url) }
        }
    )
{ }

class GetAvatarUrlJob::Private
{
    public:
        QString avatar_url;
        
};

GetAvatarUrlJob::GetAvatarUrlJob(QString userId)
    : BaseJob(HttpVerb::Get, "GetAvatarUrlJob",
        basePath % "/profile/" % userId % "/avatar_url",
        Query { },
        Data { }
    ), d(new Private)
{ }

GetAvatarUrlJob::~GetAvatarUrlJob()
{
    delete d;
}

const QString& GetAvatarUrlJob::avatar_url() const
{
    return d->avatar_url;
}

BaseJob::Status GetAvatarUrlJob::parseJson(const QJsonDocument& data)
{
    auto json = data.object();
    
    d->avatar_url = fromJson<QString>(json.value("avatar_url"));

    return Success;
}

class GetUserProfileJob::Private
{
    public:
        QString avatar_url;
        QString displayname;
        
};

GetUserProfileJob::GetUserProfileJob(QString userId)
    : BaseJob(HttpVerb::Get, "GetUserProfileJob",
        basePath % "/profile/" % userId,
        Query { },
        Data { }
    ), d(new Private)
{ }

GetUserProfileJob::~GetUserProfileJob()
{
    delete d;
}

const QString& GetUserProfileJob::avatar_url() const
{
    return d->avatar_url;
}

const QString& GetUserProfileJob::displayname() const
{
    return d->displayname;
}

BaseJob::Status GetUserProfileJob::parseJson(const QJsonDocument& data)
{
    auto json = data.object();
    
    d->avatar_url = fromJson<QString>(json.value("avatar_url"));

    d->displayname = fromJson<QString>(json.value("displayname"));

    return Success;
}