diff --git a/Octokit.Reactive/Clients/IObservableRepositoryPagesClient.cs b/Octokit.Reactive/Clients/IObservableRepositoryPagesClient.cs
index d62daa70..8033fc6c 100644
--- a/Octokit.Reactive/Clients/IObservableRepositoryPagesClient.cs
+++ b/Octokit.Reactive/Clients/IObservableRepositoryPagesClient.cs
@@ -16,6 +16,7 @@ namespace Octokit.Reactive
///
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get")]
IObservable Get(string owner, string repositoryName);
+
///
/// Gets all build metadata for a given repository
///
@@ -26,6 +27,18 @@ namespace Octokit.Reactive
///
///
IObservable GetAll(string owner, string repositoryName);
+
+ ///
+ /// Gets all build metadata for a given repository
+ ///
+ /// The owner of the repository
+ /// The name of the repository
+ /// Options to change the response of the API
+ ///
+ /// See the API documentation for more information.
+ ///
+ ///
+ IObservable GetAll(string owner, string repositoryName, ApiOptions options);
///
/// Gets the build metadata for the last build for a given repository
///
diff --git a/Octokit.Reactive/Clients/ObservableRepositoryPagesClient.cs b/Octokit.Reactive/Clients/ObservableRepositoryPagesClient.cs
index ebcd3af7..a6093885 100644
--- a/Octokit.Reactive/Clients/ObservableRepositoryPagesClient.cs
+++ b/Octokit.Reactive/Clients/ObservableRepositoryPagesClient.cs
@@ -53,6 +53,25 @@ namespace Octokit.Reactive
return _connection.GetAndFlattenAllPages(ApiUrls.RepositoryPageBuilds(owner, repositoryName));
}
+ ///
+ /// Gets all build metadata for a given repository
+ ///
+ /// The owner of the repository
+ /// The name of the repository
+ /// Options to change the behaviour of the API
+ ///
+ /// See the API documentation for more information.
+ ///
+ ///
+ public IObservable GetAll(string owner, string repositoryName, ApiOptions options)
+ {
+ Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
+ Ensure.ArgumentNotNullOrEmptyString(repositoryName, "repositoryName");
+ Ensure.ArgumentNotNull(options, "options");
+
+ return _connection.GetAndFlattenAllPages(ApiUrls.RepositoryPageBuilds(owner, repositoryName), options);
+ }
+
///
/// Gets the build metadata for the last build for a given repository
///
diff --git a/Octokit.Tests.Integration/Octokit.Tests.Integration.csproj b/Octokit.Tests.Integration/Octokit.Tests.Integration.csproj
index 0a5c12a3..26098482 100644
--- a/Octokit.Tests.Integration/Octokit.Tests.Integration.csproj
+++ b/Octokit.Tests.Integration/Octokit.Tests.Integration.csproj
@@ -147,6 +147,7 @@
+
diff --git a/Octokit.Tests.Integration/Reactive/ObservableRepositoryPagesClientTests.cs b/Octokit.Tests.Integration/Reactive/ObservableRepositoryPagesClientTests.cs
new file mode 100644
index 00000000..34677032
--- /dev/null
+++ b/Octokit.Tests.Integration/Reactive/ObservableRepositoryPagesClientTests.cs
@@ -0,0 +1,86 @@
+using System.Reactive.Linq;
+using System.Threading.Tasks;
+using Octokit.Reactive;
+using Xunit;
+
+namespace Octokit.Tests.Integration.Reactive
+{
+ public class ObservableRepositoryPagesClientTests
+ {
+ public class TheGetAllMethod
+ {
+ readonly ObservableRepositoryPagesClient _repositoryPagesClient;
+ const string owner = "octokit";
+ const string name = "octokit.net";
+
+ public TheGetAllMethod()
+ {
+ var github = Helper.GetAuthenticatedClient();
+
+ _repositoryPagesClient = new ObservableRepositoryPagesClient(github);
+ }
+
+ [IntegrationTest]
+ public async Task ReturnsRepositoryPages()
+ {
+ var pages = await _repositoryPagesClient.GetAll(owner, name).ToList();
+
+ Assert.NotEmpty(pages);
+ }
+
+ [IntegrationTest]
+ public async Task ReturnsCorrectCountOfPagesWithoutStart()
+ {
+ var options = new ApiOptions
+ {
+ PageSize = 5,
+ PageCount = 1
+ };
+
+ var pages = await _repositoryPagesClient.GetAll(owner, name, options).ToList();
+ Assert.Equal(5, pages.Count);
+ }
+
+ [IntegrationTest]
+ public async Task ReturnCorrectCountOfPagesWithStart()
+ {
+ var options = new ApiOptions
+ {
+ PageSize = 5,
+ PageCount = 1,
+ StartPage = 2
+ };
+
+ var pages = await _repositoryPagesClient.GetAll(owner, name, options).ToList();
+ Assert.Equal(5, pages.Count);
+ }
+
+ [IntegrationTest]
+ public async Task ReturnsDistinctResultsBasedOnStartPage()
+ {
+ var startOptions = new ApiOptions
+ {
+ PageSize = 5,
+ PageCount = 1
+ };
+
+ var firstPage = await _repositoryPagesClient.GetAll(owner, name, startOptions).ToList();
+
+ var skipStartOptions = new ApiOptions
+ {
+ PageSize = 5,
+ PageCount = 1,
+ StartPage = 2
+ };
+
+ var secondPage = await _repositoryPagesClient.GetAll(owner, name, skipStartOptions).ToList();
+
+ Assert.NotEqual(firstPage[0].Url, secondPage[0].Url);
+ Assert.NotEqual(firstPage[1].Url, secondPage[1].Url);
+ Assert.NotEqual(firstPage[2].Url, secondPage[2].Url);
+ Assert.NotEqual(firstPage[3].Url, secondPage[3].Url);
+ Assert.NotEqual(firstPage[4].Url, secondPage[4].Url);
+ }
+ }
+ }
+}
diff --git a/Octokit.Tests/Clients/RepositoryPagesClientTests.cs b/Octokit.Tests/Clients/RepositoryPagesClientTests.cs
index dbafeb1a..54c56ede 100644
--- a/Octokit.Tests/Clients/RepositoryPagesClientTests.cs
+++ b/Octokit.Tests/Clients/RepositoryPagesClientTests.cs
@@ -31,7 +31,7 @@ namespace Octokit.Tests.Clients
}
}
- public class TheGetBuildsMethod
+ public class TheGetAllBuildsMethod
{
[Fact]
public void RequestsCorrectUrl()
@@ -41,7 +41,7 @@ namespace Octokit.Tests.Clients
client.GetAll("fake", "repo");
- connection.Received().GetAll(Arg.Is(u => u.ToString() == "repos/fake/repo/pages/builds"));
+ connection.Received().GetAll(Arg.Is(u => u.ToString() == "repos/fake/repo/pages/builds"), null, AcceptHeaders.StableVersion, Args.ApiOptions);
}
[Fact]
@@ -50,8 +50,9 @@ namespace Octokit.Tests.Clients
var connection = Substitute.For();
var client = new RepositoryPagesClient(connection);
- await Assert.ThrowsAsync(() => client.Get(null, "name"));
- await Assert.ThrowsAsync(() => client.Get("owner", null));
+ await Assert.ThrowsAsync(() => client.GetAll(null, "name", new ApiOptions()));
+ await Assert.ThrowsAsync(() => client.GetAll("owner", null, new ApiOptions()));
+ await Assert.ThrowsAsync(() => client.GetAll("owner", "name", null));
}
}
diff --git a/Octokit/Clients/IRepositoryPagesClient.cs b/Octokit/Clients/IRepositoryPagesClient.cs
index 579b2633..2458466f 100644
--- a/Octokit/Clients/IRepositoryPagesClient.cs
+++ b/Octokit/Clients/IRepositoryPagesClient.cs
@@ -23,6 +23,7 @@ namespace Octokit
///
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get")]
Task Get(string owner, string repositoryName);
+
///
/// Gets all build metadata for a given repository
///
@@ -33,6 +34,19 @@ namespace Octokit
///
///
Task> GetAll(string owner, string repositoryName);
+
+ ///
+ /// Gets all build metadata for a given repository
+ ///
+ /// The owner of the repository
+ /// The name of the repository
+ /// Options for changing the behaviour of the API
+ ///
+ /// See the API documentation for more information.
+ ///
+ ///
+ Task> GetAll(string owner, string repositoryName, ApiOptions options);
+
///
/// Gets the build metadata for the last build for a given repository
///
diff --git a/Octokit/Clients/RepositoryPagesClient.cs b/Octokit/Clients/RepositoryPagesClient.cs
index 04ed5c2a..8800ec2a 100644
--- a/Octokit/Clients/RepositoryPagesClient.cs
+++ b/Octokit/Clients/RepositoryPagesClient.cs
@@ -50,9 +50,28 @@ namespace Octokit
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
Ensure.ArgumentNotNullOrEmptyString(repositoryName, "repositoryName");
- return ApiConnection.GetAll(ApiUrls.RepositoryPageBuilds(owner, repositoryName));
+ return GetAll(owner, repositoryName, ApiOptions.None);
}
+ ///
+ /// Gets all build metadata for a given repository
+ ///
+ /// The owner of the repository
+ /// The name of the repository
+ /// Options to change the API response
+ ///
+ /// See the API documentation for more information.
+ ///
+ ///
+ public Task> GetAll(string owner, string repositoryName, ApiOptions options)
+ {
+ Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
+ Ensure.ArgumentNotNullOrEmptyString(repositoryName, "repositoryName");
+ Ensure.ArgumentNotNull(options, "options");
+
+ var endpoint = ApiUrls.RepositoryPageBuilds(owner, repositoryName);
+ return ApiConnection.GetAll(endpoint, null, AcceptHeaders.StableVersion, options);
+ }
///
/// Gets the build metadata for the last build for a given repository
///