mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-06-04 19:26:51 +00:00
add IssuesReactionsClient; some fixes
This commit is contained in:
+2
-2
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace Octokit.Reactive
|
||||
{
|
||||
public interface IObservableCommitCommentReactionClient
|
||||
public interface IObservableCommitCommentsReactionsClient
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a reaction for an specified Commit Comment
|
||||
@@ -11,7 +11,7 @@ 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 comment id</param>
|
||||
/// <param name="reaction">The reaction for </param>
|
||||
/// <param name="reaction">The reaction to create </param>
|
||||
/// <returns></returns>
|
||||
IObservable<Reaction> CreateReaction(string owner, string name, int number, NewReaction reaction);
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
|
||||
namespace Octokit.Reactive
|
||||
{
|
||||
public interface IObservableIssuesReactionsClient
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a reaction for an specified Commit Comment
|
||||
/// </summary>
|
||||
/// <remarks>http://developer.github.com/v3/repos/comments/#create-reaction-for-an-issue</remarks>
|
||||
/// <param name="owner">The owner of the repository</param>
|
||||
/// <param name="name">The name of the repository</param>
|
||||
/// <param name="number">The issue id</param>
|
||||
/// <param name="reaction">The reaction to create </param>
|
||||
/// <returns></returns>
|
||||
IObservable<Reaction> CreateReaction(string owner, string name, int number, NewReaction reaction);
|
||||
|
||||
/// <summary>
|
||||
/// List reactions for a specified Commit Comment
|
||||
/// </summary>
|
||||
/// <remarks>http://developer.github.com/v3/repos/comments/#list-reactions-for-an-issue</remarks>
|
||||
/// <param name="owner">The owner of the repository</param>
|
||||
/// <param name="name">The name of the repository</param>
|
||||
/// <param name="number">The issue id</param>
|
||||
/// <returns></returns>
|
||||
IObservable<Reaction> GetAll(string owner, string name, int number);
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,8 @@
|
||||
{
|
||||
public interface IObservableReactionsClient
|
||||
{
|
||||
IObservableCommitCommentReactionClient CommitComments { get; }
|
||||
IObservableCommitCommentsReactionsClient CommitComment { get; }
|
||||
|
||||
IObservableIssuesReactionsClient Issue { get; }
|
||||
}
|
||||
}
|
||||
|
||||
+6
-6
@@ -4,16 +4,16 @@ using Octokit.Reactive.Internal;
|
||||
|
||||
namespace Octokit.Reactive
|
||||
{
|
||||
public class ObservableCommitCommentReactionClient : IObservableCommitCommentReactionClient
|
||||
public class ObservableCommitCommentsReactionClient : IObservableCommitCommentsReactionsClient
|
||||
{
|
||||
readonly ICommitCommentReactionClient _client;
|
||||
readonly ICommitCommentsReactionsClient _client;
|
||||
readonly IConnection _connection;
|
||||
|
||||
public ObservableCommitCommentReactionClient(IGitHubClient client)
|
||||
public ObservableCommitCommentsReactionClient(IGitHubClient client)
|
||||
{
|
||||
Ensure.ArgumentNotNull(client, "client");
|
||||
|
||||
_client = client.Reaction.CommitComments;
|
||||
_client = client.Reaction.CommitComment;
|
||||
_connection = client.Connection;
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ 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 comment id</param>
|
||||
/// <param name="reaction">The reaction for </param>
|
||||
/// <param name="reaction">The reaction to create</param>
|
||||
/// <returns></returns>
|
||||
public IObservable<Reaction> CreateReaction(string owner, string name, int number, NewReaction reaction)
|
||||
{
|
||||
@@ -48,7 +48,7 @@ namespace Octokit.Reactive
|
||||
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
||||
Ensure.ArgumentNotNullOrEmptyString(name, "name");
|
||||
|
||||
return _connection.GetAndFlattenAllPages<Reaction>(ApiUrls.CommitCommentReaction(owner, name, number));
|
||||
return _connection.GetAndFlattenAllPages<Reaction>(ApiUrls.CommitCommentReactions(owner, name, number));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
using Octokit.Reactive.Internal;
|
||||
using System;
|
||||
using System.Reactive.Threading.Tasks;
|
||||
|
||||
namespace Octokit.Reactive
|
||||
{
|
||||
public class ObservableIssuesReactionsClient : IObservableIssuesReactionsClient
|
||||
{
|
||||
readonly IIssuesReactionsClient _client;
|
||||
readonly IConnection _connection;
|
||||
|
||||
public ObservableIssuesReactionsClient(IGitHubClient client)
|
||||
{
|
||||
Ensure.ArgumentNotNull(client, "client");
|
||||
|
||||
_client = client.Reaction.Issue;
|
||||
_connection = client.Connection;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a reaction for a specified Issue
|
||||
/// </summary>
|
||||
/// <remarks>http://developer.github.com/v3/repos/comments/#create-reaction-for-an-issue</remarks>
|
||||
/// <param name="owner">The owner of the repository</param>
|
||||
/// <param name="name">The name of the repository</param>
|
||||
/// <param name="number">The issue id</param>
|
||||
/// <param name="reaction">The reaction to create</param>
|
||||
/// <returns></returns>
|
||||
public IObservable<Reaction> CreateReaction(string owner, string name, int number, NewReaction reaction)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
||||
Ensure.ArgumentNotNullOrEmptyString(name, "name");
|
||||
Ensure.ArgumentNotNull(reaction, "reaction");
|
||||
|
||||
return _client.CreateReaction(owner, name, number, reaction).ToObservable();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// List reactions for a specified Commit Comment
|
||||
/// </summary>
|
||||
/// <remarks>http://developer.github.com/v3/repos/comments/#list-reactions-for-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>
|
||||
public IObservable<Reaction> GetAll(string owner, string name, int number)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
||||
Ensure.ArgumentNotNullOrEmptyString(name, "name");
|
||||
|
||||
return _connection.GetAndFlattenAllPages<Reaction>(ApiUrls.IssueReactions(owner, name, number));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,6 @@
|
||||
namespace Octokit.Reactive
|
||||
using System;
|
||||
|
||||
namespace Octokit.Reactive
|
||||
{
|
||||
public class ObservableReactionsClient : IObservableReactionsClient
|
||||
{
|
||||
@@ -6,9 +8,12 @@
|
||||
{
|
||||
Ensure.ArgumentNotNull(client, "client");
|
||||
|
||||
CommitComments = new ObservableCommitCommentReactionClient(client);
|
||||
CommitComment = new ObservableCommitCommentsReactionClient(client);
|
||||
Issue = new ObservableIssuesReactionsClient(client);
|
||||
}
|
||||
|
||||
public IObservableCommitCommentReactionClient CommitComments { get; private set; }
|
||||
public IObservableCommitCommentsReactionsClient CommitComment { get; private set; }
|
||||
|
||||
public IObservableIssuesReactionsClient Issue { get; private set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -186,6 +186,10 @@
|
||||
<Compile Include="Clients\ObservableReactionsClient.cs" />
|
||||
<Compile Include="Clients\IObservableCommitCommentReactionClient.cs" />
|
||||
<Compile Include="Clients\ObservableCommitCommentReactionClient.cs" />
|
||||
<Compile Include="Clients\IObservableCommitCommentsReactionsClient.cs" />
|
||||
<Compile Include="Clients\IObservableIssuesReactionsClient.cs" />
|
||||
<Compile Include="Clients\ObservableCommitCommentsReactionClient.cs" />
|
||||
<Compile Include="Clients\ObservableIssuesReactionsClient.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<ItemGroup>
|
||||
|
||||
@@ -194,6 +194,10 @@
|
||||
<Compile Include="Clients\ObservableReactionsClient.cs" />
|
||||
<Compile Include="Clients\IObservableCommitCommentReactionClient.cs" />
|
||||
<Compile Include="Clients\ObservableCommitCommentReactionClient.cs" />
|
||||
<Compile Include="Clients\IObservableCommitCommentsReactionsClient.cs" />
|
||||
<Compile Include="Clients\IObservableIssuesReactionsClient.cs" />
|
||||
<Compile Include="Clients\ObservableCommitCommentsReactionClient.cs" />
|
||||
<Compile Include="Clients\ObservableIssuesReactionsClient.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Novell\Novell.MonoDroid.CSharp.targets" />
|
||||
<ItemGroup>
|
||||
|
||||
@@ -190,6 +190,10 @@
|
||||
<Compile Include="Clients\ObservableReactionsClient.cs" />
|
||||
<Compile Include="Clients\IObservableCommitCommentReactionClient.cs" />
|
||||
<Compile Include="Clients\ObservableCommitCommentReactionClient.cs" />
|
||||
<Compile Include="Clients\IObservableCommitCommentsReactionsClient.cs" />
|
||||
<Compile Include="Clients\IObservableIssuesReactionsClient.cs" />
|
||||
<Compile Include="Clients\ObservableCommitCommentsReactionClient.cs" />
|
||||
<Compile Include="Clients\ObservableIssuesReactionsClient.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<ItemGroup>
|
||||
|
||||
@@ -90,7 +90,8 @@
|
||||
<Compile Include="Clients\Enterprise\ObservableEnterpriseSearchIndexingClient.cs" />
|
||||
<Compile Include="Clients\Enterprise\ObservableEnterpriseOrganizationClient.cs" />
|
||||
<Compile Include="Clients\Enterprise\ObservableEnterpriseLicenseClient.cs" />
|
||||
<Compile Include="Clients\IObservableCommitCommentReactionClient.cs" />
|
||||
<Compile Include="Clients\IObservableCommitCommentsReactionsClient.cs" />
|
||||
<Compile Include="Clients\IObservableIssuesReactionsClient.cs" />
|
||||
<Compile Include="Clients\IObservableMigrationsClient.cs" />
|
||||
<Compile Include="Clients\IObservableMergingClient.cs" />
|
||||
<Compile Include="Clients\IObservableMigrationClient.cs" />
|
||||
@@ -101,7 +102,8 @@
|
||||
<Compile Include="Clients\IObservableUserAdministrationClient.cs" />
|
||||
<Compile Include="Clients\IObservableUserKeysClient.cs" />
|
||||
<Compile Include="Clients\IObservableReactionsClient.cs" />
|
||||
<Compile Include="Clients\ObservableCommitCommentReactionClient.cs" />
|
||||
<Compile Include="Clients\ObservableCommitCommentsReactionClient.cs" />
|
||||
<Compile Include="Clients\ObservableIssuesReactionsClient.cs" />
|
||||
<Compile Include="Clients\ObservableMigrationsClient.cs" />
|
||||
<Compile Include="Clients\ObservableMergingClient.cs" />
|
||||
<Compile Include="Clients\ObservableMigrationClient.cs" />
|
||||
|
||||
+9
-9
@@ -5,14 +5,14 @@ using Xunit;
|
||||
|
||||
namespace Octokit.Tests.Clients
|
||||
{
|
||||
public class CommitCommentReactionClientTests
|
||||
public class CommitCommentsReactionsClientTests
|
||||
{
|
||||
public class TheCtor
|
||||
{
|
||||
[Fact]
|
||||
public void EnsuresNonNullArguments()
|
||||
{
|
||||
Assert.Throws<ArgumentNullException>(() => new CommitCommentReactionClient(null));
|
||||
Assert.Throws<ArgumentNullException>(() => new CommitCommentsReactionsClient(null));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace Octokit.Tests.Clients
|
||||
var connection = Substitute.For<IApiConnection>();
|
||||
var client = new ReactionsClient(connection);
|
||||
|
||||
client.CommitComments.GetAll("fake", "repo", 42);
|
||||
client.CommitComment.GetAll("fake", "repo", 42);
|
||||
|
||||
connection.Received().GetAll<Reaction>(Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/comments/1/reactions"), "application/vnd.github.squirrel-girl-preview");
|
||||
}
|
||||
@@ -35,11 +35,11 @@ namespace Octokit.Tests.Clients
|
||||
var connection = Substitute.For<IApiConnection>();
|
||||
var client = new ReactionsClient(connection);
|
||||
|
||||
await Assert.ThrowsAsync<ArgumentNullException>(() => client.CommitComments.CreateReaction(null, "name", 1, new NewReaction(ReactionType.Heart)));
|
||||
await Assert.ThrowsAsync<ArgumentException>(() => client.CommitComments.CreateReaction("", "name", 1, new NewReaction(ReactionType.Heart)));
|
||||
await Assert.ThrowsAsync<ArgumentNullException>(() => client.CommitComments.CreateReaction("owner", null, 1, new NewReaction(ReactionType.Heart)));
|
||||
await Assert.ThrowsAsync<ArgumentException>(() => client.CommitComments.CreateReaction("owner", "", 1, new NewReaction(ReactionType.Heart)));
|
||||
await Assert.ThrowsAsync<ArgumentException>(() => client.CommitComments.CreateReaction("owner", "name", 1, null));
|
||||
await Assert.ThrowsAsync<ArgumentNullException>(() => client.CommitComment.CreateReaction(null, "name", 1, new NewReaction(ReactionType.Heart)));
|
||||
await Assert.ThrowsAsync<ArgumentException>(() => client.CommitComment.CreateReaction("", "name", 1, new NewReaction(ReactionType.Heart)));
|
||||
await Assert.ThrowsAsync<ArgumentNullException>(() => client.CommitComment.CreateReaction("owner", null, 1, new NewReaction(ReactionType.Heart)));
|
||||
await Assert.ThrowsAsync<ArgumentException>(() => client.CommitComment.CreateReaction("owner", "", 1, new NewReaction(ReactionType.Heart)));
|
||||
await Assert.ThrowsAsync<ArgumentException>(() => client.CommitComment.CreateReaction("owner", "name", 1, null));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace Octokit.Tests.Clients
|
||||
var connection = Substitute.For<IApiConnection>();
|
||||
var client = new ReactionsClient(connection);
|
||||
|
||||
client.CommitComments.CreateReaction("fake", "repo", 1, newReaction);
|
||||
client.CommitComment.CreateReaction("fake", "repo", 1, newReaction);
|
||||
|
||||
connection.Received().Post<Reaction>(Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/comments/1/reactions"), Arg.Any<object>(), "application/vnd.github.squirrel-girl-preview");
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
using NSubstitute;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Xunit;
|
||||
|
||||
namespace Octokit.Tests.Clients
|
||||
{
|
||||
public class IssuesReactionsClientTests
|
||||
{
|
||||
public class TheCtor
|
||||
{
|
||||
[Fact]
|
||||
public void EnsuresNonNullArguments()
|
||||
{
|
||||
Assert.Throws<ArgumentNullException>(() => new CommitCommentsReactionsClient(null));
|
||||
}
|
||||
}
|
||||
|
||||
public class TheGetAllMethod
|
||||
{
|
||||
[Fact]
|
||||
public async Task RequestsCorrectUrl()
|
||||
{
|
||||
var connection = Substitute.For<IApiConnection>();
|
||||
var client = new ReactionsClient(connection);
|
||||
|
||||
client.CommitComment.GetAll("fake", "repo", 42);
|
||||
|
||||
connection.Received().GetAll<Reaction>(Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/issues/1/reactions"), "application/vnd.github.squirrel-girl-preview");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task EnsuresArgumentsNotNull()
|
||||
{
|
||||
var connection = Substitute.For<IApiConnection>();
|
||||
var client = new ReactionsClient(connection);
|
||||
|
||||
await Assert.ThrowsAsync<ArgumentNullException>(() => client.Issue.CreateReaction(null, "name", 1, new NewReaction(ReactionType.Heart)));
|
||||
await Assert.ThrowsAsync<ArgumentException>(() => client.Issue.CreateReaction("", "name", 1, new NewReaction(ReactionType.Heart)));
|
||||
await Assert.ThrowsAsync<ArgumentNullException>(() => client.Issue.CreateReaction("owner", null, 1, new NewReaction(ReactionType.Heart)));
|
||||
await Assert.ThrowsAsync<ArgumentException>(() => client.Issue.CreateReaction("owner", "", 1, new NewReaction(ReactionType.Heart)));
|
||||
await Assert.ThrowsAsync<ArgumentException>(() => client.Issue.CreateReaction("owner", "name", 1, null));
|
||||
}
|
||||
}
|
||||
|
||||
public class TheCreateMethod
|
||||
{
|
||||
[Fact]
|
||||
public void RequestsCorrectUrl()
|
||||
{
|
||||
NewReaction newReaction = new NewReaction(ReactionType.Heart);
|
||||
|
||||
var connection = Substitute.For<IApiConnection>();
|
||||
var client = new ReactionsClient(connection);
|
||||
|
||||
client.CommitComment.CreateReaction("fake", "repo", 1, newReaction);
|
||||
|
||||
connection.Received().Post<Reaction>(Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/issues/1/reactions"), Arg.Any<object>(), "application/vnd.github.squirrel-girl-preview");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -85,7 +85,8 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Authentication\CredentialsTests.cs" />
|
||||
<Compile Include="Clients\CommitCommentReactionClientTests.cs" />
|
||||
<Compile Include="Clients\CommitCommentsReactionsClientTests.cs" />
|
||||
<Compile Include="Clients\IssuesReactionsClientTests.cs" />
|
||||
<Compile Include="Clients\MigrationsClientTests.cs" />
|
||||
<Compile Include="Clients\Enterprise\EnterpriseAdminStatsClientTests.cs" />
|
||||
<Compile Include="Clients\Enterprise\EnterpriseLdapClientTests.cs" />
|
||||
|
||||
@@ -23,19 +23,19 @@ namespace Octokit.Tests.Reactive
|
||||
[Fact]
|
||||
public void RequestsCorrectUrl()
|
||||
{
|
||||
_client.CommitComments.GetAll("fake", "repo", 42);
|
||||
_githubClient.Received().Reaction.CommitComments.GetAll("fake", "repo", 42);
|
||||
_client.CommitComment.GetAll("fake", "repo", 42);
|
||||
_githubClient.Received().Reaction.CommitComment.GetAll("fake", "repo", 42);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void EnsuresArgumentsNotNull()
|
||||
{
|
||||
|
||||
Assert.Throws<ArgumentNullException>(() => _client.CommitComments.CreateReaction(null, "name", 1, new NewReaction(ReactionType.Heart)));
|
||||
Assert.Throws<ArgumentException>(() => _client.CommitComments.CreateReaction("", "name", 1, new NewReaction(ReactionType.Heart)));
|
||||
Assert.Throws<ArgumentNullException>(() => _client.CommitComments.CreateReaction("owner", null, 1, new NewReaction(ReactionType.Heart)));
|
||||
Assert.Throws<ArgumentException>(() => _client.CommitComments.CreateReaction("owner", "", 1, new NewReaction(ReactionType.Heart)));
|
||||
Assert.Throws<ArgumentException>(() => _client.CommitComments.CreateReaction("owner", "name", 1, null));
|
||||
Assert.Throws<ArgumentNullException>(() => _client.CommitComment.CreateReaction(null, "name", 1, new NewReaction(ReactionType.Heart)));
|
||||
Assert.Throws<ArgumentException>(() => _client.CommitComment.CreateReaction("", "name", 1, new NewReaction(ReactionType.Heart)));
|
||||
Assert.Throws<ArgumentNullException>(() => _client.CommitComment.CreateReaction("owner", null, 1, new NewReaction(ReactionType.Heart)));
|
||||
Assert.Throws<ArgumentException>(() => _client.CommitComment.CreateReaction("owner", "", 1, new NewReaction(ReactionType.Heart)));
|
||||
Assert.Throws<ArgumentException>(() => _client.CommitComment.CreateReaction("owner", "name", 1, null));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,8 +48,8 @@ namespace Octokit.Tests.Reactive
|
||||
var client = new ObservableReactionsClient(githubClient);
|
||||
var newReaction = new NewReaction(ReactionType.Confused);
|
||||
|
||||
client.CommitComments.CreateReaction("fake", "repo", 1, newReaction);
|
||||
githubClient.Received().Reaction.CommitComments.CreateReaction("fake", "repo", 1, newReaction);
|
||||
client.CommitComment.CreateReaction("fake", "repo", 1, newReaction);
|
||||
githubClient.Received().Reaction.CommitComment.CreateReaction("fake", "repo", 1, newReaction);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+5
-5
@@ -3,9 +3,9 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace Octokit
|
||||
{
|
||||
public class CommitCommentReactionClient : ApiClient, ICommitCommentReactionClient
|
||||
public class CommitCommentsReactionsClient : ApiClient, ICommitCommentsReactionsClient
|
||||
{
|
||||
public CommitCommentReactionClient(IApiConnection apiConnection)
|
||||
public CommitCommentsReactionsClient(IApiConnection apiConnection)
|
||||
: base(apiConnection)
|
||||
{
|
||||
}
|
||||
@@ -17,7 +17,7 @@ namespace Octokit
|
||||
/// <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>
|
||||
/// <param name="reaction">The reaction for </param>
|
||||
/// <param name="reaction">The reaction to create</param>
|
||||
/// <returns></returns>
|
||||
public Task<Reaction> CreateReaction(string owner, string name, int number, NewReaction reaction)
|
||||
{
|
||||
@@ -25,7 +25,7 @@ namespace Octokit
|
||||
Ensure.ArgumentNotNullOrEmptyString(name, "name");
|
||||
Ensure.ArgumentNotNull(reaction, "reaction");
|
||||
|
||||
return ApiConnection.Post<Reaction>(ApiUrls.CommitCommentReaction(owner, name, number), reaction, AcceptHeaders.ReactionsPreview);
|
||||
return ApiConnection.Post<Reaction>(ApiUrls.CommitCommentReactions(owner, name, number), reaction, AcceptHeaders.ReactionsPreview);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -41,7 +41,7 @@ namespace Octokit
|
||||
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
||||
Ensure.ArgumentNotNullOrEmptyString(name, "name");
|
||||
|
||||
return ApiConnection.GetAll<Reaction>(ApiUrls.CommitCommentReaction(owner, name, number), AcceptHeaders.ReactionsPreview);
|
||||
return ApiConnection.GetAll<Reaction>(ApiUrls.CommitCommentReactions(owner, name, number), AcceptHeaders.ReactionsPreview);
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -3,7 +3,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace Octokit
|
||||
{
|
||||
public interface ICommitCommentReactionClient
|
||||
public interface ICommitCommentsReactionsClient
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a reaction for an specified Commit Comment
|
||||
@@ -12,7 +12,7 @@ namespace Octokit
|
||||
/// <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>
|
||||
/// <param name="reaction">The reaction for </param>
|
||||
/// <param name="reaction">The reaction to create</param>
|
||||
/// <returns></returns>
|
||||
Task<Reaction> CreateReaction(string owner, string name, int number, NewReaction reaction);
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Octokit
|
||||
{
|
||||
public interface IIssuesReactionsClient
|
||||
{
|
||||
/// <summary>
|
||||
/// Get all reactions for an specified Issue
|
||||
/// </summary>
|
||||
/// <remarks>http://developer.github.com/v3/repos/comments/#list-reactions-for-an-issue</remarks>
|
||||
/// <param name="owner">The owner of the repository</param>
|
||||
/// <param name="name">The name of the repository</param>
|
||||
/// <param name="number">The issue id</param>
|
||||
/// <returns></returns>
|
||||
Task<IReadOnlyList<Reaction>> GetAll(string owner, string name, int number);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a reaction for an specified Issue
|
||||
/// </summary>
|
||||
/// <remarks>http://developer.github.com/v3/repos/comments/#create-reaction-for-an-issue</remarks>
|
||||
/// <param name="owner">The owner of the repository</param>
|
||||
/// <param name="name">The name of the repository</param>
|
||||
/// <param name="number">The issue id</param>
|
||||
/// <param name="reaction">The reaction to create</param>
|
||||
/// <returns></returns>
|
||||
Task<Reaction> CreateReaction(string owner, string name, int number, NewReaction reaction);
|
||||
}
|
||||
}
|
||||
@@ -9,11 +9,19 @@
|
||||
public interface IReactionsClient
|
||||
{
|
||||
/// <summary>
|
||||
/// Access GitHub's Reactions API.
|
||||
/// Access GitHub's Reactions API for Commit Comments.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Refer to the API documentation for more information: https://developer.github.com/v3/reactions/
|
||||
/// </remarks>
|
||||
ICommitCommentReactionClient CommitComments { get; }
|
||||
ICommitCommentsReactionsClient CommitComment { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Access GitHub's Reactions API for Issues.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Refer to the API documentation for more information: https://developer.github.com/v3/reactions/
|
||||
/// </remarks>
|
||||
IIssuesReactionsClient Issue { get; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,6 +94,6 @@ namespace Octokit
|
||||
/// <param name="name">The name of the repository</param>
|
||||
/// <param name="number">The comment id</param>
|
||||
/// <returns></returns>
|
||||
Task Delete(string owner, string name, int number);
|
||||
Task Delete(string owner, string name, int number);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Octokit
|
||||
{
|
||||
public class IssuesReactionsClient : ApiClient, IIssuesReactionsClient
|
||||
{
|
||||
public IssuesReactionsClient(IApiConnection apiConnection)
|
||||
: base(apiConnection)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a reaction for an specified Issue
|
||||
/// </summary>
|
||||
/// <remarks>http://developer.github.com/v3/repos/comments/#create-reaction-for-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 issue id</param>
|
||||
/// <param name="reaction">The reaction to create</param>
|
||||
/// <returns></returns>
|
||||
public Task<Reaction> CreateReaction(string owner, string name, int number, NewReaction reaction)
|
||||
{
|
||||
Ensure.ArgumentNotNull(owner, "owner");
|
||||
Ensure.ArgumentNotNull(name, "name");
|
||||
Ensure.ArgumentNotNull(reaction, "reaction");
|
||||
|
||||
return ApiConnection.Post<Reaction>(ApiUrls.IssueReactions(owner, name, number), reaction, AcceptHeaders.ReactionsPreview);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get all reactions for an specified Issue
|
||||
/// </summary>
|
||||
/// <remarks>http://developer.github.com/v3/repos/comments/#list-reactions-for-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 issue id</param>
|
||||
/// <returns></returns>
|
||||
public Task<IReadOnlyList<Reaction>> GetAll(string owner, string name, int number)
|
||||
{
|
||||
Ensure.ArgumentNotNull(owner, "owner");
|
||||
Ensure.ArgumentNotNull(name, "name");
|
||||
|
||||
return ApiConnection.GetAll<Reaction>(ApiUrls.IssueReactions(owner, name, number), AcceptHeaders.ReactionsPreview);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,9 +9,24 @@
|
||||
public ReactionsClient(IApiConnection apiConnection)
|
||||
: base(apiConnection)
|
||||
{
|
||||
CommitComments = new CommitCommentReactionClient(apiConnection);
|
||||
CommitComment = new CommitCommentsReactionsClient(apiConnection);
|
||||
Issue = new IssuesReactionsClient(apiConnection);
|
||||
}
|
||||
|
||||
public ICommitCommentReactionClient CommitComments { get; private set; }
|
||||
/// <summary>
|
||||
/// Access GitHub's Reactions API for Commit Comments.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Refer to the API documentation for more information: https://developer.github.com/v3/reactions/
|
||||
/// </remarks>
|
||||
public ICommitCommentsReactionsClient CommitComment { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Access GitHub's Reactions API for Issues.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Refer to the API documentation for more information: https://developer.github.com/v3/reactions/
|
||||
/// </remarks>
|
||||
public IIssuesReactionsClient Issue { get; private set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -316,6 +316,18 @@ namespace Octokit
|
||||
return "repos/{0}/{1}/issues/{2}/lock".FormatUri(owner, name, number);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the <see cref="Uri"/> for the reaction of an specified issue.
|
||||
/// </summary>
|
||||
/// <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></returns>
|
||||
public static Uri IssueReactions(string owner, string name, int number)
|
||||
{
|
||||
return "repos/{0}/{1}/issues/{2}/reactions".FormatUri(owner, name, number);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the <see cref="Uri"/> for the comments for all issues in a specific repo.
|
||||
/// </summary>
|
||||
@@ -393,7 +405,7 @@ namespace Octokit
|
||||
/// <param name="name">The name of the repository</param>
|
||||
/// <param name="number">The comment number</param>
|
||||
/// <returns></returns>
|
||||
public static Uri CommitCommentReaction(string owner, string name, int number)
|
||||
public static Uri CommitCommentReactions(string owner, string name, int number)
|
||||
{
|
||||
return "repos/{0}/{1}/comments/{2}/reactions".FormatUri(owner, name, number);
|
||||
}
|
||||
|
||||
@@ -467,11 +467,13 @@
|
||||
<Compile Include="Models\Request\StartMigrationRequest.cs" />
|
||||
<Compile Include="Models\Response\Migration.cs" />
|
||||
<Compile Include="Models\Request\NewReaction.cs" />
|
||||
<Compile Include="Models\Response\Reaction.cs" />
|
||||
<Compile Include="Clients\ReactionsClient.cs" />
|
||||
<Compile Include="Clients\IReactionsClient.cs" />
|
||||
<Compile Include="Clients\CommitCommentReactionClient.cs" />
|
||||
<Compile Include="Clients\ICommitCommentReactionClient.cs" />
|
||||
<Compile Include="Models\Response\Reaction.cs" />
|
||||
<Compile Include="Clients\ReactionsClient.cs" />
|
||||
<Compile Include="Clients\IReactionsClient.cs" />
|
||||
<Compile Include="Clients\CommitCommentsReactionsClient.cs" />
|
||||
<Compile Include="Clients\ICommitCommentsReactionsClient.cs" />
|
||||
<Compile Include="Clients\IIssuesReactionsClient.cs" />
|
||||
<Compile Include="Clients\IssuesReactionsClient.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
@@ -479,10 +479,12 @@
|
||||
<Compile Include="Models\Response\Migration.cs" />
|
||||
<Compile Include="Models\Request\NewReaction.cs" />
|
||||
<Compile Include="Models\Response\Reaction.cs" />
|
||||
<Compile Include="Clients\ReactionsClient.cs" />
|
||||
<Compile Include="Clients\IReactionsClient.cs" />
|
||||
<Compile Include="Clients\CommitCommentReactionClient.cs" />
|
||||
<Compile Include="Clients\ICommitCommentReactionClient.cs" />
|
||||
<Compile Include="Clients\ReactionsClient.cs" />
|
||||
<Compile Include="Clients\IReactionsClient.cs" />
|
||||
<Compile Include="Clients\CommitCommentsReactionsClient.cs" />
|
||||
<Compile Include="Clients\ICommitCommentsReactionsClient.cs" />
|
||||
<Compile Include="Clients\IIssuesReactionsClient.cs" />
|
||||
<Compile Include="Clients\IssuesReactionsClient.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Novell\Novell.MonoDroid.CSharp.targets" />
|
||||
</Project>
|
||||
@@ -475,10 +475,12 @@
|
||||
<Compile Include="Models\Response\Migration.cs" />
|
||||
<Compile Include="Models\Request\NewReaction.cs" />
|
||||
<Compile Include="Models\Response\Reaction.cs" />
|
||||
<Compile Include="Clients\ReactionsClient.cs" />
|
||||
<Compile Include="Clients\IReactionsClient.cs" />
|
||||
<Compile Include="Clients\CommitCommentReactionClient.cs" />
|
||||
<Compile Include="Clients\ICommitCommentReactionClient.cs" />
|
||||
<Compile Include="Clients\ReactionsClient.cs" />
|
||||
<Compile Include="Clients\IReactionsClient.cs" />
|
||||
<Compile Include="Clients\CommitCommentsReactionsClient.cs" />
|
||||
<Compile Include="Clients\ICommitCommentsReactionsClient.cs" />
|
||||
<Compile Include="Clients\IIssuesReactionsClient.cs" />
|
||||
<Compile Include="Clients\IssuesReactionsClient.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.MonoTouch.CSharp.targets" />
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
|
||||
@@ -465,10 +465,12 @@
|
||||
<Compile Include="Models\Response\Migration.cs" />
|
||||
<Compile Include="Models\Request\NewReaction.cs" />
|
||||
<Compile Include="Models\Response\Reaction.cs" />
|
||||
<Compile Include="Clients\ReactionsClient.cs" />
|
||||
<Compile Include="Clients\IReactionsClient.cs" />
|
||||
<Compile Include="Clients\CommitCommentReactionClient.cs" />
|
||||
<Compile Include="Clients\ICommitCommentReactionClient.cs" />
|
||||
<Compile Include="Clients\ReactionsClient.cs" />
|
||||
<Compile Include="Clients\IReactionsClient.cs" />
|
||||
<Compile Include="Clients\CommitCommentsReactionsClient.cs" />
|
||||
<Compile Include="Clients\ICommitCommentsReactionsClient.cs" />
|
||||
<Compile Include="Clients\IIssuesReactionsClient.cs" />
|
||||
<Compile Include="Clients\IssuesReactionsClient.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CodeAnalysisDictionary Include="..\CustomDictionary.xml">
|
||||
|
||||
@@ -471,11 +471,13 @@
|
||||
<Compile Include="Models\Request\StartMigrationRequest.cs" />
|
||||
<Compile Include="Models\Response\Migration.cs" />
|
||||
<Compile Include="Models\Request\NewReaction.cs" />
|
||||
<Compile Include="Models\Response\Reaction.cs" />
|
||||
<Compile Include="Clients\ReactionsClient.cs" />
|
||||
<Compile Include="Clients\ReactionsClient.cs" />
|
||||
<Compile Include="Clients\IReactionsClient.cs" />
|
||||
<Compile Include="Clients\CommitCommentReactionClient.cs" />
|
||||
<Compile Include="Clients\ICommitCommentReactionClient.cs" />
|
||||
<Compile Include="Clients\CommitCommentsReactionsClient.cs" />
|
||||
<Compile Include="Clients\ICommitCommentsReactionsClient.cs" />
|
||||
<Compile Include="Clients\IIssuesReactionsClient.cs" />
|
||||
<Compile Include="Clients\IssuesReactionsClient.cs" />
|
||||
<Compile Include="Models\Response\Reaction.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CodeAnalysisDictionary Include="..\CustomDictionary.xml">
|
||||
|
||||
@@ -58,7 +58,9 @@
|
||||
<Link>Properties\SolutionInfo.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="Clients\ActivitiesClient.cs" />
|
||||
<Compile Include="Clients\ICommitCommentReactionClient.cs" />
|
||||
<Compile Include="Clients\ICommitCommentsReactionsClient.cs" />
|
||||
<Compile Include="Clients\IIssuesReactionsClient.cs" />
|
||||
<Compile Include="Clients\IssuesReactionsClient.cs" />
|
||||
<Compile Include="Clients\MigrationsClient.cs" />
|
||||
<Compile Include="Clients\Enterprise\EnterpriseAdminStatsClient.cs" />
|
||||
<Compile Include="Clients\Enterprise\EnterpriseLdapClient.cs" />
|
||||
@@ -86,7 +88,7 @@
|
||||
<Compile Include="Clients\OAuthClient.cs" />
|
||||
<Compile Include="Clients\IRepositoryContentsClient.cs" />
|
||||
<Compile Include="Clients\OrganizationMembersClient.cs" />
|
||||
<Compile Include="Clients\CommitCommentReactionClient.cs" />
|
||||
<Compile Include="Clients\CommitCommentsReactionsClient.cs" />
|
||||
<Compile Include="Clients\ReactionsClient.cs" />
|
||||
<Compile Include="Clients\RepositoryCommentsClient.cs" />
|
||||
<Compile Include="Clients\IRepositoryCommentsClient.cs" />
|
||||
|
||||
Reference in New Issue
Block a user