1
0
Fork 0
mirror of https://github.com/HenkKalkwater/harbour-sailfin.git synced 2024-11-22 17:25:17 +00:00
harbour-sailfin/core/codegen/loader_implementation.hbs

37 lines
1.1 KiB
Handlebars
Raw Normal View History

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