Add ability to pass ApiOptions to PullRequestsClient.Files (#2553)

* Add ability to pass ApiOptions to PullRequestsClient.Files

* Change Reactive PullRequestClient + Fix Test Mocking
This commit is contained in:
Gamer025
2022-08-28 16:12:27 +02:00
committed by GitHub
parent 3d53362bd7
commit 498c2aa0a5
6 changed files with 101 additions and 11 deletions

View File

@@ -359,12 +359,37 @@ namespace Octokit.Reactive
/// <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>
public IObservable<PullRequestFile> Files(string owner, string name, int number)
/// <param name="options">Options for changing the API response</param>
public IObservable<PullRequestFile> Files(string owner, string name, int number, ApiOptions options)
{
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
return _connection.GetAndFlattenAllPages<PullRequestFile>(ApiUrls.PullRequestFiles(owner, name, number));
return _connection.GetAndFlattenAllPages<PullRequestFile>(ApiUrls.PullRequestFiles(owner, name, number), options);
}
/// <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>
public IObservable<PullRequestFile> Files(string owner, string name, int number)
{
return Files(owner, name, number, ApiOptions.None);
}
/// <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>
/// <param name="options">Options for changing the API response</param>
public IObservable<PullRequestFile> Files(long repositoryId, int number, ApiOptions options)
{
return _connection.GetAndFlattenAllPages<PullRequestFile>(ApiUrls.PullRequestFiles(repositoryId, number), options);
}
/// <summary>
@@ -375,7 +400,7 @@ namespace Octokit.Reactive
/// <param name="number">The pull request number</param>
public IObservable<PullRequestFile> Files(long repositoryId, int number)
{
return _connection.GetAndFlattenAllPages<PullRequestFile>(ApiUrls.PullRequestFiles(repositoryId, number));
return Files(repositoryId, number, ApiOptions.None);
}
}
}