8
8
9
9
namespace Azure . Generator . Management . Utilities
10
10
{
11
- internal static class InputMethodExtensions
11
+ internal static class InputServiceMethodExtensions
12
12
{
13
13
public static bool IsLongRunningOperation ( this InputServiceMethod method )
14
14
{
15
15
return method is InputLongRunningServiceMethod || method is InputLongRunningPagingServiceMethod ;
16
16
}
17
17
18
- public static InputType ? GetResponseBodyInputType ( this InputServiceMethod method )
19
- {
20
- var operationResponses = method . Operation . Responses ;
21
- var response = operationResponses . FirstOrDefault ( r => ! r . IsErrorResponse ) ;
22
- return response ? . BodyType ;
23
- }
24
-
25
18
public static OperationFinalStateVia GetOperationFinalStateVia ( this InputServiceMethod method )
26
19
{
27
20
if ( method is InputLongRunningServiceMethod lroMethod )
@@ -35,16 +28,18 @@ public static OperationFinalStateVia GetOperationFinalStateVia(this InputService
35
28
return OperationFinalStateVia . Location ;
36
29
}
37
30
38
- public static CSharpType ? GetResponseBodyCSharpType ( this InputServiceMethod method )
31
+ public static CSharpType ? GetResponseBodyType ( this InputServiceMethod method )
39
32
{
40
- var responseBodyType = method . GetResponseBodyInputType ( ) ;
33
+ var operationResponses = method . Operation . Responses ;
34
+ var response = operationResponses . FirstOrDefault ( r => ! r . IsErrorResponse ) ;
35
+ var responseBodyType = response ? . BodyType ;
41
36
return responseBodyType is null ? null : ManagementClientGenerator . Instance . TypeFactory . CreateCSharpType ( responseBodyType ) ;
42
37
}
43
38
44
39
public static CSharpType GetOperationMethodReturnType ( this InputServiceMethod method , bool isAsync , CSharpType resourceClientCSharpType , CSharpType resourceDataType )
45
40
{
46
41
bool isLongRunningOperation = method . IsLongRunningOperation ( ) ;
47
- var responseBodyCSharpType = method . GetResponseBodyCSharpType ( ) ;
42
+ var responseBodyCSharpType = method . GetResponseBodyType ( ) ;
48
43
CSharpType rawReturnType = method . GetOperationMethodRawReturnType ( resourceClientCSharpType , resourceDataType ) ;
49
44
50
45
if ( isLongRunningOperation )
@@ -63,7 +58,7 @@ public static CSharpType GetOperationMethodReturnType(this InputServiceMethod me
63
58
64
59
private static CSharpType GetOperationMethodRawReturnType ( this InputServiceMethod method , CSharpType resourceClientCSharpType , CSharpType resourceDataType )
65
60
{
66
- var responseBodyCSharpType = method . GetResponseBodyCSharpType ( ) ;
61
+ var responseBodyCSharpType = method . GetResponseBodyType ( ) ;
67
62
CSharpType genericReturnType = resourceClientCSharpType ;
68
63
69
64
if ( responseBodyCSharpType is not null && responseBodyCSharpType != resourceDataType )
0 commit comments