mirror of
https://github.com/zoriya/octokit.net.git
synced 2025-12-06 07:16:09 +00:00
Add pagination support to Migrations client (#1949)
* Add pagination to *MigrationsClient * Add unit tests for *MigrationsClient * Add integration tests for *MigrationsClient * Fix the broken tests
This commit is contained in:
committed by
Ryan Gribble
parent
153250fbcd
commit
33f75ed149
@@ -36,9 +36,22 @@ namespace Octokit.Reactive
|
||||
/// </remarks>
|
||||
/// <param name="org">The organization of which to list migrations.</param>
|
||||
/// <returns>List of most recent <see cref="Migration"/>s.</returns>
|
||||
IObservable<List<Migration>> GetAll(
|
||||
IObservable<Migration> GetAll(
|
||||
string org);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the list of the most recent migrations of the the organization.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// https://developer.github.com/v3/migration/migrations/#get-a-list-of-migrations
|
||||
/// </remarks>
|
||||
/// <param name="org">The organization of which to list migrations.</param>
|
||||
/// <param name="options">Options for changing the API response</param>
|
||||
/// <returns>List of most recent <see cref="Migration"/>s.</returns>
|
||||
IObservable<Migration> GetAll(
|
||||
string org,
|
||||
ApiOptions options);
|
||||
|
||||
/// <summary>
|
||||
/// Get the status of a migration.
|
||||
/// </summary>
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Reactive;
|
||||
using System.Reactive.Threading.Tasks;
|
||||
using Octokit.Reactive.Internal;
|
||||
|
||||
namespace Octokit.Reactive
|
||||
{
|
||||
@@ -15,6 +16,7 @@ namespace Octokit.Reactive
|
||||
public class ObservableMigrationsClient : IObservableMigrationsClient
|
||||
{
|
||||
private readonly IMigrationsClient _client;
|
||||
private readonly IConnection _connection;
|
||||
|
||||
/// <summary>
|
||||
/// Instantiates a GitHub Migrations API client.
|
||||
@@ -25,6 +27,7 @@ namespace Octokit.Reactive
|
||||
Ensure.ArgumentNotNull(client, nameof(client));
|
||||
|
||||
_client = client.Migration.Migrations;
|
||||
_connection = client.Connection;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -50,9 +53,16 @@ namespace Octokit.Reactive
|
||||
/// </remarks>
|
||||
/// <param name="org">The organization of which to list migrations.</param>
|
||||
/// <returns>List of most recent <see cref="Migration"/>s.</returns>
|
||||
public IObservable<List<Migration>> GetAll(string org)
|
||||
public IObservable<Migration> GetAll(string org)
|
||||
{
|
||||
return _client.GetAll(org).ToObservable();
|
||||
return GetAll(org, ApiOptions.None);
|
||||
}
|
||||
|
||||
public IObservable<Migration> GetAll(string org, ApiOptions options)
|
||||
{
|
||||
Ensure.ArgumentNotNull(options, nameof(options));
|
||||
|
||||
return _connection.GetAndFlattenAllPages<Migration>(ApiUrls.EnterpriseMigrations(org), null, AcceptHeaders.MigrationsApiPreview, options);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user