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 /// [Preview("squirrel-girl")] [ManualRoute("POST", "/repos/{owner}/{repo}/comments/{comment_id}/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.CommitCommentReactions(owner, name, number), reaction, AcceptHeaders.ReactionsPreview); } /// /// 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 /// [Preview("squirrel-girl")] [ManualRoute("POST", "/repositories/{id}/comments/{comment_id}/reactions")] public Task Create(long repositoryId, int number, NewReaction reaction) { Ensure.ArgumentNotNull(reaction, nameof(reaction)); return ApiConnection.Post(ApiUrls.CommitCommentReactions(repositoryId, number), reaction, AcceptHeaders.ReactionsPreview); } /// /// 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, int number) { return GetAll(owner, name, number, 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 /// [Preview("squirrel-girl")] [ManualRoute("GET", "/repos/{owner}/{repo}/comments/{comment_id}/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.CommitCommentReactions(owner, name, number), null, AcceptHeaders.ReactionsPreview, 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, int number) { return GetAll(repositoryId, number, 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 /// [Preview("squirrel-girl")] [ManualRoute("GET", "/repositories/{id}/comments/{comment_id}/reactions")] public Task> GetAll(long repositoryId, int number, ApiOptions options) { Ensure.ArgumentNotNull(options, nameof(options)); return ApiConnection.GetAll(ApiUrls.CommitCommentReactions(repositoryId, number), null, AcceptHeaders.ReactionsPreview, options); } } }