using System;
using System.Collections.Generic;
using System.Reactive;
using System.Reactive.Threading.Tasks;
namespace Octokit.Reactive
{
///
/// An interface for GitHub's Migrations API client.
///
///
/// See the docs
/// for more information.
///
public class ObservableMigrationsClient : IObservableMigrationsClient
{
private readonly IMigrationsClient _client;
///
/// Instantiates a GitHub Migrations API client.
///
/// An for making requests.
public ObservableMigrationsClient(IGitHubClient client)
{
Ensure.ArgumentNotNull(client, "client");
_client = client.Migration.Migrations;
}
///
/// Starts a new migration specified for the given organization.
///
///
/// https://developer.github.com/v3/migration/migrations/#start-a-migration
///
/// The organization for which to start a migration.
/// Sprcifies parameters for the migration in a
/// object.
/// The started migration.
public IObservable Start(string org, StartMigrationRequest migration)
{
return _client.Start(org, migration).ToObservable();
}
///
/// Gets the list of the most recent migrations of the the organization.
///
///
/// https://developer.github.com/v3/migration/migrations/#get-a-list-of-migrations
///
/// The organization of which to list migrations.
/// List of most recent s.
public IObservable> GetAll(string org)
{
return _client.GetAll(org).ToObservable();
}
///
/// Get the status of a migration
///
///
/// https://developer.github.com/v3/migration/migrations/#get-the-status-of-a-migration
///
/// The organization which is migrating.
/// Migrations ID of the organization.
/// A object representing the state of migration.
public IObservable Get(string org, int id)
{
return _client.Get(org, id).ToObservable();
}
///
/// Get the migration archive.
///
///
/// https://developer.github.com/v3/migration/migrations/#download-a-migration-archive
///
/// The organization of which the migration was.
/// The ID of the migration.
/// The binary contents of the archive as a byte array.
public IObservable GetArchive(string org, int id)
{
return _client.GetArchive(org, id).ToObservable();
}
///
/// Deletes a previous migration archive.
///
///
/// https://developer.github.com/v3/migration/migrations/#delete-a-migration-archive
///
/// The organization of which the migration was.
/// The ID of the migration.
///
public IObservable DeleteArchive(string org, int id)
{
return _client.DeleteArchive(org, id).ToObservable();
}
///
/// Unlocks a repository that was locked for migration.
///
///
/// https://developer.github.com/v3/migration/migrations/#unlock-a-repository
///
/// The organization of which the migration was.
/// The ID of the migration.
/// The repo to unlock.
///
public IObservable UnlockRepository(string org, int id, string repo)
{
return _client.UnlockRepository(org, id, repo).ToObservable();
}
}
}