File tree Expand file tree Collapse file tree 1 file changed +29
-10
lines changed
src/templates/core/mappersmith Expand file tree Collapse file tree 1 file changed +29
-10
lines changed Original file line number Diff line number Diff line change 1
- import forge, { Client } from 'mappersmith';
1
+ import forge, { Response } from 'mappersmith';
2
+ {{!--import forge, { Client, Response } from 'mappersmith';--}}
3
+ {{ #each services }}
4
+ {{ #if imports }}
5
+ {{ #each imports }}
6
+ import type { {{{ this }}} } from '../models/{{{ this }}} ';
7
+ {{ /each }}
8
+ {{ /if }}
9
+ {{ /each }}
10
+ {{!----}}
11
+ {{!--export type {{{clientName}}}Resource = {--}}
12
+ {{!--{{#each services}}--}}
13
+ {{!-- {{name}}: {--}}
14
+ {{!-- {{#each operations}}--}}
15
+ {{!-- {{name}}: {--}}
16
+ {{!-- method: '{{method}}';--}}
17
+ {{!-- path: '{{path}}';--}}
18
+ {{!-- };--}}
19
+ {{!-- {{/each}}--}}
20
+ {{!-- };--}}
21
+ {{!--{{/each}}--}}
22
+ {{!--};--}}
2
23
3
- export type {{{ clientName }}} Resource = {
24
+ export type {{{ clientName }}} Client = {
4
25
{{ #each services }}
5
26
{{ name }} : {
6
27
{{ #each operations }}
7
- {{ name }} : {
8
- method: '{{ method }} ';
9
- path: '{{ path }} ';
10
- };
28
+ {{ name }} : (params: { {{> parameters }} }) => Promise<Response <{{> result }} >>,
11
29
{{ /each }}
12
- };
30
+ },
13
31
{{ /each }}
14
32
};
15
33
16
- export const {{{ camelCase clientName }}} MappersmithClientFactory = (host: string): Client<{{{clientName}}}Resource > =>
34
+ {{!--export const {{{camelCase clientName}}}MappersmithClientFactory = (host: string): Client<{{{clientName}}}Resource> =>--}}
35
+ export const {{{ camelCase clientName }}} MappersmithClientFactory = (host: string) =>
17
36
forge({
18
37
clientId: '{{ clientName }} ',
19
38
host,
20
39
resources: {
21
40
{{ #each services }}
22
41
{{ name }} : {
23
42
{{ #each operations }}
24
- {{ name }} : { method: '{{ method }} ', path: '{{ path }} ' },
43
+ {{ name }} : { method: '{{ method }} ', path: '{{ path }} ', bodyAttr: 'requestBody' },
25
44
{{ /each }}
26
45
},
27
46
{{ /each }}
28
47
},
29
- });
48
+ }) as {{{ clientName }}} Client ;
You can’t perform that action at this time.
0 commit comments