From afd865b91ac723614f80d8a592b532d4891ec10c Mon Sep 17 00:00:00 2001 From: "aedampir@gmail.com" Date: Thu, 26 May 2016 13:48:31 +0700 Subject: [PATCH] added new overloads --- ...servablePullRequestReviewCommentsClient.cs | 32 ++++++++++ ...servablePullRequestReviewCommentsClient.cs | 64 ++++++++++++++++++- .../PullRequestReviewCommentsClientTests.cs | 2 +- ...blePullRequestReviewCommentsClientTests.cs | 2 +- .../IPullRequestReviewCommentsClient.cs | 32 ++++++++++ .../PullRequestReviewCommentsClient.cs | 63 +++++++++++++++++- 6 files changed, 187 insertions(+), 8 deletions(-) diff --git a/Octokit.Reactive/Clients/IObservablePullRequestReviewCommentsClient.cs b/Octokit.Reactive/Clients/IObservablePullRequestReviewCommentsClient.cs index a4868c70..bc609f18 100644 --- a/Octokit.Reactive/Clients/IObservablePullRequestReviewCommentsClient.cs +++ b/Octokit.Reactive/Clients/IObservablePullRequestReviewCommentsClient.cs @@ -15,6 +15,17 @@ namespace Octokit.Reactive /// The list of s for the specified pull request IObservable GetAll(string owner, string name, int number); + /// + /// Gets review comments for a specified pull request. + /// + /// http://developer.github.com/v3/pulls/comments/#list-comments-on-a-pull-request + /// The owner of the repository + /// The name of the repository + /// The pull request number + /// Options for changing the API response + /// The list of s for the specified pull request + IObservable GetAll(string owner, string name, int number, ApiOptions options); + /// /// Gets a list of the pull request review comments in a specified repository. /// @@ -24,6 +35,16 @@ namespace Octokit.Reactive /// The list of s for the specified repository IObservable GetAllForRepository(string owner, string name); + /// + /// Gets a list of the pull request review comments in a specified repository. + /// + /// http://developer.github.com/v3/pulls/comments/#list-comments-in-a-repository + /// The owner of the repository + /// The name of the repository + /// Options for changing the API response + /// The list of s for the specified repository + IObservable GetAllForRepository(string owner, string name, ApiOptions options); + /// /// Gets a list of the pull request review comments in a specified repository. /// @@ -34,6 +55,17 @@ namespace Octokit.Reactive /// The list of s for the specified repository IObservable GetAllForRepository(string owner, string name, PullRequestReviewCommentRequest request); + /// + /// Gets a list of the pull request review comments in a specified repository. + /// + /// http://developer.github.com/v3/pulls/comments/#list-comments-in-a-repository + /// The owner of the repository + /// The name of the repository + /// The sorting parameters + /// Options for changing the API response + /// The list of s for the specified repository + IObservable GetAllForRepository(string owner, string name, PullRequestReviewCommentRequest request, ApiOptions options); + /// /// Gets a single pull request review comment by number. /// diff --git a/Octokit.Reactive/Clients/ObservablePullRequestReviewCommentsClient.cs b/Octokit.Reactive/Clients/ObservablePullRequestReviewCommentsClient.cs index 3fd32795..5ae71eda 100644 --- a/Octokit.Reactive/Clients/ObservablePullRequestReviewCommentsClient.cs +++ b/Octokit.Reactive/Clients/ObservablePullRequestReviewCommentsClient.cs @@ -31,7 +31,25 @@ namespace Octokit.Reactive Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(name, "name"); - return _connection.GetAndFlattenAllPages(ApiUrls.PullRequestReviewComments(owner, name, number)); + return GetAll(owner, name, number, ApiOptions.None); + } + + /// + /// Gets review comments for a specified pull request. + /// + /// http://developer.github.com/v3/pulls/comments/#list-comments-on-a-pull-request + /// The owner of the repository + /// The name of the repository + /// The pull request number + /// Options for changing the API response + /// The list of s for the specified pull request + public IObservable GetAll(string owner, string name, int number, ApiOptions options) + { + Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); + Ensure.ArgumentNotNullOrEmptyString(name, "name"); + Ensure.ArgumentNotNull(options, "options"); + + return _connection.GetAndFlattenAllPages(ApiUrls.PullRequestReviewComments(owner, name, number), options); } /// @@ -43,7 +61,27 @@ namespace Octokit.Reactive /// The list of s for the specified repository public IObservable 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); + } + + /// + /// Gets a list of the pull request review comments in a specified repository. + /// + /// http://developer.github.com/v3/pulls/comments/#list-comments-in-a-repository + /// The owner of the repository + /// The name of the repository + /// Options for changing the API response + /// The list of s for the specified repository + public IObservable 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); } /// @@ -60,7 +98,27 @@ namespace Octokit.Reactive Ensure.ArgumentNotNullOrEmptyString(name, "name"); Ensure.ArgumentNotNull(request, "request"); - return _connection.GetAndFlattenAllPages(ApiUrls.PullRequestReviewCommentsRepository(owner, name), request.ToParametersDictionary()); + return GetAllForRepository(owner, name, request, ApiOptions.None); + } + + /// + /// Gets a list of the pull request review comments in a specified repository. + /// + /// http://developer.github.com/v3/pulls/comments/#list-comments-in-a-repository + /// The owner of the repository + /// The name of the repository + /// The sorting parameters + /// Options for changing the API response + /// The list of s for the specified repository + public IObservable 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(ApiUrls.PullRequestReviewCommentsRepository(owner, name), request.ToParametersDictionary(), + options); } /// diff --git a/Octokit.Tests/Clients/PullRequestReviewCommentsClientTests.cs b/Octokit.Tests/Clients/PullRequestReviewCommentsClientTests.cs index 99ebd227..875e26d7 100644 --- a/Octokit.Tests/Clients/PullRequestReviewCommentsClientTests.cs +++ b/Octokit.Tests/Clients/PullRequestReviewCommentsClientTests.cs @@ -161,7 +161,7 @@ public class PullRequestReviewCommentsClientTests await Assert.ThrowsAsync(() => client.GetAllForRepository("", "name", request)); await Assert.ThrowsAsync(() => client.GetAllForRepository("owner", null, request)); await Assert.ThrowsAsync(() => client.GetAllForRepository("owner", "", request)); - await Assert.ThrowsAsync(() => client.GetAllForRepository("owner", "name", null)); + await Assert.ThrowsAsync(() => client.GetAllForRepository("owner", "name", (PullRequestReviewCommentRequest)null)); } [Fact] diff --git a/Octokit.Tests/Reactive/ObservablePullRequestReviewCommentsClientTests.cs b/Octokit.Tests/Reactive/ObservablePullRequestReviewCommentsClientTests.cs index 06522564..934cceda 100644 --- a/Octokit.Tests/Reactive/ObservablePullRequestReviewCommentsClientTests.cs +++ b/Octokit.Tests/Reactive/ObservablePullRequestReviewCommentsClientTests.cs @@ -246,7 +246,7 @@ namespace Octokit.Tests.Reactive await Assert.ThrowsAsync(() => client.GetAllForRepository("", "name", request).ToTask()); await Assert.ThrowsAsync(() => client.GetAllForRepository("owner", null, request).ToTask()); await Assert.ThrowsAsync(() => client.GetAllForRepository("owner", "", request).ToTask()); - await Assert.ThrowsAsync(() => client.GetAllForRepository("owner", "name", null).ToTask()); + await Assert.ThrowsAsync(() => client.GetAllForRepository("owner", "name", (PullRequestReviewCommentRequest)null).ToTask()); } } diff --git a/Octokit/Clients/IPullRequestReviewCommentsClient.cs b/Octokit/Clients/IPullRequestReviewCommentsClient.cs index a58b3c1f..821bb595 100644 --- a/Octokit/Clients/IPullRequestReviewCommentsClient.cs +++ b/Octokit/Clients/IPullRequestReviewCommentsClient.cs @@ -21,6 +21,17 @@ namespace Octokit /// The list of s for the specified pull request Task> GetAll(string owner, string name, int number); + /// + /// Gets review comments for a specified pull request. + /// + /// http://developer.github.com/v3/pulls/comments/#list-comments-on-a-pull-request + /// The owner of the repository + /// The name of the repository + /// The pull request number + /// Options for changing the API response + /// The list of s for the specified pull request + Task> GetAll(string owner, string name, int number, ApiOptions options); + /// /// Gets a list of the pull request review comments in a specified repository. /// @@ -30,6 +41,16 @@ namespace Octokit /// The list of s for the specified repository Task> GetAllForRepository(string owner, string name); + /// + /// Gets a list of the pull request review comments in a specified repository. + /// + /// http://developer.github.com/v3/pulls/comments/#list-comments-in-a-repository + /// The owner of the repository + /// The name of the repository + /// Options for changing the API response + /// The list of s for the specified repository + Task> GetAllForRepository(string owner, string name, ApiOptions options); + /// /// Gets a list of the pull request review comments in a specified repository. /// @@ -40,6 +61,17 @@ namespace Octokit /// The list of s for the specified repository Task> GetAllForRepository(string owner, string name, PullRequestReviewCommentRequest request); + /// + /// Gets a list of the pull request review comments in a specified repository. + /// + /// http://developer.github.com/v3/pulls/comments/#list-comments-in-a-repository + /// The owner of the repository + /// The name of the repository + /// The sorting parameters + /// Options for changing the API response + /// The list of s for the specified repository + Task> GetAllForRepository(string owner, string name, PullRequestReviewCommentRequest request, ApiOptions options); + /// /// Gets a single pull request review comment by number. /// diff --git a/Octokit/Clients/PullRequestReviewCommentsClient.cs b/Octokit/Clients/PullRequestReviewCommentsClient.cs index 8db0925b..439e70d8 100644 --- a/Octokit/Clients/PullRequestReviewCommentsClient.cs +++ b/Octokit/Clients/PullRequestReviewCommentsClient.cs @@ -30,7 +30,25 @@ namespace Octokit Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(name, "name"); - return ApiConnection.GetAll(ApiUrls.PullRequestReviewComments(owner, name, number)); + return GetAll(owner, name, number, ApiOptions.None); + } + + /// + /// Gets review comments for a specified pull request. + /// + /// http://developer.github.com/v3/pulls/comments/#list-comments-on-a-pull-request + /// The owner of the repository + /// The name of the repository + /// The pull request number + /// Options for changing the API response + /// The list of s for the specified pull request + public Task> GetAll(string owner, string name, int number, ApiOptions options) + { + Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); + Ensure.ArgumentNotNullOrEmptyString(name, "name"); + Ensure.ArgumentNotNull(options, "options"); + + return ApiConnection.GetAll(ApiUrls.PullRequestReviewComments(owner, name, number), options); } /// @@ -42,7 +60,27 @@ namespace Octokit /// The list of s for the specified repository public Task> 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); + } + + /// + /// Gets a list of the pull request review comments in a specified repository. + /// + /// http://developer.github.com/v3/pulls/comments/#list-comments-in-a-repository + /// The owner of the repository + /// The name of the repository + /// Options for changing the API response + /// The list of s for the specified repository + public Task> 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); } /// @@ -59,7 +97,26 @@ namespace Octokit Ensure.ArgumentNotNullOrEmptyString(name, "name"); Ensure.ArgumentNotNull(request, "request"); - return ApiConnection.GetAll(ApiUrls.PullRequestReviewCommentsRepository(owner, name), request.ToParametersDictionary()); + return GetAllForRepository(owner, name, request, ApiOptions.None); + } + + /// + /// Gets a list of the pull request review comments in a specified repository. + /// + /// http://developer.github.com/v3/pulls/comments/#list-comments-in-a-repository + /// The owner of the repository + /// The name of the repository + /// The sorting parameters + /// Options for changing the API response + /// The list of s for the specified repository + public Task> 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(ApiUrls.PullRequestReviewCommentsRepository(owner, name), request.ToParametersDictionary(), options); } ///