Skip to content

Instantly share code, notes, and snippets.

@josephwoodward
Last active May 22, 2020 00:29
Show Gist options
  • Save josephwoodward/4b2f4abdbabc58ca63dbc53f634b3df2 to your computer and use it in GitHub Desktop.
Save josephwoodward/4b2f4abdbabc58ca63dbc53f634b3df2 to your computer and use it in GitHub Desktop.
[ApiController]
[Route("api/[controller]")]
public class ReposController : Controller
{
private readonly IGitHub _github;
public ReposController(IGitHub github)
{
_github = github;
}
[HttpGet]
public async Task<ICollection<string>> Get()
{
var repositories = await _github.GetRepositoriesAsync("weyland-yutani", count: 10);
var names = repositories.Select(repository => repository.Name).ToList();
names.Sort();
return names;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment