我想获取 GitHub 存储库的所有分支的列表(例如https://github.com/eternicode/bootstrap-datepicker),但是我无法找到如何使用octokit.net来做到这一点。
我还想获得一个重命名的存储库,我不能只搜索存储库的名称。
有什么提示吗?
澄清:这里描述了其余的 api https://developer.github.com/v3/repos/forks/,但是如何用 octokit.net 来做呢?
我想获取 GitHub 存储库的所有分支的列表(例如https://github.com/eternicode/bootstrap-datepicker),但是我无法找到如何使用octokit.net来做到这一点。
我还想获得一个重命名的存储库,我不能只搜索存储库的名称。
有什么提示吗?
澄清:这里描述了其余的 api https://developer.github.com/v3/repos/forks/,但是如何用 octokit.net 来做呢?
您可以通过访问:
https://api.github.com/repos/<Author>/<Repo>/forks
确保用合适的值替换Author
和。Repo
/// <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);
}
对于指定存储库的其他方式,也存在类似的功能。
请随时在此处编辑此用例的完整代码。
线程有点旧,但万一其他人从谷歌那里结束,我认为 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;
}