Skip to content

Commit

Permalink
Merge pull request #954 from hahmed/docs-searching-users
Browse files Browse the repository at this point in the history
Searching users docs
  • Loading branch information
shiftkey committed Oct 31, 2015
2 parents d1db00a + 93393b1 commit 7e388c6
Showing 1 changed file with 49 additions and 1 deletion.
50 changes: 49 additions & 1 deletion docs/search.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
```

0 comments on commit 7e388c6

Please sign in to comment.