Could someone please help me modify the code below:
client.ExecuteAsync(request, response => {
Console.WriteLine(response.Content);
});
With the help of @spender, this is what i got:
You can add new file in RestSharp project, and add this code:
public partial class RestClient
{
public Task> ExecuteAsync(IRestRequest request)
{
var tcs=new TaskCompletionSource>();
this.ExecuteAsync(request, response =>
{
tcs.SetResult(
Deserialize(request, response)
);
});
return tcs.Task;
}
}
This will practically return the full response, with status code and everything, so you can check if the status of the response is OK before getting the content, and you can get the content with:
response.Content