2
2
using System . Collections . Generic ;
3
3
using System . Linq ;
4
4
using System . Threading . Tasks ;
5
- using Octokit ;
6
5
using GitHub . Logging ;
7
6
using System . Runtime . Serialization ;
8
7
using System . Text ;
@@ -19,7 +18,6 @@ public static IApiClient Create(UriString repositoryUrl, IKeychain keychain, IPr
19
18
var hostAddress = HostAddress . Create ( repositoryUrl ) ;
20
19
21
20
return new ApiClient ( repositoryUrl , keychain ,
22
- new GitHubClient ( ApplicationConfiguration . ProductHeader , credentialStore , hostAddress . ApiUri ) ,
23
21
processManager , taskManager , nodeJsExecutablePath , octorunScriptPath ) ;
24
22
}
25
23
@@ -34,11 +32,10 @@ public static IApiClient Create(UriString repositoryUrl, IKeychain keychain, IPr
34
32
private readonly NPath octorunScriptPath ;
35
33
private readonly ILoginManager loginManager ;
36
34
37
- public ApiClient ( UriString hostUrl , IKeychain keychain , IGitHubClient githubClient , IProcessManager processManager , ITaskManager taskManager , NPath nodeJsExecutablePath , NPath octorunScriptPath )
35
+ public ApiClient ( UriString hostUrl , IKeychain keychain , IProcessManager processManager , ITaskManager taskManager , NPath nodeJsExecutablePath , NPath octorunScriptPath )
38
36
{
39
37
Guard . ArgumentNotNull ( hostUrl , nameof ( hostUrl ) ) ;
40
38
Guard . ArgumentNotNull ( keychain , nameof ( keychain ) ) ;
41
- Guard . ArgumentNotNull ( githubClient , nameof ( githubClient ) ) ;
42
39
43
40
HostAddress = HostAddress . Create ( hostUrl ) ;
44
41
OriginalUrl = hostUrl ;
@@ -64,12 +61,12 @@ private async Task LogoutInternal(UriString host)
64
61
await loginManager . Logout ( host ) ;
65
62
}
66
63
67
- public async Task CreateRepository ( NewRepository newRepository , Action < GitHubRepository , Exception > callback , string organization = null )
64
+ public async Task CreateRepository ( string name , string description , bool isPrivate , Action < GitHubRepository , Exception > callback , string organization = null )
68
65
{
69
66
Guard . ArgumentNotNull ( callback , "callback" ) ;
70
67
try
71
68
{
72
- var repository = await CreateRepositoryInternal ( newRepository , organization ) ;
69
+ var repository = await CreateRepositoryInternal ( name , organization , description , isPrivate ) ;
73
70
callback ( repository , null ) ;
74
71
}
75
72
catch ( Exception e )
@@ -201,7 +198,7 @@ public async Task<bool> ContinueLoginAsync(LoginResult loginResult, Func<LoginRe
201
198
return result . Code == LoginResultCodes . Success ;
202
199
}
203
200
204
- private async Task < GitHubRepository > CreateRepositoryInternal ( NewRepository newRepository , string organization )
201
+ private async Task < GitHubRepository > CreateRepositoryInternal ( string repositoryName , string organization , string description , bool isPrivate )
205
202
{
206
203
try
207
204
{
@@ -214,12 +211,12 @@ private async Task<GitHubRepository> CreateRepositoryInternal(NewRepository newR
214
211
var keychainAdapter = await keychain . Load ( uriString ) ;
215
212
216
213
var command = new StringBuilder ( "publish -r " ) ;
217
- command . Append ( newRepository . Name ) ;
214
+ command . Append ( repositoryName ) ;
218
215
219
- if ( ! string . IsNullOrEmpty ( newRepository . Description ) )
216
+ if ( ! string . IsNullOrEmpty ( description ) )
220
217
{
221
218
command . Append ( " -d " ) ;
222
- command . Append ( newRepository . Description ) ;
219
+ command . Append ( description ) ;
223
220
}
224
221
225
222
if ( ! string . IsNullOrEmpty ( organization ) )
@@ -228,7 +225,7 @@ private async Task<GitHubRepository> CreateRepositoryInternal(NewRepository newR
228
225
command . Append ( organization ) ;
229
226
}
230
227
231
- if ( newRepository . Private ?? false )
228
+ if ( isPrivate )
232
229
{
233
230
command . Append ( " -p" ) ;
234
231
}
0 commit comments