diff --git a/Octokit.Reactive/Clients/IObservableEventsClient.cs b/Octokit.Reactive/Clients/IObservableEventsClient.cs
index 50f494908c..803a23fc21 100644
--- a/Octokit.Reactive/Clients/IObservableEventsClient.cs
+++ b/Octokit.Reactive/Clients/IObservableEventsClient.cs
@@ -47,6 +47,29 @@ public interface IObservableEventsClient
/// All the s for the particular repository.
IObservable GetAllForRepository(string owner, string name, ApiOptions options);
+ ///
+ /// Gets all the issue events for a given repository
+ ///
+ ///
+ /// http://developer.github.com/v3/activity/events/#list-issue-events-for-a-repository
+ ///
+ /// The owner of the repository
+ /// The name of the repository
+ /// All the s for the particular repository.
+ IObservable GetAllIssuesForRepository(string owner, string name);
+
+ ///
+ /// Gets all the issue events for a given repository
+ ///
+ ///
+ /// http://developer.github.com/v3/activity/events/#list-issue-events-for-a-repository
+ ///
+ /// The owner of the repository
+ /// The name of the repository
+ /// Options for changing the API response
+ /// All the s for the particular repository.
+ IObservable GetAllIssuesForRepository(string owner, string name, ApiOptions options);
+
///
/// Gets all the events for a given repository network
///
diff --git a/Octokit.Reactive/Clients/ObservableEventsClient.cs b/Octokit.Reactive/Clients/ObservableEventsClient.cs
index 18de33fdac..40eba047ff 100644
--- a/Octokit.Reactive/Clients/ObservableEventsClient.cs
+++ b/Octokit.Reactive/Clients/ObservableEventsClient.cs
@@ -74,6 +74,42 @@ public IObservable GetAllForRepository(string owner, string name, ApiO
Ensure.ArgumentNotNullOrEmptyString(name, "name");
Ensure.ArgumentNotNull(options, "options");
+ return _connection.GetAndFlattenAllPages(ApiUrls.Events(owner, name), options);
+ }
+
+ ///
+ /// Gets all the events for a given repository
+ ///
+ ///
+ /// http://developer.github.com/v3/activity/events/#list-issue-events-for-a-repository
+ ///
+ /// The owner of the repository
+ /// The name of the repository
+ /// All the s for the particular repository.
+ public IObservable GetAllIssuesForRepository(string owner, string name)
+ {
+ Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
+ Ensure.ArgumentNotNullOrEmptyString(name, "name");
+
+ return GetAllIssuesForRepository(owner, name, ApiOptions.None);
+ }
+
+ ///
+ /// Gets all the events for a given repository
+ ///
+ ///
+ /// http://developer.github.com/v3/activity/events/#list-issue-events-for-a-repository
+ ///
+ /// The owner of the repository
+ /// The name of the repository
+ /// Options for changing the API response
+ /// All the s for the particular repository.
+ public IObservable GetAllIssuesForRepository(string owner, string name, ApiOptions options)
+ {
+ Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
+ Ensure.ArgumentNotNullOrEmptyString(name, "name");
+ Ensure.ArgumentNotNull(options, "options");
+
return _connection.GetAndFlattenAllPages(ApiUrls.IssuesEvents(owner, name), options);
}
diff --git a/Octokit.Tests.Integration/Reactive/ObservableEventsClientTests.cs b/Octokit.Tests.Integration/Reactive/ObservableEventsClientTests.cs
index 3308120cb2..65f28ad30a 100644
--- a/Octokit.Tests.Integration/Reactive/ObservableEventsClientTests.cs
+++ b/Octokit.Tests.Integration/Reactive/ObservableEventsClientTests.cs
@@ -159,6 +159,82 @@ public async Task ReturnsDistinctRepositoryEventsBasedOnStartPage()
}
+ public class TheGetAllIssuesForRepositoryMethod
+ {
+ readonly ObservableEventsClient _eventsClient;
+ const string owner = "octokit";
+ const string name = "octokit.net";
+
+ public TheGetAllIssuesForRepositoryMethod()
+ {
+ _eventsClient = new ObservableEventsClient(Helper.GetAuthenticatedClient());
+ }
+ [IntegrationTest]
+ public async Task ReturnsRepositoryEvents()
+ {
+ var repositoryEvents = await _eventsClient.GetAllIssuesForRepository(owner, name).ToList();
+
+ Assert.NotEmpty(repositoryEvents);
+ }
+
+ [IntegrationTest]
+ public async Task ReturnsCorrectCountOfRepositoryEventsWithoutStart()
+ {
+ var options = new ApiOptions
+ {
+ PageSize = 5,
+ PageCount = 1
+ };
+
+ var repositoryEvents = await _eventsClient.GetAllIssuesForRepository(owner, name, options).ToList();
+
+ Assert.Equal(5, repositoryEvents.Count);
+ }
+
+ [IntegrationTest]
+ public async Task ReturnsCorrectCountOfRepositoryEventsWithStart()
+ {
+ var options = new ApiOptions
+ {
+ PageSize = 5,
+ PageCount = 1,
+ StartPage = 2
+ };
+
+ var repositoryEvents = await _eventsClient.GetAllIssuesForRepository(owner, name, options).ToList();
+
+ Assert.Equal(5, repositoryEvents.Count);
+ }
+
+ [IntegrationTest]
+ public async Task ReturnsDistinctRepositoryEventsBasedOnStartPage()
+ {
+ var startOptions = new ApiOptions
+ {
+ PageSize = 5,
+ PageCount = 1
+ };
+
+ var firstRepositoryEventsPage = await _eventsClient.GetAllIssuesForRepository(owner, name, startOptions).ToList();
+
+ var skipStartOptions = new ApiOptions
+ {
+ PageSize = 5,
+ PageCount = 1,
+ StartPage = 2
+ };
+
+ var secondRepositoryEventsPage = await _eventsClient.GetAllIssuesForRepository(owner, name, skipStartOptions).ToList();
+
+ Assert.NotEqual(firstRepositoryEventsPage[0].Id, secondRepositoryEventsPage[0].Id);
+ Assert.NotEqual(firstRepositoryEventsPage[1].Id, secondRepositoryEventsPage[1].Id);
+ Assert.NotEqual(firstRepositoryEventsPage[2].Id, secondRepositoryEventsPage[2].Id);
+ Assert.NotEqual(firstRepositoryEventsPage[3].Id, secondRepositoryEventsPage[3].Id);
+ Assert.NotEqual(firstRepositoryEventsPage[4].Id, secondRepositoryEventsPage[4].Id);
+ }
+
+ }
+
public class TheGetAllForRepositoryNetworkMethod
{
readonly ObservableEventsClient _eventsClient;
diff --git a/Octokit.Tests/Clients/EventsClientTests.cs b/Octokit.Tests/Clients/EventsClientTests.cs
index 124533e98a..d6171804df 100644
--- a/Octokit.Tests/Clients/EventsClientTests.cs
+++ b/Octokit.Tests/Clients/EventsClientTests.cs
@@ -72,7 +72,7 @@ public void RequestsCorrectUrl()
client.GetAllForRepository("fake", "repo");
- connection.Received().GetAll(Arg.Is(u => u.ToString() == "repos/fake/repo/issues/events"), Args.ApiOptions);
+ connection.Received().GetAll(Arg.Is(u => u.ToString() == "repos/fake/repo/events"), Args.ApiOptions);
}
[Fact]
public void RequestsCorrectUrlWithApiOptions()
@@ -90,7 +90,7 @@ public void RequestsCorrectUrlWithApiOptions()
client.GetAllForRepository("fake", "repo", options);
- connection.Received().GetAll(Arg.Is(u => u.ToString() == "repos/fake/repo/issues/events"), options);
+ connection.Received().GetAll(Arg.Is(u => u.ToString() == "repos/fake/repo/events"), options);
}
[Fact]
@@ -109,6 +109,53 @@ public async Task EnsuresArgumentsNotNull()
}
}
+ public class TheGetAllIssuesForRepositoryMethod
+ {
+ [Fact]
+ public void RequestsCorrectUrl()
+ {
+ var connection = Substitute.For();
+ var client = new EventsClient(connection);
+
+ client.GetAllIssuesForRepository("fake", "repo");
+
+ connection.Received().GetAll(Arg.Is(u => u.ToString() == "repos/fake/repo/issues/events"), Args.ApiOptions);
+ }
+ [Fact]
+ public void RequestsCorrectUrlWithApiOptions()
+ {
+ var connection = Substitute.For();
+ var client = new EventsClient(connection);
+
+ var options = new ApiOptions
+ {
+ PageSize = 1,
+ PageCount = 1,
+ StartPage = 1
+ };
+
+
+ client.GetAllIssuesForRepository("fake", "repo", options);
+
+ connection.Received().GetAll(Arg.Is(u => u.ToString() == "repos/fake/repo/issues/events"), options);
+ }
+
+ [Fact]
+ public async Task EnsuresArgumentsNotNull()
+ {
+ var connection = Substitute.For();
+ var client = new EventsClient(connection);
+
+ await Assert.ThrowsAsync(() => client.GetAllIssuesForRepository(null, "name"));
+ await Assert.ThrowsAsync(() => client.GetAllIssuesForRepository("", "name"));
+ await Assert.ThrowsAsync(() => client.GetAllIssuesForRepository("owner", null));
+ await Assert.ThrowsAsync(() => client.GetAllIssuesForRepository("owner", ""));
+ await Assert.ThrowsAsync(() => client.GetAllIssuesForRepository("owner", "name", null));
+ await Assert.ThrowsAsync(() => client.GetAllIssuesForRepository("owner", "", ApiOptions.None));
+ await Assert.ThrowsAsync(() => client.GetAllIssuesForRepository("", "name", ApiOptions.None));
+ }
+ }
+
public class TheGetAllForRepositoryNetworkMethod
{
[Fact]
diff --git a/Octokit.Tests/Reactive/ObservableEventsClientTests.cs b/Octokit.Tests/Reactive/ObservableEventsClientTests.cs
index 78c721d772..bccf493cad 100644
--- a/Octokit.Tests/Reactive/ObservableEventsClientTests.cs
+++ b/Octokit.Tests/Reactive/ObservableEventsClientTests.cs
@@ -44,7 +44,7 @@ public void RequestsCorrectUrl()
client.GetAllForRepository("fake", "repo");
- gitHubClient.Connection.Received(1).Get>(new Uri("repos/fake/repo/issues/events", UriKind.Relative), Args.EmptyDictionary, null);
+ gitHubClient.Connection.Received(1).Get>(new Uri("repos/fake/repo/events", UriKind.Relative), Args.EmptyDictionary, null);
}
[Fact]
@@ -60,6 +60,32 @@ public async Task EnsuresArgumentsNotNull()
}
}
+ public class TheGetAllIssuesForRepositoryMethod
+ {
+ [Fact]
+ public void RequestsCorrectUrl()
+ {
+ var gitHubClient = Substitute.For();
+ var client = new ObservableEventsClient(gitHubClient);
+
+ client.GetAllIssuesForRepository("fake", "repo");
+
+ gitHubClient.Connection.Received(1).Get>(new Uri("repos/fake/repo/issues/events", UriKind.Relative), Args.EmptyDictionary, null);
+ }
+
+ [Fact]
+ public async Task EnsuresArgumentsNotNull()
+ {
+ var gitHubClient = Substitute.For();
+ var client = new ObservableEventsClient(gitHubClient);
+
+ await Assert.ThrowsAsync(() => client.GetAllIssuesForRepository(null, "name").ToTask());
+ await Assert.ThrowsAsync(() => client.GetAllIssuesForRepository("", "name").ToTask());
+ await Assert.ThrowsAsync(() => client.GetAllIssuesForRepository("owner", null).ToTask());
+ await Assert.ThrowsAsync(() => client.GetAllIssuesForRepository("owner", "").ToTask());
+ }
+ }
+
public class TheGetAllForRepositoryNetworkMethod
{
[Fact]
diff --git a/Octokit/Clients/EventsClient.cs b/Octokit/Clients/EventsClient.cs
index a1586ca26b..aecf303be9 100644
--- a/Octokit/Clients/EventsClient.cs
+++ b/Octokit/Clients/EventsClient.cs
@@ -51,7 +51,7 @@ public Task> GetAll(ApiOptions options)
/// Gets all the events for a given repository
///
///
- /// http://developer.github.com/v3/activity/events/#list-issue-events-for-a-repository
+ /// https://developer.github.com/v3/activity/events/#list-repository-events
///
/// The owner of the repository
/// The name of the repository
@@ -68,7 +68,7 @@ public Task> GetAllForRepository(string owner, string na
/// Gets all the events for a given repository
///
///
- /// http://developer.github.com/v3/activity/events/#list-issue-events-for-a-repository
+ /// https://developer.github.com/v3/activity/events/#list-repository-events
///
/// The owner of the repository
/// The name of the repository
@@ -80,7 +80,44 @@ public Task> GetAllForRepository(string owner, string na
Ensure.ArgumentNotNullOrEmptyString(name, "name");
Ensure.ArgumentNotNull(options, "options");
- return ApiConnection.GetAll(ApiUrls.IssuesEvents(owner, name),options);
+ return ApiConnection.GetAll(ApiUrls.Events(owner, name), options);
+ }
+
+
+ ///
+ /// Gets all the event issues for a given repository
+ ///
+ ///
+ /// http://developer.github.com/v3/activity/events/#list-issue-events-for-a-repository
+ ///
+ /// The owner of the repository
+ /// The name of the repository
+ /// All the s for the particular repository.
+ public Task> GetAllIssuesForRepository(string owner, string name)
+ {
+ Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
+ Ensure.ArgumentNotNullOrEmptyString(name, "name");
+
+ return GetAllIssuesForRepository(owner, name, ApiOptions.None);
+ }
+
+ ///
+ /// Gets all the event issues for a given repository
+ ///
+ ///
+ /// http://developer.github.com/v3/activity/events/#list-issue-events-for-a-repository
+ ///
+ /// The owner of the repository
+ /// The name of the repository
+ /// Options for changing the API response
+ /// All the s for the particular repository.
+ public Task> GetAllIssuesForRepository(string owner, string name, ApiOptions options)
+ {
+ Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
+ Ensure.ArgumentNotNullOrEmptyString(name, "name");
+ Ensure.ArgumentNotNull(options, "options");
+
+ return ApiConnection.GetAll(ApiUrls.IssuesEvents(owner, name), options);
}
///
diff --git a/Octokit/Clients/IEventsClient.cs b/Octokit/Clients/IEventsClient.cs
index 06cb5ef686..cd49224525 100644
--- a/Octokit/Clients/IEventsClient.cs
+++ b/Octokit/Clients/IEventsClient.cs
@@ -54,7 +54,28 @@ public interface IEventsClient
/// All the s for the particular repository.
Task> GetAllForRepository(string owner, string name, ApiOptions options);
+ ///
+ /// Gets all the issue events for a given repository
+ ///
+ ///
+ /// http://developer.github.com/v3/activity/events/#list-issue-events-for-a-repository
+ ///
+ /// The owner of the repository
+ /// The name of the repository
+ /// All the s for the particular repository.
+ Task> GetAllIssuesForRepository(string owner, string name);
+ ///
+ /// Gets all the issue events for a given repository
+ ///
+ ///
+ /// http://developer.github.com/v3/activity/events/#list-issue-events-for-a-repository
+ ///
+ /// The owner of the repository
+ /// The name of the repository
+ /// Options for changing the API response
+ /// All the s for the particular repository.
+ Task> GetAllIssuesForRepository(string owner, string name, ApiOptions options);
///
/// Gets all the events for a given repository network
diff --git a/Octokit/Helpers/ApiUrls.cs b/Octokit/Helpers/ApiUrls.cs
index 9ee3213cda..4088152793 100644
--- a/Octokit/Helpers/ApiUrls.cs
+++ b/Octokit/Helpers/ApiUrls.cs
@@ -494,6 +494,17 @@ public static Uri OrganizationMembership(string org, string name)
return "orgs/{0}/public_members/{1}".FormatUri(org, name);
}
+ ///
+ /// Returns the that returns the issue/pull request event and issue info for the specified repository.
+ ///
+ /// The owner of the repository
+ /// The name of the repository
+ ///
+ public static Uri Events(string owner, string name)
+ {
+ return "repos/{0}/{1}/events".FormatUri(owner, name);
+ }
+
///
/// Returns the that returns the issue/pull request event info for the specified issue.
///