Skip to content

Commit be043c2

Browse files
authored
Enhance the Client to retrieve user name asynchronously (#12)
Enhance the Client to retrieve user name asynchronously
2 parents 3a51211 + d94fdfb commit be043c2

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Git.hub/Client.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using System.Collections.Generic;
33
using System.Linq;
4+
using System.Threading.Tasks;
45
using RestSharp;
56
using RestSharp.Authenticators;
67

@@ -148,7 +149,7 @@ public User getCurrentUser()
148149
return user.Data;
149150
}
150151

151-
public User GetUser(string userName)
152+
public async Task<User> GetUserAsync(string userName)
152153
{
153154
if (string.IsNullOrEmpty(userName))
154155
{
@@ -157,7 +158,7 @@ public User GetUser(string userName)
157158

158159
var request = new RestRequest($"/users/{userName}");
159160

160-
var user = client.Get<User>(request);
161+
var user = await client.ExecuteGetTaskAsync<User>(request);
161162
return user.Data;
162163
}
163164

0 commit comments

Comments
 (0)