File tree 1 file changed +15
-2
lines changed
1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change 1
1
using System ;
2
2
using System . Collections . Generic ;
3
3
using System . Linq ;
4
+ using System . Threading . Tasks ;
4
5
using RestSharp ;
5
6
using RestSharp . Authenticators ;
6
7
@@ -148,7 +149,7 @@ public User getCurrentUser()
148
149
return user . Data ;
149
150
}
150
151
151
- public User GetUser ( string userName )
152
+ public async Task < User > GetUserAsync ( string userName )
152
153
{
153
154
if ( string . IsNullOrEmpty ( userName ) )
154
155
{
@@ -157,10 +158,22 @@ public User GetUser(string userName)
157
158
158
159
var request = new RestRequest ( $ "/users/{ userName } ") ;
159
160
160
- var user = client . Get < User > ( request ) ;
161
+ var user = await client . ExecuteGetTaskAsync < User > ( request ) ;
161
162
return user . Data ;
162
163
}
163
164
165
+ public User GetUser ( string userName )
166
+ {
167
+ if ( string . IsNullOrEmpty ( userName ) )
168
+ {
169
+ throw new ArgumentException ( "Empty username" , nameof ( userName ) ) ;
170
+ }
171
+
172
+ var request = new RestRequest ( $ "/users/{ userName } ") ;
173
+
174
+ return client . Get < User > ( request ) . Data ;
175
+ }
176
+
164
177
/// <summary>
165
178
/// Searches through all of Github's repositories, similar to the search on the website itself.
166
179
/// </summary>
You can’t perform that action at this time.
0 commit comments