added new overloads

This commit is contained in:
aedampir@gmail.com
2016-05-26 13:48:31 +07:00
parent d089d18c1e
commit afd865b91a
6 changed files with 187 additions and 8 deletions

View File

@@ -15,6 +15,17 @@ namespace Octokit.Reactive
/// <returns>The list of <see cref="PullRequestReviewComment"/>s for the specified pull request</returns>
IObservable<PullRequestReviewComment> GetAll(string owner, string name, int number);
/// <summary>
/// Gets review comments for a specified pull request.
/// </summary>
/// <remarks>http://developer.github.com/v3/pulls/comments/#list-comments-on-a-pull-request</remarks>
/// <param name="owner">The owner of the repository</param>
/// <param name="name">The name of the repository</param>
/// <param name="number">The pull request number</param>
/// <param name="options">Options for changing the API response</param>
/// <returns>The list of <see cref="PullRequestReviewComment"/>s for the specified pull request</returns>
IObservable<PullRequestReviewComment> GetAll(string owner, string name, int number, ApiOptions options);
/// <summary>
/// Gets a list of the pull request review comments in a specified repository.
/// </summary>
@@ -24,6 +35,16 @@ namespace Octokit.Reactive
/// <returns>The list of <see cref="PullRequestReviewComment"/>s for the specified repository</returns>
IObservable<PullRequestReviewComment> GetAllForRepository(string owner, string name);
/// <summary>
/// Gets a list of the pull request review comments in a specified repository.
/// </summary>
/// <remarks>http://developer.github.com/v3/pulls/comments/#list-comments-in-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 list of <see cref="PullRequestReviewComment"/>s for the specified repository</returns>
IObservable<PullRequestReviewComment> GetAllForRepository(string owner, string name, ApiOptions options);
/// <summary>
/// Gets a list of the pull request review comments in a specified repository.
/// </summary>
@@ -34,6 +55,17 @@ namespace Octokit.Reactive
/// <returns>The list of <see cref="PullRequestReviewComment"/>s for the specified repository</returns>
IObservable<PullRequestReviewComment> GetAllForRepository(string owner, string name, PullRequestReviewCommentRequest request);
/// <summary>
/// Gets a list of the pull request review comments in a specified repository.
/// </summary>
/// <remarks>http://developer.github.com/v3/pulls/comments/#list-comments-in-a-repository</remarks>
/// <param name="owner">The owner of the repository</param>
/// <param name="name">The name of the repository</param>
/// <param name="request">The sorting <see cref="PullRequestReviewCommentRequest">parameters</see></param>
/// <param name="options">Options for changing the API response</param>
/// <returns>The list of <see cref="PullRequestReviewComment"/>s for the specified repository</returns>
IObservable<PullRequestReviewComment> GetAllForRepository(string owner, string name, PullRequestReviewCommentRequest request, ApiOptions options);
/// <summary>
/// Gets a single pull request review comment by number.
/// </summary>

View File

@@ -31,7 +31,25 @@ namespace Octokit.Reactive
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
Ensure.ArgumentNotNullOrEmptyString(name, "name");
return _connection.GetAndFlattenAllPages<PullRequestReviewComment>(ApiUrls.PullRequestReviewComments(owner, name, number));
return GetAll(owner, name, number, ApiOptions.None);
}
/// <summary>
/// Gets review comments for a specified pull request.
/// </summary>
/// <remarks>http://developer.github.com/v3/pulls/comments/#list-comments-on-a-pull-request</remarks>
/// <param name="owner">The owner of the repository</param>
/// <param name="name">The name of the repository</param>
/// <param name="number">The pull request number</param>
/// <param name="options">Options for changing the API response</param>
/// <returns>The list of <see cref="PullRequestReviewComment"/>s for the specified pull request</returns>
public IObservable<PullRequestReviewComment> GetAll(string owner, string name, int number, ApiOptions options)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
Ensure.ArgumentNotNullOrEmptyString(name, "name");
Ensure.ArgumentNotNull(options, "options");
return _connection.GetAndFlattenAllPages<PullRequestReviewComment>(ApiUrls.PullRequestReviewComments(owner, name, number), options);
}
/// <summary>
@@ -43,7 +61,27 @@ namespace Octokit.Reactive
/// <returns>The list of <see cref="PullRequestReviewComment"/>s for the specified repository</returns>
public IObservable<PullRequestReviewComment> GetAllForRepository(string owner, string name)
{
return GetAllForRepository(owner, name, new PullRequestReviewCommentRequest());
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
Ensure.ArgumentNotNullOrEmptyString(name, "name");
return GetAllForRepository(owner, name, new PullRequestReviewCommentRequest(), ApiOptions.None);
}
/// <summary>
/// Gets a list of the pull request review comments in a specified repository.
/// </summary>
/// <remarks>http://developer.github.com/v3/pulls/comments/#list-comments-in-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 list of <see cref="PullRequestReviewComment"/>s for the specified repository</returns>
public IObservable<PullRequestReviewComment> GetAllForRepository(string owner, string name, ApiOptions options)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
Ensure.ArgumentNotNullOrEmptyString(name, "name");
Ensure.ArgumentNotNull(options, "options");
return GetAllForRepository(owner, name, new PullRequestReviewCommentRequest(), options);
}
/// <summary>
@@ -60,7 +98,27 @@ namespace Octokit.Reactive
Ensure.ArgumentNotNullOrEmptyString(name, "name");
Ensure.ArgumentNotNull(request, "request");
return _connection.GetAndFlattenAllPages<PullRequestReviewComment>(ApiUrls.PullRequestReviewCommentsRepository(owner, name), request.ToParametersDictionary());
return GetAllForRepository(owner, name, request, ApiOptions.None);
}
/// <summary>
/// Gets a list of the pull request review comments in a specified repository.
/// </summary>
/// <remarks>http://developer.github.com/v3/pulls/comments/#list-comments-in-a-repository</remarks>
/// <param name="owner">The owner of the repository</param>
/// <param name="name">The name of the repository</param>
/// <param name="request">The sorting <see cref="PullRequestReviewCommentRequest">parameters</see></param>
/// <param name="options">Options for changing the API response</param>
/// <returns>The list of <see cref="PullRequestReviewComment"/>s for the specified repository</returns>
public IObservable<PullRequestReviewComment> GetAllForRepository(string owner, string name, PullRequestReviewCommentRequest request, ApiOptions options)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
Ensure.ArgumentNotNullOrEmptyString(name, "name");
Ensure.ArgumentNotNull(request, "request");
Ensure.ArgumentNotNull(options, "options");
return _connection.GetAndFlattenAllPages<PullRequestReviewComment>(ApiUrls.PullRequestReviewCommentsRepository(owner, name), request.ToParametersDictionary(),
options);
}
/// <summary>

View File

@@ -161,7 +161,7 @@ public class PullRequestReviewCommentsClientTests
await Assert.ThrowsAsync<ArgumentException>(() => client.GetAllForRepository("", "name", request));
await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetAllForRepository("owner", null, request));
await Assert.ThrowsAsync<ArgumentException>(() => client.GetAllForRepository("owner", "", request));
await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetAllForRepository("owner", "name", null));
await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetAllForRepository("owner", "name", (PullRequestReviewCommentRequest)null));
}
[Fact]

View File

@@ -246,7 +246,7 @@ namespace Octokit.Tests.Reactive
await Assert.ThrowsAsync<ArgumentException>(() => client.GetAllForRepository("", "name", request).ToTask());
await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetAllForRepository("owner", null, request).ToTask());
await Assert.ThrowsAsync<ArgumentException>(() => client.GetAllForRepository("owner", "", request).ToTask());
await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetAllForRepository("owner", "name", null).ToTask());
await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetAllForRepository("owner", "name", (PullRequestReviewCommentRequest)null).ToTask());
}
}

View File

@@ -21,6 +21,17 @@ namespace Octokit
/// <returns>The list of <see cref="PullRequestReviewComment"/>s for the specified pull request</returns>
Task<IReadOnlyList<PullRequestReviewComment>> GetAll(string owner, string name, int number);
/// <summary>
/// Gets review comments for a specified pull request.
/// </summary>
/// <remarks>http://developer.github.com/v3/pulls/comments/#list-comments-on-a-pull-request</remarks>
/// <param name="owner">The owner of the repository</param>
/// <param name="name">The name of the repository</param>
/// <param name="number">The pull request number</param>
/// <param name="options">Options for changing the API response</param>
/// <returns>The list of <see cref="PullRequestReviewComment"/>s for the specified pull request</returns>
Task<IReadOnlyList<PullRequestReviewComment>> GetAll(string owner, string name, int number, ApiOptions options);
/// <summary>
/// Gets a list of the pull request review comments in a specified repository.
/// </summary>
@@ -30,6 +41,16 @@ namespace Octokit
/// <returns>The list of <see cref="PullRequestReviewComment"/>s for the specified repository</returns>
Task<IReadOnlyList<PullRequestReviewComment>> GetAllForRepository(string owner, string name);
/// <summary>
/// Gets a list of the pull request review comments in a specified repository.
/// </summary>
/// <remarks>http://developer.github.com/v3/pulls/comments/#list-comments-in-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 list of <see cref="PullRequestReviewComment"/>s for the specified repository</returns>
Task<IReadOnlyList<PullRequestReviewComment>> GetAllForRepository(string owner, string name, ApiOptions options);
/// <summary>
/// Gets a list of the pull request review comments in a specified repository.
/// </summary>
@@ -40,6 +61,17 @@ namespace Octokit
/// <returns>The list of <see cref="PullRequestReviewComment"/>s for the specified repository</returns>
Task<IReadOnlyList<PullRequestReviewComment>> GetAllForRepository(string owner, string name, PullRequestReviewCommentRequest request);
/// <summary>
/// Gets a list of the pull request review comments in a specified repository.
/// </summary>
/// <remarks>http://developer.github.com/v3/pulls/comments/#list-comments-in-a-repository</remarks>
/// <param name="owner">The owner of the repository</param>
/// <param name="name">The name of the repository</param>
/// <param name="request">The sorting <see cref="PullRequestReviewCommentRequest">parameters</see></param>
/// <param name="options">Options for changing the API response</param>
/// <returns>The list of <see cref="PullRequestReviewComment"/>s for the specified repository</returns>
Task<IReadOnlyList<PullRequestReviewComment>> GetAllForRepository(string owner, string name, PullRequestReviewCommentRequest request, ApiOptions options);
/// <summary>
/// Gets a single pull request review comment by number.
/// </summary>

View File

@@ -30,7 +30,25 @@ namespace Octokit
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
Ensure.ArgumentNotNullOrEmptyString(name, "name");
return ApiConnection.GetAll<PullRequestReviewComment>(ApiUrls.PullRequestReviewComments(owner, name, number));
return GetAll(owner, name, number, ApiOptions.None);
}
/// <summary>
/// Gets review comments for a specified pull request.
/// </summary>
/// <remarks>http://developer.github.com/v3/pulls/comments/#list-comments-on-a-pull-request</remarks>
/// <param name="owner">The owner of the repository</param>
/// <param name="name">The name of the repository</param>
/// <param name="number">The pull request number</param>
/// <param name="options">Options for changing the API response</param>
/// <returns>The list of <see cref="PullRequestReviewComment"/>s for the specified pull request</returns>
public Task<IReadOnlyList<PullRequestReviewComment>> GetAll(string owner, string name, int number, ApiOptions options)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
Ensure.ArgumentNotNullOrEmptyString(name, "name");
Ensure.ArgumentNotNull(options, "options");
return ApiConnection.GetAll<PullRequestReviewComment>(ApiUrls.PullRequestReviewComments(owner, name, number), options);
}
/// <summary>
@@ -42,7 +60,27 @@ namespace Octokit
/// <returns>The list of <see cref="PullRequestReviewComment"/>s for the specified repository</returns>
public Task<IReadOnlyList<PullRequestReviewComment>> GetAllForRepository(string owner, string name)
{
return GetAllForRepository(owner, name, new PullRequestReviewCommentRequest());
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
Ensure.ArgumentNotNullOrEmptyString(name, "name");
return GetAllForRepository(owner, name, new PullRequestReviewCommentRequest(), ApiOptions.None);
}
/// <summary>
/// Gets a list of the pull request review comments in a specified repository.
/// </summary>
/// <remarks>http://developer.github.com/v3/pulls/comments/#list-comments-in-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 list of <see cref="PullRequestReviewComment"/>s for the specified repository</returns>
public Task<IReadOnlyList<PullRequestReviewComment>> GetAllForRepository(string owner, string name, ApiOptions options)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
Ensure.ArgumentNotNullOrEmptyString(name, "name");
Ensure.ArgumentNotNull(options, "options");
return GetAllForRepository(owner, name, new PullRequestReviewCommentRequest(), options);
}
/// <summary>
@@ -59,7 +97,26 @@ namespace Octokit
Ensure.ArgumentNotNullOrEmptyString(name, "name");
Ensure.ArgumentNotNull(request, "request");
return ApiConnection.GetAll<PullRequestReviewComment>(ApiUrls.PullRequestReviewCommentsRepository(owner, name), request.ToParametersDictionary());
return GetAllForRepository(owner, name, request, ApiOptions.None);
}
/// <summary>
/// Gets a list of the pull request review comments in a specified repository.
/// </summary>
/// <remarks>http://developer.github.com/v3/pulls/comments/#list-comments-in-a-repository</remarks>
/// <param name="owner">The owner of the repository</param>
/// <param name="name">The name of the repository</param>
/// <param name="request">The sorting <see cref="PullRequestReviewCommentRequest">parameters</see></param>
/// <param name="options">Options for changing the API response</param>
/// <returns>The list of <see cref="PullRequestReviewComment"/>s for the specified repository</returns>
public Task<IReadOnlyList<PullRequestReviewComment>> GetAllForRepository(string owner, string name, PullRequestReviewCommentRequest request, ApiOptions options)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
Ensure.ArgumentNotNullOrEmptyString(name, "name");
Ensure.ArgumentNotNull(request, "request");
Ensure.ArgumentNotNull(options, "options");
return ApiConnection.GetAll<PullRequestReviewComment>(ApiUrls.PullRequestReviewCommentsRepository(owner, name), request.ToParametersDictionary(), options);
}
/// <summary>