Skip to content

Commit 7118401

Browse files
author
mkefd
committed
mappersmith
1 parent 95b3e70 commit 7118401

File tree

1 file changed

+29
-10
lines changed

1 file changed

+29
-10
lines changed
Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,48 @@
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+
{{!--};--}}
223

3-
export type {{{clientName}}}Resource = {
24+
export type {{{clientName}}}Client = {
425
{{#each services}}
526
{{name}}: {
627
{{#each operations}}
7-
{{name}}: {
8-
method: '{{method}}';
9-
path: '{{path}}';
10-
};
28+
{{name}}: (params: { {{>parameters}} }) => Promise<Response<{{>result}}>>,
1129
{{/each}}
12-
};
30+
},
1331
{{/each}}
1432
};
1533

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) =>
1736
forge({
1837
clientId: '{{clientName}}',
1938
host,
2039
resources: {
2140
{{#each services}}
2241
{{name}}: {
2342
{{#each operations}}
24-
{{name}}: { method: '{{method}}', path: '{{path}}' },
43+
{{name}}: { method: '{{method}}', path: '{{path}}', bodyAttr: 'requestBody' },
2544
{{/each}}
2645
},
2746
{{/each}}
2847
},
29-
});
48+
}) as {{{clientName}}}Client;

0 commit comments

Comments
 (0)