Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-instate old methods, but as obsolete #2228

Merged
merged 1 commit into from
Jul 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading