diff --git a/Octokit.Reactive/Clients/IObservableRepositoriesClient.cs b/Octokit.Reactive/Clients/IObservableRepositoriesClient.cs
index d9da62cbc0..dd5c78bc85 100644
--- a/Octokit.Reactive/Clients/IObservableRepositoriesClient.cs
+++ b/Octokit.Reactive/Clients/IObservableRepositoriesClient.cs
@@ -72,6 +72,17 @@ public interface IObservableRepositoriesClient
/// A
IObservable Transfer(long repositoryId, RepositoryTransfer repositoryTransfer);
+ ///
+ /// Checks if vulnerability alerts are enabled for the specified repository.
+ ///
+ ///
+ /// See the API documentation for more information.
+ ///
+ /// The current owner of the repository
+ /// The name of the repository
+ /// A bool indicating if alerts are turned on or not.
+ IObservable AreVulnerabilityAlertsEnabled(string owner, string name);
+
///
/// Retrieves the for the specified owner and name.
///
diff --git a/Octokit.Reactive/Clients/ObservableRepositoriesClient.cs b/Octokit.Reactive/Clients/ObservableRepositoriesClient.cs
index 9fbb2157b1..80f68d1009 100644
--- a/Octokit.Reactive/Clients/ObservableRepositoriesClient.cs
+++ b/Octokit.Reactive/Clients/ObservableRepositoriesClient.cs
@@ -151,6 +151,23 @@ public IObservable Transfer(long repositoryId, RepositoryTransfer re
return _client.Transfer(repositoryId, repositoryTransfer).ToObservable();
}
+ ///
+ /// Checks if vulnerability alerts are enabled for the specified repository.
+ ///
+ ///
+ /// See the API documentation for more information.
+ ///
+ /// The current owner of the repository
+ /// The name of the repository
+ /// A bool indicating if alerts are turned on or not.
+ public IObservable AreVulnerabilityAlertsEnabled(string owner, string name)
+ {
+ Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
+ Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
+
+ return _client.AreVulnerabilityAlertsEnabled(owner, name).ToObservable();
+ }
+
///
/// Retrieves the for the specified owner and name.
///
diff --git a/Octokit.Tests.Integration/Clients/RepositoriesClientTests.cs b/Octokit.Tests.Integration/Clients/RepositoriesClientTests.cs
index cd1fffea94..cd0c7eb64e 100644
--- a/Octokit.Tests.Integration/Clients/RepositoriesClientTests.cs
+++ b/Octokit.Tests.Integration/Clients/RepositoriesClientTests.cs
@@ -2055,4 +2055,15 @@ public async Task TransfersFromUserToOrgWithTeamsById()
}
}
}
+
+ public class TheAreVulnerabilityAlertsEnabledMethod
+ {
+ [IntegrationTest]
+ public async Task AreVulnerabilityAlertsEnabledReturnsTrue()
+ {
+ var github = Helper.GetAuthenticatedClient();
+ var enabled = await github.Repository.AreVulnerabilityAlertsEnabled("owner", "name");
+ Assert.True(enabled);
+ }
+ }
}
diff --git a/Octokit.Tests/Clients/RepositoriesClientTests.cs b/Octokit.Tests/Clients/RepositoriesClientTests.cs
index 00b3b520bf..9d95cd1cee 100644
--- a/Octokit.Tests/Clients/RepositoriesClientTests.cs
+++ b/Octokit.Tests/Clients/RepositoriesClientTests.cs
@@ -3,8 +3,11 @@
using System.Net;
using System.Threading.Tasks;
using NSubstitute;
+using Octokit.Internal;
using Xunit;
+using static Octokit.Internal.TestSetup;
+
namespace Octokit.Tests.Clients
{
///
@@ -395,6 +398,55 @@ public async Task SendsPreviewHeaderById()
}
}
+ public class TheAreVulnerabilityAlertsEnabledMethod
+ {
+ [Theory]
+ [InlineData(HttpStatusCode.NoContent, true)]
+ [InlineData(HttpStatusCode.NotFound, false)]
+ public async Task RequestsCorrectValueForStatusCode(HttpStatusCode status, bool expected)
+ {
+ var response = CreateResponse(status);
+ var responseTask = Task.FromResult>(new ApiResponse