mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-06-02 19:00:47 +00:00
create classes for standalone reaction client and CommitCommentReaction
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Octokit
|
||||
{
|
||||
public interface ICommitCommentReaction
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a reaction for an specified Commit Comment
|
||||
/// </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 comment id</param>
|
||||
/// <param name="reaction">The reaction for </param>
|
||||
/// <returns></returns>
|
||||
Task<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-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 comment id</param>
|
||||
/// <returns></returns>
|
||||
Task<IReadOnlyList<Reaction>> ListReactions(string owner, string name, int number);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Octokit
|
||||
{
|
||||
public class CommitCommentReaction : ApiClient, ICommitCommentReaction
|
||||
{
|
||||
public CommitCommentReaction(IApiConnection apiConnection)
|
||||
: base(apiConnection)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a reaction for a specified Commit Comment
|
||||
/// </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 comment id</param>
|
||||
/// <param name="reaction">The reaction for </param>
|
||||
/// <returns></returns>
|
||||
public Task<Reaction> CreateReaction(string owner, string name, int number, NewReaction reaction)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
||||
Ensure.ArgumentNotNullOrEmptyString(name, "name");
|
||||
Ensure.ArgumentNotNull(reaction, "reaction");
|
||||
|
||||
return ApiConnection.Post<Reaction>(ApiUrls.CommitCommentReaction(owner, name, number), reaction, AcceptHeaders.ReactionsPreview);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// List reactions for a specified Commit Comment
|
||||
/// </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 comment id</param>
|
||||
/// <param name="reaction">The reaction for </param>
|
||||
/// <returns></returns>
|
||||
public Task<IReadOnlyList<Reaction>> ListReactions(string owner, string name, int number, NewReaction reaction)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
||||
Ensure.ArgumentNotNullOrEmptyString(name, "name");
|
||||
Ensure.ArgumentNotNull(reaction, "reaction");
|
||||
|
||||
return ApiConnection.Get<Reaction>(ApiUrls.CommitCommentReaction(owner, name, number),"", AcceptHeaders.ReactionsPreview);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
namespace Octokit
|
||||
{
|
||||
public class ReactionsClient : ApiClient, IReactionsClient
|
||||
{
|
||||
/// <summary>
|
||||
/// Instantiates a new GitHub Reactions API client
|
||||
/// </summary>
|
||||
/// <param name="apiConnection">An API connection</param>
|
||||
public ReactionsClient(IApiConnection apiConnection)
|
||||
: base(apiConnection)
|
||||
{
|
||||
CommitComments = new CommitCommentReaction(apiConnection);
|
||||
}
|
||||
|
||||
public ICommitCommentReaction CommitComments { get; private set; }
|
||||
}
|
||||
}
|
||||
@@ -99,6 +99,7 @@ namespace Octokit
|
||||
Search = new SearchClient(apiConnection);
|
||||
SshKey = new SshKeysClient(apiConnection);
|
||||
User = new UsersClient(apiConnection);
|
||||
Reaction = new ReactionsClient(apiConnection);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -305,6 +306,14 @@ namespace Octokit
|
||||
/// </remarks>
|
||||
public IEnterpriseClient Enterprise { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Access GitHub's Reactions API
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Refer to the API documentation for more information: https://developer.github.com/v3/reactions/
|
||||
/// </remarks>
|
||||
public IReactionsClient Reaction { get; private set; }
|
||||
|
||||
static Uri FixUpBaseUri(Uri uri)
|
||||
{
|
||||
Ensure.ArgumentNotNull(uri, "uri");
|
||||
|
||||
@@ -162,5 +162,13 @@ namespace Octokit
|
||||
/// Refer to the API documentation for more information: https://developer.github.com/v3/enterprise/
|
||||
/// </remarks>
|
||||
IEnterpriseClient Enterprise { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Access GitHub's Reactions API
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Refer to the API documentation for more information: https://developer.github.com/v3/reactions/
|
||||
/// </remarks>
|
||||
IReactionsClient Reaction { get; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
namespace Octokit
|
||||
{
|
||||
/// <summary>
|
||||
/// A client for GitHub's Reactions Events API.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// See the <a href="http://developer.github.com/v3/reactions/">Reactions API documentation</a> for more information
|
||||
/// </remarks>
|
||||
public interface IReactionsClient
|
||||
{
|
||||
/// <summary>
|
||||
/// Access GitHub's Reactions API.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Refer to the API documentation for more information: https://developer.github.com/v3/reactions/
|
||||
/// </remarks>
|
||||
ICommitCommentReaction CommitComments { get; }
|
||||
}
|
||||
}
|
||||
@@ -468,6 +468,10 @@
|
||||
<Compile Include="Models\Response\Migration.cs" />
|
||||
<Compile Include="Models\Request\NewReaction.cs" />
|
||||
<Compile Include="Models\Response\Reaction.cs" />
|
||||
<Compile Include="Clients\IReactionCommitComment.cs" />
|
||||
<Compile Include="Clients\ReactionCommitComment.cs" />
|
||||
<Compile Include="Clients\ReactionsClient.cs" />
|
||||
<Compile Include="IReactionsClient.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
@@ -479,6 +479,10 @@
|
||||
<Compile Include="Models\Response\Migration.cs" />
|
||||
<Compile Include="Models\Request\NewReaction.cs" />
|
||||
<Compile Include="Models\Response\Reaction.cs" />
|
||||
<Compile Include="Clients\IReactionCommitComment.cs" />
|
||||
<Compile Include="Clients\ReactionCommitComment.cs" />
|
||||
<Compile Include="Clients\ReactionsClient.cs" />
|
||||
<Compile Include="IReactionsClient.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Novell\Novell.MonoDroid.CSharp.targets" />
|
||||
</Project>
|
||||
@@ -475,6 +475,10 @@
|
||||
<Compile Include="Models\Response\Migration.cs" />
|
||||
<Compile Include="Models\Request\NewReaction.cs" />
|
||||
<Compile Include="Models\Response\Reaction.cs" />
|
||||
<Compile Include="Clients\IReactionCommitComment.cs" />
|
||||
<Compile Include="Clients\ReactionCommitComment.cs" />
|
||||
<Compile Include="Clients\ReactionsClient.cs" />
|
||||
<Compile Include="IReactionsClient.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.MonoTouch.CSharp.targets" />
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
|
||||
@@ -462,9 +462,13 @@
|
||||
<Compile Include="Clients\MigrationClient.cs" />
|
||||
<Compile Include="Clients\MigrationsClient.cs" />
|
||||
<Compile Include="Models\Request\StartMigrationRequest.cs" />
|
||||
<Compile Include="Models\Response\Migration.cs" />
|
||||
<Compile Include="Models\Response\Migration.cs" />
|
||||
<Compile Include="Models\Request\NewReaction.cs" />
|
||||
<Compile Include="Models\Response\Reaction.cs" />
|
||||
<Compile Include="Clients\IReactionCommitComment.cs" />
|
||||
<Compile Include="Clients\ReactionCommitComment.cs" />
|
||||
<Compile Include="Clients\ReactionsClient.cs" />
|
||||
<Compile Include="IReactionsClient.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CodeAnalysisDictionary Include="..\CustomDictionary.xml">
|
||||
|
||||
@@ -469,9 +469,13 @@
|
||||
<Compile Include="Clients\MigrationClient.cs" />
|
||||
<Compile Include="Clients\MigrationsClient.cs" />
|
||||
<Compile Include="Models\Request\StartMigrationRequest.cs" />
|
||||
<Compile Include="Models\Response\Migration.cs" />
|
||||
<Compile Include="Models\Response\Migration.cs" />
|
||||
<Compile Include="Models\Request\NewReaction.cs" />
|
||||
<Compile Include="Models\Response\Reaction.cs" />
|
||||
<Compile Include="Clients\IReactionCommitComment.cs" />
|
||||
<Compile Include="Clients\ReactionCommitComment.cs" />
|
||||
<Compile Include="Clients\ReactionsClient.cs" />
|
||||
<Compile Include="IReactionsClient.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CodeAnalysisDictionary Include="..\CustomDictionary.xml">
|
||||
|
||||
@@ -58,6 +58,7 @@
|
||||
<Link>Properties\SolutionInfo.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="Clients\ActivitiesClient.cs" />
|
||||
<Compile Include="Clients\IReactionCommitComment.cs" />
|
||||
<Compile Include="Clients\MigrationsClient.cs" />
|
||||
<Compile Include="Clients\Enterprise\EnterpriseAdminStatsClient.cs" />
|
||||
<Compile Include="Clients\Enterprise\EnterpriseLdapClient.cs" />
|
||||
@@ -85,6 +86,8 @@
|
||||
<Compile Include="Clients\OAuthClient.cs" />
|
||||
<Compile Include="Clients\IRepositoryContentsClient.cs" />
|
||||
<Compile Include="Clients\OrganizationMembersClient.cs" />
|
||||
<Compile Include="Clients\ReactionCommitComment.cs" />
|
||||
<Compile Include="Clients\ReactionsClient.cs" />
|
||||
<Compile Include="Clients\RepositoryCommentsClient.cs" />
|
||||
<Compile Include="Clients\IRepositoryCommentsClient.cs" />
|
||||
<Compile Include="Clients\FeedsClient.cs" />
|
||||
@@ -118,6 +121,7 @@
|
||||
<Compile Include="Http\IApiInfoProvider.cs" />
|
||||
<Compile Include="Http\ProductHeaderValue.cs" />
|
||||
<Compile Include="Http\RequestBody.cs" />
|
||||
<Compile Include="IReactionsClient.cs" />
|
||||
<Compile Include="Models\Request\BranchUpdate.cs" />
|
||||
<Compile Include="Models\Request\ApiOptions.cs" />
|
||||
<Compile Include="Models\Request\NewReaction.cs" />
|
||||
|
||||
Reference in New Issue
Block a user