Skip to content

Commit 79fdb32

Browse files
committed
Moving to sync part
1 parent d43ce02 commit 79fdb32

13 files changed

+378
-324
lines changed

src/RestSharp/Request/RequestContent.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
using RestSharp.Extensions;
1818
using static RestSharp.KnownHeaders;
1919
// ReSharper disable InvertIf
20-
2120
// ReSharper disable SuggestBaseTypeForParameter
2221

2322
namespace RestSharp;

src/RestSharp/RestClient.Async.cs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,6 @@
1717
namespace RestSharp;
1818

1919
public partial class RestClient {
20-
/// <summary>
21-
/// Executes the request synchronously, authenticating if needed
22-
/// </summary>
23-
/// <param name="request">Request to be executed</param>
24-
public RestResponse Execute(RestRequest request) => AsyncHelpers.RunSync(() => ExecuteAsync(request));
25-
2620
/// <summary>
2721
/// Executes the request asynchronously, authenticating if needed
2822
/// </summary>
@@ -93,14 +87,6 @@ async Task<InternalResponse> ExecuteInternal(RestRequest request, CancellationTo
9387

9488
record InternalResponse(HttpResponseMessage? ResponseMessage, Uri Url, Exception? Exception, CancellationToken TimeoutToken);
9589

96-
/// <summary>
97-
/// A specialized method to download files as streams.
98-
/// </summary>
99-
/// <param name="request">Pre-configured request instance.</param>
100-
/// <returns>The downloaded stream.</returns>
101-
[PublicAPI]
102-
public Stream? DownloadStream(RestRequest request) => AsyncHelpers.RunSync(() => DownloadStreamAsync(request));
103-
10490
/// <summary>
10591
/// A specialized method to download files as streams.
10692
/// </summary>

src/RestSharp/RestClientExtensions.Json.cs

Lines changed: 0 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,6 @@
1919
namespace RestSharp;
2020

2121
public static partial class RestClientExtensions {
22-
/// <summary>
23-
/// Calls the URL specified in the <code>resource</code> parameter, expecting a JSON response back. Deserializes and returns the response.
24-
/// </summary>
25-
/// <param name="client">RestClient instance</param>
26-
/// <param name="resource">Resource URL</param>
27-
/// <typeparam name="TResponse">Response object type</typeparam>
28-
/// <returns>Deserialized response object</returns>
29-
public static TResponse? GetJson<TResponse>(
30-
this RestClient client,
31-
string resource)
32-
=> AsyncHelpers.RunSync(() => client.GetJsonAsync<TResponse>(resource));
33-
3422
/// <summary>
3523
/// Calls the URL specified in the <code>resource</code> parameter, expecting a JSON response back. Deserializes and returns the response.
3624
/// </summary>
@@ -44,20 +32,6 @@ public static partial class RestClientExtensions {
4432
return client.GetAsync<TResponse>(request, cancellationToken);
4533
}
4634

47-
/// <summary>
48-
/// Calls the URL specified in the <code>resource</code> parameter, expecting a JSON response back. Deserializes and returns the response.
49-
/// </summary>
50-
/// <param name="client">RestClient instance</param>
51-
/// <param name="resource">Resource URL</param>
52-
/// <param name="parameters">Parameters to pass to the request</param>
53-
/// <typeparam name="TResponse">Response object type</typeparam>
54-
/// <returns>Deserialized response object</returns>
55-
public static TResponse? GetJson<TResponse>(
56-
this RestClient client,
57-
string resource,
58-
object parameters)
59-
=> AsyncHelpers.RunSync(() => client.GetJsonAsync<TResponse>(resource, parameters));
60-
6135
/// <summary>
6236
/// Calls the URL specified in the <code>resource</code> parameter, expecting a JSON response back. Deserializes and returns the response.
6337
/// </summary>
@@ -84,23 +58,6 @@ public static partial class RestClientExtensions {
8458
return client.GetAsync<TResponse>(request, cancellationToken);
8559
}
8660

87-
/// <summary>
88-
/// Serializes the <code>request</code> object to JSON and makes a POST call to the resource specified in the <code>resource</code> parameter.
89-
/// Expects a JSON response back, deserializes it to <code>TResponse</code> type and returns it.
90-
/// </summary>
91-
/// <param name="client">RestClient instance</param>
92-
/// <param name="resource">Resource URL</param>
93-
/// <param name="request">Request object, must be serializable to JSON</param>
94-
/// <typeparam name="TRequest">Request object type</typeparam>
95-
/// <typeparam name="TResponse">Response object type</typeparam>
96-
/// <returns>Deserialized response object</returns>
97-
public static TResponse? PostJson<TRequest, TResponse>(
98-
this RestClient client,
99-
string resource,
100-
TRequest request
101-
) where TRequest : class
102-
=> AsyncHelpers.RunSync(() => client.PostJsonAsync<TRequest, TResponse>(resource, request));
103-
10461
/// <summary>
10562
/// Serializes the <code>request</code> object to JSON and makes a POST call to the resource specified in the <code>resource</code> parameter.
10663
/// Expects a JSON response back, deserializes it to <code>TResponse</code> type and returns it.
@@ -122,22 +79,6 @@ TRequest request
12279
return client.PostAsync<TResponse>(restRequest, cancellationToken);
12380
}
12481

125-
/// <summary>
126-
/// Serializes the <code>request</code> object to JSON and makes a POST call to the resource specified in the <code>resource</code> parameter.
127-
/// Expects no response back, just the status code.
128-
/// </summary>
129-
/// <param name="client">RestClient instance</param>
130-
/// <param name="resource">Resource URL</param>
131-
/// <param name="request">Request object, must be serializable to JSON</param>
132-
/// <typeparam name="TRequest">Request object type</typeparam>
133-
/// <returns>Response status code</returns>
134-
public static HttpStatusCode PostJson<TRequest>(
135-
this RestClient client,
136-
string resource,
137-
TRequest request
138-
) where TRequest : class
139-
=> AsyncHelpers.RunSync(() => client.PostJsonAsync(resource, request));
140-
14182
/// <summary>
14283
/// Serializes the <code>request</code> object to JSON and makes a POST call to the resource specified in the <code>resource</code> parameter.
14384
/// Expects no response back, just the status code.
@@ -159,23 +100,6 @@ public static async Task<HttpStatusCode> PostJsonAsync<TRequest>(
159100
return response.StatusCode;
160101
}
161102

162-
/// <summary>
163-
/// Serializes the <code>request</code> object to JSON and makes a PUT call to the resource specified in the <code>resource</code> parameter.
164-
/// Expects a JSON response back, deserializes it to <code>TResponse</code> type and returns it.
165-
/// </summary>
166-
/// <param name="client">RestClient instance</param>
167-
/// <param name="resource">Resource URL</param>
168-
/// <param name="request">Request object, must be serializable to JSON</param>
169-
/// <typeparam name="TRequest">Request object type</typeparam>
170-
/// <typeparam name="TResponse">Response object type</typeparam>
171-
/// <returns>Deserialized response object</returns>
172-
public static TResponse? PutJson<TRequest, TResponse>(
173-
this RestClient client,
174-
string resource,
175-
TRequest request
176-
) where TRequest : class
177-
=> AsyncHelpers.RunSync(() => client.PutJsonAsync<TRequest, TResponse>(resource, request));
178-
179103
/// <summary>
180104
/// Serializes the <code>request</code> object to JSON and makes a PUT call to the resource specified in the <code>resource</code> parameter.
181105
/// Expects a JSON response back, deserializes it to <code>TResponse</code> type and returns it.
@@ -197,22 +121,6 @@ TRequest request
197121
return client.PutAsync<TResponse>(restRequest, cancellationToken);
198122
}
199123

200-
/// <summary>
201-
/// Serializes the <code>request</code> object to JSON and makes a PUT call to the resource specified in the <code>resource</code> parameter.
202-
/// Expects no response back, just the status code.
203-
/// </summary>
204-
/// <param name="client">RestClient instance</param>
205-
/// <param name="resource">Resource URL</param>
206-
/// <param name="request">Request object, must be serializable to JSON</param>
207-
/// <typeparam name="TRequest">Request object type</typeparam>
208-
/// <returns>Response status code</returns>
209-
public static HttpStatusCode PutJson<TRequest>(
210-
this RestClient client,
211-
string resource,
212-
TRequest request
213-
) where TRequest : class
214-
=> AsyncHelpers.RunSync(() => client.PutJsonAsync(resource, request));
215-
216124
/// <summary>
217125
/// Serializes the <code>request</code> object to JSON and makes a PUT call to the resource specified in the <code>resource</code> parameter.
218126
/// Expects no response back, just the status code.

0 commit comments

Comments
 (0)