@@ -50,7 +50,7 @@ private async Task LogoutInternal(UriString host)
50
50
await loginManager . Logout ( host ) ;
51
51
}
52
52
53
- public async Task CreateRepository ( NewRepository newRepository , Action < Octokit . Repository , Exception > callback , string organization = null )
53
+ public async Task CreateRepository ( NewRepository newRepository , Action < GitHubRepository , Exception > callback , string organization = null )
54
54
{
55
55
Guard . ArgumentNotNull ( callback , "callback" ) ;
56
56
try
@@ -64,7 +64,7 @@ public async Task CreateRepository(NewRepository newRepository, Action<Octokit.R
64
64
}
65
65
}
66
66
67
- public async Task GetOrganizations ( Action < IList < Organization > > onSuccess , Action < Exception > onError = null )
67
+ public async Task GetOrganizations ( Action < Organization [ ] > onSuccess , Action < Exception > onError = null )
68
68
{
69
69
Guard . ArgumentNotNull ( onSuccess , nameof ( onSuccess ) ) ;
70
70
await GetOrganizationInternal ( onSuccess , onError ) ;
@@ -84,7 +84,7 @@ public async Task ValidateCurrentUser(Action onSuccess, Action<Exception> onErro
84
84
}
85
85
}
86
86
87
- public async Task GetCurrentUser ( Action < Octokit . User > callback )
87
+ public async Task GetCurrentUser ( Action < GitHubUser > callback )
88
88
{
89
89
Guard . ArgumentNotNull ( callback , "callback" ) ;
90
90
var user = await GetCurrentUserInternal ( ) ;
@@ -187,7 +187,7 @@ public async Task<bool> ContinueLoginAsync(LoginResult loginResult, Func<LoginRe
187
187
return result . Code == LoginResultCodes . Success ;
188
188
}
189
189
190
- private async Task < Octokit . Repository > CreateRepositoryInternal ( NewRepository newRepository , string organization )
190
+ private async Task < GitHubRepository > CreateRepositoryInternal ( NewRepository newRepository , string organization )
191
191
{
192
192
try
193
193
{
@@ -196,18 +196,18 @@ public async Task<bool> ContinueLoginAsync(LoginResult loginResult, Func<LoginRe
196
196
await ValidateKeychain ( ) ;
197
197
await ValidateCurrentUserInternal ( ) ;
198
198
199
- Octokit . Repository repository ;
199
+ GitHubRepository repository ;
200
200
if ( ! string . IsNullOrEmpty ( organization ) )
201
201
{
202
202
logger . Trace ( "Creating repository for organization" ) ;
203
203
204
- repository = await githubClient . Repository . Create ( organization , newRepository ) ;
204
+ repository = ( await githubClient . Repository . Create ( organization , newRepository ) ) . ToGitHubRepository ( ) ;
205
205
}
206
206
else
207
207
{
208
208
logger . Trace ( "Creating repository for user" ) ;
209
209
210
- repository = await githubClient . Repository . Create ( newRepository ) ;
210
+ repository = ( await githubClient . Repository . Create ( newRepository ) ) . ToGitHubRepository ( ) ;
211
211
}
212
212
213
213
logger . Trace ( "Created Repository" ) ;
@@ -220,7 +220,7 @@ public async Task<bool> ContinueLoginAsync(LoginResult loginResult, Func<LoginRe
220
220
}
221
221
}
222
222
223
- private async Task GetOrganizationInternal ( Action < IList < Organization > > onSuccess , Action < Exception > onError = null )
223
+ private async Task GetOrganizationInternal ( Action < Organization [ ] > onSuccess , Action < Exception > onError = null )
224
224
{
225
225
try
226
226
{
@@ -235,7 +235,11 @@ private async Task GetOrganizationInternal(Action<IList<Organization>> onSuccess
235
235
236
236
if ( organizations != null )
237
237
{
238
- onSuccess ( organizations . ToArray ( ) ) ;
238
+ var array = organizations . Select ( organization => new Organization ( ) {
239
+ Name = organization . Name ,
240
+ Login = organization . Login
241
+ } ) . ToArray ( ) ;
242
+ onSuccess ( array ) ;
239
243
}
240
244
}
241
245
catch ( Exception ex )
@@ -245,14 +249,14 @@ private async Task GetOrganizationInternal(Action<IList<Organization>> onSuccess
245
249
}
246
250
}
247
251
248
- private async Task < Octokit . User > GetCurrentUserInternal ( )
252
+ private async Task < GitHubUser > GetCurrentUserInternal ( )
249
253
{
250
254
try
251
255
{
252
256
logger . Trace ( "Getting Current User" ) ;
253
257
await ValidateKeychain ( ) ;
254
258
255
- return await githubClient . User . Current ( ) ;
259
+ return ( await githubClient . User . Current ( ) ) . ToGitHubUser ( ) ;
256
260
}
257
261
catch ( Exception ex )
258
262
{
@@ -311,6 +315,18 @@ private async Task ValidateKeychain()
311
315
}
312
316
}
313
317
318
+ class GitHubUser
319
+ {
320
+ public string Name { get ; set ; }
321
+ public string Login { get ; set ; }
322
+ }
323
+
324
+ class GitHubRepository
325
+ {
326
+ public string Name { get ; set ; }
327
+ public string CloneUrl { get ; set ; }
328
+ }
329
+
314
330
class ApiClientException : Exception
315
331
{
316
332
public ApiClientException ( )
0 commit comments