@@ -27,30 +27,31 @@ Type ReturnType
2727 [ DebuggerDisplay ( "{MethodInfo}" ) ]
2828 internal class RestMethodInfoInternal
2929 {
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 ; }
3737 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 ; }
4950 public List < ParameterFragment > FragmentPath { get ; set ; }
5051 public Type ReturnType { get ; set ; }
5152 public Type ReturnResultType { get ; set ; }
5253 public Type DeserializedResultType { get ; set ; }
53- public RefitSettings RefitSettings { get ; set ; }
54+ public RefitSettings RefitSettings { get ; }
5455 public bool IsApiResponse { get ; }
5556 public bool ShouldDisposeResponse { get ; private set ; }
5657
@@ -67,7 +68,6 @@ public RestMethodInfoInternal(
6768 {
6869 RefitSettings = refitSettings ?? new RefitSettings ( ) ;
6970 Type = targetInterface ?? throw new ArgumentNullException ( nameof ( targetInterface ) ) ;
70- Name = methodInfo . Name ;
7171 MethodInfo = methodInfo ?? throw new ArgumentNullException ( nameof ( methodInfo ) ) ;
7272
7373 var hma = methodInfo . GetCustomAttributes ( true ) . OfType < HttpMethodAttribute > ( ) . First ( ) ;
@@ -97,7 +97,7 @@ public RestMethodInfoInternal(
9797
9898 Headers = ParseHeaders ( methodInfo ) ;
9999 HeaderParameterMap = BuildHeaderParameterMap ( ParameterInfoArray ) ;
100- HeaderCollectionParameterIndex = RestMethodInfoInternal . GetHeaderCollectionParameterIndex (
100+ HeaderCollectionParameterIndex = GetHeaderCollectionParameterIndex (
101101 ParameterInfoArray
102102 ) ;
103103 PropertyParameterMap = BuildRequestPropertyMap ( ParameterInfoArray ) ;
@@ -164,6 +164,7 @@ public RestMethodInfoInternal(
164164 ) ;
165165 }
166166
167+ RestMethodInfo = new RestMethodInfo ( Name , Type , MethodInfo , RelativePath , ReturnType ! ) ;
167168 CancellationToken = ctParam ;
168169
169170 QueryUriFormat = methodInfo . GetCustomAttribute < QueryUriFormatAttribute > ( ) ? . UriFormat
@@ -216,9 +217,6 @@ static int GetHeaderCollectionParameterIndex(ParameterInfo[] parameterArray)
216217 return headerIndex ;
217218 }
218219
219- public RestMethodInfo ToRestMethodInfo ( ) =>
220- new ( Name , Type , MethodInfo , RelativePath , ReturnType ) ;
221-
222220 static Dictionary < int , string > BuildRequestPropertyMap ( ParameterInfo [ ] parameterArray )
223221 {
224222 Dictionary < int , string > ? propertyMap = null ;
0 commit comments