mirror of
https://github.com/zoriya/octokit.net.git
synced 2025-12-05 23:06:10 +00:00
* 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
250 lines
12 KiB
C#
250 lines
12 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Diagnostics.CodeAnalysis;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Octokit
|
|
{
|
|
/// <summary>
|
|
/// A client for GitHub's Pull Requests API.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// See the <a href="http://developer.github.com/v3/activity/notifications/">Pull Requests API documentation</a> for more information.
|
|
/// </remarks>
|
|
public interface IPullRequestsClient
|
|
{
|
|
/// <summary>
|
|
/// Client for managing review comments.
|
|
/// </summary>
|
|
[Obsolete("Please use IPullRequestsClient.ReviewComment instead. This method will be removed in a future version")]
|
|
IPullRequestReviewCommentsClient Comment { get; }
|
|
|
|
/// <summary>
|
|
/// Client for managing reviews.
|
|
/// </summary>
|
|
IPullRequestReviewsClient Review { get; }
|
|
|
|
/// <summary>
|
|
/// Client for managing review comments.
|
|
/// </summary>
|
|
IPullRequestReviewCommentsClient ReviewComment { get; }
|
|
|
|
/// <summary>
|
|
/// Client for managing review requests.
|
|
/// </summary>
|
|
IPullRequestReviewRequestsClient ReviewRequest { get; }
|
|
|
|
/// <summary>
|
|
/// Get a pull request by number.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// http://developer.github.com/v3/pulls/#get-a-single-pull-request
|
|
/// </remarks>
|
|
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get",
|
|
Justification = "Method makes a network request")]
|
|
Task<PullRequest> Get(string owner, string name, int number);
|
|
|
|
/// <summary>
|
|
/// Get a pull request by number.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// http://developer.github.com/v3/pulls/#get-a-single-pull-request
|
|
/// </remarks>
|
|
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get",
|
|
Justification = "Method makes a network request")]
|
|
Task<PullRequest> Get(long repositoryId, int number);
|
|
|
|
/// <summary>
|
|
/// Get all open pull requests for the repository.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// http://developer.github.com/v3/pulls/#list-pull-requests
|
|
/// </remarks>
|
|
/// <param name="owner">The owner of the repository</param>
|
|
/// <param name="name">The name of the repository</param>
|
|
Task<IReadOnlyList<PullRequest>> GetAllForRepository(string owner, string name);
|
|
|
|
/// <summary>
|
|
/// Get all open pull requests for the repository.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// http://developer.github.com/v3/pulls/#list-pull-requests
|
|
/// </remarks>
|
|
/// <param name="repositoryId">The Id of the repository</param>
|
|
Task<IReadOnlyList<PullRequest>> GetAllForRepository(long repositoryId);
|
|
|
|
/// <summary>
|
|
/// Get all open pull requests for the repository.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// http://developer.github.com/v3/pulls/#list-pull-requests
|
|
/// </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>
|
|
Task<IReadOnlyList<PullRequest>> GetAllForRepository(string owner, string name, ApiOptions options);
|
|
|
|
/// <summary>
|
|
/// Get all open pull requests for the repository.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// http://developer.github.com/v3/pulls/#list-pull-requests
|
|
/// </remarks>
|
|
/// <param name="repositoryId">The Id of the repository</param>
|
|
/// <param name="options">Options for changing the API response</param>
|
|
Task<IReadOnlyList<PullRequest>> GetAllForRepository(long repositoryId, ApiOptions options);
|
|
|
|
/// <summary>
|
|
/// Query pull requests for the repository based on criteria
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// http://developer.github.com/v3/pulls/#list-pull-requests
|
|
/// </remarks>
|
|
/// <param name="owner">The owner of the repository</param>
|
|
/// <param name="name">The name of the repository</param>
|
|
/// <param name="request">Used to filter and sort the list of pull requests returned</param>
|
|
Task<IReadOnlyList<PullRequest>> GetAllForRepository(string owner, string name, PullRequestRequest request);
|
|
|
|
/// <summary>
|
|
/// Query pull requests for the repository based on criteria
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// http://developer.github.com/v3/pulls/#list-pull-requests
|
|
/// </remarks>
|
|
/// <param name="repositoryId">The Id of the repository</param>
|
|
/// <param name="request">Used to filter and sort the list of pull requests returned</param>
|
|
Task<IReadOnlyList<PullRequest>> GetAllForRepository(long repositoryId, PullRequestRequest request);
|
|
|
|
/// <summary>
|
|
/// Query pull requests for the repository based on criteria
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// http://developer.github.com/v3/pulls/#list-pull-requests
|
|
/// </remarks>
|
|
/// <param name="owner">The owner of the repository</param>
|
|
/// <param name="name">The name of the repository</param>
|
|
/// <param name="request">Used to filter and sort the list of pull requests returned</param>
|
|
/// <param name="options">Options for changing the API response</param>
|
|
Task<IReadOnlyList<PullRequest>> GetAllForRepository(string owner, string name, PullRequestRequest request, ApiOptions options);
|
|
|
|
/// <summary>
|
|
/// Query pull requests for the repository based on criteria
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// http://developer.github.com/v3/pulls/#list-pull-requests
|
|
/// </remarks>
|
|
/// <param name="repositoryId">The Id of the repository</param>
|
|
/// <param name="request">Used to filter and sort the list of pull requests returned</param>
|
|
/// <param name="options">Options for changing the API response</param>
|
|
Task<IReadOnlyList<PullRequest>> GetAllForRepository(long repositoryId, PullRequestRequest request, ApiOptions options);
|
|
|
|
/// <summary>
|
|
/// Create a pull request for the specified repository.
|
|
/// </summary>
|
|
/// <remarks>http://developer.github.com/v3/pulls/#create-a-pull-request</remarks>
|
|
/// <param name="owner">The owner of the repository</param>
|
|
/// <param name="name">The name of the repository</param>
|
|
/// <param name="newPullRequest">A <see cref="NewPullRequest"/> instance describing the new PullRequest to create</param>
|
|
Task<PullRequest> Create(string owner, string name, NewPullRequest newPullRequest);
|
|
|
|
/// <summary>
|
|
/// Create a pull request for the specified repository.
|
|
/// </summary>
|
|
/// <remarks>http://developer.github.com/v3/pulls/#create-a-pull-request</remarks>
|
|
/// <param name="repositoryId">The Id of the repository</param>
|
|
/// <param name="newPullRequest">A <see cref="NewPullRequest"/> instance describing the new PullRequest to create</param>
|
|
Task<PullRequest> Create(long repositoryId, NewPullRequest newPullRequest);
|
|
|
|
/// <summary>
|
|
/// Create a pull request for the specified repository.
|
|
/// </summary>
|
|
/// <remarks>http://developer.github.com/v3/pulls/#update-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 PullRequest number</param>
|
|
/// <param name="pullRequestUpdate">An <see cref="PullRequestUpdate"/> instance describing the changes to make to the PullRequest
|
|
/// </param>
|
|
Task<PullRequest> Update(string owner, string name, int number, PullRequestUpdate pullRequestUpdate);
|
|
|
|
/// <summary>
|
|
/// Create a pull request for the specified repository.
|
|
/// </summary>
|
|
/// <remarks>http://developer.github.com/v3/pulls/#update-a-pull-request</remarks>
|
|
/// <param name="repositoryId">The Id of the repository</param>
|
|
/// <param name="number">The PullRequest number</param>
|
|
/// <param name="pullRequestUpdate">An <see cref="PullRequestUpdate"/> instance describing the changes to make to the PullRequest
|
|
/// </param>
|
|
Task<PullRequest> Update(long repositoryId, int number, PullRequestUpdate pullRequestUpdate);
|
|
|
|
/// <summary>
|
|
/// Merge a pull request.
|
|
/// </summary>
|
|
/// <remarks>http://developer.github.com/v3/pulls/#merge-a-pull-request-merge-buttontrade</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="mergePullRequest">A <see cref="MergePullRequest"/> instance describing a pull request merge</param>
|
|
Task<PullRequestMerge> Merge(string owner, string name, int number, MergePullRequest mergePullRequest);
|
|
|
|
/// <summary>
|
|
/// Merge a pull request.
|
|
/// </summary>
|
|
/// <remarks>http://developer.github.com/v3/pulls/#merge-a-pull-request-merge-buttontrade</remarks>
|
|
/// <param name="repositoryId">The Id of the repository</param>
|
|
/// <param name="number">The pull request number</param>
|
|
/// <param name="mergePullRequest">A <see cref="MergePullRequest"/> instance describing a pull request merge</param>
|
|
Task<PullRequestMerge> Merge(long repositoryId, int number, MergePullRequest mergePullRequest);
|
|
|
|
/// <summary>
|
|
/// Get the pull request merge status.
|
|
/// </summary>
|
|
/// <remarks>http://developer.github.com/v3/pulls/#get-if-a-pull-request-has-been-merged</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>
|
|
Task<bool> Merged(string owner, string name, int number);
|
|
|
|
/// <summary>
|
|
/// Get the pull request merge status.
|
|
/// </summary>
|
|
/// <remarks>http://developer.github.com/v3/pulls/#get-if-a-pull-request-has-been-merged</remarks>
|
|
/// <param name="repositoryId">The Id of the repository</param>
|
|
/// <param name="number">The pull request number</param>
|
|
Task<bool> Merged(long repositoryId, int number);
|
|
|
|
/// <summary>
|
|
/// Get the list of commits on a pull request.
|
|
/// </summary>
|
|
/// <remarks>http://developer.github.com/v3/pulls/#list-commits-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>
|
|
Task<IReadOnlyList<PullRequestCommit>> Commits(string owner, string name, int number);
|
|
|
|
/// <summary>
|
|
/// Get the list of commits on a pull request.
|
|
/// </summary>
|
|
/// <remarks>http://developer.github.com/v3/pulls/#list-commits-on-a-pull-request</remarks>
|
|
/// <param name="repositoryId">The Id of the repository</param>
|
|
/// <param name="number">The pull request number</param>
|
|
Task<IReadOnlyList<PullRequestCommit>> Commits(long repositoryId, int number);
|
|
|
|
/// <summary>
|
|
/// Get the list of files on a pull request.
|
|
/// </summary>
|
|
/// <remarks>https://developer.github.com/v3/pulls/#list-pull-requests-files</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>
|
|
Task<IReadOnlyList<PullRequestFile>> Files(string owner, string name, int number);
|
|
|
|
/// <summary>
|
|
/// Get the list of files on a pull request.
|
|
/// </summary>
|
|
/// <remarks>https://developer.github.com/v3/pulls/#list-pull-requests-files</remarks>
|
|
/// <param name="repositoryId">The Id of the repository</param>
|
|
/// <param name="number">The pull request number</param>
|
|
Task<IReadOnlyList<PullRequestFile>> Files(long repositoryId, int number);
|
|
}
|
|
}
|