diff --git a/Octokit.Reactive/Clients/IObservableRepositoryContentsClient.cs b/Octokit.Reactive/Clients/IObservableRepositoryContentsClient.cs
index 4b56ed1b..ed132889 100644
--- a/Octokit.Reactive/Clients/IObservableRepositoryContentsClient.cs
+++ b/Octokit.Reactive/Clients/IObservableRepositoryContentsClient.cs
@@ -34,8 +34,17 @@ namespace Octokit.Reactive
/// The owner of the repository
/// The name of the repository
///
+ [Obsolete("Use GetArchive to download the archive instead")]
IObservable GetArchiveLink(string owner, string name);
+ ///
+ /// Get an archive of a given repository's contents
+ ///
+ /// https://developer.github.com/v3/repos/contents/#get-archive-link
+ /// The owner of the repository
+ /// The name of the repository
+ IObservable GetArchive(string owner, string name);
+
///
/// This method will return a 302 to a URL to download a tarball or zipball archive for a repository.
/// Please make sure your HTTP framework is configured to follow redirects or you will need to use the
@@ -47,8 +56,19 @@ namespace Octokit.Reactive
/// The name of the repository
/// The format of the archive. Can be either tarball or zipball
///
+ [Obsolete("Use GetArchive to download the archive instead")]
IObservable GetArchiveLink(string owner, string name, ArchiveFormat archiveFormat);
+ ///
+ /// Get an archive of a given repository's contents, in a specific format
+ ///
+ /// https://developer.github.com/v3/repos/contents/#get-archive-link
+ /// The owner of the repository
+ /// The name of the repository
+ /// The format of the archive. Can be either tarball or zipball
+ ///
+ IObservable GetArchive(string owner, string name, ArchiveFormat archiveFormat);
+
///
/// This method will return a 302 to a URL to download a tarball or zipball archive for a repository.
/// Please make sure your HTTP framework is configured to follow redirects or you will need to use the
@@ -61,8 +81,19 @@ namespace Octokit.Reactive
/// The format of the archive. Can be either tarball or zipball
/// A valid Git reference.
///
+ [Obsolete("Use GetArchive to download the archive instead")]
IObservable GetArchiveLink(string owner, string name, ArchiveFormat archiveFormat, string reference);
+ ///
+ /// Get an archive of a given repository's contents, using a specific format and reference
+ ///
+ /// https://developer.github.com/v3/repos/contents/#get-archive-link
+ /// The owner of the repository
+ /// The name of the repository
+ /// The format of the archive. Can be either tarball or zipball
+ /// A valid Git reference.
+ IObservable GetArchive(string owner, string name, ArchiveFormat archiveFormat, string reference);
+
///
/// Returns the contents of a file or directory in a repository.
///
diff --git a/Octokit.Reactive/Clients/ObservableRepositoryContentsClient.cs b/Octokit.Reactive/Clients/ObservableRepositoryContentsClient.cs
index ca2889e4..8c7dde33 100644
--- a/Octokit.Reactive/Clients/ObservableRepositoryContentsClient.cs
+++ b/Octokit.Reactive/Clients/ObservableRepositoryContentsClient.cs
@@ -59,11 +59,23 @@ namespace Octokit.Reactive
/// The owner of the repository
/// The name of the repository
///
+ [Obsolete("Use GetArchive to download the archive instead")]
public IObservable GetArchiveLink(string owner, string name)
{
return GetArchiveLink(owner, name, ArchiveFormat.Tarball, string.Empty);
}
+ ///
+ /// Get an archive of a given repository's contents
+ ///
+ /// https://developer.github.com/v3/repos/contents/#get-archive-link
+ /// The owner of the repository
+ /// The name of the repository
+ public IObservable GetArchive(string owner, string name)
+ {
+ return _client.Repository.Content.GetArchive(owner, name).ToObservable();
+ }
+
///
/// This method will return a 302 to a URL to download a tarball or zipball archive for a repository.
/// Please make sure your HTTP framework is configured to follow redirects or you will need to use the
@@ -75,11 +87,25 @@ namespace Octokit.Reactive
/// The name of the repository
/// The format of the archive. Can be either tarball or zipball
///
+ [Obsolete("Use GetArchive to download the archive instead")]
public IObservable GetArchiveLink(string owner, string name, ArchiveFormat archiveFormat)
{
return GetArchiveLink(owner, name, archiveFormat, String.Empty);
}
+ ///
+ /// Get an archive of a given repository's contents, in a specific format
+ ///
+ /// https://developer.github.com/v3/repos/contents/#get-archive-link
+ /// The owner of the repository
+ /// The name of the repository
+ /// The format of the archive. Can be either tarball or zipball
+ ///
+ public IObservable GetArchive(string owner, string name, ArchiveFormat archiveFormat)
+ {
+ return _client.Repository.Content.GetArchive(owner, name, archiveFormat).ToObservable();
+ }
+
///
/// This method will return a 302 to a URL to download a tarball or zipball archive for a repository.
/// Please make sure your HTTP framework is configured to follow redirects or you will need to use the
@@ -92,6 +118,7 @@ namespace Octokit.Reactive
/// The format of the archive. Can be either tarball or zipball
/// A valid Git reference.
///
+ [Obsolete("Use GetArchive to download the archive instead")]
public IObservable GetArchiveLink(string owner, string name, ArchiveFormat archiveFormat, string reference)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
@@ -100,6 +127,19 @@ namespace Octokit.Reactive
return _client.Repository.Content.GetArchiveLink(owner, name, archiveFormat, reference).ToObservable();
}
+ ///
+ /// Get an archive of a given repository's contents, using a specific format and reference
+ ///
+ /// https://developer.github.com/v3/repos/contents/#get-archive-link
+ /// The owner of the repository
+ /// The name of the repository
+ /// The format of the archive. Can be either tarball or zipball
+ /// A valid Git reference.
+ public IObservable GetArchive(string owner, string name, ArchiveFormat archiveFormat, string reference)
+ {
+ return _client.Repository.Content.GetArchive(owner, name, archiveFormat, reference).ToObservable();
+ }
+
///
/// Returns the contents of a file or directory in a repository.
///
diff --git a/Octokit.Tests.Integration/Clients/RepositoryContentsClientTests.cs b/Octokit.Tests.Integration/Clients/RepositoryContentsClientTests.cs
index 707c4c47..d2d0bf9d 100644
--- a/Octokit.Tests.Integration/Clients/RepositoryContentsClientTests.cs
+++ b/Octokit.Tests.Integration/Clients/RepositoryContentsClientTests.cs
@@ -115,43 +115,43 @@ namespace Octokit.Tests.Integration.Clients
}
}
- [IntegrationTest]
- public async Task GetsArchiveLinkAsTarball()
+ [IntegrationTest(Skip = "this will probably take too long")]
+ public async Task GetsArchiveAsTarball()
{
var github = Helper.GetAuthenticatedClient();
- var archiveLink = await github
+ var archive = await github
.Repository
.Content
- .GetArchiveLink("octokit", "octokit.net");
+ .GetArchive("octokit", "octokit.net");
- Assert.Equal("https://codeload.github.com/octokit/octokit.net/legacy.tar.gz/master", archiveLink);
+ Assert.NotEmpty(archive);
}
[IntegrationTest]
- public async Task GetsArchiveLinkAsZipball()
+ public async Task GetsArchiveAsZipball()
{
var github = Helper.GetAuthenticatedClient();
- var archiveLink = await github
+ var archive = await github
.Repository
.Content
- .GetArchiveLink("octokit", "octokit.net", ArchiveFormat.Zipball, "");
+ .GetArchive("octokit", "octokit.net", ArchiveFormat.Zipball, "");
- Assert.Equal("https://codeload.github.com/octokit/octokit.net/legacy.zip/master", archiveLink);
+ Assert.NotEmpty(archive);
}
[IntegrationTest]
- public async Task GetsArchiveLinkForReleaseBranchAsTarball()
+ public async Task GetsArchiveForReleaseBranchAsTarball()
{
var github = Helper.GetAuthenticatedClient();
- var archiveLink = await github
+ var archive = await github
.Repository
.Content
- .GetArchiveLink("alfhenrik", "ScriptCs.OctoKit", ArchiveFormat.Tarball, "dev");
+ .GetArchive("alfhenrik", "ScriptCs.OctoKit", ArchiveFormat.Tarball, "dev");
- Assert.Equal("https://codeload.github.com/alfhenrik/ScriptCs.OctoKit/legacy.tar.gz/dev", archiveLink);
+ Assert.NotEmpty(archive);
}
}
}
\ No newline at end of file
diff --git a/Octokit/Clients/IRepositoryContentsClient.cs b/Octokit/Clients/IRepositoryContentsClient.cs
index 45a217b0..fc2ba027 100644
--- a/Octokit/Clients/IRepositoryContentsClient.cs
+++ b/Octokit/Clients/IRepositoryContentsClient.cs
@@ -1,3 +1,4 @@
+using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Octokit.Internal;
@@ -57,8 +58,18 @@ namespace Octokit
/// The owner of the repository
/// The name of the repository
///
+ [Obsolete("Use GetArchive to download the archive instead")]
Task GetArchiveLink(string owner, string name);
+ ///
+ /// Get an archive of a given repository's contents
+ ///
+ /// https://developer.github.com/v3/repos/contents/#get-archive-link
+ /// The owner of the repository
+ /// The name of the repository
+ ///
+ Task GetArchive(string owner, string name);
+
///
/// This method will return a 302 to a URL to download a tarball or zipball archive for a repository.
/// Please make sure your HTTP framework is configured to follow redirects or you will need to use the
@@ -70,8 +81,19 @@ namespace Octokit
/// The name of the repository
/// The format of the archive. Can be either tarball or zipball
///
+ [Obsolete("Use GetArchive to download the archive instead")]
Task GetArchiveLink(string owner, string name, ArchiveFormat archiveFormat);
+ ///
+ /// Get an archive of a given repository's contents, in a specific format
+ ///
+ /// https://developer.github.com/v3/repos/contents/#get-archive-link
+ /// The owner of the repository
+ /// The name of the repository
+ /// The format of the archive. Can be either tarball or zipball
+ ///
+ Task GetArchive(string owner, string name, ArchiveFormat archiveFormat);
+
///
/// This method will return a 302 to a URL to download a tarball or zipball archive for a repository.
/// Please make sure your HTTP framework is configured to follow redirects or you will need to use the
@@ -84,8 +106,20 @@ namespace Octokit
/// The format of the archive. Can be either tarball or zipball
/// A valid Git reference.
///
+ [Obsolete("Use GetArchive to download the archive instead")]
Task GetArchiveLink(string owner, string name, ArchiveFormat archiveFormat, string reference);
+ ///
+ /// Get an archive of a given repository's contents, using a specific format and reference
+ ///
+ /// https://developer.github.com/v3/repos/contents/#get-archive-link
+ /// The owner of the repository
+ /// The name of the repository
+ /// The format of the archive. Can be either tarball or zipball
+ /// A valid Git reference.
+ ///
+ Task GetArchive(string owner, string name, ArchiveFormat archiveFormat, string reference);
+
///
/// Creates a commit that creates a new file in a repository.
///
diff --git a/Octokit/Clients/RepositoryContentsClient.cs b/Octokit/Clients/RepositoryContentsClient.cs
index 7b867f01..ae252ebb 100644
--- a/Octokit/Clients/RepositoryContentsClient.cs
+++ b/Octokit/Clients/RepositoryContentsClient.cs
@@ -89,6 +89,18 @@ namespace Octokit
return GetArchiveLink(owner, name, ArchiveFormat.Tarball, string.Empty);
}
+ ///
+ /// Get an archive of a given repository's contents
+ ///
+ /// https://developer.github.com/v3/repos/contents/#get-archive-link
+ /// The owner of the repository
+ /// The name of the repository
+ ///
+ public Task GetArchive(string owner, string name)
+ {
+ return GetArchive(owner, name, ArchiveFormat.Tarball, string.Empty);
+ }
+
///
/// This method will return a 302 to a URL to download a tarball or zipball archive for a repository.
/// Please make sure your HTTP framework is configured to follow redirects or you will need to use the
@@ -105,6 +117,19 @@ namespace Octokit
return GetArchiveLink(owner, name, archiveFormat, string.Empty);
}
+ ///
+ /// Get an archive of a given repository's contents, in a specific format
+ ///
+ /// https://developer.github.com/v3/repos/contents/#get-archive-link
+ /// The owner of the repository
+ /// The name of the repository
+ /// The format of the archive. Can be either tarball or zipball
+ ///
+ public Task GetArchive(string owner, string name, ArchiveFormat archiveFormat)
+ {
+ return GetArchive(owner, name, archiveFormat, string.Empty);
+ }
+
///
/// This method will return a 302 to a URL to download a tarball or zipball archive for a repository.
/// Please make sure your HTTP framework is configured to follow redirects or you will need to use the
@@ -125,6 +150,27 @@ namespace Octokit
return ApiConnection.GetRedirect(ApiUrls.RepositoryArchiveLink(owner, name, archiveFormat, reference));
}
+ ///
+ /// Get an archive of a given repository's contents, using a specific format and reference
+ ///
+ /// https://developer.github.com/v3/repos/contents/#get-archive-link
+ /// The owner of the repository
+ /// The name of the repository
+ /// The format of the archive. Can be either tarball or zipball
+ /// A valid Git reference.
+ ///
+ public async Task GetArchive(string owner, string name, ArchiveFormat archiveFormat, string reference)
+ {
+ Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
+ Ensure.ArgumentNotNullOrEmptyString(name, "name");
+
+ var endpoint = ApiUrls.RepositoryArchiveLink(owner, name, archiveFormat, reference);
+
+ var response = await Connection.Get(endpoint, new Dictionary(), null);
+
+ return response.Body;
+ }
+
///
/// Creates a commit that creates a new file in a repository.
///