-
Notifications
You must be signed in to change notification settings - Fork 266
Expand file tree
/
Copy pathapi_methods.cpp.j2
More file actions
28 lines (23 loc) · 1.2 KB
/
Copy pathapi_methods.cpp.j2
File metadata and controls
28 lines (23 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// Generated by `make api-generate`. Do not edit.
#include "tgbot/Api.h"
#include "tgbot/ApiCodec.h"
#include "tgbot/Types.h"
namespace TgBot {
{% for method in methods %}
{% if method.parameters %}
{{ method.return_type }} Api::{{ method.name }}({{ method.parameters[0].declaration_type }} {{ method.parameters[0].cpp_name }}{{ "," if method.parameters | length > 1 else "" }}
{% for parameter in method.parameters[1:] %}
{{ parameter.declaration_type }} {{ parameter.cpp_name }}{{ "," if not loop.last else "" }}
{% endfor %}) const {
{% else %}
{{ method.return_type }} Api::{{ method.name }}() const {
{% endif %}
return ApiResponse::{{ "decodeObjectOrTrue<Message>" if method.return_type != method.response_type else "decode<" + method.return_type + ">" }}(sendRequest(
"{{ method.name }}",
ApiRequest::makeFields(
{% for parameter in method.parameters %}
ApiRequest::{{ "required" if parameter.required or parameter.always_send else "optional" }}("{{ parameter.wire_name }}", {{ parameter.cpp_name }}{% if parameter.wire_default_value is not none %}, {{ parameter.wire_default_value }}{% endif %}){{ "," if not loop.last else "" }}
{% endfor %})));
}
{% endfor %}
} // namespace TgBot