From 3acdd10be4800f376f5f008fd202b3a776409695 Mon Sep 17 00:00:00 2001 From: Brendan Forster Date: Sun, 31 May 2015 22:44:41 +0930 Subject: [PATCH 1/5] deprecate the optional AllowAutoRedirect parameter --- Octokit.Tests/Http/RedirectHandlerTests.cs | 13 ------------- Octokit/Http/Connection.cs | 8 +++----- Octokit/Http/HttpClientAdapter.cs | 6 ------ Octokit/Http/IRequest.cs | 1 + Octokit/Http/Request.cs | 3 ++- 5 files changed, 6 insertions(+), 25 deletions(-) diff --git a/Octokit.Tests/Http/RedirectHandlerTests.cs b/Octokit.Tests/Http/RedirectHandlerTests.cs index beb55b87..5ba2face 100644 --- a/Octokit.Tests/Http/RedirectHandlerTests.cs +++ b/Octokit.Tests/Http/RedirectHandlerTests.cs @@ -102,18 +102,6 @@ namespace Octokit.Tests.Http Assert.Null(response.RequestMessage.Headers.Authorization); } - - [Fact] - public async Task DisabledRedirectShouldPassThrough() - { - var invoker = CreateInvoker(new HttpResponseMessage(HttpStatusCode.Found)); - var httpRequestMessage = CreateRequest(HttpMethod.Get); - httpRequestMessage.Properties[RedirectHandler.AllowAutoRedirectKey] = false; - var response = await invoker.SendAsync(httpRequestMessage, new CancellationToken()); - - Assert.Equal(response.StatusCode, HttpStatusCode.Redirect); - Assert.Same(response.RequestMessage, httpRequestMessage); - } [Theory] [InlineData(HttpStatusCode.MovedPermanently)] // 301 @@ -179,7 +167,6 @@ namespace Octokit.Tests.Http { var httpRequestMessage = new HttpRequestMessage(); httpRequestMessage.RequestUri = new Uri("http://example.org/foo"); - httpRequestMessage.Properties[RedirectHandler.AllowAutoRedirectKey] = true; httpRequestMessage.Method = method; return httpRequestMessage; } diff --git a/Octokit/Http/Connection.cs b/Octokit/Http/Connection.cs index c8597dad..0488d71d 100644 --- a/Octokit/Http/Connection.cs +++ b/Octokit/Http/Connection.cs @@ -153,12 +153,12 @@ namespace Octokit /// Specifies accepted response media types. /// To follow redirect links automatically or not /// representing the received HTTP response - + [Obsolete("allowAutoRedirect is no longer respected and will be deprecated in a future release")] public Task> Get(Uri uri, IDictionary parameters, string accepts, bool allowAutoRedirect) { Ensure.ArgumentNotNull(uri, "uri"); - return SendData(uri.ApplyParameters(parameters), HttpMethod.Get, null, accepts, null, CancellationToken.None, allowAutoRedirect: allowAutoRedirect); + return SendData(uri.ApplyParameters(parameters), HttpMethod.Get, null, accepts, null, CancellationToken.None); } public Task> Get(Uri uri, IDictionary parameters, string accepts, CancellationToken cancellationToken) @@ -321,8 +321,7 @@ namespace Octokit string contentType, CancellationToken cancellationToken, string twoFactorAuthenticationCode = null, - Uri baseAddress = null, - bool allowAutoRedirect = true) + Uri baseAddress = null) { Ensure.ArgumentNotNull(uri, "uri"); @@ -331,7 +330,6 @@ namespace Octokit Method = method, BaseAddress = baseAddress ?? BaseAddress, Endpoint = uri, - AllowAutoRedirect = allowAutoRedirect, }; return SendDataInternal(body, accepts, contentType, cancellationToken, twoFactorAuthenticationCode, request); diff --git a/Octokit/Http/HttpClientAdapter.cs b/Octokit/Http/HttpClientAdapter.cs index 7c45be56..e84401d6 100644 --- a/Octokit/Http/HttpClientAdapter.cs +++ b/Octokit/Http/HttpClientAdapter.cs @@ -104,7 +104,6 @@ namespace Octokit.Internal var fullUri = new Uri(request.BaseAddress, request.Endpoint); requestMessage = new HttpRequestMessage(request.Method, fullUri); - requestMessage.Properties["AllowAutoRedirect"] = request.AllowAutoRedirect; foreach (var header in request.Headers) { requestMessage.Headers.Add(header.Key, header.Value); @@ -166,7 +165,6 @@ namespace Octokit.Internal internal class RedirectHandler : DelegatingHandler { - public const string AllowAutoRedirectKey = "AllowAutoRedirect"; public const string RedirectCountKey = "RedirectCount"; public bool Enabled { get; set; } @@ -177,10 +175,6 @@ namespace Octokit.Internal // Can't redirect without somewhere to redirect too. Throw? if (response.Headers.Location == null) return response; - // Don't redirect if redirection has been disabled for this request - var allowAutoRedirect = (bool)request.Properties[AllowAutoRedirectKey]; - if (!allowAutoRedirect) return response; // Throw? - // Don't redirect if we exceed max number of redirects var redirectCount = 0; if (request.Properties.Keys.Contains(RedirectCountKey)) diff --git a/Octokit/Http/IRequest.cs b/Octokit/Http/IRequest.cs index f52b2e52..31fbc578 100644 --- a/Octokit/Http/IRequest.cs +++ b/Octokit/Http/IRequest.cs @@ -14,6 +14,7 @@ namespace Octokit.Internal Uri Endpoint { get; } TimeSpan Timeout { get; } string ContentType { get; } + [Obsolete("This value is no longer respected due to the necessary redirect work")] bool AllowAutoRedirect { get; } } } diff --git a/Octokit/Http/Request.cs b/Octokit/Http/Request.cs index cd6dad4d..f9300fd4 100644 --- a/Octokit/Http/Request.cs +++ b/Octokit/Http/Request.cs @@ -11,7 +11,6 @@ namespace Octokit.Internal { Headers = new Dictionary(); Parameters = new Dictionary(); - AllowAutoRedirect = true; Timeout = TimeSpan.FromSeconds(100); } @@ -23,6 +22,8 @@ namespace Octokit.Internal public Uri Endpoint { get; set; } public TimeSpan Timeout { get; set; } public string ContentType { get; set; } + + [Obsolete("This value is no longer respected due to the necessary redirect work")] public bool AllowAutoRedirect { get; set; } } } From 54e0865e37f683601f09595dc09447c26a51b8a3 Mon Sep 17 00:00:00 2001 From: Brendan Forster Date: Mon, 1 Jun 2015 07:48:21 +0930 Subject: [PATCH 2/5] introduce GetArchive overloads for RepositoryContentClients which handles the redirect --- .../IObservableRepositoryContentsClient.cs | 31 +++++++++++++ .../ObservableRepositoryContentsClient.cs | 40 ++++++++++++++++ .../Clients/RepositoryContentsClientTests.cs | 26 +++++------ Octokit/Clients/IRepositoryContentsClient.cs | 34 ++++++++++++++ Octokit/Clients/RepositoryContentsClient.cs | 46 +++++++++++++++++++ 5 files changed, 164 insertions(+), 13 deletions(-) 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. /// From 51947adc6d028edae4ba026f333f71278cb6a6ba Mon Sep 17 00:00:00 2001 From: Brendan Forster Date: Mon, 1 Jun 2015 07:49:24 +0930 Subject: [PATCH 3/5] added another exclusion for detecting binary content --- Octokit/Http/HttpClientAdapter.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Octokit/Http/HttpClientAdapter.cs b/Octokit/Http/HttpClientAdapter.cs index e84401d6..ac364b3a 100644 --- a/Octokit/Http/HttpClientAdapter.cs +++ b/Octokit/Http/HttpClientAdapter.cs @@ -77,7 +77,9 @@ namespace Octokit.Internal contentType = GetContentMediaType(responseMessage.Content); // We added support for downloading images and zip-files. Let's constrain this appropriately. - if (contentType != null && (contentType.StartsWith("image/") || contentType.Equals("application/zip", StringComparison.OrdinalIgnoreCase))) + if (contentType != null && (contentType.StartsWith("image/") + || contentType.Equals("application/zip", StringComparison.OrdinalIgnoreCase) + || contentType.Equals("application/x-gzip", StringComparison.OrdinalIgnoreCase))) { responseBody = await responseMessage.Content.ReadAsByteArrayAsync().ConfigureAwait(false); } From 9a634e471ccc8c1cae910a54023466fab3c34354 Mon Sep 17 00:00:00 2001 From: Brendan Forster Date: Mon, 1 Jun 2015 08:10:20 +0930 Subject: [PATCH 4/5] docs docs docs --- Octokit/Clients/IRepositoryContentsClient.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Octokit/Clients/IRepositoryContentsClient.cs b/Octokit/Clients/IRepositoryContentsClient.cs index fc2ba027..e02cd689 100644 --- a/Octokit/Clients/IRepositoryContentsClient.cs +++ b/Octokit/Clients/IRepositoryContentsClient.cs @@ -67,7 +67,7 @@ namespace Octokit /// https://developer.github.com/v3/repos/contents/#get-archive-link /// The owner of the repository /// The name of the repository - /// + /// The binary contents of the archive Task GetArchive(string owner, string name); /// @@ -91,7 +91,7 @@ namespace Octokit /// The owner of the repository /// The name of the repository /// The format of the archive. Can be either tarball or zipball - /// + /// The binary contents of the archive Task GetArchive(string owner, string name, ArchiveFormat archiveFormat); /// @@ -117,7 +117,7 @@ namespace Octokit /// The name of the repository /// The format of the archive. Can be either tarball or zipball /// A valid Git reference. - /// + /// The binary contents of the archive Task GetArchive(string owner, string name, ArchiveFormat archiveFormat, string reference); /// From fe36783c6a08e02dd2d173ec62c7641816fb681c Mon Sep 17 00:00:00 2001 From: Brendan Forster Date: Mon, 1 Jun 2015 08:13:58 +0930 Subject: [PATCH 5/5] and the other docs --- .../Clients/IObservableRepositoryContentsClient.cs | 4 +++- .../Clients/ObservableRepositoryContentsClient.cs | 4 +++- Octokit/Clients/RepositoryContentsClient.cs | 6 +++--- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Octokit.Reactive/Clients/IObservableRepositoryContentsClient.cs b/Octokit.Reactive/Clients/IObservableRepositoryContentsClient.cs index ed132889..a5221a6b 100644 --- a/Octokit.Reactive/Clients/IObservableRepositoryContentsClient.cs +++ b/Octokit.Reactive/Clients/IObservableRepositoryContentsClient.cs @@ -43,6 +43,7 @@ namespace Octokit.Reactive /// https://developer.github.com/v3/repos/contents/#get-archive-link /// The owner of the repository /// The name of the repository + /// A promise, containing the binary contents of the archive IObservable GetArchive(string owner, string name); /// @@ -66,7 +67,7 @@ namespace Octokit.Reactive /// The owner of the repository /// The name of the repository /// The format of the archive. Can be either tarball or zipball - /// + /// A promise, containing the binary contents of the archive IObservable GetArchive(string owner, string name, ArchiveFormat archiveFormat); /// @@ -92,6 +93,7 @@ namespace Octokit.Reactive /// The name of the repository /// The format of the archive. Can be either tarball or zipball /// A valid Git reference. + /// A promise, containing the binary contents of the archive IObservable GetArchive(string owner, string name, ArchiveFormat archiveFormat, string reference); /// diff --git a/Octokit.Reactive/Clients/ObservableRepositoryContentsClient.cs b/Octokit.Reactive/Clients/ObservableRepositoryContentsClient.cs index 8c7dde33..a4a5e4b2 100644 --- a/Octokit.Reactive/Clients/ObservableRepositoryContentsClient.cs +++ b/Octokit.Reactive/Clients/ObservableRepositoryContentsClient.cs @@ -71,6 +71,7 @@ namespace Octokit.Reactive /// https://developer.github.com/v3/repos/contents/#get-archive-link /// The owner of the repository /// The name of the repository + /// A promise, containing the binary contents of the archive public IObservable GetArchive(string owner, string name) { return _client.Repository.Content.GetArchive(owner, name).ToObservable(); @@ -100,7 +101,7 @@ namespace Octokit.Reactive /// The owner of the repository /// The name of the repository /// The format of the archive. Can be either tarball or zipball - /// + /// A promise, containing the binary contents of the archive public IObservable GetArchive(string owner, string name, ArchiveFormat archiveFormat) { return _client.Repository.Content.GetArchive(owner, name, archiveFormat).ToObservable(); @@ -135,6 +136,7 @@ namespace Octokit.Reactive /// The name of the repository /// The format of the archive. Can be either tarball or zipball /// A valid Git reference. + /// A promise, containing the binary contents of the archive public IObservable GetArchive(string owner, string name, ArchiveFormat archiveFormat, string reference) { return _client.Repository.Content.GetArchive(owner, name, archiveFormat, reference).ToObservable(); diff --git a/Octokit/Clients/RepositoryContentsClient.cs b/Octokit/Clients/RepositoryContentsClient.cs index ae252ebb..5f866caf 100644 --- a/Octokit/Clients/RepositoryContentsClient.cs +++ b/Octokit/Clients/RepositoryContentsClient.cs @@ -95,7 +95,7 @@ namespace Octokit /// https://developer.github.com/v3/repos/contents/#get-archive-link /// The owner of the repository /// The name of the repository - /// + /// The binary contents of the archive public Task GetArchive(string owner, string name) { return GetArchive(owner, name, ArchiveFormat.Tarball, string.Empty); @@ -124,7 +124,7 @@ namespace Octokit /// The owner of the repository /// The name of the repository /// The format of the archive. Can be either tarball or zipball - /// + /// The binary contents of the archive public Task GetArchive(string owner, string name, ArchiveFormat archiveFormat) { return GetArchive(owner, name, archiveFormat, string.Empty); @@ -158,7 +158,7 @@ namespace Octokit /// The name of the repository /// The format of the archive. Can be either tarball or zipball /// A valid Git reference. - /// + /// The binary contents of the archive public async Task GetArchive(string owner, string name, ArchiveFormat archiveFormat, string reference) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner");