Skip to content

Commit

Permalink
Re-instate old methods, but as obsolete (#2228)
Browse files Browse the repository at this point in the history
  • Loading branch information
matt-richardson authored Jul 4, 2024
1 parent a9ccd53 commit dd52ff6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/RestSharp/Options/RestClientOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,16 @@ public RestClientOptions(string baseUrl) : this(new Uri(Ensure.NotEmptyString(ba
/// </summary>
public CookieContainer? CookieContainer { get; set; }

/// <summary>
/// Maximum request duration in milliseconds. When the request timeout is specified using <seealso cref="RestRequest.Timeout"/>,
/// the lowest value between the client timeout and request timeout will be used.
/// </summary>
[Obsolete("Use Timeout instead.")]
public int MaxTimeout {
get => (int) (Timeout?.TotalMilliseconds ?? 0);
set => Timeout = TimeSpan.FromMilliseconds(value);
}

/// <summary>
/// Request duration. Used when the request timeout is not specified using <seealso cref="RestRequest.Timeout"/>,
/// </summary>
Expand Down
7 changes: 6 additions & 1 deletion src/RestSharp/RestClient.Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@ namespace RestSharp;
[PublicAPI]
public static partial class RestClientExtensions {
[PublicAPI]
public static ValueTask<RestResponse<T>> Deserialize<T>(this IRestClient client, RestResponse response, CancellationToken cancellationToken)
[Obsolete("Please use the async overload with a cancellation token")]
public static RestResponse<T> Deserialize<T>(this IRestClient client, RestResponse response)
=> AsyncHelpers.RunSync(() => client.Serializers.Deserialize<T>(response.Request, response, client.Options, CancellationToken.None).AsTask());

[PublicAPI]
public static ValueTask<RestResponse<T>> Deserialize<T>(this IRestClient client, RestResponse response, CancellationToken cancellationToken)
=> client.Serializers.Deserialize<T>(response.Request, response, client.Options, cancellationToken);

/// <summary>
Expand Down

0 comments on commit dd52ff6

Please sign in to comment.