public async Task SearchForCSharpRepositories()
    {
        var request = new SearchRepositoriesRequest("csharp");
        var repos = await _gitHubClient.Search.SearchRepo(request);

        Assert.NotEmpty(repos.Items);
    }
Exemple #2
0
        public async Task<IReadOnlyList<Repository>> SearchAsync(string term)
        {
            var search = new SearchRepositoriesRequest("caliburn")
            {
                Language = Language.CSharp,
                PerPage = 25
            };

            var results = await gitHubClient.Search.SearchRepo(search);

            return results.Items;
        }
        private static void Main()
        {
            var buildFolder = GetBuildFolder();

            var searchClient = new SearchClient(new ApiConnection(new Connection(new ProductHeaderValue("test"))));
            var searchRepositoriesRequest = new SearchRepositoriesRequest
            {
                Language = Language.CSharp,
                Forks = Range.GreaterThan(400) // 15 gets 75 projects for F#
            };

            var searchRepositoryResult =
                searchClient.SearchRepo(searchRepositoriesRequest)
                    .Result.Items.ToList();

            DownloadProjectsFromGitHub(searchRepositoryResult, buildFolder);

            AttemptToBuildProjects(buildFolder);

            Console.WriteLine("Finished. Press any key.");
            Console.ReadKey();
        }
 /// <summary>
 /// search repos
 /// http://developer.github.com/v3/search/#search-repositories
 /// </summary>
 /// <param name="search"></param>
 /// <returns>List of repos</returns>
 public Task <IReadOnlyList <Repository> > SearchRepo(SearchRepositoriesRequest search)
 {
     Ensure.ArgumentNotNull(search, "search");
     return(ApiConnection.GetAll <Repository>(ApiUrls.SearchRepositories(), search.Parameters));
 }
 public Task <SearchRepositoryResult> SearchRepo(SearchRepositoriesRequest search)
 {
     Ensure.ArgumentNotNull(search, nameof(search));
     return(ApiConnection.Get <SearchRepositoryResult>(ApiUrls.SearchRepositories(), search.Parameters));
 }
 /// <summary>
 /// search repos
 /// http://developer.github.com/v3/search/#search-repositories
 /// </summary>
 /// <param name="search"></param>
 /// <returns>List of repos</returns>
 public Task<SearchRepositoryResult> SearchRepo(SearchRepositoriesRequest search)
 {
     Ensure.ArgumentNotNull(search, "search");
     return ApiConnection.Get<SearchRepositoryResult>(ApiUrls.SearchRepositories(), search.Parameters);
 }
Exemple #7
0
        public async Task<ActionResult> Stats()
        {
            var vm = new StatsViewModel();

            var issueSearch = new SearchIssuesRequest
            {
                Comments = Range.GreaterThan(25),
                Created = DateRange.GreaterThan(new DateTime(DateTime.Now.Year, 01, 01)),
                SortField = IssueSearchSort.Comments,
                Language = Language.Ruby,
                Order = SortDirection.Descending
            };
            var mostCommented = await _githubClient.Search.SearchIssues(issueSearch);
            vm.MostCommentedIssue = mostCommented.Items.OrderByDescending(x=> x.Comments).Take(10).ToList();

            var repoSearch = new SearchRepositoriesRequest
            {
                Created = DateRange.GreaterThan(new DateTime(DateTime.Now.Year, 01, 01)),
                Language = Language.CSharp,
                SortField = RepoSearchSort.Stars,
                Order = SortDirection.Descending
            };
            var mostStarred = await _githubClient.Search.SearchRepo(repoSearch);
            vm.MostStarred = mostStarred.Items.Take(10).ToList();

            var repo = new RepositoryCollection();
            repo.Add("rails", "rails");
            issueSearch = new SearchIssuesRequest
            {
                 Repos = repo,
                 Created = DateRange.GreaterThan(new DateTime(DateTime.Now.Year, 01, 01)),
            };
            var railsIssues = await _githubClient.Search.SearchIssues(issueSearch);
            var dic = new Dictionary<DayOfWeek, List<Issue>>();
            foreach (var issue in railsIssues.Items)
            {
                if(dic.ContainsKey(issue.CreatedAt.DayOfWeek))
                {
                    dic[issue.CreatedAt.DayOfWeek].Add(issue);
                }
                else
                {
                    dic.Add(issue.CreatedAt.DayOfWeek, new List<Issue> { issue });
                }
            }

            vm.RailsIssues = dic;

            return View(vm);
        }
Exemple #8
0
 /// <summary>
 /// search repos
 /// http://developer.github.com/v3/search/#search-repositories
 /// </summary>
 /// <param name="search"></param>
 /// <returns>List of repos</returns>
 public Task<IReadOnlyList<Repository>> SearchRepo(SearchRepositoriesRequest search)
 {
     Ensure.ArgumentNotNull(search, "search");
     return ApiConnection.GetAll<Repository>(ApiUrls.SearchRepositories(), search.Parameters);
 }