diff --git a/Octokit.Reactive/Clients/IObservableMiscellaneousClient.cs b/Octokit.Reactive/Clients/IObservableMiscellaneousClient.cs index 4fbf18eb66..c46969fe28 100644 --- a/Octokit.Reactive/Clients/IObservableMiscellaneousClient.cs +++ b/Octokit.Reactive/Clients/IObservableMiscellaneousClient.cs @@ -52,6 +52,15 @@ public interface IObservableMiscellaneousClient [SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")] IObservable GetAllLicenses(); + /// + /// Returns a list of the licenses shown in the license picker on GitHub.com. This is not a comprehensive + /// list of all possible OSS licenses. + /// + /// This is a PREVIEW API! Use it at your own risk. + /// Options for changing the API response + /// A list of licenses available on the site + IObservable GetAllLicenses(ApiOptions options); + /// /// Retrieves a license based on the license key such as "MIT" /// diff --git a/Octokit.Reactive/Clients/ObservableMiscellaneousClient.cs b/Octokit.Reactive/Clients/ObservableMiscellaneousClient.cs index 8bd20c67c0..92ac177f1d 100644 --- a/Octokit.Reactive/Clients/ObservableMiscellaneousClient.cs +++ b/Octokit.Reactive/Clients/ObservableMiscellaneousClient.cs @@ -74,7 +74,19 @@ public IObservable GetGitIgnoreTemplate(string templateName) /// A list of licenses available on the site public IObservable GetAllLicenses() { - return _client.GetAllLicenses().ToObservable().SelectMany(l => l); + return GetAllLicenses(ApiOptions.None); + } + + /// + /// Returns a list of the licenses shown in the license picker on GitHub.com. This is not a comprehensive + /// list of all possible OSS licenses. + /// + /// This is a PREVIEW API! Use it at your own risk. + /// Options for changing the API response + /// A list of licenses available on the site + public IObservable GetAllLicenses(ApiOptions options) + { + return _client.GetAllLicenses(options).ToObservable().SelectMany(l => l); } /// diff --git a/Octokit.Tests/Clients/MiscellaneousClientTests.cs b/Octokit.Tests/Clients/MiscellaneousClientTests.cs index 6d7d3ecec7..95074e00aa 100644 --- a/Octokit.Tests/Clients/MiscellaneousClientTests.cs +++ b/Octokit.Tests/Clients/MiscellaneousClientTests.cs @@ -184,11 +184,11 @@ public void EnsuresNonNullArguments() public class TheGetAllLicensesMethod { [Fact] - public async void EnsuresNonNullArguments() + public void EnsuresNonNullArguments() { var client = new MiscellaneousClient(Substitute.For()); - await Assert.ThrowsAsync(() => client.GetAllLicenses(null)); + Assert.ThrowsAsync(() => client.GetAllLicenses(null)); } [Fact] @@ -196,8 +196,8 @@ public async Task RequestsTheLicensesEndpoint() { IReadOnlyList response = new ReadOnlyCollection(new List() { - new LicenseMetadata("foo1", "foo2", "http://example.com/foo1" ), - new LicenseMetadata("bar1", "bar2", "http://example.com/bar1" ) + new LicenseMetadata("foo1", "node-id-1", "foo2", "http://example.com/foo1", "something", true), + new LicenseMetadata("bar1", "node-id-1", "bar2", "http://example.com/bar1", "something else", false ) }); var connection = Substitute.For(); connection.GetAll(Args.Uri, null, AcceptHeaders.LicensesApiPreview, Args.ApiOptions) diff --git a/Octokit.Tests/Reactive/ObservableMiscellaneousClientTests.cs b/Octokit.Tests/Reactive/ObservableMiscellaneousClientTests.cs index b069c08be5..602890ec27 100644 --- a/Octokit.Tests/Reactive/ObservableMiscellaneousClientTests.cs +++ b/Octokit.Tests/Reactive/ObservableMiscellaneousClientTests.cs @@ -87,7 +87,7 @@ public void CallsIntoClient() client.GetAllLicenses(); - gitHubClient.Miscellaneous.Received(1).GetAllLicenses(); + gitHubClient.Miscellaneous.Received(1).GetAllLicenses(Args.ApiOptions); } }