Skip to content

Commit aa079d1

Browse files
committed
Another extension method
1 parent 7bb6fb0 commit aa079d1

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

RestSharp/RestClient.Async.cs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -107,16 +107,5 @@ private void ProcessResponse(HttpResponse httpResponse, RestRequestAsyncHandle a
107107
callback(restResponse, asyncHandle);
108108
});
109109
}
110-
111-
/// <summary>
112-
/// Executes the request and callback asynchronously, authenticating if needed
113-
/// </summary>
114-
/// <typeparam name="T">Target deserialization type</typeparam>
115-
/// <param name="request">Request to be executed</param>
116-
/// <param name="callback">Callback function to be executed upon completion providing access to the async handle</param>
117-
public virtual RestRequestAsyncHandle ExecuteAsync<T>(IRestRequest request, Action<RestResponse<T>> callback) where T : new()
118-
{
119-
return ExecuteAsync<T>(request, (response, asyncHandle) => callback(response));
120-
}
121110
}
122111
}

RestSharp/RestClientExtensions.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,17 @@ public static RestRequestAsyncHandle ExecuteAsync(this IRestClient client, IRest
1414
{
1515
return client.ExecuteAsync(request, (response, handle) => callback(response));
1616
}
17+
18+
/// <summary>
19+
/// Executes the request and callback asynchronously, authenticating if needed
20+
/// </summary>
21+
/// <param name="client">The IRestClient this method extends</param>
22+
/// <typeparam name="T">Target deserialization type</typeparam>
23+
/// <param name="request">Request to be executed</param>
24+
/// <param name="callback">Callback function to be executed upon completion providing access to the async handle</param>
25+
public static RestRequestAsyncHandle ExecuteAsync<T>(this IRestClient client, IRestRequest request, Action<RestResponse<T>> callback) where T : new()
26+
{
27+
return client.ExecuteAsync<T>(request, (response, asyncHandle) => callback(response));
28+
}
1729
}
1830
}

0 commit comments

Comments
 (0)