Files
octokit.net/Octokit/Clients/CommitCommentReactionsClient.cs
2016-09-15 02:15:11 +02:00

81 lines
3.6 KiB
C#

using System.Collections.Generic;
using System.Threading.Tasks;
namespace Octokit
{
/// <summary>
/// A client for GitHub's Reactions API.
/// </summary>
/// <remarks>
/// See the <a href="https://developer.github.com/v3/reactions">Reactions API documentation</a> for more information.
/// </remarks>
public class CommitCommentReactionsClient : ApiClient, ICommitCommentReactionsClient
{
public CommitCommentReactionsClient(IApiConnection apiConnection)
: base(apiConnection)
{
}
/// <summary>
/// Creates a reaction for a specified Commit Comment
/// </summary>
/// <remarks>https://developer.github.com/v3/reactions/#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 to create</param>
/// <returns></returns>
public Task<Reaction> Create(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.CommitCommentReactions(owner, name, number), reaction, AcceptHeaders.ReactionsPreview);
}
/// <summary>
/// Creates a reaction for a specified Commit Comment
/// </summary>
/// <remarks>https://developer.github.com/v3/reactions/#create-reaction-for-a-commit-comment</remarks>
/// <param name="repositoryId">The owner of the repository</param>
/// <param name="number">The comment id</param>
/// <param name="reaction">The reaction to create</param>
/// <returns></returns>
public Task<Reaction> Create(long repositoryId, int number, NewReaction reaction)
{
Ensure.ArgumentNotNull(reaction, "reaction");
return ApiConnection.Post<Reaction>(ApiUrls.CommitCommentReactions(repositoryId, number), reaction, AcceptHeaders.ReactionsPreview);
}
/// <summary>
/// Get all reactions for a specified Commit Comment
/// </summary>
/// <remarks>https://developer.github.com/v3/reactions/#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 Task<IReadOnlyList<Reaction>> GetAll(string owner, string name, int number)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
Ensure.ArgumentNotNullOrEmptyString(name, "name");
return ApiConnection.GetAll<Reaction>(ApiUrls.CommitCommentReactions(owner, name, number), AcceptHeaders.ReactionsPreview);
}
/// <summary>
/// Get all reactions for a specified Commit Comment
/// </summary>
/// <remarks>https://developer.github.com/v3/reactions/#list-reactions-for-a-commit-comment</remarks>
/// <param name="repositoryId">The owner of the repository</param>
/// <param name="number">The comment id</param>
/// <returns></returns>
public Task<IReadOnlyList<Reaction>> GetAll(long repositoryId, int number)
{
return ApiConnection.GetAll<Reaction>(ApiUrls.CommitCommentReactions(repositoryId, number), AcceptHeaders.ReactionsPreview);
}
}
}