2015-01-12 40 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); 
    } 

類似的功能。

請隨時在此代碼中完整編輯此用例。

相關問題