using System; using System.Reactive.Threading.Tasks; using Octokit.Reactive.Internal; namespace Octokit.Reactive { public class ObservableIssuesEventsClient : IObservableIssuesEventsClient { readonly IIssuesEventsClient _client; readonly IConnection _connection; public ObservableIssuesEventsClient(IGitHubClient client) { Ensure.ArgumentNotNull(client, "client"); _client = client.Issue.Events; _connection = client.Connection; } /// /// Gets all events for the issue. /// /// /// http://developer.github.com/v3/issues/events/#list-events-for-an-issue /// /// The owner of the repository /// The name of the repository /// The issue number /// public IObservable GetForIssue(string owner, string name, int number) { return _connection.GetAndFlattenAllPages(ApiUrls.IssuesEvents(owner, name, number)); } /// /// Gets all events for the repository. /// /// /// http://developer.github.com/v3/issues/events/#list-events-for-a-repository /// /// The owner of the repository /// The name of the repository /// public IObservable GetForRepository(string owner, string name) { return _connection.GetAndFlattenAllPages(ApiUrls.IssuesEvents(owner, name)); } /// /// Gets a single event /// /// /// http://developer.github.com/v3/issues/events/#get-a-single-event /// /// The owner of the repository /// The name of the repository /// The event id /// public IObservable Get(string owner, string name, int number) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(name, "name"); return _client.Get(owner, name, number).ToObservable(); } } }