File tree Expand file tree Collapse file tree 8 files changed +27
-16
lines changed Expand file tree Collapse file tree 8 files changed +27
-16
lines changed Original file line number Diff line number Diff line change @@ -18,8 +18,8 @@ export const getOperationResponse = (
18
18
code : responseCode ,
19
19
description : response . description || null ,
20
20
export : 'generic' ,
21
- type : 'any' ,
22
- base : 'any' ,
21
+ type : responseCode === 204 ? 'undefined' : 'any' ,
22
+ base : responseCode === 204 ? 'undefined' : 'any' ,
23
23
template : null ,
24
24
link : null ,
25
25
isDefinition : false ,
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ export const getOperationResults = (operationResponses: OperationResponse[]): Op
15
15
// Filter out success response codes, but skip "204 No Content"
16
16
operationResponses . forEach ( operationResponse => {
17
17
const { code } = operationResponse ;
18
- if ( code && code !== 204 && code >= 200 && code < 300 ) {
18
+ if ( code && code >= 200 && code < 300 ) {
19
19
operationResults . push ( operationResponse ) ;
20
20
}
21
21
} ) ;
Original file line number Diff line number Diff line change @@ -19,8 +19,8 @@ export const getOperationResponse = (
19
19
code : responseCode ,
20
20
description : response . description || null ,
21
21
export : 'generic' ,
22
- type : 'any' ,
23
- base : 'any' ,
22
+ type : responseCode === 204 ? 'undefined' : 'any' ,
23
+ base : responseCode === 204 ? 'undefined' : 'any' ,
24
24
template : null ,
25
25
link : null ,
26
26
isDefinition : false ,
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ export const getOperationResults = (operationResponses: OperationResponse[]): Op
15
15
// Filter out success response codes, but skip "204 No Content"
16
16
operationResponses . forEach ( operationResponse => {
17
17
const { code } = operationResponse ;
18
- if ( code && code !== 204 && code >= 200 && code < 300 ) {
18
+ if ( code && code >= 200 && code < 300 ) {
19
19
operationResults . push ( operationResponse ) ;
20
20
}
21
21
} ) ;
Original file line number Diff line number Diff line change @@ -5,6 +5,21 @@ import type { HttpRequest } from './core';
5
5
import type { {{ #each imports }} {{{ this }}} ,{{ /each }} } from './models';
6
6
{{ /if }}
7
7
8
+ {{ #each operations }}
9
+ export interface {{ name }} Params {
10
+ {{ #each parameters }}
11
+ {{ #if description }}
12
+ /** {{{ escapeComment description }}} **/
13
+ {{ /if }}
14
+ {{{ name }}}{{> isRequired }} : {{> type }} ,
15
+ {{ /each }}
16
+ }
17
+
18
+ export type {{ name }} Result =
19
+ {{ #each results }} | {{> type }} {{ /each }} ;
20
+
21
+ {{ /each }}
22
+
8
23
9
24
export class {{{ name }}}{{{ @root.postfix }}} {
10
25
constructor(private readonly http: HttpRequest) {}
Original file line number Diff line number Diff line change 4
4
{{ #each parameters }}
5
5
{{{ name }}} {{ #if default }} = {{{ default }}} {{ /if }} ,
6
6
{{ /each }}
7
- }: {
8
- {{ #each parameters }}
9
- {{ #if description }}
10
- /** {{{ escapeComment description }}} **/
11
- {{ /if }}
12
- {{{ name }}}{{> isRequired }} : {{> type }} ,
13
- {{ /each }}
14
- }
7
+ }: {{{ name }}} Params
15
8
{{ ~else }}
16
9
17
10
{{ #each parameters }}
Original file line number Diff line number Diff line change 1
1
{{ ~#if results ~}}
2
- {{ #each results }} {{> type }} {{ #unless @last }} | {{ /unless }}{{ /each }}
2
+ {{ name }} Result
3
3
{{ ~else ~}}
4
4
void
5
5
{{ ~/if ~}}
Original file line number Diff line number Diff line change @@ -36,7 +36,10 @@ export const writeClientServices = async (
36
36
) ;
37
37
service . imports = Array . from ( new Set ( service . imports ) ) ;
38
38
service . operations = Array . from ( new Set ( service . operations ) ) ;
39
-
39
+ // console.dir(
40
+ // service.operations.filter(x => x.path === '/crm/v3/objects/companies/batch/archive'),
41
+ // { depth: 9 }
42
+ // );
40
43
const templateResult = templates . exports . service ( {
41
44
...service ,
42
45
useUnionTypes,
You can’t perform that action at this time.
0 commit comments