-
Notifications
You must be signed in to change notification settings - Fork 2
/
SwaggerService_template.hbs
43 lines (42 loc) · 1.11 KB
/
SwaggerService_template.hbs
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
'use strict';
let ETHController = require("{{path_to_eth_connector}}/Controller.js");
{{#each methods}}
{{#ifEquals type "function"}}
{{#if constant}}
{{#ifHas ../allowed_methods (append 'get_' name)}}
/**
* @function
* @instance
* @param { {{name}}_get_params } {{name}}_get_params
* returns { Promise }
**/
exports.get_{{name}} = function({{name}}_get_params) {
return new ETHController().get_{{name}}(
{{name}}_get_params.from,
{{#each inputs}}
{{../name}}_get_params["{{#if name}}{{name}}{{else}}{{type}}{{/if}}"],
{{/each}}
);
};
{{/ifHas}}
{{else }}
{{#ifHas ../allowed_methods (append 'post_' name)}}
/**
* @function
* @instance
* @param { {{name}}_post_params } {{name}}_post_params
* returns { Promise }
**/
exports.post_{{name}} = function({{name}}_post_params) {
return new ETHController().post_{{name}}(
{{name}}_post_params.from,
{{#if payable}} {{name}}_get_params.value, {{/if}}
{{#each inputs}}
{{../name}}_post_params["{{#if name}}{{name}}{{else}}{{type}}{{/if}}"],
{{/each}}
);
};
{{/ifHas}}
{{/if}}
{{/ifEquals}}
{{/each}}