diff --git a/Octokit.Reactive/Clients/IObservableIssueCommentReactionsClient.cs b/Octokit.Reactive/Clients/IObservableIssueCommentReactionsClient.cs new file mode 100644 index 00000000..a04bd9ed --- /dev/null +++ b/Octokit.Reactive/Clients/IObservableIssueCommentReactionsClient.cs @@ -0,0 +1,28 @@ +using System; + +namespace Octokit.Reactive +{ + public interface IObservableIssueCommentReactionsClient + { + /// + /// Creates a reaction for an specified Commit Comment + /// + /// http://developer.github.com/v3/repos/comments/#create-reaction-for-an-issue-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); + + /// + /// List reactions for a specified Commit Comment + /// + /// http://developer.github.com/v3/repos/comments/#list-reactions-for-an-issue-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/ObservableCommitCommentReactionsClient.cs b/Octokit.Reactive/Clients/ObservableCommitCommentReactionsClient.cs index cb95edac..bfd12684 100644 --- a/Octokit.Reactive/Clients/ObservableCommitCommentReactionsClient.cs +++ b/Octokit.Reactive/Clients/ObservableCommitCommentReactionsClient.cs @@ -48,7 +48,7 @@ namespace Octokit.Reactive Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(name, "name"); - return _connection.GetAndFlattenAllPages(ApiUrls.CommitCommentReactions(owner, name, number)); + return _connection.GetAndFlattenAllPages(ApiUrls.CommitCommentReactions(owner, name, number), AcceptHeaders.ReactionsPreview); } } } diff --git a/Octokit.Reactive/Clients/ObservableIssueCommentReactionsClient.cs b/Octokit.Reactive/Clients/ObservableIssueCommentReactionsClient.cs new file mode 100644 index 00000000..833158f3 --- /dev/null +++ b/Octokit.Reactive/Clients/ObservableIssueCommentReactionsClient.cs @@ -0,0 +1,54 @@ +using Octokit.Reactive.Internal; +using System; +using System.Reactive.Threading.Tasks; + +namespace Octokit.Reactive +{ + public class ObservableIssueCommentReactionsClient : IObservableIssueCommentReactionsClient + { + readonly ICommitCommentReactionsClient _client; + readonly IConnection _connection; + + public ObservableIssueCommentReactionsClient(IGitHubClient client) + { + Ensure.ArgumentNotNull(client, "client"); + + _client = client.Reaction.CommitComment; + _connection = client.Connection; + } + + /// + /// Creates a reaction for an specified Commit Comment + /// + /// http://developer.github.com/v3/repos/comments/#create-reaction-for-an-issue-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(); + } + + /// + /// List reactions for a specified Commit Comment + /// + /// http://developer.github.com/v3/repos/comments/#list-reactions-for-an-issue-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.IssueCommentReactions(owner, name, number), AcceptHeaders.ReactionsPreview); + } + } +} diff --git a/Octokit.Reactive/Clients/ObservableIssueReactionsClient.cs b/Octokit.Reactive/Clients/ObservableIssueReactionsClient.cs index ffa33fcf..8246041c 100644 --- a/Octokit.Reactive/Clients/ObservableIssueReactionsClient.cs +++ b/Octokit.Reactive/Clients/ObservableIssueReactionsClient.cs @@ -48,7 +48,7 @@ namespace Octokit.Reactive Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(name, "name"); - return _connection.GetAndFlattenAllPages(ApiUrls.IssueReactions(owner, name, number)); + return _connection.GetAndFlattenAllPages(ApiUrls.IssueReactions(owner, name, number), AcceptHeaders.ReactionsPreview); } } } diff --git a/Octokit.Reactive/Octokit.Reactive-Mono.csproj b/Octokit.Reactive/Octokit.Reactive-Mono.csproj index 2eae99e7..8996d64c 100644 --- a/Octokit.Reactive/Octokit.Reactive-Mono.csproj +++ b/Octokit.Reactive/Octokit.Reactive-Mono.csproj @@ -194,6 +194,8 @@ + + diff --git a/Octokit.Reactive/Octokit.Reactive-MonoAndroid.csproj b/Octokit.Reactive/Octokit.Reactive-MonoAndroid.csproj index e311e3d8..38d89c8f 100644 --- a/Octokit.Reactive/Octokit.Reactive-MonoAndroid.csproj +++ b/Octokit.Reactive/Octokit.Reactive-MonoAndroid.csproj @@ -202,6 +202,8 @@ + + diff --git a/Octokit.Reactive/Octokit.Reactive-Monotouch.csproj b/Octokit.Reactive/Octokit.Reactive-Monotouch.csproj index 700314d5..bb68d1f0 100644 --- a/Octokit.Reactive/Octokit.Reactive-Monotouch.csproj +++ b/Octokit.Reactive/Octokit.Reactive-Monotouch.csproj @@ -198,6 +198,8 @@ + + diff --git a/Octokit.Reactive/Octokit.Reactive.csproj b/Octokit.Reactive/Octokit.Reactive.csproj index 732721c1..a63f8014 100644 --- a/Octokit.Reactive/Octokit.Reactive.csproj +++ b/Octokit.Reactive/Octokit.Reactive.csproj @@ -91,6 +91,7 @@ + @@ -103,6 +104,7 @@ + diff --git a/Octokit/Clients/IIssueCommentReactionsClient.cs b/Octokit/Clients/IIssueCommentReactionsClient.cs new file mode 100644 index 00000000..298e9046 --- /dev/null +++ b/Octokit/Clients/IIssueCommentReactionsClient.cs @@ -0,0 +1,29 @@ +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace Octokit +{ + public interface IIssueCommentReactionsClient + { + /// + /// Creates a reaction for an specified Issue Comment + /// + /// http://developer.github.com/v3/repos/comments/#create-reaction-for-an-issue-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 Commit Comment + /// + /// http://developer.github.com/v3/repos/comments/#list-reactions-for-an-issue-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 fc5ad5ec..d22b83e1 100644 --- a/Octokit/Clients/IReactionsClient.cs +++ b/Octokit/Clients/IReactionsClient.cs @@ -23,5 +23,13 @@ /// Refer to the API documentation for more information: https://developer.github.com/v3/reactions/ /// IIssueReactionsClient Issue { get; } + + /// + /// Access GitHub's Reactions API for Issue Comments. + /// + /// + /// Refer to the API documentation for more information: https://developer.github.com/v3/reactions/ + /// + IIssueCommentReactionsClient IssueComment { get; } } } diff --git a/Octokit/Clients/IssueCommentReactionsClient.cs b/Octokit/Clients/IssueCommentReactionsClient.cs new file mode 100644 index 00000000..4ee05089 --- /dev/null +++ b/Octokit/Clients/IssueCommentReactionsClient.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace Octokit +{ + public class IssueCommentReactionsClient : ApiClient, IIssueCommentReactionsClient + { + public IssueCommentReactionsClient(IApiConnection apiConnection) + : base(apiConnection) + { + } + + /// + /// Creates a reaction for an specified Issue Comment + /// + /// http://developer.github.com/v3/repos/comments/#create-reaction-for-an-issue-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.IssueCommentReactions(owner, name, number), reaction, AcceptHeaders.ReactionsPreview); + } + + /// + /// Get all reactions for a specified Commit Comment + /// + /// http://developer.github.com/v3/repos/comments/#list-reactions-for-an-issue-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.IssueCommentReactions(owner, name, number), AcceptHeaders.ReactionsPreview); + } + } +} diff --git a/Octokit/Clients/ReactionsClient.cs b/Octokit/Clients/ReactionsClient.cs index 7ef899d5..53364212 100644 --- a/Octokit/Clients/ReactionsClient.cs +++ b/Octokit/Clients/ReactionsClient.cs @@ -1,4 +1,6 @@ -namespace Octokit +using System; + +namespace Octokit { public class ReactionsClient : ApiClient, IReactionsClient { @@ -28,5 +30,13 @@ /// Refer to the API documentation for more information: https://developer.github.com/v3/reactions/ /// public IIssueReactionsClient Issue { get; private set; } + + /// + /// Access GitHub's Reactions API for Issue Comments. + /// + /// + /// Refer to the API documentation for more information: https://developer.github.com/v3/reactions/ + /// + public IIssueCommentReactionsClient IssueComment { get; private set; } } } diff --git a/Octokit/Octokit-Mono.csproj b/Octokit/Octokit-Mono.csproj index 656cbe64..5e46e53c 100644 --- a/Octokit/Octokit-Mono.csproj +++ b/Octokit/Octokit-Mono.csproj @@ -469,11 +469,13 @@ - + + + \ No newline at end of file diff --git a/Octokit/Octokit-MonoAndroid.csproj b/Octokit/Octokit-MonoAndroid.csproj index d04b6021..d9d8efbe 100644 --- a/Octokit/Octokit-MonoAndroid.csproj +++ b/Octokit/Octokit-MonoAndroid.csproj @@ -480,11 +480,13 @@ - + + + \ No newline at end of file diff --git a/Octokit/Octokit-Monotouch.csproj b/Octokit/Octokit-Monotouch.csproj index e2d9466c..3858e96f 100644 --- a/Octokit/Octokit-Monotouch.csproj +++ b/Octokit/Octokit-Monotouch.csproj @@ -476,11 +476,13 @@ - + + + diff --git a/Octokit/Octokit-Portable.csproj b/Octokit/Octokit-Portable.csproj index f39ff5fc..1e93e924 100644 --- a/Octokit/Octokit-Portable.csproj +++ b/Octokit/Octokit-Portable.csproj @@ -466,11 +466,13 @@ - + + + diff --git a/Octokit/Octokit-netcore45.csproj b/Octokit/Octokit-netcore45.csproj index b2036f65..43aa1886 100644 --- a/Octokit/Octokit-netcore45.csproj +++ b/Octokit/Octokit-netcore45.csproj @@ -478,6 +478,8 @@ + + diff --git a/Octokit/Octokit.csproj b/Octokit/Octokit.csproj index 55215602..3d3ca2fb 100644 --- a/Octokit/Octokit.csproj +++ b/Octokit/Octokit.csproj @@ -59,7 +59,9 @@ + +