mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-06-03 03:01:31 +00:00
implemented IReleaseClient.GetAll with overloads to take ApiOptions
This commit is contained in:
@@ -2,14 +2,13 @@
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using NSubstitute;
|
||||
using Octokit.Tests.Helpers;
|
||||
using Xunit;
|
||||
|
||||
namespace Octokit.Tests.Clients
|
||||
{
|
||||
public class ReleasesClientTests
|
||||
{
|
||||
public class TheGetReleasesMethod
|
||||
public class TheGetAllMethod
|
||||
{
|
||||
[Fact]
|
||||
public void RequestsCorrectUrl()
|
||||
@@ -21,7 +20,8 @@ namespace Octokit.Tests.Clients
|
||||
|
||||
client.Received().GetAll<Release>(Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/releases"),
|
||||
null,
|
||||
"application/vnd.github.v3");
|
||||
AcceptHeaders.StableVersion,
|
||||
Args.ApiOptions);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
@@ -67,5 +67,10 @@ namespace Octokit.Tests
|
||||
{
|
||||
get { return Arg.Any<NewDeployKey>(); }
|
||||
}
|
||||
|
||||
public static ApiOptions ApiOptions
|
||||
{
|
||||
get { return Arg.Any<ApiOptions>(); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,19 @@ namespace Octokit
|
||||
/// <returns>The list of <see cref="Release"/>s for the specified repository.</returns>
|
||||
Task<IReadOnlyList<Release>> GetAll(string owner, string name);
|
||||
|
||||
/// <summary>
|
||||
/// Gets all <see cref="Release"/>s for the specified repository.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// See the <a href="http://developer.github.com/v3/repos/releases/#list-releases-for-a-repository">API documentation</a> for more information.
|
||||
/// </remarks>
|
||||
/// <param name="owner">The repository's owner</param>
|
||||
/// <param name="name">The repository's name</param>
|
||||
/// <param name="options">Options for changing the API response</param>
|
||||
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
|
||||
/// <returns>The list of <see cref="Release"/>s for the specified repository.</returns>
|
||||
Task<IReadOnlyList<Release>> GetAll(string owner, string name, ApiOptions options);
|
||||
|
||||
/// <summary>
|
||||
/// Gets a single <see cref="Release"/> for the specified repository.
|
||||
/// </summary>
|
||||
|
||||
@@ -36,8 +36,28 @@ namespace Octokit
|
||||
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
||||
Ensure.ArgumentNotNullOrEmptyString(name, "repository");
|
||||
|
||||
return GetAll(owner, name, ApiOptions.None);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets all <see cref="Release"/>s for the specified repository.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// See the <a href="http://developer.github.com/v3/repos/releases/#list-releases-for-a-repository">API documentation</a> for more information.
|
||||
/// </remarks>
|
||||
/// <param name="owner">The repository's owner</param>
|
||||
/// <param name="name">The repository's name</param>
|
||||
/// <param name="options">Options for changing the API response</param>
|
||||
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
|
||||
/// <returns>The list of <see cref="Release"/>s for the specified repository.</returns>
|
||||
public Task<IReadOnlyList<Release>> GetAll(string owner, string name, ApiOptions options)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
||||
Ensure.ArgumentNotNullOrEmptyString(name, "repository");
|
||||
Ensure.ArgumentNotNull(options, "options");
|
||||
|
||||
var endpoint = ApiUrls.Releases(owner, name);
|
||||
return ApiConnection.GetAll<Release>(endpoint, null, AcceptHeaders.StableVersion);
|
||||
return ApiConnection.GetAll<Release>(endpoint, null, AcceptHeaders.StableVersion, options);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user