@@ -27,30 +27,31 @@ Type ReturnType
27
27
[ DebuggerDisplay ( "{MethodInfo}" ) ]
28
28
internal class RestMethodInfoInternal
29
29
{
30
- private int HeaderCollectionParameterIndex { get ; set ; }
31
- public string Name { get ; set ; }
32
- public Type Type { get ; set ; }
33
- public MethodInfo MethodInfo { get ; set ; }
34
- public HttpMethod HttpMethod { get ; set ; }
35
- public string RelativePath { get ; set ; }
36
- public bool IsMultipart { get ; private set ; }
30
+ private int HeaderCollectionParameterIndex { get ; }
31
+ private string Name => MethodInfo . Name ;
32
+ public Type Type { get ; }
33
+ public MethodInfo MethodInfo { get ; }
34
+ public HttpMethod HttpMethod { get ; }
35
+ public string RelativePath { get ; }
36
+ public bool IsMultipart { get ; }
37
37
public string MultipartBoundary { get ; private set ; }
38
- public ParameterInfo ? CancellationToken { get ; set ; }
39
- public UriFormat QueryUriFormat { get ; set ; }
40
- public Dictionary < string , string ? > Headers { get ; set ; }
41
- public Dictionary < int , string > HeaderParameterMap { get ; set ; }
42
- public Dictionary < int , string > PropertyParameterMap { get ; set ; }
43
- public Tuple < BodySerializationMethod , bool , int > ? BodyParameterInfo { get ; set ; }
44
- public Tuple < string , int > ? AuthorizeParameterInfo { get ; set ; }
45
- public Dictionary < int , string > QueryParameterMap { get ; set ; }
46
- public Dictionary < int , Tuple < string , string > > AttachmentNameMap { get ; set ; }
47
- public ParameterInfo [ ] ParameterInfoArray { get ; set ; }
48
- public Dictionary < int , RestMethodParameterInfo > ParameterMap { get ; set ; }
38
+ public RestMethodInfo RestMethodInfo { get ; }
39
+ public ParameterInfo ? CancellationToken { get ; }
40
+ public UriFormat QueryUriFormat { get ; }
41
+ public Dictionary < string , string ? > Headers { get ; }
42
+ public Dictionary < int , string > HeaderParameterMap { get ; }
43
+ public Dictionary < int , string > PropertyParameterMap { get ; }
44
+ public Tuple < BodySerializationMethod , bool , int > ? BodyParameterInfo { get ; }
45
+ public Tuple < string , int > ? AuthorizeParameterInfo { get ; }
46
+ public Dictionary < int , string > QueryParameterMap { get ; }
47
+ public Dictionary < int , Tuple < string , string > > AttachmentNameMap { get ; }
48
+ public ParameterInfo [ ] ParameterInfoArray { get ; }
49
+ public Dictionary < int , RestMethodParameterInfo > ParameterMap { get ; }
49
50
public List < ParameterFragment > FragmentPath { get ; set ; }
50
51
public Type ReturnType { get ; set ; }
51
52
public Type ReturnResultType { get ; set ; }
52
53
public Type DeserializedResultType { get ; set ; }
53
- public RefitSettings RefitSettings { get ; set ; }
54
+ public RefitSettings RefitSettings { get ; }
54
55
public bool IsApiResponse { get ; }
55
56
public bool ShouldDisposeResponse { get ; private set ; }
56
57
@@ -67,7 +68,6 @@ public RestMethodInfoInternal(
67
68
{
68
69
RefitSettings = refitSettings ?? new RefitSettings ( ) ;
69
70
Type = targetInterface ?? throw new ArgumentNullException ( nameof ( targetInterface ) ) ;
70
- Name = methodInfo . Name ;
71
71
MethodInfo = methodInfo ?? throw new ArgumentNullException ( nameof ( methodInfo ) ) ;
72
72
73
73
var hma = methodInfo . GetCustomAttributes ( true ) . OfType < HttpMethodAttribute > ( ) . First ( ) ;
@@ -97,7 +97,7 @@ public RestMethodInfoInternal(
97
97
98
98
Headers = ParseHeaders ( methodInfo ) ;
99
99
HeaderParameterMap = BuildHeaderParameterMap ( ParameterInfoArray ) ;
100
- HeaderCollectionParameterIndex = RestMethodInfoInternal . GetHeaderCollectionParameterIndex (
100
+ HeaderCollectionParameterIndex = GetHeaderCollectionParameterIndex (
101
101
ParameterInfoArray
102
102
) ;
103
103
PropertyParameterMap = BuildRequestPropertyMap ( ParameterInfoArray ) ;
@@ -164,6 +164,7 @@ public RestMethodInfoInternal(
164
164
) ;
165
165
}
166
166
167
+ RestMethodInfo = new RestMethodInfo ( Name , Type , MethodInfo , RelativePath , ReturnType ! ) ;
167
168
CancellationToken = ctParam ;
168
169
169
170
QueryUriFormat = methodInfo . GetCustomAttribute < QueryUriFormatAttribute > ( ) ? . UriFormat
@@ -216,9 +217,6 @@ static int GetHeaderCollectionParameterIndex(ParameterInfo[] parameterArray)
216
217
return headerIndex ;
217
218
}
218
219
219
- public RestMethodInfo ToRestMethodInfo ( ) =>
220
- new ( Name , Type , MethodInfo , RelativePath , ReturnType ) ;
221
-
222
220
static Dictionary < int , string > BuildRequestPropertyMap ( ParameterInfo [ ] parameterArray )
223
221
{
224
222
Dictionary < int , string > ? propertyMap = null ;
0 commit comments