-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
/
api-header.mustache
89 lines (72 loc) · 2.22 KB
/
api-header.mustache
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
{{>licenseInfo}}
{{#operations}}/*
* {{classname}}.h
*
* {{description}}
*/
#ifndef {{classname}}_H_
#define {{classname}}_H_
{{{defaultInclude}}}
#include <memory>
#include <utility>
#include <corvusoft/restbed/session.hpp>
#include <corvusoft/restbed/resource.hpp>
#include <corvusoft/restbed/service.hpp>
{{#imports}}{{{import}}}
{{/imports}}
{{#apiNamespaceDeclarations}}
namespace {{this}} {
{{/apiNamespaceDeclarations}}
using namespace {{modelNamespace}};
class {{declspec}} {{classname}}: public restbed::Service
{
public:
{{classname}}();
~{{classname}}();
void startService(int const& port);
void stopService();
};
{{#operation}}
/// <summary>
/// {{summary}}
/// </summary>
/// <remarks>
/// {{notes}}
/// </remarks>
class {{declspec}} {{classname}}{{vendorExtensions.x-codegen-resourceName}}Resource: public restbed::Resource
{
public:
{{classname}}{{vendorExtensions.x-codegen-resourceName}}Resource();
virtual ~{{classname}}{{vendorExtensions.x-codegen-resourceName}}Resource();
void {{httpMethod}}_method_handler(const std::shared_ptr<restbed::Session> session);
{{#vendorExtensions.x-codegen-otherMethods}}
void {{httpMethod}}_method_handler(const std::shared_ptr<restbed::Session> session);
{{/vendorExtensions.x-codegen-otherMethods}}
void set_handler_{{httpMethod}}(
std::function<std::pair<int, std::string>(
{{#allParams}}{{{dataType}}} const &{{#hasMore}}, {{/hasMore}}{{/allParams}}
)> handler
);
{{#vendorExtensions.x-codegen-otherMethods}}
void set_handler_{{httpMethod}}(
std::function<std::pair<int, std::string>(
{{#allParams}}{{{dataType}}} const &{{#hasMore}}, {{/hasMore}}{{/allParams}}
)> handler
);
{{/vendorExtensions.x-codegen-otherMethods}}
private:
std::function<std::pair<int, std::string>(
{{#allParams}}{{{dataType}}} const &{{#hasMore}}, {{/hasMore}}{{/allParams}}
)> handler_{{httpMethod}}_;
{{#vendorExtensions.x-codegen-otherMethods}}
std::function<std::pair<int, std::string>(
{{#allParams}}{{{dataType}}} const &{{#hasMore}}, {{/hasMore}}{{/allParams}}
)> handler_{{httpMethod}}_;
{{/vendorExtensions.x-codegen-otherMethods}}
};
{{/operation}}
{{#apiNamespaceDeclarations}}
}
{{/apiNamespaceDeclarations}}
#endif /* {{classname}}_H_ */
{{/operations}}