diff options
author | n-peugnet <n.peugnet@free.fr> | 2022-10-06 19:27:24 +0200 |
---|---|---|
committer | n-peugnet <n.peugnet@free.fr> | 2022-10-06 19:27:24 +0200 |
commit | d911b207f49e936b3e992200796110f0749ed150 (patch) | |
tree | 96d20ebb4d074a4c1755e21cb316a52d584daee3 /gtad/operation.cpp.mustache | |
parent | 8ad8a74152c5701b6ca1f9a00487ba9257a439b4 (diff) | |
parent | 56c2f2e2b809b9077393eb617828f33d144f5634 (diff) | |
download | libquotient-d911b207f49e936b3e992200796110f0749ed150.tar.gz libquotient-d911b207f49e936b3e992200796110f0749ed150.zip |
New upstream version 0.7.0
Diffstat (limited to 'gtad/operation.cpp.mustache')
-rw-r--r-- | gtad/operation.cpp.mustache | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/gtad/operation.cpp.mustache b/gtad/operation.cpp.mustache new file mode 100644 index 00000000..4b75434c --- /dev/null +++ b/gtad/operation.cpp.mustache @@ -0,0 +1,59 @@ +{{! +SPDX-FileCopyrightText: 2020 Kitsune Ral <Kitsune-Ral@users.sf.net> +SPDX-License-Identifier: LGPL-2.1-or-later +}}{{>preamble}} +#include "{{filenameBase}}.h" + +using namespace Quotient; +{{#operations}}{{#operation}} + {{#queryParams?}} + +auto queryTo{{camelCaseOperationId}}( + {{#queryParams}}{{>joinedParamDef}}{{/queryParams}}) +{ + QUrlQuery _q;{{#queryParams}} + addParam<{{^required?}}IfNotEmpty{{/required?}}>(_q, + QStringLiteral("{{baseName}}"), {{paramName}});{{/queryParams}} + return _q; +} + {{/queryParams?}} + {{^hasBody?}} + +QUrl {{camelCaseOperationId}}Job::makeRequestUrl(QUrl baseUrl{{#allParams?}}, + {{#allParams}}{{>joinedParamDef}}{{/allParams}}{{/allParams?}}) +{ + return BaseJob::makeRequestUrl(std::move(baseUrl), {{>passPathAndMaybeQuery}}); +} {{/hasBody?}} + +{{camelCaseOperationId}}Job::{{camelCaseOperationId}}Job( + {{#allParams}}{{>joinedParamDef}}{{/allParams}}) + : BaseJob(HttpVerb::{{#_cap}}{{#_tolower}}{{httpMethod}}{{/_tolower}}{{/_cap}}, + {{!object name}}QStringLiteral("{{camelCaseOperationId}}Job"), + {{>passPathAndMaybeQuery}} + {{#skipAuth}}{{#queryParams?}}, {}{{/queryParams?}}, false{{/skipAuth}} ) +{ {{#headerParams}} + setRequestHeader("{{baseName}}", {{paramName}}.toLatin1()); + {{/headerParams}}{{#inlineBody}}{{^propertyMap}}{{^bodyParams?}} + setRequestData({ {{#consumesNonJson?}}{{nameCamelCase}}{{/consumesNonJson? + }}{{^consumesNonJson?}}toJson({{nameCamelCase}}){{/consumesNonJson?}} }); + {{/bodyParams?}}{{/propertyMap}}{{/inlineBody + }}{{^consumesNonJson?}}{{#bodyParams?}} + QJsonObject _dataJson; + {{#propertyMap}} + fillJson(_dataJson, {{nameCamelCase}}); + {{/propertyMap}}{{#inlineBody}} + fillJson<{{>maybeOmittableType}}>(_dataJson, {{paramName}}); + {{/inlineBody}}{{#bodyParams}} + addParam<{{^required?}}IfNotEmpty{{/required?}}>(_dataJson, + QStringLiteral("{{baseName}}"), {{paramName}}); + {{/bodyParams}} + setRequestData({ _dataJson }); + {{/bodyParams?}}{{/consumesNonJson?}}{{#producesNonJson?}} + setExpectedContentTypes({ {{#produces}}"{{_}}"{{>cjoin}}{{/produces}} }); + {{/producesNonJson?}}{{^producesNonJson? + }}{{#responses}}{{#normalResponse?}}{{#properties}}{{#required?}} + addExpectedKey("{{baseName}}"); + {{/required?}}{{/properties}}{{/normalResponse?}}{{/responses + }}{{/producesNonJson?}} +} +{{/operation}}{{/operations}} |