From f7e210bc04bdb45b05f3c75237001b8e51198242 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Wed, 6 Dec 2017 21:19:55 +0900 Subject: Use new GTAD features: avoid copying of custom schemas; inline body where appropriate Body inlining is needed in content-repo cases and also cases with freeform JSON in the body (such as the one of upcoming PostReceiptJob). --- jobs/{{base}}.cpp.mustache | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'jobs/{{base}}.cpp.mustache') diff --git a/jobs/{{base}}.cpp.mustache b/jobs/{{base}}.cpp.mustache index 84bb2bea..b303c053 100644 --- a/jobs/{{base}}.cpp.mustache +++ b/jobs/{{base}}.cpp.mustache @@ -28,7 +28,7 @@ using namespace QMatrixClient; {{/trivial?}}{{/models.model}}{{#operations}} static const auto basePath = QStringLiteral("{{basePathWithoutHost}}"); {{# operation}}{{#models.model}}{{^trivial?}} -{{qualifiedName}}::operator QJsonValue() const +{{qualifiedName}}::operator QJsonObject() const { QJsonObject o; {{#vars}}o.insert("{{baseName}}", toJson({{nameCamelCase}})); @@ -49,7 +49,7 @@ namespace QMatrixClient return result; } }; -} +} // namespace QMatrixClient {{/ trivial?}}{{/models.model}}{{#responses}}{{#normalResponse?}}{{#properties?}} class {{camelCaseOperationId}}Job::Private { @@ -67,10 +67,11 @@ class {{camelCaseOperationId}}Job::Private }{{/queryParams?}}{{#skipAuth}}, Data { }, false{{/skipAuth}} ){{#responses}}{{#normalResponse?}}{{#properties?}}, d(new Private){{/properties?}}{{/normalResponse?}}{{/responses}} {{#bodyParams?}}{ - Data _data;{{#bodyParams}} +{{#inlineBody}} setRequestData(Data({{paramName}}));{{/inlineBody}}{{! +}}{{^inlineBody}} QJsonObject _data;{{#bodyParams}} {{^required?}}{{#string?}} if (!{{paramName}}.isEmpty()) {{/string?}}{{/required?}} _data.insert("{{baseName}}", toJson({{paramName}}));{{/bodyParams}} - setRequestData(_data); + setRequestData(_data);{{/inlineBody}} }{{/bodyParams?}}{{^bodyParams?}}{ }{{/bodyParams?}} {{# responses}}{{#normalResponse?}}{{#properties?}} {{camelCaseOperationId}}Job::~{{camelCaseOperationId}}Job() -- cgit v1.2.3