mirror of
https://github.com/zoriya/octokit.net.git
synced 2025-12-05 23:06:10 +00:00
[FEAT] Adds support listing branch/pr per commit
This commit is contained in:
@@ -11,6 +11,38 @@ namespace Octokit.Reactive
|
||||
/// </remarks>
|
||||
public interface IObservableRepositoryCommitsClient
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets all pull requests for a given commit
|
||||
/// </summary>
|
||||
/// <param name="repositoryId">The Id of the repository</param>
|
||||
/// <param name="sha1">Used to find all branches where the given commit SHA is the HEAD, or latest commit for the branch</param>
|
||||
IObservable<Branch> BranchesWhereHead(long repositoryId, string sha1);
|
||||
|
||||
/// <summary>
|
||||
/// Gets all pull requests for a given commit
|
||||
/// </summary>
|
||||
/// <param name="repositoryId">The Id of the repository</param>
|
||||
/// <param name="sha1">Used to find all branches where the given commit SHA is the HEAD, or latest commit for the branch</param>
|
||||
/// /// <param name="options">Options for changing the API response</param>
|
||||
IObservable<Branch> BranchesWhereHead(long repositoryId, string sha1, ApiOptions options);
|
||||
|
||||
/// <summary>
|
||||
/// List pull requests associated with a commit
|
||||
/// </summary>
|
||||
/// <param name="owner">The owner of the repository</param>
|
||||
/// <param name="name">The name of the repository</param>
|
||||
/// <param name="sha1">Used to find all branches where the given commit SHA is the HEAD, or latest commit for the branch</param>
|
||||
IObservable<Branch> BranchesWhereHead(string owner, string name, string sha1);
|
||||
|
||||
/// <summary>
|
||||
/// Gets all pull requests for a given commit
|
||||
/// </summary>
|
||||
/// <param name="owner">The owner of the repository</param>
|
||||
/// <param name="name">The name of the repository</param>
|
||||
/// <param name="sha1">Used to find all branches where the given commit SHA is the HEAD, or latest commit for the branch</param>
|
||||
/// /// <param name="options">Options for changing the API response</param>
|
||||
IObservable<Branch> BranchesWhereHead(string owner, string name, string sha1, ApiOptions options);
|
||||
|
||||
/// <summary>
|
||||
/// Compare two references in a repository
|
||||
/// </summary>
|
||||
@@ -123,5 +155,37 @@ namespace Octokit.Reactive
|
||||
/// <param name="repositoryId">The Id of the repository</param>
|
||||
/// <param name="reference">The repository reference</param>
|
||||
IObservable<string> GetSha1(long repositoryId, string reference);
|
||||
|
||||
/// <summary>
|
||||
/// List pull requests associated with a commit
|
||||
/// </summary>
|
||||
/// <param name="owner">The owner of the repository</param>
|
||||
/// <param name="name">The name of the repository</param>
|
||||
/// <param name="sha1">Used to find all pull requests containing the provided commit SHA, which can be from any point in the commit history</param>
|
||||
IObservable<CommitPullRequest> PullRequests(string owner, string name, string sha1);
|
||||
|
||||
/// <summary>
|
||||
/// Gets all pull requests for a given commit
|
||||
/// </summary>
|
||||
/// <param name="repositoryId">The Id of the repository</param>
|
||||
/// <param name="sha1">Used to find all pull requests containing the provided commit SHA, which can be from any point in the commit history</param>
|
||||
IObservable<CommitPullRequest> PullRequests(long repositoryId, string sha1);
|
||||
|
||||
/// <summary>
|
||||
/// Gets all pull requests for a given commit
|
||||
/// </summary>
|
||||
/// <param name="repositoryId">The Id of the repository</param>
|
||||
/// <param name="sha1">Used to find all pull requests containing the provided commit SHA, which can be from any point in the commit history</param>
|
||||
/// /// <param name="options">Options for changing the API response</param>
|
||||
IObservable<CommitPullRequest> PullRequests(long repositoryId, string sha1, ApiOptions options);
|
||||
|
||||
/// <summary>
|
||||
/// Gets all pull requests for a given commit
|
||||
/// </summary>
|
||||
/// <param name="owner">The owner of the repository</param>
|
||||
/// <param name="name">The name of the repository</param>
|
||||
/// <param name="sha1">Used to find all pull requests containing the provided commit SHA, which can be from any point in the commit history</param>
|
||||
/// /// <param name="options">Options for changing the API response</param>
|
||||
IObservable<CommitPullRequest> PullRequests(string owner, string name, string sha1, ApiOptions options);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,62 @@ namespace Octokit.Reactive
|
||||
_commit = client.Repository.Commit;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets all pull requests for a given commit
|
||||
/// </summary>
|
||||
/// <param name="repositoryId">The Id of the repository</param>
|
||||
/// <param name="sha1">Used to find all branches where the given commit SHA is the HEAD, or latest commit for the branch</param>
|
||||
[ManualRoute("GET", "/repositories/{id}/commits/{commit_sha}/branches-where-head")]
|
||||
public IObservable<Branch> BranchesWhereHead(long repositoryId, string sha1)
|
||||
{
|
||||
return BranchesWhereHead(repositoryId, sha1, ApiOptions.None);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets all pull requests for a given commit
|
||||
/// </summary>
|
||||
/// <param name="repositoryId">The Id of the repository</param>
|
||||
/// <param name="sha1">Used to find all branches where the given commit SHA is the HEAD, or latest commit for the branch</param>
|
||||
/// /// <param name="options">Options for changing the API response</param>
|
||||
[ManualRoute("GET", "/repositories/{id}/commits/{commit_sha}/branches-where-head")]
|
||||
public IObservable<Branch> BranchesWhereHead(long repositoryId, string sha1, ApiOptions options)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(sha1, nameof(sha1));
|
||||
Ensure.ArgumentNotNull(options, nameof(options));
|
||||
|
||||
return _connection.GetAndFlattenAllPages<Branch>(ApiUrls.RepositoryCommitsBranchesWhereHead(repositoryId, sha1), null, options);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// List pull requests associated with a commit
|
||||
/// </summary>
|
||||
/// <param name="owner">The owner of the repository</param>
|
||||
/// <param name="name">The name of the repository</param>
|
||||
/// <param name="sha1">Used to find all branches where the given commit SHA is the HEAD, or latest commit for the branch</param>
|
||||
[ManualRoute("GET", "/repos/{owner}/{repo}/commits/{commit_sha}/branches-where-head")]
|
||||
public IObservable<Branch> BranchesWhereHead(string owner, string name, string sha1)
|
||||
{
|
||||
return BranchesWhereHead(owner, name, sha1, ApiOptions.None);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets all pull requests for a given commit
|
||||
/// </summary>
|
||||
/// <param name="owner">The owner of the repository</param>
|
||||
/// <param name="name">The name of the repository</param>
|
||||
/// <param name="sha1">Used to find all branches where the given commit SHA is the HEAD, or latest commit for the branch</param>
|
||||
/// /// <param name="options">Options for changing the API response</param>
|
||||
[ManualRoute("GET", "/repos/{owner}/{repo}/commits/{commit_sha}/branches-where-head")]
|
||||
public IObservable<Branch> BranchesWhereHead(string owner, string name, string sha1, ApiOptions options)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
|
||||
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
|
||||
Ensure.ArgumentNotNullOrEmptyString(sha1, nameof(sha1));
|
||||
Ensure.ArgumentNotNull(options, nameof(options));
|
||||
|
||||
return _connection.GetAndFlattenAllPages<Branch>(ApiUrls.RepositoryCommitsBranchesWhereHead(owner, name, sha1), null, options);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Compare two references in a repository
|
||||
/// </summary>
|
||||
@@ -214,5 +270,61 @@ namespace Octokit.Reactive
|
||||
|
||||
return _commit.GetSha1(repositoryId, reference).ToObservable();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets all pull requests for a given commit
|
||||
/// </summary>
|
||||
/// <param name="repositoryId">The Id of the repository</param>
|
||||
/// <param name="sha1">Used to find all pull requests containing the provided commit SHA, which can be from any point in the commit history</param>
|
||||
[ManualRoute("GET", "/repositories/{id}/commits/{commit_sha}/pulls")]
|
||||
public IObservable<CommitPullRequest> PullRequests(long repositoryId, string sha1)
|
||||
{
|
||||
return PullRequests(repositoryId, sha1, ApiOptions.None);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets all pull requests for a given commit
|
||||
/// </summary>
|
||||
/// <param name="repositoryId">The Id of the repository</param>
|
||||
/// <param name="sha1">Used to find all pull requests containing the provided commit SHA, which can be from any point in the commit history</param>
|
||||
/// /// <param name="options">Options for changing the API response</param>
|
||||
[ManualRoute("GET", "/repositories/{id}/commits/{commit_sha}/pulls")]
|
||||
public IObservable<CommitPullRequest> PullRequests(long repositoryId, string sha1, ApiOptions options)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(sha1, nameof(sha1));
|
||||
Ensure.ArgumentNotNull(options, nameof(options));
|
||||
|
||||
return _connection.GetAndFlattenAllPages<CommitPullRequest>(ApiUrls.RepositoryCommitsPull(repositoryId, sha1), null, options);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// List pull requests associated with a commit
|
||||
/// </summary>
|
||||
/// <param name="owner">The owner of the repository</param>
|
||||
/// <param name="name">The name of the repository</param>
|
||||
/// <param name="sha1">Used to find all pull requests containing the provided commit SHA, which can be from any point in the commit history</param>
|
||||
[ManualRoute("GET", "/repos/{owner}/{repo}/commits/{commit_sha}/pulls")]
|
||||
public IObservable<CommitPullRequest> PullRequests(string owner, string name, string sha1)
|
||||
{
|
||||
return PullRequests(owner, name, sha1, ApiOptions.None);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets all pull requests for a given commit
|
||||
/// </summary>
|
||||
/// <param name="owner">The owner of the repository</param>
|
||||
/// <param name="name">The name of the repository</param>
|
||||
/// <param name="sha1">Used to find all pull requests containing the provided commit SHA, which can be from any point in the commit history</param>
|
||||
/// /// <param name="options">Options for changing the API response</param>
|
||||
[ManualRoute("GET", "/repos/{owner}/{repo}/commits/{commit_sha}/pulls")]
|
||||
public IObservable<CommitPullRequest> PullRequests(string owner, string name, string sha1, ApiOptions options)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
|
||||
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
|
||||
Ensure.ArgumentNotNullOrEmptyString(sha1, nameof(sha1));
|
||||
Ensure.ArgumentNotNull(options, nameof(options));
|
||||
|
||||
return _connection.GetAndFlattenAllPages<CommitPullRequest>(ApiUrls.RepositoryCommitsPull(owner, name, sha1), null, options);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user