Skip to content

Instantly share code, notes, and snippets.

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