Skip to content

Commit 245761c

Browse files
Add getUser method and User.AvatarUrl property
1 parent 6180d28 commit 245761c

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

Git.hub/Client.cs

+13
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,19 @@ public User getCurrentUser()
148148
return user.Data;
149149
}
150150

151+
public User GetUser(string userName)
152+
{
153+
if (string.IsNullOrEmpty(userName))
154+
{
155+
throw new ArgumentException("Empty username", nameof(userName));
156+
}
157+
158+
var request = new RestRequest($"/users/{userName}");
159+
160+
var user = client.Get<User>(request);
161+
return user.Data;
162+
}
163+
151164
/// <summary>
152165
/// Searches through all of Github's repositories, similar to the search on the website itself.
153166
/// </summary>

Git.hub/User.cs

+5
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ public class User
77
/// </summary>
88
public string Login { get; internal set; }
99

10+
/// <summary>
11+
/// The avatar URL
12+
/// </summary>
13+
public string AvatarUrl { get; set; }
14+
1015
public User()
1116
{
1217
}

0 commit comments

Comments
 (0)