aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--jobs/basejob.cpp1
-rw-r--r--jobs/generated/administrative_contact.cpp21
-rw-r--r--jobs/generated/banning.cpp12
-rw-r--r--jobs/generated/directory.cpp21
-rw-r--r--jobs/generated/inviting.cpp6
-rw-r--r--jobs/generated/kicking.cpp6
-rw-r--r--jobs/generated/leaving.cpp14
-rw-r--r--jobs/generated/list_public_rooms.cpp32
-rw-r--r--jobs/generated/login.cpp7
-rw-r--r--jobs/generated/logout.cpp7
-rw-r--r--jobs/generated/profile.cpp36
-rw-r--r--jobs/generated/receipts.cpp6
-rw-r--r--jobs/generated/redaction.cpp7
-rw-r--r--jobs/generated/third_party_membership.cpp6
-rw-r--r--jobs/generated/typing.cpp6
-rw-r--r--jobs/generated/versions.cpp8
-rw-r--r--jobs/generated/whoami.cpp8
17 files changed, 76 insertions, 128 deletions
diff --git a/jobs/basejob.cpp b/jobs/basejob.cpp
index 74031909..dddff800 100644
--- a/jobs/basejob.cpp
+++ b/jobs/basejob.cpp
@@ -105,6 +105,7 @@ BaseJob::BaseJob(HttpVerb verb, const QString& name, const QString& endpoint,
: d(new Private(verb, endpoint, query, data, needsToken))
{
setObjectName(name);
+ setExpectedContentTypes({ "application/json" });
d->timer.setSingleShot(true);
connect (&d->timer, &QTimer::timeout, this, &BaseJob::timeout);
d->retryTimer.setSingleShot(true);
diff --git a/jobs/generated/administrative_contact.cpp b/jobs/generated/administrative_contact.cpp
index 584c447f..479bee52 100644
--- a/jobs/generated/administrative_contact.cpp
+++ b/jobs/generated/administrative_contact.cpp
@@ -44,10 +44,10 @@ class GetAccount3PIDsJob::Private
GetAccount3PIDsJob::GetAccount3PIDsJob()
: BaseJob(HttpVerb::Get, "GetAccount3PIDsJob",
- basePath % "/account/3pid",
- Query { }
- ), d(new Private)
-{ }
+ basePath % "/account/3pid")
+ , d(new Private)
+{
+}
GetAccount3PIDsJob::~GetAccount3PIDsJob() = default;
@@ -94,22 +94,17 @@ namespace QMatrixClient
Post3PIDsJob::Post3PIDsJob(const ThreePidCredentials& threePidCreds, bool bind)
: BaseJob(HttpVerb::Post, "Post3PIDsJob",
- basePath % "/account/3pid",
- Query { }
- )
+ basePath % "/account/3pid")
{
QJsonObject _data;
_data.insert("three_pid_creds", toJson(threePidCreds));
_data.insert("bind", toJson(bind));
setRequestData(_data);
-
- addExpectedContentType("application/json");
}
RequestTokenTo3PIDJob::RequestTokenTo3PIDJob()
: BaseJob(HttpVerb::Post, "RequestTokenTo3PIDJob",
- basePath % "/account/3pid/email/requestToken",
- Query { }, Data { }, false
- )
-{ }
+ basePath % "/account/3pid/email/requestToken", false)
+{
+}
diff --git a/jobs/generated/banning.cpp b/jobs/generated/banning.cpp
index b7888062..f66b27b6 100644
--- a/jobs/generated/banning.cpp
+++ b/jobs/generated/banning.cpp
@@ -14,29 +14,21 @@ static const auto basePath = QStringLiteral("/_matrix/client/r0");
BanJob::BanJob(const QString& roomId, const QString& userId, const QString& reason)
: BaseJob(HttpVerb::Post, "BanJob",
- basePath % "/rooms/" % roomId % "/ban",
- Query { }
- )
+ basePath % "/rooms/" % roomId % "/ban")
{
QJsonObject _data;
_data.insert("user_id", toJson(userId));
if (!reason.isEmpty())
_data.insert("reason", toJson(reason));
setRequestData(_data);
-
- addExpectedContentType("application/json");
}
UnbanJob::UnbanJob(const QString& roomId, const QString& userId)
: BaseJob(HttpVerb::Post, "UnbanJob",
- basePath % "/rooms/" % roomId % "/unban",
- Query { }
- )
+ basePath % "/rooms/" % roomId % "/unban")
{
QJsonObject _data;
_data.insert("user_id", toJson(userId));
setRequestData(_data);
-
- addExpectedContentType("application/json");
}
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)
+{
+}
diff --git a/jobs/generated/inviting.cpp b/jobs/generated/inviting.cpp
index 6cd67ad7..d2ee2107 100644
--- a/jobs/generated/inviting.cpp
+++ b/jobs/generated/inviting.cpp
@@ -14,14 +14,10 @@ static const auto basePath = QStringLiteral("/_matrix/client/r0");
InviteUserJob::InviteUserJob(const QString& roomId, const QString& userId)
: BaseJob(HttpVerb::Post, "InviteUserJob",
- basePath % "/rooms/" % roomId % "/invite",
- Query { }
- )
+ basePath % "/rooms/" % roomId % "/invite")
{
QJsonObject _data;
_data.insert("user_id", toJson(userId));
setRequestData(_data);
-
- addExpectedContentType("application/json");
}
diff --git a/jobs/generated/kicking.cpp b/jobs/generated/kicking.cpp
index bf94fe59..bf2490b7 100644
--- a/jobs/generated/kicking.cpp
+++ b/jobs/generated/kicking.cpp
@@ -14,16 +14,12 @@ static const auto basePath = QStringLiteral("/_matrix/client/r0");
KickJob::KickJob(const QString& roomId, const QString& userId, const QString& reason)
: BaseJob(HttpVerb::Post, "KickJob",
- basePath % "/rooms/" % roomId % "/kick",
- Query { }
- )
+ basePath % "/rooms/" % roomId % "/kick")
{
QJsonObject _data;
_data.insert("user_id", toJson(userId));
if (!reason.isEmpty())
_data.insert("reason", toJson(reason));
setRequestData(_data);
-
- addExpectedContentType("application/json");
}
diff --git a/jobs/generated/leaving.cpp b/jobs/generated/leaving.cpp
index 604fcc73..89c110dd 100644
--- a/jobs/generated/leaving.cpp
+++ b/jobs/generated/leaving.cpp
@@ -14,15 +14,13 @@ static const auto basePath = QStringLiteral("/_matrix/client/r0");
LeaveRoomJob::LeaveRoomJob(const QString& roomId)
: BaseJob(HttpVerb::Post, "LeaveRoomJob",
- basePath % "/rooms/" % roomId % "/leave",
- Query { }
- )
-{ }
+ basePath % "/rooms/" % roomId % "/leave")
+{
+}
ForgetRoomJob::ForgetRoomJob(const QString& roomId)
: BaseJob(HttpVerb::Post, "ForgetRoomJob",
- basePath % "/rooms/" % roomId % "/forget",
- Query { }
- )
-{ }
+ basePath % "/rooms/" % roomId % "/forget")
+{
+}
diff --git a/jobs/generated/list_public_rooms.cpp b/jobs/generated/list_public_rooms.cpp
index 1e775f1b..a2c0e406 100644
--- a/jobs/generated/list_public_rooms.cpp
+++ b/jobs/generated/list_public_rooms.cpp
@@ -68,14 +68,17 @@ class GetPublicRoomsJob::Private
GetPublicRoomsJob::GetPublicRoomsJob(double limit, const QString& since, const QString& server)
: BaseJob(HttpVerb::Get, "GetPublicRoomsJob",
- basePath % "/publicRooms",
- Query {
- { "limit", toJson(limit).toString() },
- { "since", toJson(since).toString() },
- { "server", toJson(server).toString() }
- }, Data { }, false
- ), d(new Private)
-{ }
+ basePath % "/publicRooms", false)
+ , d(new Private)
+{
+ QUrlQuery _q;
+ _q.addQueryItem("limit", QString("%1").arg(limit));
+ if (!since.isEmpty())
+ _q.addQueryItem("since", since);
+ if (!server.isEmpty())
+ _q.addQueryItem("server", server);
+ setRequestQuery(_q);
+}
GetPublicRoomsJob::~GetPublicRoomsJob() = default;
@@ -193,20 +196,19 @@ class QueryPublicRoomsJob::Private
QueryPublicRoomsJob::QueryPublicRoomsJob(const QString& server, double limit, const QString& since, const Filter& filter)
: BaseJob(HttpVerb::Post, "QueryPublicRoomsJob",
- basePath % "/publicRooms",
- Query {
- { "server", toJson(server).toString() }
- }
- ), d(new Private)
+ basePath % "/publicRooms")
+ , d(new Private)
{
+ QUrlQuery _q;
+ if (!server.isEmpty())
+ _q.addQueryItem("server", server);
+ setRequestQuery(_q);
QJsonObject _data;
_data.insert("limit", toJson(limit));
if (!since.isEmpty())
_data.insert("since", toJson(since));
_data.insert("filter", toJson(filter));
setRequestData(_data);
-
- addExpectedContentType("application/json");
}
QueryPublicRoomsJob::~QueryPublicRoomsJob() = default;
diff --git a/jobs/generated/login.cpp b/jobs/generated/login.cpp
index 67d991db..a4dab428 100644
--- a/jobs/generated/login.cpp
+++ b/jobs/generated/login.cpp
@@ -23,9 +23,8 @@ class LoginJob::Private
LoginJob::LoginJob(const QString& type, const QString& user, const QString& medium, const QString& address, const QString& password, const QString& token, const QString& deviceId, const QString& initialDeviceDisplayName)
: BaseJob(HttpVerb::Post, "LoginJob",
- basePath % "/login",
- Query { }, Data { }, false
- ), d(new Private)
+ basePath % "/login", false)
+ , d(new Private)
{
QJsonObject _data;
_data.insert("type", toJson(type));
@@ -44,8 +43,6 @@ LoginJob::LoginJob(const QString& type, const QString& user, const QString& medi
if (!initialDeviceDisplayName.isEmpty())
_data.insert("initial_device_display_name", toJson(initialDeviceDisplayName));
setRequestData(_data);
-
- addExpectedContentType("application/json");
}
LoginJob::~LoginJob() = default;
diff --git a/jobs/generated/logout.cpp b/jobs/generated/logout.cpp
index b6904070..f7f8eff9 100644
--- a/jobs/generated/logout.cpp
+++ b/jobs/generated/logout.cpp
@@ -14,8 +14,7 @@ static const auto basePath = QStringLiteral("/_matrix/client/r0");
LogoutJob::LogoutJob()
: BaseJob(HttpVerb::Post, "LogoutJob",
- basePath % "/logout",
- Query { }
- )
-{ }
+ basePath % "/logout")
+{
+}
diff --git a/jobs/generated/profile.cpp b/jobs/generated/profile.cpp
index b30b9a36..9523ca96 100644
--- a/jobs/generated/profile.cpp
+++ b/jobs/generated/profile.cpp
@@ -14,16 +14,12 @@ static const auto basePath = QStringLiteral("/_matrix/client/r0");
SetDisplayNameJob::SetDisplayNameJob(const QString& userId, const QString& displayname)
: BaseJob(HttpVerb::Put, "SetDisplayNameJob",
- basePath % "/profile/" % userId % "/displayname",
- Query { }
- )
+ basePath % "/profile/" % userId % "/displayname")
{
QJsonObject _data;
if (!displayname.isEmpty())
_data.insert("displayname", toJson(displayname));
setRequestData(_data);
-
- addExpectedContentType("application/json");
}
class GetDisplayNameJob::Private
@@ -34,10 +30,10 @@ class GetDisplayNameJob::Private
GetDisplayNameJob::GetDisplayNameJob(const QString& userId)
: BaseJob(HttpVerb::Get, "GetDisplayNameJob",
- basePath % "/profile/" % userId % "/displayname",
- Query { }, Data { }, false
- ), d(new Private)
-{ }
+ basePath % "/profile/" % userId % "/displayname", false)
+ , d(new Private)
+{
+}
GetDisplayNameJob::~GetDisplayNameJob() = default;
@@ -55,16 +51,12 @@ BaseJob::Status GetDisplayNameJob::parseJson(const QJsonDocument& data)
SetAvatarUrlJob::SetAvatarUrlJob(const QString& userId, const QString& avatarUrl)
: BaseJob(HttpVerb::Put, "SetAvatarUrlJob",
- basePath % "/profile/" % userId % "/avatar_url",
- Query { }
- )
+ basePath % "/profile/" % userId % "/avatar_url")
{
QJsonObject _data;
if (!avatarUrl.isEmpty())
_data.insert("avatar_url", toJson(avatarUrl));
setRequestData(_data);
-
- addExpectedContentType("application/json");
}
class GetAvatarUrlJob::Private
@@ -75,10 +67,10 @@ class GetAvatarUrlJob::Private
GetAvatarUrlJob::GetAvatarUrlJob(const QString& userId)
: BaseJob(HttpVerb::Get, "GetAvatarUrlJob",
- basePath % "/profile/" % userId % "/avatar_url",
- Query { }, Data { }, false
- ), d(new Private)
-{ }
+ basePath % "/profile/" % userId % "/avatar_url", false)
+ , d(new Private)
+{
+}
GetAvatarUrlJob::~GetAvatarUrlJob() = default;
@@ -103,10 +95,10 @@ class GetUserProfileJob::Private
GetUserProfileJob::GetUserProfileJob(const QString& userId)
: BaseJob(HttpVerb::Get, "GetUserProfileJob",
- basePath % "/profile/" % userId,
- Query { }, Data { }, false
- ), d(new Private)
-{ }
+ basePath % "/profile/" % userId, false)
+ , d(new Private)
+{
+}
GetUserProfileJob::~GetUserProfileJob() = default;
diff --git a/jobs/generated/receipts.cpp b/jobs/generated/receipts.cpp
index 20e58ffb..83c38b6f 100644
--- a/jobs/generated/receipts.cpp
+++ b/jobs/generated/receipts.cpp
@@ -14,12 +14,8 @@ static const auto basePath = QStringLiteral("/_matrix/client/r0");
PostReceiptJob::PostReceiptJob(const QString& roomId, const QString& receiptType, const QString& eventId, const QJsonObject& receipt)
: BaseJob(HttpVerb::Post, "PostReceiptJob",
- basePath % "/rooms/" % roomId % "/receipt/" % receiptType % "/" % eventId,
- Query { }
- )
+ basePath % "/rooms/" % roomId % "/receipt/" % receiptType % "/" % eventId)
{
setRequestData(Data(receipt));
-
- addExpectedContentType("application/json");
}
diff --git a/jobs/generated/redaction.cpp b/jobs/generated/redaction.cpp
index 218e1aa6..0da35dfc 100644
--- a/jobs/generated/redaction.cpp
+++ b/jobs/generated/redaction.cpp
@@ -20,16 +20,13 @@ class RedactEventJob::Private
RedactEventJob::RedactEventJob(const QString& roomId, const QString& eventId, const QString& txnId, const QString& reason)
: BaseJob(HttpVerb::Put, "RedactEventJob",
- basePath % "/rooms/" % roomId % "/redact/" % eventId % "/" % txnId,
- Query { }
- ), d(new Private)
+ basePath % "/rooms/" % roomId % "/redact/" % eventId % "/" % txnId)
+ , d(new Private)
{
QJsonObject _data;
if (!reason.isEmpty())
_data.insert("reason", toJson(reason));
setRequestData(_data);
-
- addExpectedContentType("application/json");
}
RedactEventJob::~RedactEventJob() = default;
diff --git a/jobs/generated/third_party_membership.cpp b/jobs/generated/third_party_membership.cpp
index f5ccf123..b637d481 100644
--- a/jobs/generated/third_party_membership.cpp
+++ b/jobs/generated/third_party_membership.cpp
@@ -14,16 +14,12 @@ static const auto basePath = QStringLiteral("/_matrix/client/r0");
InviteBy3PIDJob::InviteBy3PIDJob(const QString& roomId, const QString& idServer, const QString& medium, const QString& address)
: BaseJob(HttpVerb::Post, "InviteBy3PIDJob",
- basePath % "/rooms/" % roomId % "/invite",
- Query { }
- )
+ basePath % "/rooms/" % roomId % "/invite")
{
QJsonObject _data;
_data.insert("id_server", toJson(idServer));
_data.insert("medium", toJson(medium));
_data.insert("address", toJson(address));
setRequestData(_data);
-
- addExpectedContentType("application/json");
}
diff --git a/jobs/generated/typing.cpp b/jobs/generated/typing.cpp
index 05e5fd1e..fa700290 100644
--- a/jobs/generated/typing.cpp
+++ b/jobs/generated/typing.cpp
@@ -14,15 +14,11 @@ static const auto basePath = QStringLiteral("/_matrix/client/r0");
SetTypingJob::SetTypingJob(const QString& userId, const QString& roomId, bool typing, int timeout)
: BaseJob(HttpVerb::Put, "SetTypingJob",
- basePath % "/rooms/" % roomId % "/typing/" % userId,
- Query { }
- )
+ basePath % "/rooms/" % roomId % "/typing/" % userId)
{
QJsonObject _data;
_data.insert("typing", toJson(typing));
_data.insert("timeout", toJson(timeout));
setRequestData(_data);
-
- addExpectedContentType("application/json");
}
diff --git a/jobs/generated/versions.cpp b/jobs/generated/versions.cpp
index 8ff58365..938c1d34 100644
--- a/jobs/generated/versions.cpp
+++ b/jobs/generated/versions.cpp
@@ -20,10 +20,10 @@ class GetVersionsJob::Private
GetVersionsJob::GetVersionsJob()
: BaseJob(HttpVerb::Get, "GetVersionsJob",
- basePath % "/versions",
- Query { }, Data { }, false
- ), d(new Private)
-{ }
+ basePath % "/versions", false)
+ , d(new Private)
+{
+}
GetVersionsJob::~GetVersionsJob() = default;
diff --git a/jobs/generated/whoami.cpp b/jobs/generated/whoami.cpp
index d4da99d4..4f7b052c 100644
--- a/jobs/generated/whoami.cpp
+++ b/jobs/generated/whoami.cpp
@@ -20,10 +20,10 @@ class GetTokenOwnerJob::Private
GetTokenOwnerJob::GetTokenOwnerJob()
: BaseJob(HttpVerb::Get, "GetTokenOwnerJob",
- basePath % "/account/whoami",
- Query { }
- ), d(new Private)
-{ }
+ basePath % "/account/whoami")
+ , d(new Private)
+{
+}
GetTokenOwnerJob::~GetTokenOwnerJob() = default;