@@ -281,7 +281,6 @@ string summary
281281
282282 return BuildMethod (
283283 methodName ,
284- delegateType ,
285284 createMethod ,
286285 resultType ,
287286 resultResponseType ,
@@ -302,7 +301,6 @@ string summary
302301
303302 return BuildMethod (
304303 methodName ,
305- delegateType ,
306304 createMethod ,
307305 resultType ,
308306 resultResponseType ,
@@ -352,7 +350,6 @@ string summary
352350
353351 return BuildMethod (
354352 methodName ,
355- delegateType ,
356353 createMethod ,
357354 resultType ,
358355 resultResponseType ,
@@ -428,7 +425,6 @@ string summary
428425
429426 return BuildMethod (
430427 methodName ,
431- delegateType ,
432428 createMethod ,
433429 resultType ,
434430 resultResponseType ,
@@ -464,7 +460,6 @@ string summary
464460
465461 return BuildMethod (
466462 methodName ,
467- delegateType ,
468463 createMethod ,
469464 resultType ,
470465 resultResponseType ,
@@ -539,7 +534,6 @@ string summary
539534
540535 return BuildMethod (
541536 methodName ,
542- delegateType ,
543537 createMethod ,
544538 resultType ,
545539 resultResponseType ,
@@ -695,7 +689,6 @@ _ when responseType.StartsWith("List<", StringComparison.Ordinal) =>
695689
696690 private static ( string PublicMethod , string PrivateDelegate ) BuildMethod (
697691 string methodName ,
698- string delegateType ,
699692 string createMethod ,
700693 string resultType ,
701694 string resultResponseType ,
@@ -712,6 +705,9 @@ string summary
712705 ? string . Empty
713706 : $ "{ publicParams } ,";
714707
708+ // Derive delegate type name: CreatePost → PostAsync, CreateGet → GetAsync, etc.
709+ var delegateType = createMethod . Replace ( "Create" , string . Empty , StringComparison . Ordinal ) + "Async" ;
710+
715711 var privateDelegate = $$ """
716712 private static {{ delegateType }} <{{ resultResponseType }} , string, {{ paramType }} > {{ privateFunctionName }} { get; } =
717713 RestClient.Net.HttpClientFactoryExtensions.{{ createMethod }} <{{ resultResponseType }} , string, {{ paramType }} >(
@@ -727,8 +723,8 @@ string summary
727723 public static Task<{{ resultType }} > {{ methodName }} (
728724 this HttpClient httpClient,
729725 {{ paramsWithComma }}
730- CancellationToken ct = default
731- ) => {{ privateFunctionName }} (httpClient, {{ paramInvocation }} , ct );
726+ CancellationToken cancellationToken = default
727+ ) => {{ privateFunctionName }} (httpClient, {{ paramInvocation }} , cancellationToken );
732728 """ ;
733729
734730 return ( publicMethod , privateDelegate ) ;
0 commit comments