Example #1
0
        private static async Task LabelExamples(GitHubClient client)
        {
            Repository repository = await client.Repository.Get("octokit", "octokit.net");

            SearchLabelsResult result = await client.Search.SearchLabels(
                new SearchLabelsRequest("category", repository.Id));

            Console.WriteLine($"Search.SearchLabels (Simple Search): TotalCount={result.TotalCount}");

            await LabelAllFieldsExample(client, repository);
        }
Example #2
0
        private static async Task LabelAllFieldsExample(GitHubClient client, Repository repository)
        {
            string term = "category";

            var request = new SearchLabelsRequest(term, repository.Id)
            {
                Order     = SortDirection.Descending,
                SortField = LabelSearchSort.Created
            };

            SearchLabelsResult result = await client.Search.SearchLabels(request);

            Console.WriteLine($"Search.SearchLabels (All Fields): TotalCount={result.TotalCount}");
        }
Example #3
0
        public static async Task <IEnumerable <string> > GetAreaLabels(string owner, string repo)
        {
            var repository = await _client.Repository.Get(owner, repo);

            var request = new SearchLabelsRequest("area-", repository.Id);

            request.Page = 0;
            var labels = Enumerable.Empty <Label>();
            SearchLabelsResult areasFound = null;

            do
            {
                request.Page += 1;
                areasFound    = await _client.Search.SearchLabels(request);

                labels = areasFound.Items.Union(labels);
            } while (labels.Count() < areasFound.TotalCount);

            return(labels.Select(x => x.Name));
        }