From 1e36a4e3c30d792d059025f0ee5f3a53706ffcdc Mon Sep 17 00:00:00 2001 From: "aedampir@gmail.com" Date: Wed, 15 Jun 2016 18:03:10 +0700 Subject: [PATCH] added new overloads --- .../IObservableIssueReactionsClient.cs | 33 ++++++++++--- .../Clients/ObservableIssueReactionsClient.cs | 47 ++++++++++++++----- Octokit/Clients/IIssueReactionsClient.cs | 19 ++++++++ Octokit/Clients/IssueReactionsClient.cs | 47 +++++++++++++++---- 4 files changed, 118 insertions(+), 28 deletions(-) diff --git a/Octokit.Reactive/Clients/IObservableIssueReactionsClient.cs b/Octokit.Reactive/Clients/IObservableIssueReactionsClient.cs index e87af5f9..03aa0e90 100644 --- a/Octokit.Reactive/Clients/IObservableIssueReactionsClient.cs +++ b/Octokit.Reactive/Clients/IObservableIssueReactionsClient.cs @@ -10,6 +10,25 @@ namespace Octokit.Reactive /// public interface IObservableIssueReactionsClient { + /// + /// List reactions for a specified Issue. + /// + /// https://developer.github.com/v3/reactions/#list-reactions-for-an-issue + /// The owner of the repository + /// The name of the repository + /// The issue id + /// An representing s for a specified issue. + IObservable GetAll(string owner, string name, int number); + + /// + /// List reactions for a specified Issue. + /// + /// https://developer.github.com/v3/reactions/#list-reactions-for-an-issue + /// The ID of the repository + /// The issue id + /// An representing s for a specified issue. + IObservable GetAll(int repositoryId, int number); + /// /// Creates a reaction for a specified Issue. /// @@ -22,13 +41,13 @@ namespace Octokit.Reactive IObservable Create(string owner, string name, int number, NewReaction reaction); /// - /// List reactions for a specified Issue. + /// Creates a reaction for a specified Issue. /// - /// https://developer.github.com/v3/reactions/#list-reactions-for-an-issue - /// The owner of the repository - /// The name of the repository - /// The issue id - /// An representing s for a specified issue. - IObservable GetAll(string owner, string name, int number); + /// https://developer.github.com/v3/reactions/#create-reaction-for-an-issue + /// The ID of the repository + /// The issue id + /// The reaction to create + /// An representing created for a specified issue. + IObservable Create(int repositoryId, int number, NewReaction reaction); } } diff --git a/Octokit.Reactive/Clients/ObservableIssueReactionsClient.cs b/Octokit.Reactive/Clients/ObservableIssueReactionsClient.cs index f7026973..7249abdc 100644 --- a/Octokit.Reactive/Clients/ObservableIssueReactionsClient.cs +++ b/Octokit.Reactive/Clients/ObservableIssueReactionsClient.cs @@ -23,6 +23,34 @@ namespace Octokit.Reactive _connection = client.Connection; } + /// + /// List reactions for a specified Issue + /// + /// https://developer.github.com/v3/reactions/#list-reactions-for-an-issue + /// The owner of the repository + /// The name of the repository + /// The issue id + /// An representing s for a specified issue. + public IObservable GetAll(string owner, string name, int number) + { + Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); + Ensure.ArgumentNotNullOrEmptyString(name, "name"); + + return _connection.GetAndFlattenAllPages(ApiUrls.IssueReactions(owner, name, number), null, AcceptHeaders.ReactionsPreview); + } + + /// + /// List reactions for a specified Issue. + /// + /// https://developer.github.com/v3/reactions/#list-reactions-for-an-issue + /// The ID of the repository + /// The issue id + /// An representing s for a specified issue. + public IObservable GetAll(int repositoryId, int number) + { + return _connection.GetAndFlattenAllPages(ApiUrls.IssueReactions(repositoryId, number), null, AcceptHeaders.ReactionsPreview); + } + /// /// Creates a reaction for a specified Issue /// @@ -42,19 +70,16 @@ namespace Octokit.Reactive } /// - /// List reactions for a specified Issue + /// Creates a reaction for a specified Issue. /// - /// https://developer.github.com/v3/reactions/#list-reactions-for-an-issue - /// The owner of the repository - /// The name of the repository - /// The issue id - /// An representing s for a specified issue. - public IObservable GetAll(string owner, string name, int number) + /// https://developer.github.com/v3/reactions/#create-reaction-for-an-issue + /// The ID of the repository + /// The issue id + /// The reaction to create + /// An representing created for a specified issue. + public IObservable Create(int repositoryId, int number, NewReaction reaction) { - Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); - Ensure.ArgumentNotNullOrEmptyString(name, "name"); - - return _connection.GetAndFlattenAllPages(ApiUrls.IssueReactions(owner, name, number), null, AcceptHeaders.ReactionsPreview); + return _client.Create(repositoryId, number, reaction).ToObservable(); } } } diff --git a/Octokit/Clients/IIssueReactionsClient.cs b/Octokit/Clients/IIssueReactionsClient.cs index 5860daa0..9a5c501e 100644 --- a/Octokit/Clients/IIssueReactionsClient.cs +++ b/Octokit/Clients/IIssueReactionsClient.cs @@ -21,6 +21,15 @@ namespace Octokit /// A of representing s for a specified issue. Task> GetAll(string owner, string name, int number); + /// + /// Get all reactions for a specified Issue + /// + /// https://developer.github.com/v3/reactions/#list-reactions-for-an-issue + /// The ID of the repository + /// The issue id + /// A of representing s for a specified issue. + Task> GetAll(int repositoryId, int number); + /// /// Creates a reaction for a specified Issue /// @@ -31,5 +40,15 @@ namespace Octokit /// The reaction to create /// A representing created for a specified issue. Task Create(string owner, string name, int number, NewReaction reaction); + + /// + /// Creates a reaction for a specified Issue + /// + /// https://developer.github.com/v3/reactions/#create-reaction-for-an-issue + /// The ID of the repository + /// The issue id + /// The reaction to create + /// A representing created for a specified issue. + Task Create(int repositoryId, int number, NewReaction reaction); } } diff --git a/Octokit/Clients/IssueReactionsClient.cs b/Octokit/Clients/IssueReactionsClient.cs index dc57f21b..30874053 100644 --- a/Octokit/Clients/IssueReactionsClient.cs +++ b/Octokit/Clients/IssueReactionsClient.cs @@ -16,6 +16,34 @@ namespace Octokit { } + /// + /// Get all reactions for a specified Issue + /// + /// https://developer.github.com/v3/reactions/#list-reactions-for-an-issue + /// The owner of the repository + /// The name of the repository + /// The issue id + /// A of representing s for a specified issue. + public Task> GetAll(string owner, string name, int number) + { + Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); + Ensure.ArgumentNotNullOrEmptyString(name, "name"); + + return ApiConnection.GetAll(ApiUrls.IssueReactions(owner, name, number), AcceptHeaders.ReactionsPreview); + } + + /// + /// Get all reactions for a specified Issue + /// + /// https://developer.github.com/v3/reactions/#list-reactions-for-an-issue + /// The ID of the repository + /// The issue id + /// A of representing s for a specified issue. + public Task> GetAll(int repositoryId, int number) + { + return ApiConnection.GetAll(ApiUrls.IssueReactions(repositoryId, number), AcceptHeaders.ReactionsPreview); + } + /// /// Creates a reaction for a specified Issue /// @@ -35,19 +63,18 @@ namespace Octokit } /// - /// Get all reactions for a specified Issue + /// Creates a reaction for a specified Issue /// - /// https://developer.github.com/v3/reactions/#list-reactions-for-an-issue - /// The owner of the repository - /// The name of the repository - /// The issue id - /// A of representing s for a specified issue. - public Task> GetAll(string owner, string name, int number) + /// https://developer.github.com/v3/reactions/#create-reaction-for-an-issue + /// The ID of the repository + /// The issue id + /// The reaction to create + /// A representing created for a specified issue. + public Task Create(int repositoryId, int number, NewReaction reaction) { - Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); - Ensure.ArgumentNotNullOrEmptyString(name, "name"); + Ensure.ArgumentNotNull(reaction, "reaction"); - return ApiConnection.GetAll(ApiUrls.IssueReactions(owner, name, number), AcceptHeaders.ReactionsPreview); + return ApiConnection.Post(ApiUrls.IssueReactions(repositoryId, number), reaction, AcceptHeaders.ReactionsPreview); } } }