From b19b6b8282a6466ee66bbb25fcd457c4b56ab9b1 Mon Sep 17 00:00:00 2001 From: Brendan Forster Date: Fri, 17 Jul 2015 16:45:50 +0930 Subject: [PATCH] added some docs for these changes --- docs/search.md | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 docs/search.md diff --git a/docs/search.md b/docs/search.md new file mode 100644 index 00000000..58ef1bbe --- /dev/null +++ b/docs/search.md @@ -0,0 +1,57 @@ +# Search + +You can use Octokit to search for different sorts of data available +on the GitHub or GitHub Enterprise server: + + - issues + - repositories + - code + - users + +I won't go into the full details here as the [developer documentation](https://developer.github.com/) +covers all the options far better than I could. + +## Search Issues + +You can search for issues containing a given phrase across many repositories: + +```csharp +// a search +var request = new SearchIssuesRequest("linux"); + +// it is highly recommended to search in specific repositories +request.Repos = new Collection { + "aspnet/dnx", + "aspnet/dnvm" +}; + +// other parameters available for tweaking the output +request.SortField = IssueSearchSort.Created; +request.Order = SortDirection.Descending; +``` + +By default, search will return the first page of results and use +a page size of 100 results. + +```csharp +request.Page = 2; +request.PerPage = 30; +``` + + +Once you've set the right parameters, execute the request: + +```csharp +// actually perform the search +var repos = await client.Search.SearchIssues(request); + +Console.WriteLine("Query has {0} matches.", repos.TotalCount); +Console.WriteLine("Response has {0} items.", repos.Items.Count); +Assert.NotEmpty(); +``` + +## Search Repositories + +## Search Code + +## Search Users