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

35 lines
975 B
Handlebars

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