aboutsummaryrefslogtreecommitdiff
path: root/gtad/operation.cpp.mustache
diff options
context:
space:
mode:
authorAndres Salomon <dilinger@queued.net>2021-01-18 04:00:14 -0500
committerAndres Salomon <dilinger@queued.net>2021-01-18 04:00:14 -0500
commit09eb39236666e81d5da014acea011dcd74d0999b (patch)
tree52876d96be71be1a39d5d935c1295a51995e8949 /gtad/operation.cpp.mustache
parentf1788ee27f33e9339334e0d79bde9a27d9ce2e44 (diff)
parenta4e78956f105875625b572d8b98459ffa86fafe5 (diff)
downloadlibquotient-09eb39236666e81d5da014acea011dcd74d0999b.tar.gz
libquotient-09eb39236666e81d5da014acea011dcd74d0999b.zip
Update upstream source from tag 'upstream/0.6.4'
Update to upstream version '0.6.4' with Debian dir aa8705fd74743e79c043bc9e3e425d5064404cfe
Diffstat (limited to 'gtad/operation.cpp.mustache')
-rw-r--r--gtad/operation.cpp.mustache58
1 files changed, 58 insertions, 0 deletions
diff --git a/gtad/operation.cpp.mustache b/gtad/operation.cpp.mustache
new file mode 100644
index 00000000..3c3396e9
--- /dev/null
+++ b/gtad/operation.cpp.mustache
@@ -0,0 +1,58 @@
+{{>preamble}}
+#include "{{filenameBase}}.h"
+
+#include <QtCore/QStringBuilder>
+
+using namespace Quotient;
+{{#operations}}{{#operation}}
+ {{#queryParams?}}
+
+auto queryTo{{camelCaseOperationId}}(
+ {{#queryParams}}{{>joinedParamDef}}{{/queryParams}})
+{
+ BaseJob::Query _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(Data({{#consumesNonJson?}}{{nameCamelCase}}{{/consumesNonJson?
+ }}{{^consumesNonJson?}}toJson({{nameCamelCase}}){{/consumesNonJson?}}));
+ {{/bodyParams?}}{{/propertyMap}}{{/inlineBody
+ }}{{^consumesNonJson?}}{{#bodyParams?}}
+ QJsonObject _data;
+ {{#propertyMap}}
+ fillJson(_data, {{nameCamelCase}});
+ {{/propertyMap}}{{#inlineBody}}
+ fillJson<{{>maybeOmittableType}}>(_data, {{paramName}});
+ {{/inlineBody}}{{#bodyParams}}
+ addParam<{{^required?}}IfNotEmpty{{/required?}}>(_data,
+ QStringLiteral("{{baseName}}"), {{paramName}});
+ {{/bodyParams}}
+ setRequestData(std::move(_data));
+ {{/bodyParams?}}{{/consumesNonJson?}}{{#producesNonJson?}}
+ setExpectedContentTypes({ {{#produces}}"{{_}}"{{>cjoin}}{{/produces}} });
+ {{/producesNonJson?}}{{^producesNonJson?
+ }}{{#responses}}{{#normalResponse?}}{{#properties}}{{#required?}}
+ addExpectedKey("{{baseName}}");
+ {{/required?}}{{/properties}}{{/normalResponse?}}{{/responses
+ }}{{/producesNonJson?}}
+}
+{{/operation}}{{/operations}}