aboutsummaryrefslogtreecommitdiff
path: root/jobs/generated/directory.cpp
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2018-01-05 19:46:41 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2018-01-05 19:57:52 +0900
commitccf2b4dd9d41b39167379669f035b45d656e3633 (patch)
treea6afb913b58409335809f8ea6a33dd7a16c3f2ca /jobs/generated/directory.cpp
parentea5cd86a9deacc9a6b57f1c432ad6e51e92de428 (diff)
downloadlibquotient-ccf2b4dd9d41b39167379669f035b45d656e3633.tar.gz
libquotient-ccf2b4dd9d41b39167379669f035b45d656e3633.zip
jobs: expect application/json by default; set query in constructor body; properly convert numbers to strings in query
The query should be set in constructor body because there's no reason to pass non-required parameters into the query. As for numbers to strings conversion - there was an attempt to use QJsonValue(a).toString() for that. That doesn't work; QJsonValue does not turn numbers to strings.
Diffstat (limited to 'jobs/generated/directory.cpp')
-rw-r--r--jobs/generated/directory.cpp21
1 files changed, 8 insertions, 13 deletions
diff --git a/jobs/generated/directory.cpp b/jobs/generated/directory.cpp
index ea6d493f..4e61ed74 100644
--- a/jobs/generated/directory.cpp
+++ b/jobs/generated/directory.cpp
@@ -14,16 +14,12 @@ static const auto basePath = QStringLiteral("/_matrix/client/r0/directory");
SetRoomAliasJob::SetRoomAliasJob(const QString& roomAlias, const QString& roomId)
: BaseJob(HttpVerb::Put, "SetRoomAliasJob",
- basePath % "/room/" % roomAlias,
- Query { }
- )
+ basePath % "/room/" % roomAlias)
{
QJsonObject _data;
if (!roomId.isEmpty())
_data.insert("room_id", toJson(roomId));
setRequestData(_data);
-
- addExpectedContentType("application/json");
}
class GetRoomIdByAliasJob::Private
@@ -35,10 +31,10 @@ class GetRoomIdByAliasJob::Private
GetRoomIdByAliasJob::GetRoomIdByAliasJob(const QString& roomAlias)
: BaseJob(HttpVerb::Get, "GetRoomIdByAliasJob",
- basePath % "/room/" % roomAlias,
- Query { }, Data { }, false
- ), d(new Private)
-{ }
+ basePath % "/room/" % roomAlias, false)
+ , d(new Private)
+{
+}
GetRoomIdByAliasJob::~GetRoomIdByAliasJob() = default;
@@ -62,8 +58,7 @@ BaseJob::Status GetRoomIdByAliasJob::parseJson(const QJsonDocument& data)
DeleteRoomAliasJob::DeleteRoomAliasJob(const QString& roomAlias)
: BaseJob(HttpVerb::Delete, "DeleteRoomAliasJob",
- basePath % "/room/" % roomAlias,
- Query { }
- )
-{ }
+ basePath % "/room/" % roomAlias)
+{
+}