@@ -46,6 +46,13 @@ public void WriteEndpointClassToBlock(TypeScriptBlock endpointBlock, WebApiContr
46
46
var controllerBlock = endpointBlock
47
47
. AddAndUseBlock ( $ "export { Config . NamespaceOrModuleName } { webApiController . Name } ") ;
48
48
49
+ TypeScriptBlock serviceBlock = null ;
50
+ if ( Config . GenerateService )
51
+ {
52
+ serviceBlock = controllerBlock
53
+ . AddAndUseBlock ( $ "export interface I{ webApiController . Name } Service") ;
54
+ }
55
+
49
56
var actions = webApiController . Actions ;
50
57
51
58
foreach ( var action in actions )
@@ -59,10 +66,16 @@ public void WriteEndpointClassToBlock(TypeScriptBlock endpointBlock, WebApiContr
59
66
60
67
WriteInterfaceToBlock ( interfaceBlock , action ) ;
61
68
62
- var interfaceWithCallBlock = controllerBlock
63
- . AddAndUseBlock ( $ "export interface I{ actionName } WithCall extends I{ actionName } , { IEndpoint } ") ;
69
+ if ( Config . GenerateService )
70
+ {
71
+ var interfaceWithCallBlock = controllerBlock
72
+ . AddAndUseBlock ( $ "export interface I{ actionName } WithCall extends I{ actionName } , { IEndpoint } ") ;
73
+
74
+ WriteInterfaceWithCallToBlock ( interfaceWithCallBlock , action ) ;
64
75
65
- WriteInterfaceWithCallToBlock ( interfaceWithCallBlock , action ) ;
76
+ serviceBlock
77
+ . AddStatement ( $ "{ actionName } : (args?: I{ actionName } ) => I{ actionName } WithCall") ;
78
+ }
66
79
67
80
var classBlock = controllerBlock
68
81
. AddAndUseBlock ( $ "export class { actionName } implements I{ actionName } , { IEndpoint } ")
0 commit comments