Skip to content

Commit 2c23bc7

Browse files
committed
Removed the api propertly, was a bad idea.
1 parent 056651b commit 2c23bc7

2 files changed

Lines changed: 42 additions & 6 deletions

File tree

csharp-github-api/API/UserApi.cs

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,22 @@ public class UserApi
3636
private RestClient _client;
3737
private IAuthenticator _authenticator;
3838

39+
/// <summary>
40+
/// Instantiattes a new instance of the <see cref="UserApi"/> class.
41+
/// </summary>
42+
/// <param name="baseUrl">The base url for GitHub's API.</param>
3943
public UserApi(string baseUrl)
4044
{
4145
BaseUrl = baseUrl;
4246

4347
_client = new RestClient(BaseUrl);
4448
}
4549

50+
/// <summary>
51+
/// Fluently returns an authenticated instance of the <see cref="UserApi"/> class.
52+
/// </summary>
53+
/// <param name="authenticator">The <see cref="IAuthenticator"/> class to use to authenticate requests to the user api.</param>
54+
/// <returns>An authenticated instance of the <see cref="UserApi"/> class.</returns>
4655
public UserApi Authenticated(IAuthenticator authenticator)
4756
{
4857
_authenticator = authenticator;
@@ -53,6 +62,11 @@ public UserApi Authenticated(IAuthenticator authenticator)
5362
return this;
5463
}
5564

65+
/// <summary>
66+
/// Gets the specified user from GitHub.
67+
/// </summary>
68+
/// <param name="username">The user to get from GitHub.</param>
69+
/// <returns>A <see cref="User"/> instance which encapsulates the response from GitHub for the requested user.</returns>
5670
public User GetUser(string username)
5771
{
5872
if (_client == null) _client = GetRestClient();
@@ -70,7 +84,12 @@ public User GetUser(string username)
7084
return user;
7185
}
7286

73-
public IList<User> FindUser(string username)
87+
/// <summary>
88+
/// Searches for the user on GitHub.
89+
/// </summary>
90+
/// <param name="username">The user to search for.</param>
91+
/// <returns>Returns a lise of <see cref="User"/> instances of GitHub users who may match the search.</returns>
92+
public IList<User> SearchUser(string username)
7493
{
7594
if (_client == null) _client = GetRestClient();
7695

@@ -85,6 +104,12 @@ public IList<User> FindUser(string username)
85104
return response.Data;
86105
}
87106

107+
/// <summary>
108+
/// Finds a user specified by their email address.
109+
/// This will only match the email address listed in a users public profile, and is opt-in for everyone.
110+
/// </summary>
111+
/// <param name="email">The email address of the user to search for.</param>
112+
/// <returns>A <see cref="User"/> instance which encapsulates the response from GitHub for the requested user.</returns>
88113
public User FindUserByEmail(string email)
89114
{
90115
if (_client == null) _client = GetRestClient();
@@ -100,13 +125,28 @@ public User FindUserByEmail(string email)
100125
return response.Data;
101126
}
102127

128+
/// <summary>
129+
/// Gets a list of the users that the specified user is following.
130+
/// </summary>
131+
/// <param name="user">The <see cref="User"/> to get the following list for.</param>
132+
/// <returns>A list of the users (username only) that the specified user is following.</returns>
103133
public IList<string> GetFollowing(User user)
134+
{
135+
return GetFollowing(user.Login);
136+
}
137+
138+
/// <summary>
139+
/// Gets a list of the users that the specified user is following.
140+
/// </summary>
141+
/// <param name="username">The username to get the following list for.</param>
142+
/// <returns>A list of the users (username only) that the specified user is following.</returns>
143+
public IList<string> GetFollowing(string username)
104144
{
105145
if (_client == null) _client = GetRestClient();
106146

107147
var request = new RestRequest
108148
{
109-
Resource = string.Format("/user/show/{0}/following", user.Login),
149+
Resource = string.Format("/user/show/{0}/following", username),
110150
RootElement = "users"
111151
};
112152

csharp-github-api/Models/User.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,6 @@ public class User
4545
public virtual int PrivateGistCount { get; set;}
4646
public virtual Plan Plan { get; set;}
4747

48-
/* none github stuff */
49-
50-
public UserApi Api { get; set; }
51-
5248
public override bool Equals(object obj)
5349
{
5450
if(obj is User)

0 commit comments

Comments
 (0)