diff --git a/Octokit.Reactive/Clients/IObservableMigrationsClient.cs b/Octokit.Reactive/Clients/IObservableMigrationsClient.cs index 288069ab3c..5ca361d844 100644 --- a/Octokit.Reactive/Clients/IObservableMigrationsClient.cs +++ b/Octokit.Reactive/Clients/IObservableMigrationsClient.cs @@ -40,7 +40,7 @@ IObservable> GetAll( string org); /// - /// Get the status of a migration + /// Get the status of a migration. /// /// /// https://developer.github.com/v3/migration/migrations/#get-the-status-of-a-migration @@ -54,15 +54,15 @@ IObservable Get( int id); /// - /// Fetches the URL to a migration archive. + /// 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. - /// URL as a string of the download link of the archive. - IObservable GetArchive( + /// The binary contents of the archive as a byte array. + IObservable GetArchive( string org, int id); diff --git a/Octokit.Reactive/Clients/ObservableMigrationsClient.cs b/Octokit.Reactive/Clients/ObservableMigrationsClient.cs index c789bb2591..55b29c50ae 100644 --- a/Octokit.Reactive/Clients/ObservableMigrationsClient.cs +++ b/Octokit.Reactive/Clients/ObservableMigrationsClient.cs @@ -70,15 +70,15 @@ public IObservable Get(string org, int id) } /// - /// Fetches the URL to a migration archive. + /// 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. - /// URL as a string of the download link of the archive. - public IObservable GetArchive(string org, int id) + /// The binary contents of the archive as a byte array. + public IObservable GetArchive(string org, int id) { return _client.GetArchive(org, id).ToObservable(); } diff --git a/Octokit.Tests.Integration/Clients/MigrationsClientTests.cs b/Octokit.Tests.Integration/Clients/MigrationsClientTests.cs index 2b2322acc1..fc81f5a8a8 100644 --- a/Octokit.Tests.Integration/Clients/MigrationsClientTests.cs +++ b/Octokit.Tests.Integration/Clients/MigrationsClientTests.cs @@ -84,9 +84,9 @@ public async Task CanGetArchive() Thread.Sleep(2000); } - var url = await _gitHub.Migration.Migrations.GetArchive(_orgName, _migrationContext.Id); - - Assert.NotEmpty(url); + var contents = await _gitHub.Migration.Migrations.GetArchive(_orgName, _migrationContext.Id); + + Assert.NotEmpty(contents); } [IntegrationTest] diff --git a/Octokit.Tests/Clients/MigrationsClientTests.cs b/Octokit.Tests/Clients/MigrationsClientTests.cs index 6beadb4633..03b99f05eb 100644 --- a/Octokit.Tests/Clients/MigrationsClientTests.cs +++ b/Octokit.Tests/Clients/MigrationsClientTests.cs @@ -123,7 +123,7 @@ public void RequestsCorrectUrl() client.GetArchive("fake", 69); - connection.Received().Get( + connection.Connection.Received().Get( Arg.Is(u => u.ToString() == "orgs/fake/migrations/69/archive"), null, AcceptHeaders.MigrationsApiPreview); diff --git a/Octokit/Clients/IMigrationsClient.cs b/Octokit/Clients/IMigrationsClient.cs index 68925a970e..75a7f97487 100644 --- a/Octokit/Clients/IMigrationsClient.cs +++ b/Octokit/Clients/IMigrationsClient.cs @@ -53,15 +53,15 @@ Task Get( int id); /// - /// Fetches the URL to a migration archive. + /// 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. - /// URL as a string of the download link of the archive. - Task GetArchive( + /// The binary contents of the archive as a byte array. + Task GetArchive( string org, int id); diff --git a/Octokit/Clients/MigrationsClient.cs b/Octokit/Clients/MigrationsClient.cs index e73b2ab48c..a54f0c59fa 100644 --- a/Octokit/Clients/MigrationsClient.cs +++ b/Octokit/Clients/MigrationsClient.cs @@ -75,21 +75,22 @@ public async Task Get(string org, int id) } /// - /// Fetches the URL to a migration archive. + /// 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. - /// URL as a string of the download link of the archive. - public async Task GetArchive(string org, int id) + /// The binary contents of the archive as a byte array. + public async Task GetArchive(string org, int id) { Ensure.ArgumentNotNullOrEmptyString(org, "org"); var endpoint = ApiUrls.EnterpriseMigrationArchive(org, id); + var response = await Connection.Get(endpoint, null, AcceptHeaders.MigrationsApiPreview); - return await ApiConnection.Get(endpoint, null, AcceptHeaders.MigrationsApiPreview); + return response.Body; } ///