Skip to content

Commit

Permalink
csharp: fix return type of async void methods
Browse files Browse the repository at this point in the history
  • Loading branch information
olivier-lando committed Jul 24, 2024
1 parent 2d553fb commit 03c136e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions templates/csharp/api.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ namespace {{packageName}}.{{apiPackage}}
{{#isDeprecated}}
[Obsolete]
{{/isDeprecated}}
public {{#returnType}}Task<{{{returnType}}}>{{/returnType}}{{^returnType}}void{{/returnType}} {{operationId}}Async({{#allParams}}{{{dataType}}} {{paramName}}{{^required}}{{#optionalMethodArgument}} = default{{/optionalMethodArgument}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}}{{#vendorExtensions.x-client-chunk-upload}},IUploadProgressListener progressListener = null{{/vendorExtensions.x-client-chunk-upload}}, CancellationToken cancellationToken = default)
public {{#returnType}}Task<{{{returnType}}}>{{/returnType}}{{^returnType}}Task<ApiResponse<object>>{{/returnType}} {{operationId}}Async({{#allParams}}{{{dataType}}} {{paramName}}{{^required}}{{#optionalMethodArgument}} = default{{/optionalMethodArgument}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}}{{#vendorExtensions.x-client-chunk-upload}},IUploadProgressListener progressListener = null{{/vendorExtensions.x-client-chunk-upload}}, CancellationToken cancellationToken = default)
{
{{#returnType}}Task<ApiResponse<{{{returnType}}}>> localVarResponse = {{operationId}}WithHttpInfoAsync({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{#vendorExtensions.x-client-chunk-upload}},progressListener{{/vendorExtensions.x-client-chunk-upload}}, cancellationToken);
return localVarResponse.ContinueWith((Task<ApiResponse<{{{returnType}}}>> task) => task.Result.Data );
{{/returnType}}{{^returnType}}{{operationId}}WithHttpInfoAsync({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}, cancellationToken);{{/returnType}}
{{/returnType}}{{^returnType}}return {{operationId}}WithHttpInfoAsync({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}, cancellationToken);{{/returnType}}
}

/// <summary>
Expand Down

0 comments on commit 03c136e

Please sign in to comment.