Exemplo de RestSharp ASYNC client.ExecuteAsync <T> () funciona

Alguém poderia me ajudar a modificar o código abaixo:

client.ExecuteAsync(request, response => {
    Console.WriteLine(response.Content);
});

Basicamente eu quero usar o método ExecuteAsync acima, mas não quero imprimir, mas retornar response.Content para o chamador.

Existe alguma maneira fácil de conseguir isso?

Eu tentei isso, mas não funciona:

    public T Execute<T>(RestRequest request) where T : new()
        {
            var client = new RestClient();
            client.BaseUrl = BaseUrl;
            client.Authenticator = new HttpBasicAuthenticator(_accountSid, _secretKey);
            request.AddParameter("AccountSid", _accountSid, ParameterType.UrlSegment); // used on every request
            var response = client.ExecuteAsync(request, response => {
    return response.data);
});

}

O código acima é dehttps://github.com/restsharp/RestSharp

questionAnswers(3)

yourAnswerToTheQuestion