Reputation: 19870
I would like to get a list of all forks of a GitHub repo (e.g. https://github.com/eternicode/bootstrap-datepicker), however I am unable to find out how to do it using octokit.net.
I want also get a renamed repositories, I could not just search a name of a repository.
Any hints?
CLARIFICATION: The rest api is described here https://developer.github.com/v3/repos/forks/, but how to do it with octokit.net?
Upvotes: 6
Views: 4958
Reputation: 138
You can achieve that by visiting:
https://api.github.com/repos/<Author>/<Repo>/forks
Make sure to replace Author
and Repo
with suitable values.
Upvotes: 12
Reputation: 528
The functionality has been added to octokit.net recently: 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);
}
Similar functions exist for other ways to specify repository.
Please feel free to edit in the full code for this use case here.
Upvotes: 2
Reputation: 1
Threads a bit old but in case someone else ends up here from google thought Id necro it.
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;
}
Upvotes: 0