diff --git a/Octokit.Reactive/Clients/IAssigneesClient.cs b/Octokit.Reactive/Clients/IObservableAssigneesClient.cs similarity index 69% rename from Octokit.Reactive/Clients/IAssigneesClient.cs rename to Octokit.Reactive/Clients/IObservableAssigneesClient.cs index 14108139..5a70e1bf 100644 --- a/Octokit.Reactive/Clients/IAssigneesClient.cs +++ b/Octokit.Reactive/Clients/IObservableAssigneesClient.cs @@ -1,8 +1,9 @@ -using System.Threading.Tasks; +using System; +using System.Collections.Generic; -namespace Octokit +namespace Octokit.Reactive { - public interface IAssigneesClient + public interface IObservableAssigneesClient { /// /// Gets all the available assignees (owner + collaborators) to which issues may be assigned. @@ -10,7 +11,7 @@ namespace Octokit /// The owner of the repository /// The name of the repository /// - Task> GetForRepository(string owner, string name); + IObservable> GetForRepository(string owner, string name); /// /// Checks to see if a user is an assignee for a repository. @@ -19,6 +20,6 @@ namespace Octokit /// The name of the repository /// Username of the prospective assignee /// - Task CheckAssignee(string owner, string name, string assignee); + IObservable CheckAssignee(string owner, string name, string assignee); } } diff --git a/Octokit.Reactive/Clients/ObservableAssigneesClient.cs b/Octokit.Reactive/Clients/ObservableAssigneesClient.cs new file mode 100644 index 00000000..ae8d13a3 --- /dev/null +++ b/Octokit.Reactive/Clients/ObservableAssigneesClient.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using System.Reactive.Threading.Tasks; + +namespace Octokit.Reactive +{ + public class ObservableAssigneesClient : IObservableAssigneesClient + { + readonly IAssigneesClient _client; + + public ObservableAssigneesClient(IGitHubClient client) + { + Ensure.ArgumentNotNull(client, "client"); + + _client = client.Issue.Assignee; + } + + /// + /// Gets all the available assignees (owner + collaborators) to which issues may be assigned. + /// + /// The owner of the repository + /// The name of the repository + /// + public IObservable> GetForRepository(string owner, string name) + { + Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); + Ensure.ArgumentNotNullOrEmptyString(name, "name"); + + return _client.GetForRepository(owner, name).ToObservable(); + } + + /// + /// Checks to see if a user is an assignee for a repository. + /// + /// The owner of the repository + /// The name of the repository + /// Username of the prospective assignee + /// + public IObservable CheckAssignee(string owner, string name, string assignee) + { + Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); + Ensure.ArgumentNotNullOrEmptyString(name, "name"); + Ensure.ArgumentNotNullOrEmptyString(assignee, "assignee"); + + return _client.CheckAssignee(owner, name, assignee).ToObservable(); + } + } +} diff --git a/Octokit.Reactive/Octokit.Reactive.csproj b/Octokit.Reactive/Octokit.Reactive.csproj index a318c61b..bfe5da0a 100644 --- a/Octokit.Reactive/Octokit.Reactive.csproj +++ b/Octokit.Reactive/Octokit.Reactive.csproj @@ -71,6 +71,7 @@ Properties\SolutionInfo.cs + @@ -81,7 +82,7 @@ - +