Skip to content

Instantly share code, notes, and snippets.

@vmussak
Created February 12, 2019 00:35
Embed
What would you like to do?
public class TrelloController : Controller
{
//...continuação
public async Task<IActionResult> Index()
{
var model = await TrelloGetRequest<TrelloUser>("members/me?boards=all&organizations=all&");
return View("Index", model);
}
private async Task<T> TrelloGetRequest<T>(string url)
{
var request = await _httpClient.GetAsync($"{url}key={_apiKey}&token={_token}");
if (!request.IsSuccessStatusCode)
throw new Exception("Deu errado...");
var model = await request.Content.ReadAsAsync<T>();
return model;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment