22using System . Collections . Generic ;
33using System . Linq ;
44using System . Threading . Tasks ;
5- using Octokit ;
65using GitHub . Logging ;
76using System . Runtime . Serialization ;
87using System . Text ;
@@ -19,7 +18,6 @@ public static IApiClient Create(UriString repositoryUrl, IKeychain keychain, IPr
1918 var hostAddress = HostAddress . Create ( repositoryUrl ) ;
2019
2120 return new ApiClient ( repositoryUrl , keychain ,
22- new GitHubClient ( ApplicationConfiguration . ProductHeader , credentialStore , hostAddress . ApiUri ) ,
2321 processManager , taskManager , nodeJsExecutablePath , octorunScriptPath ) ;
2422 }
2523
@@ -34,11 +32,10 @@ public static IApiClient Create(UriString repositoryUrl, IKeychain keychain, IPr
3432 private readonly NPath octorunScriptPath ;
3533 private readonly ILoginManager loginManager ;
3634
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 )
3836 {
3937 Guard . ArgumentNotNull ( hostUrl , nameof ( hostUrl ) ) ;
4038 Guard . ArgumentNotNull ( keychain , nameof ( keychain ) ) ;
41- Guard . ArgumentNotNull ( githubClient , nameof ( githubClient ) ) ;
4239
4340 HostAddress = HostAddress . Create ( hostUrl ) ;
4441 OriginalUrl = hostUrl ;
@@ -64,12 +61,12 @@ private async Task LogoutInternal(UriString host)
6461 await loginManager . Logout ( host ) ;
6562 }
6663
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 )
6865 {
6966 Guard . ArgumentNotNull ( callback , "callback" ) ;
7067 try
7168 {
72- var repository = await CreateRepositoryInternal ( newRepository , organization ) ;
69+ var repository = await CreateRepositoryInternal ( name , organization , description , isPrivate ) ;
7370 callback ( repository , null ) ;
7471 }
7572 catch ( Exception e )
@@ -201,7 +198,7 @@ public async Task<bool> ContinueLoginAsync(LoginResult loginResult, Func<LoginRe
201198 return result . Code == LoginResultCodes . Success ;
202199 }
203200
204- private async Task < GitHubRepository > CreateRepositoryInternal ( NewRepository newRepository , string organization )
201+ private async Task < GitHubRepository > CreateRepositoryInternal ( string repositoryName , string organization , string description , bool isPrivate )
205202 {
206203 try
207204 {
@@ -214,12 +211,12 @@ private async Task<GitHubRepository> CreateRepositoryInternal(NewRepository newR
214211 var keychainAdapter = await keychain . Load ( uriString ) ;
215212
216213 var command = new StringBuilder ( "publish -r " ) ;
217- command . Append ( newRepository . Name ) ;
214+ command . Append ( repositoryName ) ;
218215
219- if ( ! string . IsNullOrEmpty ( newRepository . Description ) )
216+ if ( ! string . IsNullOrEmpty ( description ) )
220217 {
221218 command . Append ( " -d " ) ;
222- command . Append ( newRepository . Description ) ;
219+ command . Append ( description ) ;
223220 }
224221
225222 if ( ! string . IsNullOrEmpty ( organization ) )
@@ -228,7 +225,7 @@ private async Task<GitHubRepository> CreateRepositoryInternal(NewRepository newR
228225 command . Append ( organization ) ;
229226 }
230227
231- if ( newRepository . Private ?? false )
228+ if ( isPrivate )
232229 {
233230 command . Append ( " -p" ) ;
234231 }
0 commit comments