2021-03-25 16:32:00 +00:00
|
|
|
{{#if endpoint.hasSuccessResponse}}
|
|
|
|
|
2021-03-28 02:00:00 +00:00
|
|
|
using namespace {{dtoNamespace}};
|
|
|
|
|
2021-03-26 20:27:35 +00:00
|
|
|
{{className}}Loader::{{className}}Loader(ApiClient *apiClient)
|
2021-03-28 02:00:00 +00:00
|
|
|
: {{supportNamespace}}::HttpLoader<{{endpoint.resultType}}, {{endpoint.parameterType}}>(apiClient) {}
|
2021-03-25 16:32:00 +00:00
|
|
|
|
2021-03-26 20:27:35 +00:00
|
|
|
QString {{className}}Loader::path(const {{endpoint.parameterType}} ¶ms) const {
|
2021-03-25 16:32:00 +00:00
|
|
|
Q_UNUSED(params) // Might be overzealous, but I don't like theses kind of warnings
|
|
|
|
|
|
|
|
return {{pathStringInterpolation "params"}};
|
|
|
|
}
|
|
|
|
|
2021-03-26 20:27:35 +00:00
|
|
|
QUrlQuery {{className}}Loader::query(const {{endpoint.parameterType}} ¶ms) const {
|
2021-03-25 16:32:00 +00:00
|
|
|
Q_UNUSED(params) // Might be overzealous, but I don't like theses kind of warnings
|
|
|
|
|
|
|
|
QUrlQuery result;
|
|
|
|
|
|
|
|
{{#each endpoint.requiredQueryParameters as |p|}}
|
2021-03-28 02:00:00 +00:00
|
|
|
result.addQueryItem("{{p.name}}", Support::toString<{{p.type.typeNameWithQualifiers}}>(params.{{p.type.name}}()));
|
2021-03-25 16:32:00 +00:00
|
|
|
|
|
|
|
{{/each}}
|
|
|
|
|
|
|
|
// Optional parameters
|
|
|
|
|
|
|
|
{{#each endpoint.optionalQueryParameters as |p|}}
|
|
|
|
if (!params.{{p.type.name}}Null()) {
|
2021-03-28 02:00:00 +00:00
|
|
|
result.addQueryItem("{{p.name}}", Support::toString<{{p.type.typeNameWithQualifiers}}>(params.{{p.type.name}}()));
|
2021-03-25 16:32:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
{{/each}}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
{{/if}}
|