using System.Collections.Generic;
using System.Threading.Tasks;
namespace Octokit
{
///
/// A client for GitHub's Reactions API.
///
///
/// See the Reactions API documentation for more information.
///
public class CommitCommentReactionsClient : ApiClient, ICommitCommentReactionsClient
{
public CommitCommentReactionsClient(IApiConnection apiConnection)
: base(apiConnection)
{
}
///
/// Creates a reaction for a specified Commit Comment
///
/// https://developer.github.com/v3/reactions/#create-reaction-for-a-commit-comment
/// The owner of the repository
/// The name of the repository
/// The comment id
/// The reaction to create
///
[ManualRoute("POST", "/repos/{owner}/{repo}/comments/{comment_id}/reactions")]
public Task Create(string owner, string name, long commentId, NewReaction reaction)
{
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
Ensure.ArgumentNotNull(reaction, nameof(reaction));
return ApiConnection.Post(ApiUrls.CommitCommentReactions(owner, name, commentId), reaction);
}
///
/// Creates a reaction for a specified Commit Comment
///
/// https://developer.github.com/v3/reactions/#create-reaction-for-a-commit-comment
/// The owner of the repository
/// The comment id
/// The reaction to create
///
[ManualRoute("POST", "/repositories/{id}/comments/{comment_id}/reactions")]
public Task Create(long repositoryId, long commentId, NewReaction reaction)
{
Ensure.ArgumentNotNull(reaction, nameof(reaction));
return ApiConnection.Post(ApiUrls.CommitCommentReactions(repositoryId, commentId), reaction);
}
///
/// Get all reactions for a specified Commit Comment
///
/// https://developer.github.com/v3/reactions/#list-reactions-for-a-commit-comment
/// The owner of the repository
/// The name of the repository
/// The comment id
///
[ManualRoute("GET", "/repos/{owner}/{repo}/comments/{comment_id}/reactions")]
public Task> GetAll(string owner, string name, long commentId)
{
return GetAll(owner, name, commentId, ApiOptions.None);
}
///
/// Get all reactions for a specified Commit Comment
///
/// https://developer.github.com/v3/reactions/#list-reactions-for-a-commit-comment
/// The owner of the repository
/// The name of the repository
/// The comment id
/// Options for changing the API response
///
[ManualRoute("GET", "/repos/{owner}/{repo}/comments/{comment_id}/reactions")]
public Task> GetAll(string owner, string name, long commentId, ApiOptions options)
{
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
Ensure.ArgumentNotNull(options, nameof(options));
return ApiConnection.GetAll(ApiUrls.CommitCommentReactions(owner, name, commentId), null, options);
}
///
/// Get all reactions for a specified Commit Comment
///
/// https://developer.github.com/v3/reactions/#list-reactions-for-a-commit-comment
/// The owner of the repository
/// The comment id
///
[ManualRoute("GET", "/repositories/{id}/comments/{comment_id}/reactions")]
public Task> GetAll(long repositoryId, long commentId)
{
return GetAll(repositoryId, commentId, ApiOptions.None);
}
///
/// Get all reactions for a specified Commit Comment
///
/// https://developer.github.com/v3/reactions/#list-reactions-for-a-commit-comment
/// The owner of the repository
/// The comment id
/// Options for changing the API response
///
[ManualRoute("GET", "/repositories/{id}/comments/{comment_id}/reactions")]
public Task> GetAll(long repositoryId, long commentId, ApiOptions options)
{
Ensure.ArgumentNotNull(options, nameof(options));
return ApiConnection.GetAll(ApiUrls.CommitCommentReactions(repositoryId, commentId), null, options);
}
///
/// Deletes a reaction for a specified Commit Comment
///
/// https://docs.github.com/rest/reactions#delete-a-commit-comment-reaction
/// The owner of the repository
/// The name of the repository
/// The comment id
/// The reaction id
///
[ManualRoute("DELETE", "/repos/{owner}/{repo}/comments/{comment_id}/reactions/{reaction_id}")]
public Task Delete(string owner, string name, long commentId, long reactionId)
{
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
return ApiConnection.Delete(ApiUrls.CommitCommentReaction(owner, name, commentId, reactionId));
}
///
/// Deletes a reaction for a specified Commit Comment
///
/// https://docs.github.com/rest/reactions#delete-a-commit-comment-reaction
/// The owner of the repository
/// The comment id
/// The reaction id
///
[ManualRoute("DELETE", "/repositories/{id}/comments/{comment_id}/reactions/{reaction_id}")]
public Task Delete(long repositoryId, long commentId, long reactionId)
{
return ApiConnection.Delete(ApiUrls.CommitCommentReaction(repositoryId, commentId, reactionId));
}
}
}