From 6ece0ef037d09239b50f3f73c1372c67378ce93a Mon Sep 17 00:00:00 2001 From: "aedampir@gmail.com" Date: Wed, 25 May 2016 13:27:44 +0700 Subject: [PATCH] added new overloads --- .../Clients/IObservablePullRequestsClient.cs | 25 ++++++++++ .../Clients/ObservablePullRequestsClient.cs | 47 ++++++++++++++++++- Octokit/Clients/IPullRequestsClient.cs | 25 ++++++++++ Octokit/Clients/PullRequestsClient.cs | 47 ++++++++++++++++++- 4 files changed, 140 insertions(+), 4 deletions(-) diff --git a/Octokit.Reactive/Clients/IObservablePullRequestsClient.cs b/Octokit.Reactive/Clients/IObservablePullRequestsClient.cs index c1d85374..ad26ec10 100644 --- a/Octokit.Reactive/Clients/IObservablePullRequestsClient.cs +++ b/Octokit.Reactive/Clients/IObservablePullRequestsClient.cs @@ -32,6 +32,18 @@ namespace Octokit.Reactive /// A collection of results IObservable GetAllForRepository(string owner, string name); + /// + /// Gets all open pull requests for the repository. + /// + /// + /// http://developer.github.com/v3/pulls/#list-pull-requests + /// + /// The owner of the repository + /// The name of the repository + /// Options for changing the API response + /// A collection of results + IObservable GetAllForRepository(string owner, string name, ApiOptions options); + /// /// Query pull requests for the repository based on criteria /// @@ -44,6 +56,19 @@ namespace Octokit.Reactive /// A collection of results IObservable GetAllForRepository(string owner, string name, PullRequestRequest request); + /// + /// Query pull requests for the repository based on criteria + /// + /// + /// http://developer.github.com/v3/pulls/#list-pull-requests + /// + /// The owner of the repository + /// The name of the repository + /// Used to filter and sort the list of pull requests returned + /// Options for changing the API response + /// A collection of results + IObservable GetAllForRepository(string owner, string name, PullRequestRequest request, ApiOptions options); + /// /// Creates a pull request for the specified repository. /// diff --git a/Octokit.Reactive/Clients/ObservablePullRequestsClient.cs b/Octokit.Reactive/Clients/ObservablePullRequestsClient.cs index b62929d6..20e87680 100644 --- a/Octokit.Reactive/Clients/ObservablePullRequestsClient.cs +++ b/Octokit.Reactive/Clients/ObservablePullRequestsClient.cs @@ -49,7 +49,29 @@ namespace Octokit.Reactive /// A collection of results public IObservable GetAllForRepository(string owner, string name) { - return _connection.GetAndFlattenAllPages(ApiUrls.PullRequests(owner, name)); + Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); + Ensure.ArgumentNotNullOrEmptyString(name, "name"); + + return GetAllForRepository(owner, name, ApiOptions.None); + } + + /// + /// Gets all open pull requests for the repository. + /// + /// + /// http://developer.github.com/v3/pulls/#list-pull-requests + /// + /// The owner of the repository + /// The name of the repository + /// Options for changing the API response + /// A collection of results + public IObservable GetAllForRepository(string owner, string name, ApiOptions options) + { + Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); + Ensure.ArgumentNotNullOrEmptyString(name, "name"); + Ensure.ArgumentNotNull(options, "options"); + + return _connection.GetAndFlattenAllPages(ApiUrls.PullRequests(owner, name), options); } /// @@ -68,8 +90,29 @@ namespace Octokit.Reactive Ensure.ArgumentNotNullOrEmptyString(name, "name"); Ensure.ArgumentNotNull(request, "request"); + return GetAllForRepository(owner, name, request, ApiOptions.None); + } + + /// + /// Query pull requests for the repository based on criteria + /// + /// + /// http://developer.github.com/v3/pulls/#list-pull-requests + /// + /// The owner of the repository + /// The name of the repository + /// Used to filter and sort the list of pull requests returned + /// Options for changing the API response + /// A collection of results + public IObservable GetAllForRepository(string owner, string name, PullRequestRequest request, ApiOptions options) + { + Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); + Ensure.ArgumentNotNullOrEmptyString(name, "name"); + Ensure.ArgumentNotNull(request, "request"); + Ensure.ArgumentNotNull(options, "options"); + return _connection.GetAndFlattenAllPages(ApiUrls.PullRequests(owner, name), - request.ToParametersDictionary()); + request.ToParametersDictionary(), options); } /// diff --git a/Octokit/Clients/IPullRequestsClient.cs b/Octokit/Clients/IPullRequestsClient.cs index 0ed1cd25..1dfd8a25 100644 --- a/Octokit/Clients/IPullRequestsClient.cs +++ b/Octokit/Clients/IPullRequestsClient.cs @@ -33,6 +33,18 @@ namespace Octokit /// A of s which are currently open Task> GetAllForRepository(string owner, string name); + /// + /// Get all open pull requests for the repository. + /// + /// + /// http://developer.github.com/v3/pulls/#list-pull-requests + /// + /// The owner of the repository + /// The name of the repository + /// Options for changing the API response + /// A of s which are currently open + Task> GetAllForRepository(string owner, string name, ApiOptions options); + /// /// Query pull requests for the repository based on criteria /// @@ -45,6 +57,19 @@ namespace Octokit /// A of s which match the criteria Task> GetAllForRepository(string owner, string name, PullRequestRequest request); + /// + /// Query pull requests for the repository based on criteria + /// + /// + /// http://developer.github.com/v3/pulls/#list-pull-requests + /// + /// The owner of the repository + /// The name of the repository + /// Used to filter and sort the list of pull requests returned + /// Options for changing the API response + /// A of s which match the criteria + Task> GetAllForRepository(string owner, string name, PullRequestRequest request, ApiOptions options); + /// /// Create a pull request for the specified repository. /// diff --git a/Octokit/Clients/PullRequestsClient.cs b/Octokit/Clients/PullRequestsClient.cs index 119b2c87..f1d3f49e 100644 --- a/Octokit/Clients/PullRequestsClient.cs +++ b/Octokit/Clients/PullRequestsClient.cs @@ -42,7 +42,29 @@ namespace Octokit /// A of s which are currently open public Task> GetAllForRepository(string owner, string name) { - return GetAllForRepository(owner, name, new PullRequestRequest()); + Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); + Ensure.ArgumentNotNullOrEmptyString(name, "name"); + + return GetAllForRepository(owner, name, new PullRequestRequest(), ApiOptions.None); + } + + /// + /// Get all open pull requests for the repository. + /// + /// + /// http://developer.github.com/v3/pulls/#list-pull-requests + /// + /// The owner of the repository + /// The name of the repository + /// Options for changing the API response + /// A of s which are currently open + 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 PullRequestRequest(), options); } /// @@ -61,8 +83,29 @@ namespace Octokit Ensure.ArgumentNotNullOrEmptyString(name, "name"); Ensure.ArgumentNotNull(request, "request"); + return GetAllForRepository(owner, name, request, ApiOptions.None); + } + + /// + /// Query pull requests for the repository based on criteria + /// + /// + /// http://developer.github.com/v3/pulls/#list-pull-requests + /// + /// The owner of the repository + /// The name of the repository + /// Used to filter and sort the list of pull requests returned + /// Options for changing the API response + /// A of s which match the criteria + public Task> GetAllForRepository(string owner, string name, PullRequestRequest request, ApiOptions options) + { + Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); + Ensure.ArgumentNotNullOrEmptyString(name, "name"); + Ensure.ArgumentNotNull(request, "request"); + Ensure.ArgumentNotNull(options, "options"); + return ApiConnection.GetAll(ApiUrls.PullRequests(owner, name), - request.ToParametersDictionary()); + request.ToParametersDictionary(), options); } ///