forked from octokit/octokit.net
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement Review API for Pull Requests (octokit#1648)
* First Iteration Need to finish tests and docs * Mostly Complete * Fixing tests and adding review comments * Added tests for reactive client * Moved Reviews inside fo the Pull request client for better organization and began initial intigration testing * Fixing bad recursive function breaking tests * test fixes * Add paging support to review comments call * Fixing recursive function * Addressing comments from PR * fixing CI break * Typo build break * Fixing Convention Tests * Adding correct nameof() usage in Ensure * Small consitancy changes * Trigger build * Address PR Comments * Fixup test naming * Fix sub client ordering and incorrect URL * Tidy up comments and remove StringEnum wrapper from Request models as it is only for Response models * Rename GetReview to Get * tweak debugger display * Rework integration tests - implement the easy Get/GetAll ones first... * Implement integration tests for Create method. Move helpers to create PR/review into SetupHelper class Fixed up review status enum to contain correct values Tests for Approve/RequestChanges currently failing as a user cant approve/request changes on their own PR * Implement secondary account settings for integration tests and a new [DualAccountTest] attribute for discovery when configured Change integration test to create PR from the 2nd account, so the main test account is able to perform review actions on the PR * Add integration tests for Delete, Dismiss and Submit methods Fixed up API client implementation for delete (was looking for incorrect 201 http status) Removed unnecessary await/async calls from client implementations that dont need to do anything with the result * Attempting to add comments as part of a review revealed that we cant use the existing PullRequestReviewCommentCreate class as the API throws a validation error due to the CommitId field These newer review APIs need a DraftPullRequestReviewComment (that doesnt have a commitId) instead * add second test account user/password to configure-integration-tests script
- Loading branch information
1 parent
7c17021
commit ff9521c
Showing
26 changed files
with
3,381 additions
and
78 deletions.
There are no files selected for viewing
187 changes: 187 additions & 0 deletions
187
Octokit.Reactive/Clients/IObservablePullRequestReviewsClient.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,187 @@ | ||
using System; | ||
using System.Reactive; | ||
|
||
namespace Octokit.Reactive | ||
{ | ||
/// <summary> | ||
/// A client for GitHub's Pull Request Review API. | ||
/// </summary> | ||
/// <remarks> | ||
/// See the <a href="https://developer.github.com/v3/pulls/reviews/">Review API documentation</a> for more information. | ||
/// </remarks> | ||
public interface IObservablePullRequestReviewsClient | ||
{ | ||
/// <summary> | ||
/// Gets reviews for a specified pull request. | ||
/// </summary> | ||
/// <remarks>https://developer.github.com/v3/pulls/reviews/#list-reviews-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> | ||
IObservable<PullRequestReview> GetAll(string owner, string name, int number); | ||
|
||
/// <summary> | ||
/// Gets reviews for a specified pull request. | ||
/// </summary> | ||
/// <remarks>https://developer.github.com/v3/pulls/reviews/#list-reviews-on-a-pull-request</remarks> | ||
/// <param name="repositoryId">The Id of the repository</param> | ||
/// <param name="number">The pull request number</param> | ||
IObservable<PullRequestReview> GetAll(long repositoryId, int number); | ||
|
||
/// <summary> | ||
/// Gets reviews for a specified pull request. | ||
/// </summary> | ||
/// <remarks>https://developer.github.com/v3/pulls/reviews/#list-reviews-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> | ||
IObservable<PullRequestReview> GetAll(string owner, string name, int number, ApiOptions options); | ||
|
||
/// <summary> | ||
/// Gets reviews for a specified pull request. | ||
/// </summary> | ||
/// <remarks>https://developer.github.com/v3/pulls/reviews/#list-reviews-on-a-pull-request</remarks> | ||
/// <param name="repositoryId">The Id of the repository</param> | ||
/// <param name="number">The pull request number</param> | ||
/// <param name="options">Options for changing the API response</param> | ||
IObservable<PullRequestReview> GetAll(long repositoryId, int number, ApiOptions options); | ||
|
||
/// <summary> | ||
/// Gets a single pull request review by ID. | ||
/// </summary> | ||
/// <remarks>https://developer.github.com/v3/pulls/reviews/#get-a-single-review</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="reviewId">The pull request review number</param> | ||
IObservable<PullRequestReview> Get(string owner, string name, int number, long reviewId); | ||
|
||
/// <summary> | ||
/// Gets a single pull request review by ID. | ||
/// </summary> | ||
/// <remarks>https://developer.github.com/v3/pulls/reviews/#get-a-single-review</remarks> | ||
/// <param name="repositoryId">The Id of the repository</param> | ||
/// <param name="number">The pull request number</param> | ||
/// <param name="reviewId">The pull request review number</param> | ||
IObservable<PullRequestReview> Get(long repositoryId, int number, long reviewId); | ||
|
||
/// <summary> | ||
/// Creates a pull request review. | ||
/// </summary> | ||
/// <remarks>https://developer.github.com/v3/pulls/reviews/#create-a-pull-request-review</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="review">The review</param> | ||
IObservable<PullRequestReview> Create(string owner, string name, int number, PullRequestReviewCreate review); | ||
|
||
/// <summary> | ||
/// Creates a pull request review. | ||
/// </summary> | ||
/// <remarks>https://developer.github.com/v3/pulls/reviews/#create-a-pull-request-review</remarks> | ||
/// <param name="repositoryId">The Id of the repository</param> | ||
/// <param name="number">The Pull Request number</param> | ||
/// <param name="review">The review</param> | ||
IObservable<PullRequestReview> Create(long repositoryId, int number, PullRequestReviewCreate review); | ||
|
||
/// <summary> | ||
/// Deletes a pull request review. | ||
/// </summary> | ||
/// <remarks>https://developer.github.com/v3/pulls/reviews/#delete-a-pending-review</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="reviewId">The pull request review number</param> | ||
IObservable<Unit> Delete(string owner, string name, int number, long reviewId); | ||
|
||
/// <summary> | ||
/// Deletes a pull request review. | ||
/// </summary> | ||
/// <remarks>https://developer.github.com/v3/pulls/reviews/#delete-a-pending-review</remarks> | ||
/// <param name="repositoryId">The Id of the repository</param> | ||
/// <param name="number">The pull request number</param> | ||
/// <param name="reviewId">The pull request review number</param> | ||
IObservable<Unit> Delete(long repositoryId, int number, long reviewId); | ||
|
||
/// <summary> | ||
/// Submits a pull request review. | ||
/// </summary> | ||
/// <remarks>https://developer.github.com/v3/pulls/reviews/#submit-a-pull-request-review</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="reviewId">The pull request review number</param> | ||
/// <param name="submitMessage">The message and event being submitted for the review</param> | ||
IObservable<PullRequestReview> Submit(string owner, string name, int number, long reviewId, PullRequestReviewSubmit submitMessage); | ||
|
||
/// <summary> | ||
/// Submits a pull request review. | ||
/// </summary> | ||
/// <remarks>https://developer.github.com/v3/pulls/reviews/#submit-a-pull-request-review</remarks> | ||
/// <param name="repositoryId">The Id of the repository</param> | ||
/// <param name="number">The pull request number</param> | ||
/// <param name="reviewId">The pull request review number</param> | ||
/// <param name="submitMessage">The message and event being submitted for the review</param> | ||
IObservable<PullRequestReview> Submit(long repositoryId, int number, long reviewId, PullRequestReviewSubmit submitMessage); | ||
|
||
/// <summary> | ||
/// Dismisses a pull request review. | ||
/// </summary> | ||
/// <remarks>https://developer.github.com/v3/pulls/reviews/#dismiss-a-pull-request-review</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="reviewId">The pull request review number</param> | ||
/// <param name="dismissMessage">The message indicating why the review was dismissed</param> | ||
IObservable<PullRequestReview> Dismiss(string owner, string name, int number, long reviewId, PullRequestReviewDismiss dismissMessage); | ||
|
||
/// <summary> | ||
/// Dismisses a pull request review. | ||
/// </summary> | ||
/// <remarks>https://developer.github.com/v3/pulls/reviews/#dismiss-a-pull-request-review</remarks> | ||
/// <param name="repositoryId">The Id of the repository</param> | ||
/// <param name="number">The pull request number</param> | ||
/// <param name="reviewId">The pull request review number</param> | ||
/// <param name="dismissMessage">The message indicating why the review was dismissed</param> | ||
IObservable<PullRequestReview> Dismiss(long repositoryId, int number, long reviewId, PullRequestReviewDismiss dismissMessage); | ||
|
||
/// <summary> | ||
/// Lists comments for a single review | ||
/// </summary> | ||
/// <remarks>https://developer.github.com/v3/pulls/reviews/#get-comments-for-a-single-review</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="reviewId">The pull request review number</param> | ||
IObservable<PullRequestReviewComment> GetAllComments(string owner, string name, int number, long reviewId); | ||
|
||
/// <summary> | ||
/// Dismisses a pull request review. | ||
/// </summary> | ||
/// <remarks>https://developer.github.com/v3/pulls/reviews/#get-comments-for-a-single-review</remarks> | ||
/// <param name="repositoryId">The Id of the repository</param> | ||
/// <param name="number">The pull request number</param> | ||
/// <param name="reviewId">The pull request review number</param> | ||
IObservable<PullRequestReviewComment> GetAllComments(long repositoryId, int number, long reviewId); | ||
|
||
/// <summary> | ||
/// Lists comments for a single review | ||
/// </summary> | ||
/// <remarks>https://developer.github.com/v3/pulls/reviews/#get-comments-for-a-single-review</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="reviewId">The pull request review number</param> | ||
IObservable<PullRequestReviewComment> GetAllComments(string owner, string name, int number, long reviewId, ApiOptions options); | ||
|
||
/// <summary> | ||
/// Dismisses a pull request review. | ||
/// </summary> | ||
/// <remarks>https://developer.github.com/v3/pulls/reviews/#get-comments-for-a-single-review</remarks> | ||
/// <param name="repositoryId">The Id of the repository</param> | ||
/// <param name="number">The pull request number</param> | ||
/// <param name="reviewId">The pull request review number</param> | ||
IObservable<PullRequestReviewComment> GetAllComments(long repositoryId, int number, long reviewId, ApiOptions options); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.