Add ApiOption overloads to IIssuesClient and IObservableIssuesClient (#1274)

This commit is contained in:
Brendan Forster
2016-06-02 11:21:30 +02:00
parent 029cefe76a
commit dfebfe31b6
8 changed files with 913 additions and 147 deletions
+164 -23
View File
@@ -56,7 +56,7 @@ namespace Octokit
/// <param name="owner">The owner of the repository</param>
/// <param name="name">The name of the repository</param>
/// <param name="number">The issue number</param>
/// <returns></returns>
/// <returns>The created <see cref="Task"/> representing requesting the issue from the API.</returns>
public Task<Issue> Get(string owner, string name, int number)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
@@ -73,10 +73,27 @@ namespace Octokit
/// Issues are sorted by the create date descending.
/// http://developer.github.com/v3/issues/#list-issues
/// </remarks>
/// <returns></returns>
/// <returns>The created <see cref="Task"/> representing requesting a list of issue from the API.</returns>
public Task<IReadOnlyList<Issue>> GetAllForCurrent()
{
return GetAllForCurrent(new IssueRequest());
return GetAllForCurrent(ApiOptions.None);
}
/// <summary>
/// Gets all open issues assigned to the authenticated user across all the authenticated users visible
/// repositories including owned repositories, member repositories, and organization repositories.
/// </summary>
/// <param name="options">Options for changing the API response</param>
/// <remarks>
/// Issues are sorted by the create date descending.
/// http://developer.github.com/v3/issues/#list-issues
/// </remarks>
/// <returns>The created <see cref="Task"/> representing requesting a list of issue from the API.</returns>
public Task<IReadOnlyList<Issue>> GetAllForCurrent(ApiOptions options)
{
Ensure.ArgumentNotNull(options, "options");
return GetAllForCurrent(new IssueRequest(), options);
}
/// <summary>
@@ -87,12 +104,30 @@ namespace Octokit
/// http://developer.github.com/v3/issues/#list-issues
/// </remarks>
/// <param name="request">Used to filter and sort the list of issues returned</param>
/// <returns></returns>
/// <returns>The created <see cref="Task"/> representing requesting a list of issue from the API.</returns>
public Task<IReadOnlyList<Issue>> GetAllForCurrent(IssueRequest request)
{
Ensure.ArgumentNotNull(request, "request");
return ApiConnection.GetAll<Issue>(ApiUrls.Issues(), request.ToParametersDictionary());
return GetAllForCurrent(request, ApiOptions.None);
}
/// <summary>
/// Gets all issues across all the authenticated users visible repositories including owned repositories,
/// member repositories, and organization repositories.
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/issues/#list-issues
/// </remarks>
/// <param name="request">Used to filter and sort the list of issues returned</param>
/// <param name="options">Options for changing the API response</param>
/// <returns>The created <see cref="Task"/> representing requesting a list of issue from the API.</returns>
public Task<IReadOnlyList<Issue>> GetAllForCurrent(IssueRequest request, ApiOptions options)
{
Ensure.ArgumentNotNull(request, "request");
Ensure.ArgumentNotNull(options, "options");
return ApiConnection.GetAll<Issue>(ApiUrls.Issues(), request.ToParametersDictionary(), options);
}
/// <summary>
@@ -103,10 +138,27 @@ namespace Octokit
/// Issues are sorted by the create date descending.
/// http://developer.github.com/v3/issues/#list-issues
/// </remarks>
/// <returns></returns>
/// <returns>The created <see cref="Task"/> representing requesting a list of issue from the API.</returns>
public Task<IReadOnlyList<Issue>> GetAllForOwnedAndMemberRepositories()
{
return GetAllForOwnedAndMemberRepositories(new IssueRequest());
return GetAllForOwnedAndMemberRepositories(ApiOptions.None);
}
/// <summary>
/// Gets all open issues assigned to the authenticated user across owned and member repositories for the
/// authenticated user.
/// </summary>
/// <param name="options">Options for changing the API response</param>
/// <remarks>
/// Issues are sorted by the create date descending.
/// http://developer.github.com/v3/issues/#list-issues
/// </remarks>
/// <returns>The created <see cref="Task"/> representing requesting a list of issue from the API.</returns>
public Task<IReadOnlyList<Issue>> GetAllForOwnedAndMemberRepositories(ApiOptions options)
{
Ensure.ArgumentNotNull(options, "options");
return GetAllForOwnedAndMemberRepositories(new IssueRequest(), options);
}
/// <summary>
@@ -116,13 +168,29 @@ namespace Octokit
/// http://developer.github.com/v3/issues/#list-issues
/// </remarks>
/// <param name="request">Used to filter and sort the list of issues returned</param>
/// <returns></returns>
/// <returns>The created <see cref="Task"/> representing requesting a list of issue from the API.</returns>
public Task<IReadOnlyList<Issue>> GetAllForOwnedAndMemberRepositories(IssueRequest request)
{
Ensure.ArgumentNotNull(request, "request");
return ApiConnection.GetAll<Issue>(ApiUrls.IssuesForOwnedAndMember(),
request.ToParametersDictionary());
return GetAllForOwnedAndMemberRepositories(request, ApiOptions.None);
}
/// <summary>
/// Gets all issues across owned and member repositories for the authenticated user.
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/issues/#list-issues
/// </remarks>
/// <param name="request">Used to filter and sort the list of issues returned</param>
/// <param name="options">Options for changing the API response</param>
/// <returns>The created <see cref="Task"/> representing requesting a list of issue from the API.</returns>
public Task<IReadOnlyList<Issue>> GetAllForOwnedAndMemberRepositories(IssueRequest request, ApiOptions options)
{
Ensure.ArgumentNotNull(request, "request");
Ensure.ArgumentNotNull(options, "options");
return ApiConnection.GetAll<Issue>(ApiUrls.IssuesForOwnedAndMember(), request.ToParametersDictionary(), options);
}
/// <summary>
@@ -132,10 +200,29 @@ namespace Octokit
/// http://developer.github.com/v3/issues/#list-issues
/// </remarks>
/// <param name="organization">The name of the organization</param>
/// <returns></returns>
/// <returns>The created <see cref="Task"/> representing requesting a list of issue from the API.</returns>
public Task<IReadOnlyList<Issue>> GetAllForOrganization(string organization)
{
return GetAllForOrganization(organization, new IssueRequest());
Ensure.ArgumentNotNullOrEmptyString(organization, "organization");
return GetAllForOrganization(organization, ApiOptions.None);
}
/// <summary>
/// Gets all open issues assigned to the authenticated user for a given organization for the authenticated user.
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/issues/#list-issues
/// </remarks>
/// <param name="organization">The name of the organization</param>
/// <param name="options">Options for changing the API response</param>
/// <returns>The created <see cref="Task"/> representing requesting a list of issue from the API.</returns>
public Task<IReadOnlyList<Issue>> GetAllForOrganization(string organization, ApiOptions options)
{
Ensure.ArgumentNotNullOrEmptyString(organization, "organization");
Ensure.ArgumentNotNull(options, "options");
return GetAllForOrganization(organization, new IssueRequest(), options);
}
/// <summary>
@@ -146,13 +233,32 @@ namespace Octokit
/// </remarks>
/// <param name="organization">The name of the organization</param>
/// <param name="request">Used to filter and sort the list of issues returned</param>
/// <returns></returns>
/// <returns>The created <see cref="Task"/> representing requesting a list of issue from the API.</returns>
public Task<IReadOnlyList<Issue>> GetAllForOrganization(string organization, IssueRequest request)
{
Ensure.ArgumentNotNullOrEmptyString(organization, "organization");
Ensure.ArgumentNotNull(request, "request");
return ApiConnection.GetAll<Issue>(ApiUrls.Issues(organization), request.ToParametersDictionary());
return GetAllForOrganization(organization, request, ApiOptions.None);
}
/// <summary>
/// Gets all issues for a given organization for the authenticated user.
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/issues/#list-issues
/// </remarks>
/// <param name="organization">The name of the organization</param>
/// <param name="request">Used to filter and sort the list of issues returned</param>
/// <param name="options">Options for changing the API response</param>
/// <returns>The created <see cref="Task"/> representing requesting a list of issue from the API.</returns>
public Task<IReadOnlyList<Issue>> GetAllForOrganization(string organization, IssueRequest request, ApiOptions options)
{
Ensure.ArgumentNotNullOrEmptyString(organization, "organization");
Ensure.ArgumentNotNull(request, "request");
Ensure.ArgumentNotNull(options, "options");
return ApiConnection.GetAll<Issue>(ApiUrls.Issues(organization), request.ToParametersDictionary(), options);
}
/// <summary>
@@ -163,12 +269,27 @@ namespace Octokit
/// </remarks>
/// <param name="owner">The owner of the repository</param>
/// <param name="name">The name of the repository</param>
/// <returns></returns>
/// <returns>The created <see cref="Task"/> representing requesting a list of issue from the API.</returns>
public Task<IReadOnlyList<Issue>> GetAllForRepository(string owner, string name)
{
return GetAllForRepository(owner, name, new RepositoryIssueRequest());
}
/// <summary>
/// Gets all open issues assigned to the authenticated user for the repository.
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/issues/#list-issues-for-a-repository
/// </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>The created <see cref="Task"/> representing requesting a list of issue from the API.</returns>
public Task<IReadOnlyList<Issue>> GetAllForRepository(string owner, string name, ApiOptions options)
{
return GetAllForRepository(owner, name, new RepositoryIssueRequest(), options);
}
/// <summary>
/// Gets issues for a repository.
/// </summary>
@@ -178,15 +299,35 @@ namespace Octokit
/// <param name="owner">The owner of the repository</param>
/// <param name="name">The name of the repository</param>
/// <param name="request">Used to filter and sort the list of issues returned</param>
/// <returns></returns>
public Task<IReadOnlyList<Issue>> GetAllForRepository(string owner, string name,
RepositoryIssueRequest request)
/// <returns>The created <see cref="Task"/> representing requesting a list of issue from the API.</returns>
public Task<IReadOnlyList<Issue>> GetAllForRepository(string owner, string name, RepositoryIssueRequest request)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
Ensure.ArgumentNotNullOrEmptyString(name, "name");
Ensure.ArgumentNotNull(request, "request");
return ApiConnection.GetAll<Issue>(ApiUrls.Issues(owner, name), request.ToParametersDictionary());
return GetAllForRepository(owner, name, request, ApiOptions.None);
}
/// <summary>
/// Gets issues for a repository.
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/issues/#list-issues-for-a-repository
/// </remarks>
/// <param name="owner">The owner of the repository</param>
/// <param name="name">The name of the repository</param>
/// <param name="request">Used to filter and sort the list of issues returned</param>
/// <param name="options">Options for changing the API response</param>
/// <returns>The created <see cref="Task"/> representing requesting a list of issue from the API.</returns>
public Task<IReadOnlyList<Issue>> GetAllForRepository(string owner, string name, RepositoryIssueRequest request, ApiOptions options)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
Ensure.ArgumentNotNullOrEmptyString(name, "name");
Ensure.ArgumentNotNull(request, "request");
Ensure.ArgumentNotNull(options, "options");
return ApiConnection.GetAll<Issue>(ApiUrls.Issues(owner, name), request.ToParametersDictionary(), options);
}
/// <summary>
@@ -197,7 +338,7 @@ namespace Octokit
/// <param name="owner">The owner of the repository</param>
/// <param name="name">The name of the repository</param>
/// <param name="newIssue">A <see cref="NewIssue"/> instance describing the new issue to create</param>
/// <returns></returns>
/// <returns>The created <see cref="Task"/> representing the new issue from the API.</returns>
public Task<Issue> Create(string owner, string name, NewIssue newIssue)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
@@ -216,7 +357,7 @@ namespace Octokit
/// <param name="number">The issue number</param>
/// <param name="issueUpdate">An <see cref="IssueUpdate"/> instance describing the changes to make to the issue
/// </param>
/// <returns></returns>
/// <returns>The created <see cref="Task"/> representing the updated issue from the API.</returns>
public Task<Issue> Update(string owner, string name, int number, IssueUpdate issueUpdate)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
@@ -233,7 +374,7 @@ namespace Octokit
/// <param name="owner">The owner of the repository</param>
/// <param name="name">The name of the repository</param>
/// <param name="number">The issue number</param>
/// <returns></returns>
/// <returns>The created <see cref="Task"/> representing accessing the API.</returns>
public Task Lock(string owner, string name, int number)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
@@ -249,7 +390,7 @@ namespace Octokit
/// <param name="owner">The owner of the repository</param>
/// <param name="name">The name of the repository</param>
/// <param name="number">The issue number</param>
/// <returns></returns>
/// <returns>The created <see cref="Task"/> representing accessing the API.</returns>
public Task Unlock(string owner, string name, int number)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");