Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Pull Request Review Request API. #1588

Merged
merged 25 commits into from
May 14, 2017
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
ce66988
Add Pull Request Review Request API.
gdziadkiewicz Apr 6, 2017
1e3512f
Merge branch 'master' into PullRequestReviewRequestAPI
gdziadkiewicz Apr 19, 2017
2624676
Add Reactive Pull Request Review Request API.
gdziadkiewicz Apr 20, 2017
91ada35
Add PullRequestReviewRequestClient tests.
gdziadkiewicz Apr 21, 2017
5169aec
Add ObservablePullRequestReviewRequestClient tests.
gdziadkiewicz Apr 21, 2017
36e6f02
Fix sub-client property naming.
gdziadkiewicz Apr 23, 2017
55deff2
Remove redundant model and update PullRequest model.
gdziadkiewicz Apr 26, 2017
896cfae
Add repositoryId based methods and missing Observable documentation.
gdziadkiewicz Apr 26, 2017
59056ec
Add missing parameter to PullRequest ctor.
Apr 27, 2017
cae3701
Merge branch 'master' into PullRequestReviewRequestAPI
gdziadkiewicz May 5, 2017
bc9a8d0
Add integration tests for PullRequestReviewRequest.
gdziadkiewicz May 6, 2017
7cf3331
Upgrade PullRequestReviewRequest integration tests.
gdziadkiewicz May 6, 2017
2ee3be3
Add integration tests for repositoryId methods and fix url bug.
gdziadkiewicz May 7, 2017
0be9f19
Add missing unit tests and fix PR issues.
gdziadkiewicz May 7, 2017
995d4d8
Add pagination support for PullRequestReviewRequst.GetAll and tests f…
gdziadkiewicz May 7, 2017
fab5a03
Merge branch 'master' into PullRequestReviewRequestAPI
gdziadkiewicz May 8, 2017
bfcd1de
Revert changes on `PullRequestReviewCommentsClientTests.cs`
gdziadkiewicz May 8, 2017
4b348be
Small upgrades - remove unused using and compress property to express…
gdziadkiewicz May 8, 2017
b62601a
Revert use of expression body in property.
gdziadkiewicz May 8, 2017
802022e
Add pagination tests for PullRequestReviewRequest.GetAll.
gdziadkiewicz May 9, 2017
d6b7161
Change pagination tests to use 2 users.
May 11, 2017
5c9d9da
Correct class/file name
ryangribble May 11, 2017
a093315
Reword the integration test names for consistency
ryangribble May 11, 2017
57d0d49
Fix DebuggerDisplay of requested reviewers
ryangribble May 12, 2017
e194682
fix reviewRequestToCreate parameter to be consistent
ryangribble May 12, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
using System;
using System.Collections.Generic;
using System.Reactive;
using System.Threading.Tasks;

namespace Octokit.Reactive
{
/// <summary>
/// A client for GitHub's Pull Request Review Requests API.
/// </summary>
/// <remarks>
/// See the <a href="https://developer.github.com/v3/pulls/review_requests/">Review Requests API documentation</a> for more information.
/// </remarks>
public interface IObservablePullRequestReviewRequestsClient
{
/// <summary>
/// Gets review requests for a specified pull request.
/// </summary>
/// <remarks>https://developer.github.com/v3/pulls/review_requests/#list-review-requests</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>
IObservable<User> GetAll(string owner, string name, int number);

/// <summary>
/// Creates review requests on a pull request for specified users.
/// </summary>
/// <remarks>https://developer.github.com/v3/pulls/review_requests/#create-a-review-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="users">List of logins of user will be requested for review</param>
IObservable<PullRequest> Create(string owner, string name, int number, PullRequestReviewRequest users);

/// <summary>
/// Deletes review request for given users on a pull request.
/// </summary>
/// <remarks>https://developer.github.com/v3/pulls/review_requests/#delete-a-review-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 review comment number</param>
/// <param name="users">List of logins of users that will be not longer requested for review</param>
IObservable<Unit> Delete(string owner, string name, int number, PullRequestReviewRequest users);
}
}
5 changes: 5 additions & 0 deletions Octokit.Reactive/Clients/IObservablePullRequestsClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ public interface IObservablePullRequestsClient
/// </summary>
IObservablePullRequestReviewCommentsClient ReviewComment { get; }

/// <summary>
/// Client for managing review requests.
/// </summary>
IObservablePullRequestReviewRequestsClient ReviewRequest { get; }

/// <summary>
/// Gets a single Pull Request by number.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
using System;
using System.Reactive;
using System.Reactive.Threading.Tasks;
using Octokit.Reactive.Internal;

namespace Octokit.Reactive
{
public class ObservablePullRequestReviewRequestsClient : IObservablePullRequestReviewRequestsClient
{
readonly IPullRequestReviewRequestsClient _client;
readonly IConnection _connection;

public ObservablePullRequestReviewRequestsClient(IGitHubClient client)
{
Ensure.ArgumentNotNull(client, "client");

_client = client.PullRequest.ReviewRequest;
_connection = client.Connection;
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just FYI that we add the xmldoc comments to the interfaces and the client implementations, so once you are done with the changes please add the xmldoc comments to all the conrete methods as well 👍

public IObservable<User> GetAll(string owner, string name, int number)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
Ensure.ArgumentNotNullOrEmptyString(name, "name");

return _connection.GetAndFlattenAllPages<User>(ApiUrls.PullRequestReviewRequests(owner, name, number), null, AcceptHeaders.PullRequestReviewsApiPreview);
}

public IObservable<PullRequest> Create(string owner, string name, int number, PullRequestReviewRequest users)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
Ensure.ArgumentNotNullOrEmptyString(name, "name");
Ensure.ArgumentNotNull(users, "users");

return _client.Create(owner, name, number, users).ToObservable();
}

public IObservable<Unit> Delete(string owner, string name, int number, PullRequestReviewRequest users)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
Ensure.ArgumentNotNullOrEmptyString(name, "name");
Ensure.ArgumentNotNull(users, "users");

return _client.Delete(owner, name, number, users).ToObservable();
}
}
}
6 changes: 6 additions & 0 deletions Octokit.Reactive/Clients/ObservablePullRequestsClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,19 @@ public class ObservablePullRequestsClient : IObservablePullRequestsClient
/// </summary>
public IObservablePullRequestReviewCommentsClient ReviewComment { get; private set; }

/// <summary>
/// Client for managing review requests.
/// </summary>
public IObservablePullRequestReviewRequestsClient ReviewRequest { get; private set; }

public ObservablePullRequestsClient(IGitHubClient client)
{
Ensure.ArgumentNotNull(client, "client");

_client = client.Repository.PullRequest;
_connection = client.Connection;
ReviewComment = new ObservablePullRequestReviewCommentsClient(client);
ReviewRequest = new ObservablePullRequestReviewRequestsClient(client);
}

/// <summary>
Expand Down
2 changes: 2 additions & 0 deletions Octokit.Reactive/Octokit.Reactive-Mono.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,8 @@
<Compile Include="Clients\ObservableRepositoryBranchesClient.cs" />
<Compile Include="Clients\IObservableRepositoryTrafficClient.cs" />
<Compile Include="Clients\ObservableRepositoryTrafficClient.cs" />
<Compile Include="Clients\IObservablePullRequestReviewRequestsClient.cs" />
<Compile Include="Clients\ObservablePullRequestReviewRequestsClient.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
Expand Down
2 changes: 2 additions & 0 deletions Octokit.Reactive/Octokit.Reactive-MonoAndroid.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,8 @@
<Compile Include="Clients\ObservableRepositoryBranchesClient.cs" />
<Compile Include="Clients\IObservableRepositoryTrafficClient.cs" />
<Compile Include="Clients\ObservableRepositoryTrafficClient.cs" />
<Compile Include="Clients\IObservablePullRequestReviewRequestsClient.cs" />
<Compile Include="Clients\ObservablePullRequestReviewRequestsClient.cs" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Novell\Novell.MonoDroid.CSharp.targets" />
<ItemGroup>
Expand Down
2 changes: 2 additions & 0 deletions Octokit.Reactive/Octokit.Reactive-Monotouch.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,8 @@
<Compile Include="Clients\ObservableRepositoryBranchesClient.cs" />
<Compile Include="Clients\IObservableRepositoryTrafficClient.cs" />
<Compile Include="Clients\ObservableRepositoryTrafficClient.cs" />
<Compile Include="Clients\IObservablePullRequestReviewRequestsClient.cs" />
<Compile Include="Clients\ObservablePullRequestReviewRequestsClient.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
Expand Down
2 changes: 2 additions & 0 deletions Octokit.Reactive/Octokit.Reactive.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@
<Compile Include="Clients\IObservableMigrationClient.cs" />
<Compile Include="Clients\IObservableOauthClient.cs" />
<Compile Include="Clients\IObservablePullRequestReviewCommentReactionsClient.cs" />
<Compile Include="Clients\IObservablePullRequestReviewRequestsClient.cs" />
<Compile Include="Clients\IObservableRepositoryTrafficClient.cs" />
<Compile Include="Clients\ObservablePullRequestReviewRequestsClient.cs" />
<Compile Include="Clients\ObservableRepositoryBranchesClient.cs" />
<Compile Include="Clients\IObservableRepositoryBranchesClient.cs" />
<Compile Include="Clients\IObservableRepositoryCommitsClients.cs" />
Expand Down
Loading