Beispiel #1
0
        public async Task <SearchCodeResult> Search(SearchCodeRequest search)
        {
            CheckInitialised();
            var repos = new RepositoryCollection();

            foreach (var repo in search.Repos)
            {
                repos.Add(repo.owner, repo.name);
            }

            var result = await _client.Search.SearchCode(
                new Octokit.SearchCodeRequest(search.Term)
            {
                Repos   = repos,
                In      = new[] { CodeInQualifier.Path },
                PerPage = search.PerPage
            });

            return(new SearchCodeResult(result.TotalCount));
        }
        public async Task <SearchCodeResult> Search(SearchCodeRequest search)
        {
            CheckInitialised();

            return(await ExceptionHandler(async() =>
            {
                var repos = new RepositoryCollection();
                foreach (var repo in search.Repos)
                {
                    repos.Add(repo.Owner, repo.Name);
                }
                var result = await _client.Search.SearchCode(
                    new Octokit.SearchCodeRequest()
                {
                    Repos = repos,
                    Extensions = search.Extensions,
                    In = new[] { CodeInQualifier.Path },
                    PerPage = search.PerPage
                });
                return new SearchCodeResult(result.TotalCount);
            }));
        }