2015-01-12 37 views
1

我想获得一个GitHub仓库的所有分支的列表(例如https://github.com/eternicode/bootstrap-datepicker),但我无法知道如何使用octokit.net来完成它。如何获取GitHub库所有分支的列表?

我也想得到一个重命名的存储库,我不能只搜索一个存储库的名称。

任何提示?

澄清:其余API在这里描述https://developer.github.com/v3/repos/forks/,但如何用octokit.net做到这一点?

+0

@YuvalItzchakov https://github.com/octokit/octokit.net/search?utf8=%E2%9C%93&q=fork但叉只是为Gist(而不是git回购)。你知道该怎么做吗? –

回答

0

线程有点老,但万一别人从谷歌这里结束了思想Id necro它。

 private static IReadOnlyList<Octokit.Repository> retrieveGitHubRepos() 
    { 
     Task<IReadOnlyList<Octokit.Repository>> getRepoList = null; 
     string appname = System.AppDomain.CurrentDomain.FriendlyName; 
     Octokit.GitHubClient client = new Octokit.GitHubClient(new Octokit.ProductHeaderValue(ConnectionDetails.appName)); 
     client.Credentials = new Octokit.Credentials(ConnectionDetails.username, ConnectionDetails.password); 
     Task.Run(() => getRepoList = client.Repository.GetAllForUser(ConnectionDetails.username)).Wait(); 
     return getRepoList.Result; 
    } 
+0

根据名称('GetAllForUser'),它不返回所有分支。 –

0

的功能已经被添加到最近octokit.net:其他方式来指定仓库存在 https://github.com/octokit/octokit.net/blob/b07ce6e11a1b286dda0a65ee427bda3b8abcefb8/Octokit.Reactive/Clients/ObservableRepositoryForksClient.cs#L31

/// <summary> 
    /// Gets the list of forks defined for a repository 
    /// </summary> 
    /// <remarks> 
    /// See <a href="http://developer.github.com/v3/repos/forks/#list-forks">API documentation</a> for more information. 
    /// </remarks> 
    /// <param name="owner">The owner of the repository</param> 
    /// <param name="name">The name of the repository</param> 
    public IObservable<Repository> GetAll(string owner, string name) 
    { 
     Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); 
     Ensure.ArgumentNotNullOrEmptyString(name, "name"); 

     return GetAll(owner, name, ApiOptions.None); 
    } 

类似的功能。

请随时在此代码中完整编辑此用例。

相关问题