2

我想获取 GitHub 存储库的所有分支的列表(例如https://github.com/eternicode/bootstrap-datepicker),但是我无法找到如何使用octokit.net来做到这一点。

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

有什么提示吗?

澄清:这里描述了其余的 api https://developer.github.com/v3/repos/forks/,但是如何用 octokit.net 来做呢?

4

3 回答 3

1

您可以通过访问:

https://api.github.com/repos/<Author>/<Repo>/forks

确保用合适的值替换Author和。Repo

于 2022-03-02T17:07:43.810 回答
1

该功能最近已添加到 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);
    }

对于指定存储库的其他方式,也存在类似的功能。

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

于 2016-07-16T13:22:05.187 回答
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;
    }
于 2015-05-11T09:19:46.817 回答