Use interfaces for Polly retry policies (#20821)

This enables use of ResiliencePipelineBuilder which returns the
interface when calling AsSyncPolicy / AsAsyncPolicy
This commit is contained in:
Jacob Ilsø 2025-03-12 09:49:03 +01:00 committed by GitHub
parent 7d9e1ecc22
commit 7f40ce0dd8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
15 changed files with 32 additions and 32 deletions

View File

@ -19,23 +19,23 @@ namespace {{packageName}}.Client
/// <summary> /// <summary>
/// Retry policy /// Retry policy
/// </summary> /// </summary>
public static Policy<RestResponse> RetryPolicy { get; set; } public static ISyncPolicy<RestResponse> RetryPolicy { get; set; }
/// <summary> /// <summary>
/// Async retry policy /// Async retry policy
/// </summary> /// </summary>
public static AsyncPolicy<RestResponse> AsyncRetryPolicy { get; set; } public static IAsyncPolicy<RestResponse> AsyncRetryPolicy { get; set; }
{{/useRestSharp}} {{/useRestSharp}}
{{#useHttpClient}} {{#useHttpClient}}
/// <summary> /// <summary>
/// Retry policy /// Retry policy
/// </summary> /// </summary>
public static Policy<HttpResponseMessage> RetryPolicy { get; set; } public static ISyncPolicy<HttpResponseMessage> RetryPolicy { get; set; }
/// <summary> /// <summary>
/// Async retry policy /// Async retry policy
/// </summary> /// </summary>
public static AsyncPolicy<HttpResponseMessage> AsyncRetryPolicy { get; set; } public static IAsyncPolicy<HttpResponseMessage> AsyncRetryPolicy { get; set; }
{{/useHttpClient}} {{/useHttpClient}}
} }
} }

View File

@ -22,11 +22,11 @@ namespace Org.OpenAPITools.Client
/// <summary> /// <summary>
/// Retry policy /// Retry policy
/// </summary> /// </summary>
public static Policy<RestResponse> RetryPolicy { get; set; } public static ISyncPolicy<RestResponse> RetryPolicy { get; set; }
/// <summary> /// <summary>
/// Async retry policy /// Async retry policy
/// </summary> /// </summary>
public static AsyncPolicy<RestResponse> AsyncRetryPolicy { get; set; } public static IAsyncPolicy<RestResponse> AsyncRetryPolicy { get; set; }
} }
} }

View File

@ -21,11 +21,11 @@ namespace Org.OpenAPITools.Client
/// <summary> /// <summary>
/// Retry policy /// Retry policy
/// </summary> /// </summary>
public static Policy<RestResponse> RetryPolicy { get; set; } public static ISyncPolicy<RestResponse> RetryPolicy { get; set; }
/// <summary> /// <summary>
/// Async retry policy /// Async retry policy
/// </summary> /// </summary>
public static AsyncPolicy<RestResponse> AsyncRetryPolicy { get; set; } public static IAsyncPolicy<RestResponse> AsyncRetryPolicy { get; set; }
} }
} }

View File

@ -21,11 +21,11 @@ namespace Org.OpenAPITools.Client
/// <summary> /// <summary>
/// Retry policy /// Retry policy
/// </summary> /// </summary>
public static Policy<HttpResponseMessage> RetryPolicy { get; set; } public static ISyncPolicy<HttpResponseMessage> RetryPolicy { get; set; }
/// <summary> /// <summary>
/// Async retry policy /// Async retry policy
/// </summary> /// </summary>
public static AsyncPolicy<HttpResponseMessage> AsyncRetryPolicy { get; set; } public static IAsyncPolicy<HttpResponseMessage> AsyncRetryPolicy { get; set; }
} }
} }

View File

@ -21,11 +21,11 @@ namespace Org.OpenAPITools.Client
/// <summary> /// <summary>
/// Retry policy /// Retry policy
/// </summary> /// </summary>
public static Policy<HttpResponseMessage> RetryPolicy { get; set; } public static ISyncPolicy<HttpResponseMessage> RetryPolicy { get; set; }
/// <summary> /// <summary>
/// Async retry policy /// Async retry policy
/// </summary> /// </summary>
public static AsyncPolicy<HttpResponseMessage> AsyncRetryPolicy { get; set; } public static IAsyncPolicy<HttpResponseMessage> AsyncRetryPolicy { get; set; }
} }
} }

View File

@ -21,11 +21,11 @@ namespace Org.OpenAPITools.Client
/// <summary> /// <summary>
/// Retry policy /// Retry policy
/// </summary> /// </summary>
public static Policy<RestResponse> RetryPolicy { get; set; } public static ISyncPolicy<RestResponse> RetryPolicy { get; set; }
/// <summary> /// <summary>
/// Async retry policy /// Async retry policy
/// </summary> /// </summary>
public static AsyncPolicy<RestResponse> AsyncRetryPolicy { get; set; } public static IAsyncPolicy<RestResponse> AsyncRetryPolicy { get; set; }
} }
} }

View File

@ -21,11 +21,11 @@ namespace Org.OpenAPITools.Client
/// <summary> /// <summary>
/// Retry policy /// Retry policy
/// </summary> /// </summary>
public static Policy<RestResponse> RetryPolicy { get; set; } public static ISyncPolicy<RestResponse> RetryPolicy { get; set; }
/// <summary> /// <summary>
/// Async retry policy /// Async retry policy
/// </summary> /// </summary>
public static AsyncPolicy<RestResponse> AsyncRetryPolicy { get; set; } public static IAsyncPolicy<RestResponse> AsyncRetryPolicy { get; set; }
} }
} }

View File

@ -21,11 +21,11 @@ namespace Org.OpenAPITools.Client
/// <summary> /// <summary>
/// Retry policy /// Retry policy
/// </summary> /// </summary>
public static Policy<RestResponse> RetryPolicy { get; set; } public static ISyncPolicy<RestResponse> RetryPolicy { get; set; }
/// <summary> /// <summary>
/// Async retry policy /// Async retry policy
/// </summary> /// </summary>
public static AsyncPolicy<RestResponse> AsyncRetryPolicy { get; set; } public static IAsyncPolicy<RestResponse> AsyncRetryPolicy { get; set; }
} }
} }

View File

@ -21,11 +21,11 @@ namespace Org.OpenAPITools.Client
/// <summary> /// <summary>
/// Retry policy /// Retry policy
/// </summary> /// </summary>
public static Policy<RestResponse> RetryPolicy { get; set; } public static ISyncPolicy<RestResponse> RetryPolicy { get; set; }
/// <summary> /// <summary>
/// Async retry policy /// Async retry policy
/// </summary> /// </summary>
public static AsyncPolicy<RestResponse> AsyncRetryPolicy { get; set; } public static IAsyncPolicy<RestResponse> AsyncRetryPolicy { get; set; }
} }
} }

View File

@ -21,11 +21,11 @@ namespace Org.OpenAPITools.Client
/// <summary> /// <summary>
/// Retry policy /// Retry policy
/// </summary> /// </summary>
public static Policy<RestResponse> RetryPolicy { get; set; } public static ISyncPolicy<RestResponse> RetryPolicy { get; set; }
/// <summary> /// <summary>
/// Async retry policy /// Async retry policy
/// </summary> /// </summary>
public static AsyncPolicy<RestResponse> AsyncRetryPolicy { get; set; } public static IAsyncPolicy<RestResponse> AsyncRetryPolicy { get; set; }
} }
} }

View File

@ -21,11 +21,11 @@ namespace Org.OpenAPITools.Client
/// <summary> /// <summary>
/// Retry policy /// Retry policy
/// </summary> /// </summary>
public static Policy<RestResponse> RetryPolicy { get; set; } public static ISyncPolicy<RestResponse> RetryPolicy { get; set; }
/// <summary> /// <summary>
/// Async retry policy /// Async retry policy
/// </summary> /// </summary>
public static AsyncPolicy<RestResponse> AsyncRetryPolicy { get; set; } public static IAsyncPolicy<RestResponse> AsyncRetryPolicy { get; set; }
} }
} }

View File

@ -21,11 +21,11 @@ namespace Org.OpenAPITools.Client
/// <summary> /// <summary>
/// Retry policy /// Retry policy
/// </summary> /// </summary>
public static Policy<RestResponse> RetryPolicy { get; set; } public static ISyncPolicy<RestResponse> RetryPolicy { get; set; }
/// <summary> /// <summary>
/// Async retry policy /// Async retry policy
/// </summary> /// </summary>
public static AsyncPolicy<RestResponse> AsyncRetryPolicy { get; set; } public static IAsyncPolicy<RestResponse> AsyncRetryPolicy { get; set; }
} }
} }

View File

@ -21,11 +21,11 @@ namespace Org.OpenAPITools.Client
/// <summary> /// <summary>
/// Retry policy /// Retry policy
/// </summary> /// </summary>
public static Policy<RestResponse> RetryPolicy { get; set; } public static ISyncPolicy<RestResponse> RetryPolicy { get; set; }
/// <summary> /// <summary>
/// Async retry policy /// Async retry policy
/// </summary> /// </summary>
public static AsyncPolicy<RestResponse> AsyncRetryPolicy { get; set; } public static IAsyncPolicy<RestResponse> AsyncRetryPolicy { get; set; }
} }
} }

View File

@ -21,11 +21,11 @@ namespace Org.OpenAPITools.Client
/// <summary> /// <summary>
/// Retry policy /// Retry policy
/// </summary> /// </summary>
public static Policy<RestResponse> RetryPolicy { get; set; } public static ISyncPolicy<RestResponse> RetryPolicy { get; set; }
/// <summary> /// <summary>
/// Async retry policy /// Async retry policy
/// </summary> /// </summary>
public static AsyncPolicy<RestResponse> AsyncRetryPolicy { get; set; } public static IAsyncPolicy<RestResponse> AsyncRetryPolicy { get; set; }
} }
} }

View File

@ -21,11 +21,11 @@ namespace Org.OpenAPITools.Client
/// <summary> /// <summary>
/// Retry policy /// Retry policy
/// </summary> /// </summary>
public static Policy<RestResponse> RetryPolicy { get; set; } public static ISyncPolicy<RestResponse> RetryPolicy { get; set; }
/// <summary> /// <summary>
/// Async retry policy /// Async retry policy
/// </summary> /// </summary>
public static AsyncPolicy<RestResponse> AsyncRetryPolicy { get; set; } public static IAsyncPolicy<RestResponse> AsyncRetryPolicy { get; set; }
} }
} }