mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-06-03 11:05:56 +00:00
Add ApiOptions overloads to I(Observable)RepositoriesClient (#1337)
This commit is contained in:
@@ -142,7 +142,20 @@ namespace Octokit.Reactive
|
||||
/// <returns>A <see cref="IReadOnlyPagedCollection{Repository}"/> of <see cref="Repository"/>.</returns>
|
||||
public IObservable<Repository> GetAllForCurrent()
|
||||
{
|
||||
return _connection.GetAndFlattenAllPages<Repository>(ApiUrls.Repositories());
|
||||
return GetAllForCurrent(ApiOptions.None);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves every <see cref="Repository"/> that belongs to the current user.
|
||||
/// </summary>
|
||||
/// <param name="options">Options for changing the API response</param>
|
||||
/// <exception cref="AuthorizationException">Thrown if the client is not authenticated.</exception>
|
||||
/// <returns>A <see cref="IReadOnlyPagedCollection{Repository}"/> of <see cref="Repository"/>.</returns>
|
||||
public IObservable<Repository> GetAllForCurrent(ApiOptions options)
|
||||
{
|
||||
Ensure.ArgumentNotNull(options, "options");
|
||||
|
||||
return _connection.GetAndFlattenAllPages<Repository>(ApiUrls.Repositories(), options);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -158,21 +171,48 @@ namespace Octokit.Reactive
|
||||
{
|
||||
Ensure.ArgumentNotNull(request, "request");
|
||||
|
||||
return GetAllForCurrent(request, ApiOptions.None);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves every <see cref="Repository"/> that belongs to the current user.
|
||||
/// </summary>
|
||||
/// <param name="request">Search parameters to filter results on</param>
|
||||
/// <param name="options">Options for changing the API response</param>
|
||||
/// <exception cref="AuthorizationException">Thrown if the client is not authenticated.</exception>
|
||||
/// <returns>A <see cref="IReadOnlyPagedCollection{Repository}"/> of <see cref="Repository"/>.</returns>
|
||||
public IObservable<Repository> GetAllForCurrent(RepositoryRequest request, ApiOptions options)
|
||||
{
|
||||
Ensure.ArgumentNotNull(request, "request");
|
||||
Ensure.ArgumentNotNull(options, "options");
|
||||
|
||||
return _connection.GetAndFlattenAllPages<Repository>(ApiUrls.Repositories(), request.ToParametersDictionary());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves every <see cref="Repository"/> that belongs to the specified user.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The default page size on GitHub.com is 30.
|
||||
/// </remarks>
|
||||
/// <param name="login">The account name to search for</param>
|
||||
/// <returns>A <see cref="IReadOnlyPagedCollection{Repository}"/> of <see cref="Repository"/>.</returns>
|
||||
public IObservable<Repository> GetAllForUser(string login)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(login, "login");
|
||||
|
||||
return _connection.GetAndFlattenAllPages<Repository>(ApiUrls.Repositories(login));
|
||||
return GetAllForUser(login, ApiOptions.None);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves every <see cref="Repository"/> that belongs to the specified user.
|
||||
/// </summary>
|
||||
/// <param name="login">The account name to search for</param>
|
||||
/// <param name="options">Options for changing the API response</param>
|
||||
/// <returns>A <see cref="IReadOnlyPagedCollection{Repository}"/> of <see cref="Repository"/>.</returns>
|
||||
public IObservable<Repository> GetAllForUser(string login, ApiOptions options)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(login, "login");
|
||||
Ensure.ArgumentNotNull(options, "options");
|
||||
|
||||
return _connection.GetAndFlattenAllPages<Repository>(ApiUrls.Repositories(login), options);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -186,7 +226,21 @@ namespace Octokit.Reactive
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(organization, "organization");
|
||||
|
||||
return _connection.GetAndFlattenAllPages<Repository>(ApiUrls.OrganizationRepositories(organization));
|
||||
return GetAllForOrg(organization, ApiOptions.None);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves every <see cref="Repository"/> that belongs to the specified organization.
|
||||
/// </summary>
|
||||
/// <param name="organization">The organization name to search for</param>
|
||||
/// <param name="options">Options for changing the API response</param>
|
||||
/// <returns>A <see cref="IReadOnlyPagedCollection{Repository}"/> of <see cref="Repository"/>.</returns>
|
||||
public IObservable<Repository> GetAllForOrg(string organization, ApiOptions options)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(organization, "organization");
|
||||
Ensure.ArgumentNotNull(options, "options");
|
||||
|
||||
return _connection.GetAndFlattenAllPages<Repository>(ApiUrls.OrganizationRepositories(organization), options);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -287,8 +341,27 @@ namespace Octokit.Reactive
|
||||
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
||||
Ensure.ArgumentNotNullOrEmptyString(name, "name");
|
||||
|
||||
var endpoint = ApiUrls.RepoBranches(owner, name);
|
||||
return _connection.GetAndFlattenAllPages<Branch>(endpoint);
|
||||
return GetAllBranches(owner, name, ApiOptions.None);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets all the branches for the specified repository.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// See the <a href="http://developer.github.com/v3/repos/#list-branches">API documentation</a> for more details
|
||||
/// </remarks>
|
||||
/// <param name="owner">The owner of the repository</param>
|
||||
/// <param name="name">The name of the repository</param>
|
||||
/// <param name="options">Options for changing the API response</param>
|
||||
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
|
||||
/// <returns>All <see cref="T:Octokit.Branch"/>es of the repository</returns>
|
||||
public IObservable<Branch> GetAllBranches(string owner, string name, ApiOptions options)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
||||
Ensure.ArgumentNotNullOrEmptyString(name, "name");
|
||||
Ensure.ArgumentNotNull(options, "options");
|
||||
|
||||
return _connection.GetAndFlattenAllPages<Branch>(ApiUrls.RepoBranches(owner, name), options);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -302,7 +375,29 @@ namespace Octokit.Reactive
|
||||
/// <returns>All contributors of the repository.</returns>
|
||||
public IObservable<RepositoryContributor> GetAllContributors(string owner, string name)
|
||||
{
|
||||
return GetAllContributors(owner, name, false);
|
||||
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
||||
Ensure.ArgumentNotNullOrEmptyString(name, "name");
|
||||
|
||||
return GetAllContributors(owner, name, ApiOptions.None);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets all contributors for the specified repository. Does not include anonymous contributors.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// See the <a href="http://developer.github.com/v3/repos/#list-contributors">API documentation</a> for more details
|
||||
/// </remarks>
|
||||
/// <param name="owner">The owner of the repository</param>
|
||||
/// <param name="name">The name of the repository</param>
|
||||
/// <param name="options">Options for changing the API response</param>
|
||||
/// <returns>All contributors of the repository.</returns>
|
||||
public IObservable<RepositoryContributor> GetAllContributors(string owner, string name, ApiOptions options)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
||||
Ensure.ArgumentNotNullOrEmptyString(name, "name");
|
||||
Ensure.ArgumentNotNull(options, "options");
|
||||
|
||||
return GetAllContributors(owner, name, false, ApiOptions.None);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -320,6 +415,15 @@ namespace Octokit.Reactive
|
||||
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
||||
Ensure.ArgumentNotNullOrEmptyString(name, "name");
|
||||
|
||||
return GetAllContributors(owner, name, false, ApiOptions.None);
|
||||
}
|
||||
|
||||
public IObservable<RepositoryContributor> GetAllContributors(string owner, string name, bool includeAnonymous, ApiOptions options)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
||||
Ensure.ArgumentNotNullOrEmptyString(name, "name");
|
||||
Ensure.ArgumentNotNull(options, "options");
|
||||
|
||||
var endpoint = ApiUrls.RepositoryContributors(owner, name);
|
||||
var parameters = new Dictionary<string, string>();
|
||||
if (includeAnonymous)
|
||||
@@ -362,8 +466,26 @@ namespace Octokit.Reactive
|
||||
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
||||
Ensure.ArgumentNotNullOrEmptyString(name, "name");
|
||||
|
||||
var endpoint = ApiUrls.RepositoryTeams(owner, name);
|
||||
return _connection.GetAndFlattenAllPages<Team>(endpoint);
|
||||
return GetAllTeams(owner, name, ApiOptions.None);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets all teams for the specified repository.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// See the <a href="http://developer.github.com/v3/repos/#list-teams">API documentation</a> for more details
|
||||
/// </remarks>
|
||||
/// <param name="owner">The owner of the repository</param>
|
||||
/// <param name="name">The name of the repository</param>
|
||||
/// <param name="options">Options for changing the API response</param>
|
||||
/// <returns>All <see cref="T:Octokit.Team"/>s associated with the repository</returns>
|
||||
public IObservable<Team> GetAllTeams(string owner, string name, ApiOptions options)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
||||
Ensure.ArgumentNotNullOrEmptyString(name, "name");
|
||||
Ensure.ArgumentNotNull(options, "options");
|
||||
|
||||
return _connection.GetAndFlattenAllPages<Team>(ApiUrls.RepositoryTeams(owner, name), options);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -380,8 +502,26 @@ namespace Octokit.Reactive
|
||||
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
||||
Ensure.ArgumentNotNullOrEmptyString(name, "name");
|
||||
|
||||
var endpoint = ApiUrls.RepositoryTags(owner, name);
|
||||
return _connection.GetAndFlattenAllPages<RepositoryTag>(endpoint);
|
||||
return GetAllTags(owner, name, ApiOptions.None);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets all tags for the specified repository.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// See the <a href="http://developer.github.com/v3/repos/#list-tags">API documentation</a> for more details
|
||||
/// </remarks>
|
||||
/// <param name="owner">The owner of the repository</param>
|
||||
/// <param name="name">The name of the repository</param>
|
||||
/// <param name="options">Options for changing the API response</param>
|
||||
/// <returns>All of the repositories tags.</returns>
|
||||
public IObservable<RepositoryTag> GetAllTags(string owner, string name, ApiOptions options)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
||||
Ensure.ArgumentNotNullOrEmptyString(name, "name");
|
||||
Ensure.ArgumentNotNull(options, "options");
|
||||
|
||||
return _connection.GetAndFlattenAllPages<RepositoryTag>(ApiUrls.RepositoryTags(owner, name), options);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user