aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--jobs/generated/banning.cpp25
-rw-r--r--jobs/generated/inviting.cpp11
-rw-r--r--jobs/generated/kicking.cpp14
-rw-r--r--jobs/generated/leaving.cpp6
-rw-r--r--jobs/generated/logout.cpp3
-rw-r--r--jobs/generated/profile.cpp33
-rw-r--r--jobs/gtad.yaml7
-rw-r--r--jobs/{{base}}.cpp.mustache13
8 files changed, 60 insertions, 52 deletions
diff --git a/jobs/generated/banning.cpp b/jobs/generated/banning.cpp
index 9fc5810a..7efc2a85 100644
--- a/jobs/generated/banning.cpp
+++ b/jobs/generated/banning.cpp
@@ -15,21 +15,24 @@ static const auto basePath = QStringLiteral("/_matrix/client/r0");
BanJob::BanJob(QString roomId, QString user_id, QString reason)
: BaseJob(HttpVerb::Post, "BanJob",
basePath % "/rooms/" % roomId % "/ban",
- Query { },
- Data {
- { "user_id", toJson(user_id) },
- { "reason", toJson(reason) }
- }
+ Query { }
)
-{ }
+{
+ Data _data;
+ _data.insert("user_id", toJson(user_id));
+ if (!reason.isEmpty())
+ _data.insert("reason", toJson(reason));
+ setRequestData(_data);
+}
UnbanJob::UnbanJob(QString roomId, QString user_id)
: BaseJob(HttpVerb::Post, "UnbanJob",
basePath % "/rooms/" % roomId % "/unban",
- Query { },
- Data {
- { "user_id", toJson(user_id) }
- }
+ Query { }
)
-{ }
+{
+ Data _data;
+ _data.insert("user_id", toJson(user_id));
+ setRequestData(_data);
+}
diff --git a/jobs/generated/inviting.cpp b/jobs/generated/inviting.cpp
index 95ba658d..91760e57 100644
--- a/jobs/generated/inviting.cpp
+++ b/jobs/generated/inviting.cpp
@@ -15,10 +15,11 @@ static const auto basePath = QStringLiteral("/_matrix/client/r0");
InviteUserJob::InviteUserJob(QString roomId, QString user_id)
: BaseJob(HttpVerb::Post, "InviteUserJob",
basePath % "/rooms/" % roomId % "/invite",
- Query { },
- Data {
- { "user_id", toJson(user_id) }
- }
+ Query { }
)
-{ }
+{
+ Data _data;
+ _data.insert("user_id", toJson(user_id));
+ setRequestData(_data);
+}
diff --git a/jobs/generated/kicking.cpp b/jobs/generated/kicking.cpp
index 2e6797d6..1a544c39 100644
--- a/jobs/generated/kicking.cpp
+++ b/jobs/generated/kicking.cpp
@@ -15,11 +15,13 @@ static const auto basePath = QStringLiteral("/_matrix/client/r0");
KickJob::KickJob(QString roomId, QString user_id, QString reason)
: BaseJob(HttpVerb::Post, "KickJob",
basePath % "/rooms/" % roomId % "/kick",
- Query { },
- Data {
- { "user_id", toJson(user_id) },
- { "reason", toJson(reason) }
- }
+ Query { }
)
-{ }
+{
+ Data _data;
+ _data.insert("user_id", toJson(user_id));
+ if (!reason.isEmpty())
+ _data.insert("reason", toJson(reason));
+ setRequestData(_data);
+}
diff --git a/jobs/generated/leaving.cpp b/jobs/generated/leaving.cpp
index 7fed347b..a86714ac 100644
--- a/jobs/generated/leaving.cpp
+++ b/jobs/generated/leaving.cpp
@@ -15,16 +15,14 @@ static const auto basePath = QStringLiteral("/_matrix/client/r0");
LeaveRoomJob::LeaveRoomJob(QString roomId)
: BaseJob(HttpVerb::Post, "LeaveRoomJob",
basePath % "/rooms/" % roomId % "/leave",
- Query { },
- Data { }
+ Query { }
)
{ }
ForgetRoomJob::ForgetRoomJob(QString roomId)
: BaseJob(HttpVerb::Post, "ForgetRoomJob",
basePath % "/rooms/" % roomId % "/forget",
- Query { },
- Data { }
+ Query { }
)
{ }
diff --git a/jobs/generated/logout.cpp b/jobs/generated/logout.cpp
index b750efe2..b807012a 100644
--- a/jobs/generated/logout.cpp
+++ b/jobs/generated/logout.cpp
@@ -15,8 +15,7 @@ static const auto basePath = QStringLiteral("/_matrix/client/r0");
LogoutJob::LogoutJob()
: BaseJob(HttpVerb::Post, "LogoutJob",
basePath % "/logout",
- Query { },
- Data { }
+ Query { }
)
{ }
diff --git a/jobs/generated/profile.cpp b/jobs/generated/profile.cpp
index 9d20a480..7ef0577b 100644
--- a/jobs/generated/profile.cpp
+++ b/jobs/generated/profile.cpp
@@ -15,12 +15,14 @@ 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) }
- }
+ Query { }
)
-{ }
+{
+ Data _data;
+ if (!displayname.isEmpty())
+ _data.insert("displayname", toJson(displayname));
+ setRequestData(_data);
+}
class GetDisplayNameJob::Private
{
@@ -32,8 +34,7 @@ class GetDisplayNameJob::Private
GetDisplayNameJob::GetDisplayNameJob(QString userId)
: BaseJob(HttpVerb::Get, "GetDisplayNameJob",
basePath % "/profile/" % userId % "/displayname",
- Query { },
- Data { }
+ Query { }, Data { }, false
), d(new Private)
{ }
@@ -59,12 +60,14 @@ BaseJob::Status GetDisplayNameJob::parseJson(const QJsonDocument& data)
SetAvatarUrlJob::SetAvatarUrlJob(QString userId, QString avatar_url)
: BaseJob(HttpVerb::Put, "SetAvatarUrlJob",
basePath % "/profile/" % userId % "/avatar_url",
- Query { },
- Data {
- { "avatar_url", toJson(avatar_url) }
- }
+ Query { }
)
-{ }
+{
+ Data _data;
+ if (!avatar_url.isEmpty())
+ _data.insert("avatar_url", toJson(avatar_url));
+ setRequestData(_data);
+}
class GetAvatarUrlJob::Private
{
@@ -76,8 +79,7 @@ class GetAvatarUrlJob::Private
GetAvatarUrlJob::GetAvatarUrlJob(QString userId)
: BaseJob(HttpVerb::Get, "GetAvatarUrlJob",
basePath % "/profile/" % userId % "/avatar_url",
- Query { },
- Data { }
+ Query { }, Data { }, false
), d(new Private)
{ }
@@ -111,8 +113,7 @@ class GetUserProfileJob::Private
GetUserProfileJob::GetUserProfileJob(QString userId)
: BaseJob(HttpVerb::Get, "GetUserProfileJob",
basePath % "/profile/" % userId,
- Query { },
- Data { }
+ Query { }, Data { }, false
), d(new Private)
{ }
diff --git a/jobs/gtad.yaml b/jobs/gtad.yaml
index d09de66c..4877aeb5 100644
--- a/jobs/gtad.yaml
+++ b/jobs/gtad.yaml
@@ -24,7 +24,10 @@ types:
- //: double
boolean: bool
string:
- - byte: &QByteArray { type: QByteArray, imports: <QtCore/QByteArray> }
+ - byte: &QByteArray
+ type: QByteArray
+ string?: true
+ imports: <QtCore/QByteArray>
- binary: *QByteArray
- date:
type: QDate
@@ -34,7 +37,7 @@ types:
type: QDateTime
avoidCopy?: true
imports: <QtCore/QDateTime>
- - //: { type: QString, imports: <QtCore/QString> }
+ - //: { type: QString, "string?": true, imports: <QtCore/QString> }
file:
type: QByteArray
imports: <QtCore/QByteArray>
diff --git a/jobs/{{base}}.cpp.mustache b/jobs/{{base}}.cpp.mustache
index 45668d4c..f3a6dc59 100644
--- a/jobs/{{base}}.cpp.mustache
+++ b/jobs/{{base}}.cpp.mustache
@@ -39,13 +39,14 @@ class {{camelCaseOperationId}}Job::Private
Query {{^queryParams}}{ }{{/queryParams}}{{#queryParams?}}{
{{#queryParams}}{ "{{baseName}}", toJson({{paramName}}).toString() }{{#hasMore}},
{{/hasMore}}{{/queryParams}}
- }{{/queryParams?}},
- Data {{^bodyParams}}{ }{{/bodyParams}}{{#bodyParams?}}{
- {{#bodyParams}}{ "{{baseName}}", toJson({{paramName}}) }{{#hasMore}},
- {{/hasMore}}{{/bodyParams}}
- }{{/bodyParams?}}{{#skipAuth}}, false{{/skipAuth}}
+ }{{/queryParams?}}{{#skipAuth}}, Data { }, false{{/skipAuth}}
){{#responses}}{{#normalResponse?}}{{#properties?}}, d(new Private){{/properties?}}{{/normalResponse?}}{{/responses}}
-{ }
+{{#bodyParams?}}{
+ Data _data;{{#bodyParams}}
+{{^required?}}{{#string?}} if (!{{paramName}}.isEmpty())
+ {{/string?}}{{/required?}} _data.insert("{{baseName}}", toJson({{paramName}}));{{/bodyParams}}
+ setRequestData(_data);
+}{{/bodyParams?}}{{^bodyParams?}}{ }{{/bodyParams?}}
{{# responses}}{{#normalResponse?}}{{#properties?}}
{{camelCaseOperationId}}Job::~{{camelCaseOperationId}}Job()
{