add delete method for reaction client

This commit is contained in:
maddin2016
2016-06-01 11:54:20 +02:00
parent 28f454a7bb
commit c4c374c532
5 changed files with 66 additions and 4 deletions
@@ -1,4 +1,7 @@
namespace Octokit.Reactive
using System;
using System.Reactive;
namespace Octokit.Reactive
{
public interface IObservableReactionsClient
{
@@ -33,5 +36,13 @@
/// Refer to the API documentation for more information: https://developer.github.com/v3/reactions/
/// </remarks>
IObservablePullRequestReviewCommentReactionsClient PullRequestReviewComment { get; }
/// <summary>
/// Delete a reaction.
/// </summary>
/// <remarks>https://developer.github.com/v3/reactions/#delete-a-reaction</remarks>
/// <param name="number">The reaction id</param>
/// <returns></returns>
IObservable<Unit> Delete(int number);
}
}
@@ -1,11 +1,19 @@
namespace Octokit.Reactive
using System;
using System.Reactive;
using System.Reactive.Threading.Tasks;
namespace Octokit.Reactive
{
public class ObservableReactionsClient : IObservableReactionsClient
{
readonly IReactionsClient _client;
public ObservableReactionsClient(IGitHubClient client)
{
Ensure.ArgumentNotNull(client, "client");
_client = client.Reaction;
CommitComment = new ObservableCommitCommentReactionsClient(client);
Issue = new ObservableIssueReactionsClient(client);
IssueComment = new ObservableIssueCommentReactionsClient(client);
@@ -43,5 +51,16 @@
/// Refer to the API documentation for more information: https://developer.github.com/v3/reactions/
/// </remarks>
public IObservablePullRequestReviewCommentReactionsClient PullRequestReviewComment { get; private set; }
/// <summary>
/// Delete a reaction.
/// </summary>
/// <remarks>https://developer.github.com/v3/reactions/#delete-a-reaction</remarks>
/// <param name="number">The reaction id</param>
/// <returns></returns>
public IObservable<Unit> Delete(int number)
{
return _client.Delete(number).ToObservable();
}
}
}
+11 -1
View File
@@ -1,4 +1,6 @@
namespace Octokit
using System.Threading.Tasks;
namespace Octokit
{
/// <summary>
/// A client for GitHub's Reactions Events API.
@@ -39,5 +41,13 @@
/// Refer to the API documentation for more information: https://developer.github.com/v3/reactions/
/// </remarks>
IPullRequestReviewCommentReactionsClient PullRequestReviewComment { get; }
/// <summary>
/// Delete a reaction.
/// </summary>
/// <remarks>https://developer.github.com/v3/reactions/#delete-a-reaction</remarks>
/// <param name="number">The reaction id</param>
/// <returns></returns>
Task Delete(int number);
}
}
+13 -1
View File
@@ -1,4 +1,5 @@
using System;
using System.Threading.Tasks;
namespace Octokit
{
@@ -47,6 +48,17 @@ namespace Octokit
/// <remarks>
/// Refer to the API documentation for more information: https://developer.github.com/v3/reactions/
/// </remarks>
public IPullRequestReviewCommentReactionsClient PullRequestReviewComment { get; private set; }
public IPullRequestReviewCommentReactionsClient PullRequestReviewComment { get; private set; }
/// <summary>
/// Delete a reaction.
/// </summary>
/// <remarks>https://developer.github.com/v3/reactions/#delete-a-reaction</remarks>
/// <param name="number">The reaction id</param>
/// <returns></returns>
public Task Delete(int number)
{
return ApiConnection.Delete(ApiUrls.Reactions(number));
}
}
}
+10
View File
@@ -2926,5 +2926,15 @@ namespace Octokit
{
return "repositories/{0}/subscribers".FormatUri(repositoryId);
}
/// <summary>
/// Returns the <see cref="Uri"/> for deleting a reaction.
/// </summary>
/// <param name="number">The reaction number</param>
/// <returns>The <see cref="Uri"/> that lists the watched repositories for the authenticated user.</returns>
public static Uri Reactions(int number)
{
return "reactions/{0}".FormatUri(number);
}
}
}