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 IssueCommentReactionsClient : ApiClient, IIssueCommentReactionsClient { public IssueCommentReactionsClient(IApiConnection apiConnection) : base(apiConnection) { } /// /// Creates a reaction for a specified Issue Comment /// /// https://developer.github.com/v3/reactions/#create-reactions-for-an-issue-comment /// The owner of the repository /// The name of the repository /// The comment id /// The reaction to create [Preview("squirrel-girl")] [ManualRoute("POST", "/repos/{owner}/{repo}/issues/comments/{number}/reactions")] public Task Create(string owner, string name, int number, NewReaction reaction) { Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner)); Ensure.ArgumentNotNullOrEmptyString(name, nameof(name)); Ensure.ArgumentNotNull(reaction, nameof(reaction)); return ApiConnection.Post(ApiUrls.IssueCommentReactions(owner, name, number), reaction, AcceptHeaders.ReactionsPreview); } /// /// Creates a reaction for a specified Issue Comment /// /// https://developer.github.com/v3/reactions/#create-reaction-for-an-issue-comment /// The Id of the repository /// The comment id /// The reaction to create [Preview("squirrel-girl")] [ManualRoute("POST", "/repositories/{0}/issues/comments/{number}/reactions")] public Task Create(long repositoryId, int number, NewReaction reaction) { Ensure.ArgumentNotNull(reaction, nameof(reaction)); return ApiConnection.Post(ApiUrls.IssueCommentReactions(repositoryId, number), reaction, AcceptHeaders.ReactionsPreview); } /// /// Get all reactions for a specified Issue Comment /// /// https://developer.github.com/v3/reactions/#list-reactions-for-an-issue-comment /// The owner of the repository /// The name of the repository /// The comment id [ManualRoute("POST", "/repos/{owner}/{repo}/issues/comments/{number}/reactions")] public Task> GetAll(string owner, string name, int number) { return GetAll(owner, name, number, ApiOptions.None); } /// /// Get all reactions for a specified Issue Comment /// /// https://developer.github.com/v3/reactions/#list-reactions-for-an-issue-comment /// The owner of the repository /// The name of the repository /// The comment id /// Options for changing the API response [Preview("squirrel-girl")] [ManualRoute("POST", "/repos/{owner}/{repo}/issues/comments/{number}/reactions")] public Task> GetAll(string owner, string name, int number, ApiOptions options) { Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner)); Ensure.ArgumentNotNullOrEmptyString(name, nameof(name)); Ensure.ArgumentNotNull(options, nameof(options)); return ApiConnection.GetAll(ApiUrls.IssueCommentReactions(owner, name, number), null, AcceptHeaders.ReactionsPreview, options); } /// /// Get all reactions for a specified Issue Comment /// /// https://developer.github.com/v3/reactions/#list-reactions-for-an-issue-comment /// The Id of the repository /// The comment id [ManualRoute("GET", "/repositories/{0}/issues/comments/{number}/reactions")] public Task> GetAll(long repositoryId, int number) { return GetAll(repositoryId, number, ApiOptions.None); } /// /// Get all reactions for a specified Issue Comment /// /// https://developer.github.com/v3/reactions/#list-reactions-for-an-issue-comment /// The Id of the repository /// The comment id /// Options for changing the API response [Preview("squirrel-girl")] [ManualRoute("GET", "/repositories/{0}/issues/comments/{number}/reactions")] public Task> GetAll(long repositoryId, int number, ApiOptions options) { Ensure.ArgumentNotNull(options, nameof(options)); return ApiConnection.GetAll(ApiUrls.IssueCommentReactions(repositoryId, number), null, AcceptHeaders.ReactionsPreview, options); } } }