mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-06-08 04:40:54 +00:00
Merge pull request #1379 from dampir/add-repo-id-issue-comments-client
Add repositoryId overloads to methods on I(Observable)IssueCommentsClient
This commit is contained in:
@@ -4,6 +4,12 @@ using System.Reactive;
|
||||
|
||||
namespace Octokit.Reactive
|
||||
{
|
||||
/// <summary>
|
||||
/// A client for GitHub's Issue Comments API.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// See the <a href="http://developer.github.com/v3/issues/comments/">Issue Comments API documentation</a> for more information.
|
||||
/// </remarks>
|
||||
public interface IObservableIssueCommentsClient
|
||||
{
|
||||
/// <summary>
|
||||
@@ -13,20 +19,35 @@ namespace Octokit.Reactive
|
||||
/// <param name="owner">The owner of the repository</param>
|
||||
/// <param name="name">The name of the repository</param>
|
||||
/// <param name="id">The issue comment id</param>
|
||||
/// <returns>The <see cref="IssueComment"/>s for the specified Issue Comment.</returns>
|
||||
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get",
|
||||
Justification = "Method makes a network request")]
|
||||
IObservable<IssueComment> Get(string owner, string name, int id);
|
||||
|
||||
/// <summary>
|
||||
/// Gets a single Issue Comment by id.
|
||||
/// </summary>
|
||||
/// <remarks>http://developer.github.com/v3/issues/comments/#get-a-single-comment</remarks>
|
||||
/// <param name="repositoryId">The ID of the repository</param>
|
||||
/// <param name="id">The issue comment id</param>
|
||||
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get",
|
||||
Justification = "Method makes a network request")]
|
||||
IObservable<IssueComment> Get(int repositoryId, int id);
|
||||
|
||||
/// <summary>
|
||||
/// Gets Issue Comments for a repository.
|
||||
/// </summary>
|
||||
/// <remarks>http://developer.github.com/v3/issues/comments/#list-comments-in-a-repository</remarks>
|
||||
/// <param name="owner">The owner of the repository</param>
|
||||
/// <param name="name">The name of the repository</param>
|
||||
/// <returns>The list of <see cref="IssueComment"/>s for the specified Repository.</returns>
|
||||
IObservable<IssueComment> GetAllForRepository(string owner, string name);
|
||||
|
||||
/// <summary>
|
||||
/// Gets Issue Comments for a repository.
|
||||
/// </summary>
|
||||
/// <remarks>http://developer.github.com/v3/issues/comments/#list-comments-in-a-repository</remarks>
|
||||
/// <param name="repositoryId">The ID of the repository</param>
|
||||
IObservable<IssueComment> GetAllForRepository(int repositoryId);
|
||||
|
||||
/// <summary>
|
||||
/// Gets Issue Comments for a repository.
|
||||
/// </summary>
|
||||
@@ -34,9 +55,16 @@ namespace Octokit.Reactive
|
||||
/// <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>
|
||||
/// <returns>The list of <see cref="IssueComment"/>s for the specified Repository.</returns>
|
||||
IObservable<IssueComment> GetAllForRepository(string owner, string name, ApiOptions options);
|
||||
|
||||
/// <summary>
|
||||
/// Gets Issue Comments for a repository.
|
||||
/// </summary>
|
||||
/// <remarks>http://developer.github.com/v3/issues/comments/#list-comments-in-a-repository</remarks>
|
||||
/// <param name="repositoryId">The ID of the repository</param>
|
||||
/// <param name="options">Options for changing the API response</param>
|
||||
IObservable<IssueComment> GetAllForRepository(int repositoryId, ApiOptions options);
|
||||
|
||||
/// <summary>
|
||||
/// Gets Issue Comments for a specified Issue.
|
||||
/// </summary>
|
||||
@@ -44,9 +72,16 @@ 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 issue number</param>
|
||||
/// <returns>The list of <see cref="IssueComment"/>s for the specified Issue.</returns>
|
||||
IObservable<IssueComment> GetAllForIssue(string owner, string name, int number);
|
||||
|
||||
/// <summary>
|
||||
/// Gets Issue Comments for a specified Issue.
|
||||
/// </summary>
|
||||
/// <remarks>http://developer.github.com/v3/issues/comments/#list-comments-on-an-issue</remarks>
|
||||
/// <param name="repositoryId">The ID of the repository</param>
|
||||
/// <param name="number">The issue number</param>
|
||||
IObservable<IssueComment> GetAllForIssue(int repositoryId, int number);
|
||||
|
||||
/// <summary>
|
||||
/// Gets Issue Comments for a specified Issue.
|
||||
/// </summary>
|
||||
@@ -55,9 +90,17 @@ namespace Octokit.Reactive
|
||||
/// <param name="name">The name of the repository</param>
|
||||
/// <param name="number">The issue number</param>
|
||||
/// <param name="options">Options for changing the API response</param>
|
||||
/// <returns>The list of <see cref="IssueComment"/>s for the specified Issue.</returns>
|
||||
IObservable<IssueComment> GetAllForIssue(string owner, string name, int number, ApiOptions options);
|
||||
|
||||
/// <summary>
|
||||
/// Gets Issue Comments for a specified Issue.
|
||||
/// </summary>
|
||||
/// <remarks>http://developer.github.com/v3/issues/comments/#list-comments-on-an-issue</remarks>
|
||||
/// <param name="repositoryId">The ID of the repository</param>
|
||||
/// <param name="number">The issue number</param>
|
||||
/// <param name="options">Options for changing the API response</param>
|
||||
IObservable<IssueComment> GetAllForIssue(int repositoryId, int number, ApiOptions options);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new Issue Comment for a specified Issue.
|
||||
/// </summary>
|
||||
@@ -66,9 +109,17 @@ namespace Octokit.Reactive
|
||||
/// <param name="name">The name of the repository</param>
|
||||
/// <param name="number">The number of the issue</param>
|
||||
/// <param name="newComment">The text of the new comment</param>
|
||||
/// <returns>The <see cref="IssueComment"/> that was just created.</returns>
|
||||
IObservable<IssueComment> Create(string owner, string name, int number, string newComment);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new Issue Comment for a specified Issue.
|
||||
/// </summary>
|
||||
/// <remarks>http://developer.github.com/v3/issues/comments/#create-a-comment</remarks>
|
||||
/// <param name="repositoryId">The ID of the repository</param>
|
||||
/// <param name="number">The number of the issue</param>
|
||||
/// <param name="newComment">The text of the new comment</param>
|
||||
IObservable<IssueComment> Create(int repositoryId, int number, string newComment);
|
||||
|
||||
/// <summary>
|
||||
/// Updates a specified Issue Comment.
|
||||
/// </summary>
|
||||
@@ -77,9 +128,17 @@ namespace Octokit.Reactive
|
||||
/// <param name="name">The name of the repository</param>
|
||||
/// <param name="id">The comment id</param>
|
||||
/// <param name="commentUpdate">The modified comment</param>
|
||||
/// <returns>The <see cref="IssueComment"/> that was just updated.</returns>
|
||||
IObservable<IssueComment> Update(string owner, string name, int id, string commentUpdate);
|
||||
|
||||
/// <summary>
|
||||
/// Updates a specified Issue Comment.
|
||||
/// </summary>
|
||||
/// <remarks>http://developer.github.com/v3/issues/comments/#edit-a-comment</remarks>
|
||||
/// <param name="repositoryId">The ID of the repository</param>
|
||||
/// <param name="id">The comment id</param>
|
||||
/// <param name="commentUpdate">The modified comment</param>
|
||||
IObservable<IssueComment> Update(int repositoryId, int id, string commentUpdate);
|
||||
|
||||
/// <summary>
|
||||
/// Deletes the specified Issue Comment
|
||||
/// </summary>
|
||||
@@ -87,7 +146,14 @@ namespace Octokit.Reactive
|
||||
/// <param name="owner">The owner of the repository</param>
|
||||
/// <param name="name">The name of the repository</param>
|
||||
/// <param name="id">The comment id</param>
|
||||
/// <returns></returns>
|
||||
IObservable<Unit> Delete(string owner, string name, int id);
|
||||
|
||||
/// <summary>
|
||||
/// Deletes the specified Issue Comment
|
||||
/// </summary>
|
||||
/// <remarks>http://developer.github.com/v3/issues/comments/#delete-a-comment</remarks>
|
||||
/// <param name="repositoryId">The ID of the repository</param>
|
||||
/// <param name="id">The comment id</param>
|
||||
IObservable<Unit> Delete(int repositoryId, int id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,12 @@ using Octokit.Reactive.Internal;
|
||||
|
||||
namespace Octokit.Reactive
|
||||
{
|
||||
/// <summary>
|
||||
/// A client for GitHub's Issue Comments API.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// See the <a href="http://developer.github.com/v3/issues/comments/">Issue Comments API documentation</a> for more information.
|
||||
/// </remarks>
|
||||
public class ObservableIssueCommentsClient : IObservableIssueCommentsClient
|
||||
{
|
||||
readonly IIssueCommentsClient _client;
|
||||
@@ -25,7 +31,6 @@ namespace Octokit.Reactive
|
||||
/// <param name="owner">The owner of the repository</param>
|
||||
/// <param name="name">The name of the repository</param>
|
||||
/// <param name="id">The issue comment id</param>
|
||||
/// <returns>The <see cref="IssueComment"/>s for the specified Issue Comment.</returns>
|
||||
public IObservable<IssueComment> Get(string owner, string name, int id)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
||||
@@ -34,13 +39,23 @@ namespace Octokit.Reactive
|
||||
return _client.Get(owner, name, id).ToObservable();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a single Issue Comment by id.
|
||||
/// </summary>
|
||||
/// <remarks>http://developer.github.com/v3/issues/comments/#get-a-single-comment</remarks>
|
||||
/// <param name="repositoryId">The ID of the repository</param>
|
||||
/// <param name="id">The issue comment id</param>
|
||||
public IObservable<IssueComment> Get(int repositoryId, int id)
|
||||
{
|
||||
return _client.Get(repositoryId, id).ToObservable();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets Issue Comments for a repository.
|
||||
/// </summary>
|
||||
/// <remarks>http://developer.github.com/v3/issues/comments/#list-comments-in-a-repository</remarks>
|
||||
/// <param name="owner">The owner of the repository</param>
|
||||
/// <param name="name">The name of the repository</param>
|
||||
/// <returns>The list of <see cref="IssueComment"/>s for the specified Repository.</returns>
|
||||
public IObservable<IssueComment> GetAllForRepository(string owner, string name)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
||||
@@ -49,6 +64,16 @@ namespace Octokit.Reactive
|
||||
return GetAllForRepository(owner, name, ApiOptions.None);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets Issue Comments for a repository.
|
||||
/// </summary>
|
||||
/// <remarks>http://developer.github.com/v3/issues/comments/#list-comments-in-a-repository</remarks>
|
||||
/// <param name="repositoryId">The ID of the repository</param>
|
||||
public IObservable<IssueComment> GetAllForRepository(int repositoryId)
|
||||
{
|
||||
return GetAllForRepository(repositoryId, ApiOptions.None);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets Issue Comments for a repository.
|
||||
/// </summary>
|
||||
@@ -56,7 +81,6 @@ namespace Octokit.Reactive
|
||||
/// <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>
|
||||
/// <returns>The list of <see cref="IssueComment"/>s for the specified Repository.</returns>
|
||||
public IObservable<IssueComment> GetAllForRepository(string owner, string name, ApiOptions options)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
||||
@@ -66,6 +90,19 @@ namespace Octokit.Reactive
|
||||
return _connection.GetAndFlattenAllPages<IssueComment>(ApiUrls.IssueComments(owner, name), null, AcceptHeaders.ReactionsPreview, options);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets Issue Comments for a repository.
|
||||
/// </summary>
|
||||
/// <remarks>http://developer.github.com/v3/issues/comments/#list-comments-in-a-repository</remarks>
|
||||
/// <param name="repositoryId">The ID of the repository</param>
|
||||
/// <param name="options">Options for changing the API response</param>
|
||||
public IObservable<IssueComment> GetAllForRepository(int repositoryId, ApiOptions options)
|
||||
{
|
||||
Ensure.ArgumentNotNull(options, "options");
|
||||
|
||||
return _connection.GetAndFlattenAllPages<IssueComment>(ApiUrls.IssueComments(repositoryId), options);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets Issue Comments for a specified Issue.
|
||||
/// </summary>
|
||||
@@ -73,7 +110,6 @@ 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 issue number</param>
|
||||
/// <returns>The list of <see cref="IssueComment"/>s for the specified Issue.</returns>
|
||||
public IObservable<IssueComment> GetAllForIssue(string owner, string name, int number)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
||||
@@ -82,6 +118,17 @@ namespace Octokit.Reactive
|
||||
return GetAllForIssue(owner, name, number, ApiOptions.None);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets Issue Comments for a specified Issue.
|
||||
/// </summary>
|
||||
/// <remarks>http://developer.github.com/v3/issues/comments/#list-comments-on-an-issue</remarks>
|
||||
/// <param name="repositoryId">The ID of the repository</param>
|
||||
/// <param name="number">The issue number</param>
|
||||
public IObservable<IssueComment> GetAllForIssue(int repositoryId, int number)
|
||||
{
|
||||
return GetAllForIssue(repositoryId, number, ApiOptions.None);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets Issue Comments for a specified Issue.
|
||||
/// </summary>
|
||||
@@ -90,7 +137,6 @@ namespace Octokit.Reactive
|
||||
/// <param name="name">The name of the repository</param>
|
||||
/// <param name="number">The issue number</param>
|
||||
/// <param name="options">Options for changing the API response</param>
|
||||
/// <returns>The list of <see cref="IssueComment"/>s for the specified Issue.</returns>
|
||||
public IObservable<IssueComment> GetAllForIssue(string owner, string name, int number, ApiOptions options)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
||||
@@ -100,6 +146,20 @@ namespace Octokit.Reactive
|
||||
return _connection.GetAndFlattenAllPages<IssueComment>(ApiUrls.IssueComments(owner, name, number), null, AcceptHeaders.ReactionsPreview, options);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets Issue Comments for a specified Issue.
|
||||
/// </summary>
|
||||
/// <remarks>http://developer.github.com/v3/issues/comments/#list-comments-on-an-issue</remarks>
|
||||
/// <param name="repositoryId">The ID of the repository</param>
|
||||
/// <param name="number">The issue number</param>
|
||||
/// <param name="options">Options for changing the API response</param>
|
||||
public IObservable<IssueComment> GetAllForIssue(int repositoryId, int number, ApiOptions options)
|
||||
{
|
||||
Ensure.ArgumentNotNull(options, "options");
|
||||
|
||||
return _connection.GetAndFlattenAllPages<IssueComment>(ApiUrls.IssueComments(repositoryId, number), options);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new Issue Comment for a specified Issue.
|
||||
/// </summary>
|
||||
@@ -108,7 +168,6 @@ namespace Octokit.Reactive
|
||||
/// <param name="name">The name of the repository</param>
|
||||
/// <param name="number">The number of the issue</param>
|
||||
/// <param name="newComment">The text of the new comment</param>
|
||||
/// <returns>The <see cref="IssueComment"/> that was just created.</returns>
|
||||
public IObservable<IssueComment> Create(string owner, string name, int number, string newComment)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
||||
@@ -118,6 +177,20 @@ namespace Octokit.Reactive
|
||||
return _client.Create(owner, name, number, newComment).ToObservable();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new Issue Comment for a specified Issue.
|
||||
/// </summary>
|
||||
/// <remarks>http://developer.github.com/v3/issues/comments/#create-a-comment</remarks>
|
||||
/// <param name="repositoryId">The ID of the repository</param>
|
||||
/// <param name="number">The number of the issue</param>
|
||||
/// <param name="newComment">The text of the new comment</param>
|
||||
public IObservable<IssueComment> Create(int repositoryId, int number, string newComment)
|
||||
{
|
||||
Ensure.ArgumentNotNull(newComment, "newComment");
|
||||
|
||||
return _client.Create(repositoryId, number, newComment).ToObservable();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates a specified Issue Comment.
|
||||
/// </summary>
|
||||
@@ -126,7 +199,6 @@ namespace Octokit.Reactive
|
||||
/// <param name="name">The name of the repository</param>
|
||||
/// <param name="id">The comment id</param>
|
||||
/// <param name="commentUpdate">The modified comment</param>
|
||||
/// <returns>The <see cref="IssueComment"/> that was just updated.</returns>
|
||||
public IObservable<IssueComment> Update(string owner, string name, int id, string commentUpdate)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
||||
@@ -136,6 +208,20 @@ namespace Octokit.Reactive
|
||||
return _client.Update(owner, name, id, commentUpdate).ToObservable();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates a specified Issue Comment.
|
||||
/// </summary>
|
||||
/// <remarks>http://developer.github.com/v3/issues/comments/#edit-a-comment</remarks>
|
||||
/// <param name="repositoryId">The ID of the repository</param>
|
||||
/// <param name="id">The comment id</param>
|
||||
/// <param name="commentUpdate">The modified comment</param>
|
||||
public IObservable<IssueComment> Update(int repositoryId, int id, string commentUpdate)
|
||||
{
|
||||
Ensure.ArgumentNotNull(commentUpdate, "commentUpdate");
|
||||
|
||||
return _client.Update(repositoryId, id, commentUpdate).ToObservable();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deletes the specified Issue Comment
|
||||
/// </summary>
|
||||
@@ -143,7 +229,6 @@ namespace Octokit.Reactive
|
||||
/// <param name="owner">The owner of the repository</param>
|
||||
/// <param name="name">The name of the repository</param>
|
||||
/// <param name="id">The comment id</param>
|
||||
/// <returns></returns>
|
||||
public IObservable<Unit> Delete(string owner, string name, int id)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
||||
@@ -151,5 +236,16 @@ namespace Octokit.Reactive
|
||||
|
||||
return _client.Delete(owner, name, id).ToObservable();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deletes the specified Issue Comment
|
||||
/// </summary>
|
||||
/// <remarks>http://developer.github.com/v3/issues/comments/#delete-a-comment</remarks>
|
||||
/// <param name="repositoryId">The ID of the repository</param>
|
||||
/// <param name="id">The comment id</param>
|
||||
public IObservable<Unit> Delete(int repositoryId, int id)
|
||||
{
|
||||
return _client.Delete(repositoryId, id).ToObservable();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user