diff --git a/Octokit.Reactive/Clients/IObservablePullRequestReviewCommentReactionsClient.cs b/Octokit.Reactive/Clients/IObservablePullRequestReviewCommentReactionsClient.cs new file mode 100644 index 00000000..75cc0a88 --- /dev/null +++ b/Octokit.Reactive/Clients/IObservablePullRequestReviewCommentReactionsClient.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; + +namespace Octokit.Reactive +{ + public interface IObservablePullRequestReviewCommentReactionsClient + { + /// + /// Creates a reaction for a specified Pull Request Review Comment. + /// + /// https://developer.github.com/v3/reactions/#create-reaction-for-a-pull-request-review-comment + /// The owner of the repository + /// The name of the repository + /// The comment id + /// The reaction to create + /// + IObservable Create(string owner, string name, int number, NewReaction reaction); + + /// + /// Get all reactions for a specified Pull Request Review Comment. + /// + /// https://developer.github.com/v3/reactions/#list-reactions-for-a-pull-request-review-comment + /// The owner of the repository + /// The name of the repository + /// The comment id + /// + IObservable GetAll(string owner, string name, int number); + } +} diff --git a/Octokit.Reactive/Clients/IObservableReactionsClient.cs b/Octokit.Reactive/Clients/IObservableReactionsClient.cs index c6ce8111..534ed3db 100644 --- a/Octokit.Reactive/Clients/IObservableReactionsClient.cs +++ b/Octokit.Reactive/Clients/IObservableReactionsClient.cs @@ -7,5 +7,7 @@ IObservableIssueReactionsClient Issue { get; } IObservableIssueCommentReactionsClient IssueComment { get; } + + IObservablePullRequestReviewCommentReactionsClient PullRequestReviewComment { get; } } } diff --git a/Octokit.Reactive/Clients/ObservableIssueCommentReactionsClient.cs b/Octokit.Reactive/Clients/ObservableIssueCommentReactionsClient.cs index c218a12c..a7c64ecf 100644 --- a/Octokit.Reactive/Clients/ObservableIssueCommentReactionsClient.cs +++ b/Octokit.Reactive/Clients/ObservableIssueCommentReactionsClient.cs @@ -1,19 +1,20 @@ using Octokit.Reactive.Internal; using System; +using System.Reactive.Linq; using System.Reactive.Threading.Tasks; namespace Octokit.Reactive { public class ObservableIssueCommentReactionsClient : IObservableIssueCommentReactionsClient { - readonly ICommitCommentReactionsClient _client; + readonly IIssueCommentReactionsClient _client; readonly IConnection _connection; public ObservableIssueCommentReactionsClient(IGitHubClient client) { Ensure.ArgumentNotNull(client, "client"); - _client = client.Reaction.CommitComment; + _client = client.Reaction.IssueComment; _connection = client.Connection; } diff --git a/Octokit.Reactive/Clients/ObservablePullRequestReviewCommentReactionsClient.cs b/Octokit.Reactive/Clients/ObservablePullRequestReviewCommentReactionsClient.cs new file mode 100644 index 00000000..331b721d --- /dev/null +++ b/Octokit.Reactive/Clients/ObservablePullRequestReviewCommentReactionsClient.cs @@ -0,0 +1,55 @@ +using Octokit.Reactive.Internal; +using System; +using System.Collections.Generic; +using System.Reactive.Threading.Tasks; + +namespace Octokit.Reactive +{ + class ObservablePullRequestReviewCommentReactionsClient : IObservablePullRequestReviewCommentReactionsClient + { + readonly IPullRequestReviewCommentReactionsClient _client; + readonly IConnection _connection; + + public ObservablePullRequestReviewCommentReactionsClient(IGitHubClient client) + { + Ensure.ArgumentNotNull(client, "client"); + + _client = client.Reaction.PullRequestReviewComment; + _connection = client.Connection; + } + + /// + /// Creates a reaction for a specified Pull Request Review Comment. + /// + /// https://developer.github.com/v3/reactions/#create-reaction-for-a-pull-request-review-comment + /// The owner of the repository + /// The name of the repository + /// The comment id + /// The reaction to create + /// + public IObservable Create(string owner, string name, int number, NewReaction reaction) + { + Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); + Ensure.ArgumentNotNullOrEmptyString(name, "name"); + Ensure.ArgumentNotNull(reaction, "reaction"); + + return _client.Create(owner, name, number, reaction).ToObservable(); + } + + /// + /// Get all reactions for a specified Pull Request Review Comment. + /// + /// https://developer.github.com/v3/reactions/#list-reactions-for-a-pull-request-review-comment + /// The owner of the repository + /// The name of the repository + /// The comment id + /// + public IObservable GetAll(string owner, string name, int number) + { + Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); + Ensure.ArgumentNotNullOrEmptyString(name, "name"); + + return _connection.GetAndFlattenAllPages(ApiUrls.PullRequestReviewCommentReaction(owner, name, number), null, AcceptHeaders.ReactionsPreview); + } + } +} diff --git a/Octokit.Reactive/Clients/ObservableReactionsClient.cs b/Octokit.Reactive/Clients/ObservableReactionsClient.cs index dfb34007..d8fe56bf 100644 --- a/Octokit.Reactive/Clients/ObservableReactionsClient.cs +++ b/Octokit.Reactive/Clients/ObservableReactionsClient.cs @@ -1,6 +1,4 @@ -using System; - -namespace Octokit.Reactive +namespace Octokit.Reactive { public class ObservableReactionsClient : IObservableReactionsClient { @@ -11,6 +9,7 @@ namespace Octokit.Reactive CommitComment = new ObservableCommitCommentReactionsClient(client); Issue = new ObservableIssueReactionsClient(client); IssueComment = new ObservableIssueCommentReactionsClient(client); + PullRequestReviewComment = new ObservablePullRequestReviewCommentReactionsClient(client); } public IObservableCommitCommentReactionsClient CommitComment { get; private set; } @@ -18,5 +17,7 @@ namespace Octokit.Reactive public IObservableIssueReactionsClient Issue { get; private set; } public IObservableIssueCommentReactionsClient IssueComment { get; private set; } + + public IObservablePullRequestReviewCommentReactionsClient PullRequestReviewComment { get; private set; } } } diff --git a/Octokit.Reactive/Octokit.Reactive-Mono.csproj b/Octokit.Reactive/Octokit.Reactive-Mono.csproj index 8996d64c..d0376939 100644 --- a/Octokit.Reactive/Octokit.Reactive-Mono.csproj +++ b/Octokit.Reactive/Octokit.Reactive-Mono.csproj @@ -196,6 +196,8 @@ + + diff --git a/Octokit.Reactive/Octokit.Reactive-MonoAndroid.csproj b/Octokit.Reactive/Octokit.Reactive-MonoAndroid.csproj index 38d89c8f..57562b4c 100644 --- a/Octokit.Reactive/Octokit.Reactive-MonoAndroid.csproj +++ b/Octokit.Reactive/Octokit.Reactive-MonoAndroid.csproj @@ -204,6 +204,8 @@ + + diff --git a/Octokit.Reactive/Octokit.Reactive-Monotouch.csproj b/Octokit.Reactive/Octokit.Reactive-Monotouch.csproj index bb68d1f0..72227946 100644 --- a/Octokit.Reactive/Octokit.Reactive-Monotouch.csproj +++ b/Octokit.Reactive/Octokit.Reactive-Monotouch.csproj @@ -200,6 +200,8 @@ + + diff --git a/Octokit.Reactive/Octokit.Reactive.csproj b/Octokit.Reactive/Octokit.Reactive.csproj index a63f8014..d7614575 100644 --- a/Octokit.Reactive/Octokit.Reactive.csproj +++ b/Octokit.Reactive/Octokit.Reactive.csproj @@ -97,6 +97,7 @@ + @@ -109,6 +110,7 @@ + diff --git a/Octokit/Clients/IPullRequestReviewCommentReactionsClient.cs b/Octokit/Clients/IPullRequestReviewCommentReactionsClient.cs new file mode 100644 index 00000000..5c2c4dba --- /dev/null +++ b/Octokit/Clients/IPullRequestReviewCommentReactionsClient.cs @@ -0,0 +1,29 @@ +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace Octokit +{ + public interface IPullRequestReviewCommentReactionsClient + { + /// + /// Creates a reaction for a specified Pull Request Review Comment. + /// + /// https://developer.github.com/v3/reactions/#create-reaction-for-a-pull-request-review-comment + /// The owner of the repository + /// The name of the repository + /// The comment id + /// The reaction to create + /// + Task Create(string owner, string name, int number, NewReaction reaction); + + /// + /// Get all reactions for a specified Pull Request Review Comment. + /// + /// https://developer.github.com/v3/reactions/#list-reactions-for-a-pull-request-review-comment + /// The owner of the repository + /// The name of the repository + /// The comment id + /// + Task> GetAll(string owner, string name, int number); + } +} diff --git a/Octokit/Clients/IReactionsClient.cs b/Octokit/Clients/IReactionsClient.cs index d22b83e1..08f14c44 100644 --- a/Octokit/Clients/IReactionsClient.cs +++ b/Octokit/Clients/IReactionsClient.cs @@ -31,5 +31,13 @@ /// Refer to the API documentation for more information: https://developer.github.com/v3/reactions/ /// IIssueCommentReactionsClient IssueComment { get; } + + /// + /// Access GitHub's Reactions API for Issue Comments. + /// + /// + /// Refer to the API documentation for more information: https://developer.github.com/v3/reactions/ + /// + IPullRequestReviewCommentReactionsClient PullRequestReviewComment { get; } } } diff --git a/Octokit/Clients/PullRequestReviewCommentReactionsClient.cs b/Octokit/Clients/PullRequestReviewCommentReactionsClient.cs new file mode 100644 index 00000000..4c07dffa --- /dev/null +++ b/Octokit/Clients/PullRequestReviewCommentReactionsClient.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace Octokit +{ + public class PullRequestReviewCommentReactionsClient : ApiClient, IPullRequestReviewCommentReactionsClient + { + public PullRequestReviewCommentReactionsClient(IApiConnection apiConnection) + : base(apiConnection) + { + } + + /// + /// Creates a reaction for a specified Pull Request Review Comment. + /// + /// https://developer.github.com/v3/reactions/#create-reaction-for-a-pull-request-review-comment + /// The owner of the repository + /// The name of the repository + /// The comment id + /// The reaction to create + /// + public Task Create(string owner, string name, int number, NewReaction reaction) + { + Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); + Ensure.ArgumentNotNullOrEmptyString(name, "name"); + Ensure.ArgumentNotNull(reaction, "reaction"); + + return ApiConnection.Post(ApiUrls.PullRequestReviewCommentReaction(owner, name, number), reaction, AcceptHeaders.ReactionsPreview); + } + + /// + /// Get all reactions for a specified Pull Request Review Comment. + /// + /// https://developer.github.com/v3/reactions/#list-reactions-for-a-pull-request-review-comment + /// The owner of the repository + /// The name of the repository + /// The comment id + /// + public Task> GetAll(string owner, string name, int number) + { + Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); + Ensure.ArgumentNotNullOrEmptyString(name, "name"); + + return ApiConnection.GetAll(ApiUrls.PullRequestReviewCommentReaction(owner, name, number), AcceptHeaders.ReactionsPreview); + } + } +} diff --git a/Octokit/Clients/ReactionsClient.cs b/Octokit/Clients/ReactionsClient.cs index 53364212..9c1d110b 100644 --- a/Octokit/Clients/ReactionsClient.cs +++ b/Octokit/Clients/ReactionsClient.cs @@ -13,6 +13,8 @@ namespace Octokit { CommitComment = new CommitCommentReactionsClient(apiConnection); Issue = new IssueReactionsClient(apiConnection); + IssueComment = new IssueCommentReactionsClient(apiConnection); + PullRequestReviewComment = new PullRequestReviewCommentReactionsClient(apiConnection); } /// @@ -38,5 +40,13 @@ namespace Octokit /// Refer to the API documentation for more information: https://developer.github.com/v3/reactions/ /// public IIssueCommentReactionsClient IssueComment { get; private set; } + + /// + /// Access GitHub's Reactions API for Pull Request Review Comments. + /// + /// + /// Refer to the API documentation for more information: https://developer.github.com/v3/reactions/ + /// + public IPullRequestReviewCommentReactionsClient PullRequestReviewComment { get; private set; } } } diff --git a/Octokit/Octokit-Mono.csproj b/Octokit/Octokit-Mono.csproj index 5e46e53c..fc193944 100644 --- a/Octokit/Octokit-Mono.csproj +++ b/Octokit/Octokit-Mono.csproj @@ -476,6 +476,8 @@ + + \ No newline at end of file diff --git a/Octokit/Octokit-MonoAndroid.csproj b/Octokit/Octokit-MonoAndroid.csproj index d9d8efbe..33d012e3 100644 --- a/Octokit/Octokit-MonoAndroid.csproj +++ b/Octokit/Octokit-MonoAndroid.csproj @@ -487,6 +487,8 @@ + + \ No newline at end of file diff --git a/Octokit/Octokit-Monotouch.csproj b/Octokit/Octokit-Monotouch.csproj index 3858e96f..5dd8eacf 100644 --- a/Octokit/Octokit-Monotouch.csproj +++ b/Octokit/Octokit-Monotouch.csproj @@ -483,6 +483,8 @@ + + diff --git a/Octokit/Octokit-Portable.csproj b/Octokit/Octokit-Portable.csproj index 1e93e924..3207c985 100644 --- a/Octokit/Octokit-Portable.csproj +++ b/Octokit/Octokit-Portable.csproj @@ -473,6 +473,8 @@ + + diff --git a/Octokit/Octokit-netcore45.csproj b/Octokit/Octokit-netcore45.csproj index 43aa1886..d7c46cee 100644 --- a/Octokit/Octokit-netcore45.csproj +++ b/Octokit/Octokit-netcore45.csproj @@ -480,6 +480,8 @@ + + diff --git a/Octokit/Octokit.csproj b/Octokit/Octokit.csproj index 3d3ca2fb..53108b0c 100644 --- a/Octokit/Octokit.csproj +++ b/Octokit/Octokit.csproj @@ -61,6 +61,7 @@ + @@ -91,6 +92,7 @@ +