diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2017-12-06 21:19:55 +0900 |
---|---|---|
committer | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2017-12-07 12:53:00 +0900 |
commit | f7e210bc04bdb45b05f3c75237001b8e51198242 (patch) | |
tree | c97f3bf7655c508b74aeb391ec02dbd2d18da61f /jobs/{{base}}.cpp.mustache | |
parent | e74de57832f684244d7da82fa743b63d459bf488 (diff) | |
download | libquotient-f7e210bc04bdb45b05f3c75237001b8e51198242.tar.gz libquotient-f7e210bc04bdb45b05f3c75237001b8e51198242.zip |
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).
Diffstat (limited to 'jobs/{{base}}.cpp.mustache')
-rw-r--r-- | jobs/{{base}}.cpp.mustache | 9 |
1 files changed, 5 insertions, 4 deletions
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() |