public async Task ListRepos(IDialogContext context, LuisResult result) { string token = await ValidateLoggedInAsync(context); if (!string.IsNullOrEmpty(token)) { EntityRecommendation eScope; result.TryFindEntity("ScopeType::Scope", out eScope); IReadOnlyList <Repository> repos = await GitHubCommands.GetRepoList(token, eScope?.Entity); string msg; if (!repos.Any()) { msg = "You don't own any repos on GitHub."; } else { msg = repos.Aggregate($"You own the following {eScope?.Entity} repos: ", (current, repo) => current + Environment.NewLine + $"* [{repo.Name}]({repo.HtmlUrl})"); } await context.PostAsync(msg); } context.Wait(MessageReceived); }
private async Task GetRepo(IDialogContext context, string token, ResumeAfter <string> resume) { if (string.IsNullOrEmpty(_lastRepo)) { IReadOnlyList <Repository> list = await GitHubCommands.GetRepoList(token, string.Empty); IEnumerable <string> repos = list.Select(i => i.Name); PromptDialog.Choice(context, resume, repos, "Which repo are you asking about?", "I didn't catch that...try again?"); } else { await resume(context, Awaitable.FromItem(_lastRepo)); } }