Add repositoryId overloads to methods on I(Observable)RepositoryCommentsClient (#1344)

This commit is contained in:
Alexander Efremov
2016-06-18 04:47:43 +07:00
committed by Brendan Forster
parent 637802c90a
commit 6bd1f06962
7 changed files with 986 additions and 134 deletions
@@ -5,11 +5,17 @@ using Octokit.Reactive.Internal;
namespace Octokit.Reactive
{
/// <summary>
/// A client for GitHub's Repository Comments API.
/// </summary>
/// <remarks>
/// See the <a href="http://developer.github.com/v3/repos/comments/">Repository Comments API documentation</a> for more information.
/// </remarks>
public class ObservableRepositoryCommentsClient : IObservableRepositoryCommentsClient
{
readonly IRepositoryCommentsClient _client;
readonly IConnection _connection;
public ObservableRepositoryCommentsClient(IGitHubClient client)
{
Ensure.ArgumentNotNull(client, "client");
@@ -21,11 +27,10 @@ namespace Octokit.Reactive
/// <summary>
/// Gets a single Repository Comment by number.
/// </summary>
/// <remarks>http://developer.github.com/v3/repos/comments/#get-a-single-commit-comment</remarks>
/// <param name="owner">The owner of the repository</param>
/// <param name="name">The name of the repository</param>
/// <param name="number">The comment id</param>
/// <returns></returns>
/// <remarks>http://developer.github.com/v3/repos/comments/#get-a-single-commit-comment</remarks>
public IObservable<CommitComment> Get(string owner, string name, int number)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
@@ -34,13 +39,23 @@ namespace Octokit.Reactive
return _client.Get(owner, name, number).ToObservable();
}
/// <summary>
/// Gets a single Repository Comment by number.
/// </summary>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="number">The comment id</param>
/// <remarks>http://developer.github.com/v3/repos/comments/#get-a-single-commit-comment</remarks>
public IObservable<CommitComment> Get(int repositoryId, int number)
{
return _client.Get(repositoryId, number).ToObservable();
}
/// <summary>
/// Gets Commit Comments for a repository.
/// </summary>
/// <remarks>http://developer.github.com/v3/repos/comments/#list-commit-comments-for-a-repository</remarks>
/// <param name="owner">The owner of the repository</param>
/// <param name="name">The name of the repository</param>
/// <returns></returns>
/// <remarks>http://developer.github.com/v3/repos/comments/#list-commit-comments-for-a-repository</remarks>
public IObservable<CommitComment> GetAllForRepository(string owner, string name)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
@@ -52,11 +67,20 @@ namespace Octokit.Reactive
/// <summary>
/// Gets Commit Comments for a repository.
/// </summary>
/// <param name="repositoryId">The ID of the repository</param>
/// <remarks>http://developer.github.com/v3/repos/comments/#list-commit-comments-for-a-repository</remarks>
public IObservable<CommitComment> GetAllForRepository(int repositoryId)
{
return GetAllForRepository(repositoryId, ApiOptions.None);
}
/// <summary>
/// Gets Commit Comments for a repository.
/// </summary>
/// <param name="owner">The owner of the repository</param>
/// <param name="name">The name of the repository</param>
/// <param name="options">Options to change the API response</param>
/// <returns></returns>
/// <remarks>http://developer.github.com/v3/repos/comments/#list-commit-comments-for-a-repository</remarks>
public IObservable<CommitComment> GetAllForRepository(string owner, string name, ApiOptions options)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
@@ -66,14 +90,26 @@ namespace Octokit.Reactive
return _connection.GetAndFlattenAllPages<CommitComment>(ApiUrls.CommitComments(owner, name), options);
}
/// <summary>
/// Gets Commit Comments for a repository.
/// </summary>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="options">Options to change the API response</param>
/// <remarks>http://developer.github.com/v3/repos/comments/#list-commit-comments-for-a-repository</remarks>
public IObservable<CommitComment> GetAllForRepository(int repositoryId, ApiOptions options)
{
Ensure.ArgumentNotNull(options, "options");
return _connection.GetAndFlattenAllPages<CommitComment>(ApiUrls.CommitComments(repositoryId), options);
}
/// <summary>
/// Gets Commit Comments for a specified Commit.
/// </summary>
/// <remarks>http://developer.github.com/v3/repos/comments/#list-comments-for-a-single-commit</remarks>
/// <param name="owner">The owner of the repository</param>
/// <param name="name">The name of the repository</param>
/// <param name="sha">The sha of the commit</param>
/// <returns></returns>
/// <remarks>http://developer.github.com/v3/repos/comments/#list-comments-for-a-single-commit</remarks>
public IObservable<CommitComment> GetAllForCommit(string owner, string name, string sha)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
@@ -86,12 +122,24 @@ namespace Octokit.Reactive
/// <summary>
/// Gets Commit Comments for a specified Commit.
/// </summary>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="sha">The sha of the commit</param>
/// <remarks>http://developer.github.com/v3/repos/comments/#list-comments-for-a-single-commit</remarks>
public IObservable<CommitComment> GetAllForCommit(int repositoryId, string sha)
{
Ensure.ArgumentNotNullOrEmptyString(sha, "sha");
return GetAllForCommit(repositoryId, sha, ApiOptions.None);
}
/// <summary>
/// Gets Commit Comments for a specified Commit.
/// </summary>
/// <param name="owner">The owner of the repository</param>
/// <param name="name">The name of the repository</param>
/// <param name="sha">The sha of the commit</param>
/// <param name="options">Options to change the API response</param>
/// <returns></returns>
/// <remarks>http://developer.github.com/v3/repos/comments/#list-comments-for-a-single-commit</remarks>
public IObservable<CommitComment> GetAllForCommit(string owner, string name, string sha, ApiOptions options)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
@@ -102,15 +150,29 @@ namespace Octokit.Reactive
return _connection.GetAndFlattenAllPages<CommitComment>(ApiUrls.CommitComments(owner, name, sha), options);
}
/// <summary>
/// Gets Commit Comments for a specified Commit.
/// </summary>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="sha">The sha of the commit</param>
/// <param name="options">Options to change the API response</param>
/// <remarks>http://developer.github.com/v3/repos/comments/#list-comments-for-a-single-commit</remarks>
public IObservable<CommitComment> GetAllForCommit(int repositoryId, string sha, ApiOptions options)
{
Ensure.ArgumentNotNullOrEmptyString(sha, "sha");
Ensure.ArgumentNotNull(options, "options");
return _connection.GetAndFlattenAllPages<CommitComment>(ApiUrls.CommitComments(repositoryId, sha), options);
}
/// <summary>
/// Creates a new Commit Comment for a specified Commit.
/// </summary>
/// <remarks>http://developer.github.com/v3/repos/comments/#create-a-commit-comment</remarks>
/// <param name="owner">The owner of the repository</param>
/// <param name="name">The name of the repository</param>
/// <param name="sha">The sha reference of commit</param>
/// <param name="newCommitComment">The new comment to add to the commit</param>
/// <returns></returns>
/// <remarks>http://developer.github.com/v3/repos/comments/#create-a-commit-comment</remarks>
public IObservable<CommitComment> Create(string owner, string name, string sha, NewCommitComment newCommitComment)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
@@ -121,15 +183,29 @@ namespace Octokit.Reactive
return _client.Create(owner, name, sha, newCommitComment).ToObservable();
}
/// <summary>
/// Creates a new Commit Comment for a specified Commit.
/// </summary>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="sha">The sha reference of commit</param>
/// <param name="newCommitComment">The new comment to add to the commit</param>
/// <remarks>http://developer.github.com/v3/repos/comments/#create-a-commit-comment</remarks>
public IObservable<CommitComment> Create(int repositoryId, string sha, NewCommitComment newCommitComment)
{
Ensure.ArgumentNotNullOrEmptyString(sha, "sha");
Ensure.ArgumentNotNull(newCommitComment, "newCommitComment");
return _client.Create(repositoryId, sha, newCommitComment).ToObservable();
}
/// <summary>
/// Updates a specified Commit Comment.
/// </summary>
/// <remarks>http://developer.github.com/v3/repos/comments/#update-a-commit-comment</remarks>
/// <param name="owner">The owner of the repository</param>
/// <param name="name">The name of the repository</param>
/// <param name="number">The comment number</param>
/// <param name="commentUpdate">The modified comment</param>
/// <returns></returns>
/// <remarks>http://developer.github.com/v3/repos/comments/#update-a-commit-comment</remarks>
public IObservable<CommitComment> Update(string owner, string name, int number, string commentUpdate)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
@@ -139,14 +215,27 @@ namespace Octokit.Reactive
return _client.Update(owner, name, number, commentUpdate).ToObservable();
}
/// <summary>
/// Updates a specified Commit Comment.
/// </summary>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="number">The comment number</param>
/// <param name="commentUpdate">The modified comment</param>
/// <remarks>http://developer.github.com/v3/repos/comments/#update-a-commit-comment</remarks>
public IObservable<CommitComment> Update(int repositoryId, int number, string commentUpdate)
{
Ensure.ArgumentNotNull(commentUpdate, "commentUpdate");
return _client.Update(repositoryId, number, commentUpdate).ToObservable();
}
/// <summary>
/// Deletes the specified Commit Comment
/// </summary>
/// <remarks>http://developer.github.com/v3/repos/comments/#delete-a-commit-comment</remarks>
/// <param name="owner">The owner of the repository</param>
/// <param name="name">The name of the repository</param>
/// <param name="number">The comment id</param>
/// <returns></returns>
/// <remarks>http://developer.github.com/v3/repos/comments/#delete-a-commit-comment</remarks>
public IObservable<Unit> Delete(string owner, string name, int number)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
@@ -154,5 +243,16 @@ namespace Octokit.Reactive
return _client.Delete(owner, name, number).ToObservable();
}
/// <summary>
/// Deletes the specified Commit Comment
/// </summary>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="number">The comment id</param>
/// <remarks>http://developer.github.com/v3/repos/comments/#delete-a-commit-comment</remarks>
public IObservable<Unit> Delete(int repositoryId, int number)
{
return _client.Delete(repositoryId, number).ToObservable();
}
}
}