From a0fa3b2ed9b68847c74282263aded11acaaa0678 Mon Sep 17 00:00:00 2001 From: Matt Richardson Date: Wed, 19 Jun 2024 13:50:55 +1000 Subject: [PATCH] Re-instate old methods, but as obsolete --- src/RestSharp/Options/RestClientOptions.cs | 10 ++++++++++ src/RestSharp/RestClient.Extensions.cs | 7 ++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/RestSharp/Options/RestClientOptions.cs b/src/RestSharp/Options/RestClientOptions.cs index b251a3115..5e924d09f 100644 --- a/src/RestSharp/Options/RestClientOptions.cs +++ b/src/RestSharp/Options/RestClientOptions.cs @@ -181,6 +181,16 @@ public RestClientOptions(string baseUrl) : this(new Uri(Ensure.NotEmptyString(ba /// public CookieContainer? CookieContainer { get; set; } + /// + /// Maximum request duration in milliseconds. When the request timeout is specified using , + /// the lowest value between the client timeout and request timeout will be used. + /// + [Obsolete("Use Timeout instead.")] + public int MaxTimeout { + get => (int) (Timeout?.TotalMilliseconds ?? 0); + set => Timeout = TimeSpan.FromMilliseconds(value); + } + /// /// Request duration. Used when the request timeout is not specified using , /// diff --git a/src/RestSharp/RestClient.Extensions.cs b/src/RestSharp/RestClient.Extensions.cs index 7e16487a7..27997aa01 100644 --- a/src/RestSharp/RestClient.Extensions.cs +++ b/src/RestSharp/RestClient.Extensions.cs @@ -20,7 +20,12 @@ namespace RestSharp; [PublicAPI] public static partial class RestClientExtensions { [PublicAPI] - public static ValueTask> Deserialize(this IRestClient client, RestResponse response, CancellationToken cancellationToken) + [Obsolete("Please use the async overload with a cancellation token")] + public static RestResponse Deserialize(this IRestClient client, RestResponse response) + => AsyncHelpers.RunSync(() => client.Serializers.Deserialize(response.Request, response, client.Options, CancellationToken.None).AsTask()); + + [PublicAPI] + public static ValueTask> Deserialize(this IRestClient client, RestResponse response, CancellationToken cancellationToken) => client.Serializers.Deserialize(response.Request, response, client.Options, cancellationToken); ///