Skip to content

Commit 7f40ce0

Browse files
authored
Use interfaces for Polly retry policies (#20821)
This enables use of ResiliencePipelineBuilder which returns the interface when calling AsSyncPolicy / AsAsyncPolicy
1 parent 7d9e1ec commit 7f40ce0

15 files changed

Lines changed: 32 additions & 32 deletions

File tree

modules/openapi-generator/src/main/resources/csharp/RetryConfiguration.mustache

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,23 @@ namespace {{packageName}}.Client
1919
/// <summary>
2020
/// Retry policy
2121
/// </summary>
22-
public static Policy<RestResponse> RetryPolicy { get; set; }
22+
public static ISyncPolicy<RestResponse> RetryPolicy { get; set; }
2323

2424
/// <summary>
2525
/// Async retry policy
2626
/// </summary>
27-
public static AsyncPolicy<RestResponse> AsyncRetryPolicy { get; set; }
27+
public static IAsyncPolicy<RestResponse> AsyncRetryPolicy { get; set; }
2828
{{/useRestSharp}}
2929
{{#useHttpClient}}
3030
/// <summary>
3131
/// Retry policy
3232
/// </summary>
33-
public static Policy<HttpResponseMessage> RetryPolicy { get; set; }
33+
public static ISyncPolicy<HttpResponseMessage> RetryPolicy { get; set; }
3434

3535
/// <summary>
3636
/// Async retry policy
3737
/// </summary>
38-
public static AsyncPolicy<HttpResponseMessage> AsyncRetryPolicy { get; set; }
38+
public static IAsyncPolicy<HttpResponseMessage> AsyncRetryPolicy { get; set; }
3939
{{/useHttpClient}}
4040
}
4141
}

samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Client/RetryConfiguration.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ public static class RetryConfiguration
2222
/// <summary>
2323
/// Retry policy
2424
/// </summary>
25-
public static Policy<RestResponse> RetryPolicy { get; set; }
25+
public static ISyncPolicy<RestResponse> RetryPolicy { get; set; }
2626

2727
/// <summary>
2828
/// Async retry policy
2929
/// </summary>
30-
public static AsyncPolicy<RestResponse> AsyncRetryPolicy { get; set; }
30+
public static IAsyncPolicy<RestResponse> AsyncRetryPolicy { get; set; }
3131
}
3232
}

samples/client/others/csharp-complex-files/src/Org.OpenAPITools/Client/RetryConfiguration.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ public static class RetryConfiguration
2121
/// <summary>
2222
/// Retry policy
2323
/// </summary>
24-
public static Policy<RestResponse> RetryPolicy { get; set; }
24+
public static ISyncPolicy<RestResponse> RetryPolicy { get; set; }
2525

2626
/// <summary>
2727
/// Async retry policy
2828
/// </summary>
29-
public static AsyncPolicy<RestResponse> AsyncRetryPolicy { get; set; }
29+
public static IAsyncPolicy<RestResponse> AsyncRetryPolicy { get; set; }
3030
}
3131
}

samples/client/petstore/csharp/httpclient/net9/Petstore/src/Org.OpenAPITools/Client/RetryConfiguration.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ public static class RetryConfiguration
2121
/// <summary>
2222
/// Retry policy
2323
/// </summary>
24-
public static Policy<HttpResponseMessage> RetryPolicy { get; set; }
24+
public static ISyncPolicy<HttpResponseMessage> RetryPolicy { get; set; }
2525

2626
/// <summary>
2727
/// Async retry policy
2828
/// </summary>
29-
public static AsyncPolicy<HttpResponseMessage> AsyncRetryPolicy { get; set; }
29+
public static IAsyncPolicy<HttpResponseMessage> AsyncRetryPolicy { get; set; }
3030
}
3131
}

samples/client/petstore/csharp/httpclient/standard2.0/Petstore/src/Org.OpenAPITools/Client/RetryConfiguration.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ public static class RetryConfiguration
2121
/// <summary>
2222
/// Retry policy
2323
/// </summary>
24-
public static Policy<HttpResponseMessage> RetryPolicy { get; set; }
24+
public static ISyncPolicy<HttpResponseMessage> RetryPolicy { get; set; }
2525

2626
/// <summary>
2727
/// Async retry policy
2828
/// </summary>
29-
public static AsyncPolicy<HttpResponseMessage> AsyncRetryPolicy { get; set; }
29+
public static IAsyncPolicy<HttpResponseMessage> AsyncRetryPolicy { get; set; }
3030
}
3131
}

samples/client/petstore/csharp/restsharp/net4.7/MultipleFrameworks/src/Org.OpenAPITools/Client/RetryConfiguration.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ public static class RetryConfiguration
2121
/// <summary>
2222
/// Retry policy
2323
/// </summary>
24-
public static Policy<RestResponse> RetryPolicy { get; set; }
24+
public static ISyncPolicy<RestResponse> RetryPolicy { get; set; }
2525

2626
/// <summary>
2727
/// Async retry policy
2828
/// </summary>
29-
public static AsyncPolicy<RestResponse> AsyncRetryPolicy { get; set; }
29+
public static IAsyncPolicy<RestResponse> AsyncRetryPolicy { get; set; }
3030
}
3131
}

samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Client/RetryConfiguration.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ public static class RetryConfiguration
2121
/// <summary>
2222
/// Retry policy
2323
/// </summary>
24-
public static Policy<RestResponse> RetryPolicy { get; set; }
24+
public static ISyncPolicy<RestResponse> RetryPolicy { get; set; }
2525

2626
/// <summary>
2727
/// Async retry policy
2828
/// </summary>
29-
public static AsyncPolicy<RestResponse> AsyncRetryPolicy { get; set; }
29+
public static IAsyncPolicy<RestResponse> AsyncRetryPolicy { get; set; }
3030
}
3131
}

samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Client/RetryConfiguration.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ public static class RetryConfiguration
2121
/// <summary>
2222
/// Retry policy
2323
/// </summary>
24-
public static Policy<RestResponse> RetryPolicy { get; set; }
24+
public static ISyncPolicy<RestResponse> RetryPolicy { get; set; }
2525

2626
/// <summary>
2727
/// Async retry policy
2828
/// </summary>
29-
public static AsyncPolicy<RestResponse> AsyncRetryPolicy { get; set; }
29+
public static IAsyncPolicy<RestResponse> AsyncRetryPolicy { get; set; }
3030
}
3131
}

samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Client/RetryConfiguration.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ public static class RetryConfiguration
2121
/// <summary>
2222
/// Retry policy
2323
/// </summary>
24-
public static Policy<RestResponse> RetryPolicy { get; set; }
24+
public static ISyncPolicy<RestResponse> RetryPolicy { get; set; }
2525

2626
/// <summary>
2727
/// Async retry policy
2828
/// </summary>
29-
public static AsyncPolicy<RestResponse> AsyncRetryPolicy { get; set; }
29+
public static IAsyncPolicy<RestResponse> AsyncRetryPolicy { get; set; }
3030
}
3131
}

samples/client/petstore/csharp/restsharp/net8/ParameterMappings/src/Org.OpenAPITools/Client/RetryConfiguration.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ public static class RetryConfiguration
2121
/// <summary>
2222
/// Retry policy
2323
/// </summary>
24-
public static Policy<RestResponse> RetryPolicy { get; set; }
24+
public static ISyncPolicy<RestResponse> RetryPolicy { get; set; }
2525

2626
/// <summary>
2727
/// Async retry policy
2828
/// </summary>
29-
public static AsyncPolicy<RestResponse> AsyncRetryPolicy { get; set; }
29+
public static IAsyncPolicy<RestResponse> AsyncRetryPolicy { get; set; }
3030
}
3131
}

0 commit comments

Comments
 (0)