From d5e69e32fc7911a7ea72146fb3c88db6739e4a11 Mon Sep 17 00:00:00 2001 From: Haroon Date: Fri, 30 Oct 2015 23:13:08 +0000 Subject: [PATCH 1/2] Searching users docs --- docs/search.md | 50 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/docs/search.md b/docs/search.md index 34b3f1d5f5..e4bf92e064 100644 --- a/docs/search.md +++ b/docs/search.md @@ -188,4 +188,52 @@ var request = new SearchRepositoriesRequest("mvc client side framework") ## Search Users -**TODO** +To search for users using Octokit you need to create a SearchUsersRequest and populate it with the search criteria. + +```csharp +// Initialize a new instance of the SearchUsersRequest class with a search term +var request = new SearchUsersRequest("dhh"); + +var result = await githubClient.Search.SearchUsers(request); +``` + +Now we can further filter our search. + +```csharp +var request = new SearchUsersRequest("dhh") +{ + // lets find user with over 1k followers + Followers = Range.GreaterThan(1000), + + // find a user created after the date + Created = DateRange.GreaterThan(new DateTime(2015, 1, 1)), + + // we can search the location of a user, found a martian anyone? + Location = "Mars", + + // find a user that has over 100 repos + Repositories = Range.GreaterThan(100), + + // how about we find users that have a repo that match a certain language + Language = Language.JavaScript, + + // we may want to restrict to orgs or users only + AccountType = AccountSearchType.Org, + + // maybe we want to peek the username only? + In = new[] { UserInQualifier.Username }, + + // or go all out and search username, email and fullname? + In = new[] { UserInQualifier.Username, UserInQualifier.Email, UserInQualifier.Fullname }, +}; +``` + +We can also sort our results, by Followers, Repositories, Joined or leave as null for best match. + +```csharp +var request = new SearchUsersRequest("dhh") +{ + // sort by the number of followers + SortField = UsersSearchSort.Followers +} +``` From 93393b199687915580abd41f19b8dae46e0d3fb2 Mon Sep 17 00:00:00 2001 From: Haroon Date: Sat, 31 Oct 2015 10:59:51 +0000 Subject: [PATCH 2/2] :lipstick: --- docs/search.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/search.md b/docs/search.md index e4bf92e064..6b6cd22a12 100644 --- a/docs/search.md +++ b/docs/search.md @@ -188,7 +188,7 @@ var request = new SearchRepositoriesRequest("mvc client side framework") ## Search Users -To search for users using Octokit you need to create a SearchUsersRequest and populate it with the search criteria. +To search for users using Octokit you need to create a `SearchUsersRequest` and populate it with the search criteria. ```csharp // Initialize a new instance of the SearchUsersRequest class with a search term