diff --git a/Octokit.Reactive/Clients/IObservableCheckSuitesClient.cs b/Octokit.Reactive/Clients/IObservableCheckSuitesClient.cs index 25a2ecc9ec..129615c97a 100644 --- a/Octokit.Reactive/Clients/IObservableCheckSuitesClient.cs +++ b/Octokit.Reactive/Clients/IObservableCheckSuitesClient.cs @@ -142,29 +142,6 @@ public interface IObservableCheckSuitesClient /// Details of the Check Suite to create IObservable Create(long repositoryId, NewCheckSuite newCheckSuite); - /// - /// Triggers GitHub to create a new check suite, without pushing new code to a repository - /// - /// - /// See the Check Suites API documentation for more information. - /// - /// The owner of the repository - /// The name of the repository - /// Details of the Check Suite request - [Obsolete("This method has been deprecated in the GitHub Api, however can still be used on GitHub Enterprise 2.14")] - IObservable Request(string owner, string name, CheckSuiteTriggerRequest request); - - /// - /// Triggers GitHub to create a new check suite, without pushing new code to a repository - /// - /// - /// See the Check Suites API documentation for more information. - /// - /// The Id of the repository - /// Details of the Check Suite request - [Obsolete("This method has been deprecated in the GitHub Api, however can still be used on GitHub Enterprise 2.14")] - IObservable Request(long repositoryId, CheckSuiteTriggerRequest request); - /// /// Triggers GitHub to rerequest an existing check suite, without pushing new code to a repository /// @@ -186,4 +163,4 @@ public interface IObservableCheckSuitesClient /// The Id of the check suite IObservable Rerequest(long repositoryId, long checkSuiteId); } -} \ No newline at end of file +} diff --git a/Octokit.Reactive/Clients/ObservableCheckSuitesClient.cs b/Octokit.Reactive/Clients/ObservableCheckSuitesClient.cs index df86d8a5a5..4cd569c465 100644 --- a/Octokit.Reactive/Clients/ObservableCheckSuitesClient.cs +++ b/Octokit.Reactive/Clients/ObservableCheckSuitesClient.cs @@ -234,41 +234,6 @@ public IObservable Create(long repositoryId, NewCheckSuite newCheckS return _client.Create(repositoryId, newCheckSuite).ToObservable(); } - /// - /// Triggers GitHub to create a new check suite, without pushing new code to a repository - /// - /// - /// See the Check Suites API documentation for more information. - /// - /// The owner of the repository - /// The name of the repository - /// Details of the Check Suite request - [Obsolete("This method has been deprecated in the GitHub Api, however can still be used on GitHub Enterprise 2.14")] - public IObservable Request(string owner, string name, CheckSuiteTriggerRequest request) - { - Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner)); - Ensure.ArgumentNotNullOrEmptyString(name, nameof(name)); - Ensure.ArgumentNotNull(request, nameof(request)); - - return _client.Request(owner, name, request).ToObservable(); - } - - /// - /// Triggers GitHub to create a new check suite, without pushing new code to a repository - /// - /// - /// See the Check Suites API documentation for more information. - /// - /// The Id of the repository - /// Details of the Check Suite request - [Obsolete("This method has been deprecated in the GitHub Api, however can still be used on GitHub Enterprise 2.14")] - public IObservable Request(long repositoryId, CheckSuiteTriggerRequest request) - { - Ensure.ArgumentNotNull(request, nameof(request)); - - return _client.Request(repositoryId, request).ToObservable(); - } - /// /// Triggers GitHub to rerequest an existing check suite, without pushing new code to a repository /// @@ -299,4 +264,4 @@ public IObservable Rerequest(long repositoryId, long checkSuiteId) return _client.Rerequest(repositoryId, checkSuiteId).ToObservable(); } } -} \ No newline at end of file +} diff --git a/Octokit.Tests/Clients/CheckSuitesClientTests.cs b/Octokit.Tests/Clients/CheckSuitesClientTests.cs index 558610a28d..194c70fcc7 100644 --- a/Octokit.Tests/Clients/CheckSuitesClientTests.cs +++ b/Octokit.Tests/Clients/CheckSuitesClientTests.cs @@ -332,70 +332,6 @@ public async Task EnsuresNonEmptyArguments() } } -#pragma warning disable CS0618 // Type or member is obsolete - public class TheRequestMethod - { - [Fact] - public async Task RequestsCorrectUrl() - { - var connection = MockedIApiConnection.PostReturnsHttpStatus(HttpStatusCode.Created); - var client = new CheckSuitesClient(connection); - - var request = new CheckSuiteTriggerRequest("123abc"); - - await client.Request("fake", "repo", request); - - connection.Connection.Received().Post( - Arg.Is(u => u.ToString() == "repos/fake/repo/check-suite-requests"), - request, - "application/vnd.github.antiope-preview+json"); - } - - [Fact] - public async Task RequestsCorrectUrlWithRepositoryId() - { - var connection = MockedIApiConnection.PostReturnsHttpStatus(HttpStatusCode.Created); - var client = new CheckSuitesClient(connection); - - var request = new CheckSuiteTriggerRequest("123abc"); - - await client.Request(1, request); - - connection.Connection.Received().Post( - Arg.Is(u => u.ToString() == "repositories/1/check-suite-requests"), - request, - "application/vnd.github.antiope-preview+json"); - } - - [Fact] - public async Task EnsuresNonNullArguments() - { - var connection = Substitute.For(); - var client = new CheckSuitesClient(connection); - - var request = new CheckSuiteTriggerRequest("123abc"); - - await Assert.ThrowsAsync(() => client.Request(null, "repo", request)); - await Assert.ThrowsAsync(() => client.Request("fake", null, request)); - await Assert.ThrowsAsync(() => client.Request("fake", "repo", null)); - - await Assert.ThrowsAsync(() => client.Request(1, null)); - } - - [Fact] - public async Task EnsuresNonEmptyArguments() - { - var connection = Substitute.For(); - var client = new CheckSuitesClient(connection); - - var request = new CheckSuiteTriggerRequest("123abc"); - - await Assert.ThrowsAsync(() => client.Request("", "repo", request)); - await Assert.ThrowsAsync(() => client.Request("fake", "", request)); - } - } -#pragma warning restore CS0618 // Type or member is obsolete - public class TheRerequestMethod { [Fact] @@ -447,4 +383,4 @@ public async Task EnsuresNonEmptyArguments() } } } -} \ No newline at end of file +} diff --git a/Octokit.Tests/Reactive/ObservableCheckSuitesClientTests.cs b/Octokit.Tests/Reactive/ObservableCheckSuitesClientTests.cs index 7cbd5e2425..8e7024c25b 100644 --- a/Octokit.Tests/Reactive/ObservableCheckSuitesClientTests.cs +++ b/Octokit.Tests/Reactive/ObservableCheckSuitesClientTests.cs @@ -313,64 +313,6 @@ public async Task EnsuresNonEmptyArguments() } } -#pragma warning disable CS0618 // Type or member is obsolete - public class TheRequestMethod - { - [Fact] - public async Task RequestsCorrectUrl() - { - var gitHubClient = Substitute.For(); - var client = new ObservableCheckSuitesClient(gitHubClient); - - var request = new CheckSuiteTriggerRequest("123abc"); - - client.Request("fake", "repo", request); - - gitHubClient.Check.Suite.Received().Request("fake", "repo", request); - } - - [Fact] - public async Task RequestsCorrectUrlWithRepositoryId() - { - var gitHubClient = Substitute.For(); - var client = new ObservableCheckSuitesClient(gitHubClient); - - var request = new CheckSuiteTriggerRequest("123abc"); - - client.Request(1, request); - - gitHubClient.Check.Suite.Received().Request(1, request); - } - - [Fact] - public async Task EnsuresNonNullArguments() - { - var gitHubClient = Substitute.For(); - var client = new ObservableCheckSuitesClient(gitHubClient); - - var request = new CheckSuiteTriggerRequest("123abc"); - - Assert.Throws(() => client.Request(null, "repo", request)); - Assert.Throws(() => client.Request("fake", null, request)); - Assert.Throws(() => client.Request("fake", "repo", null)); - - Assert.Throws(() => client.Request(1, null)); - } - - [Fact] - public async Task EnsuresNonEmptyArguments() - { - var gitHubClient = Substitute.For(); - var client = new ObservableCheckSuitesClient(gitHubClient); - - var request = new CheckSuiteTriggerRequest("123abc"); - - Assert.Throws(() => client.Request("", "repo", request)); - Assert.Throws(() => client.Request("fake", "", request)); - } - } -#pragma warning restore CS0618 // Type or member is obsolete - public class TheRerequestMethod { [Fact] diff --git a/Octokit/Clients/CheckSuitesClient.cs b/Octokit/Clients/CheckSuitesClient.cs index a3d1863371..b912e593b5 100644 --- a/Octokit/Clients/CheckSuitesClient.cs +++ b/Octokit/Clients/CheckSuitesClient.cs @@ -248,55 +248,6 @@ public Task Create(long repositoryId, NewCheckSuite newCheckSuite) return ApiConnection.Post(ApiUrls.CheckSuites(repositoryId), newCheckSuite, AcceptHeaders.ChecksApiPreview); } - /// - /// Triggers GitHub to create a new check suite, without pushing new code to a repository - /// - /// - /// See the Check Suites API documentation for more information. - /// - /// The owner of the repository - /// The name of the repository - /// Details of the Check Suite request - [Obsolete("This method has been deprecated in the GitHub Api, however can still be used on GitHub Enterprise 2.14")] - public async Task Request(string owner, string name, CheckSuiteTriggerRequest request) - { - Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner)); - Ensure.ArgumentNotNullOrEmptyString(name, nameof(name)); - Ensure.ArgumentNotNull(request, nameof(request)); - - var httpStatusCode = await Connection.Post(ApiUrls.CheckSuiteRequests(owner, name), request, AcceptHeaders.ChecksApiPreview).ConfigureAwait(false); - - if (httpStatusCode != HttpStatusCode.Created) - { - throw new ApiException("Invalid Status Code returned. Expected a 201", httpStatusCode); - } - - return httpStatusCode == HttpStatusCode.Created; - } - - /// - /// Triggers GitHub to create a new check suite, without pushing new code to a repository - /// - /// - /// See the Check Suites API documentation for more information. - /// - /// The Id of the repository - /// Details of the Check Suite request - [Obsolete("This method has been deprecated in the GitHub Api, however can still be used on GitHub Enterprise 2.14")] - public async Task Request(long repositoryId, CheckSuiteTriggerRequest request) - { - Ensure.ArgumentNotNull(request, nameof(request)); - - var httpStatusCode = await Connection.Post(ApiUrls.CheckSuiteRequests(repositoryId), request, AcceptHeaders.ChecksApiPreview).ConfigureAwait(false); - - if (httpStatusCode != HttpStatusCode.Created) - { - throw new ApiException("Invalid Status Code returned. Expected a 201", httpStatusCode); - } - - return httpStatusCode == HttpStatusCode.Created; - } - /// /// Triggers GitHub to rerequest an existing check suite, without pushing new code to a repository /// diff --git a/Octokit/Clients/ICheckSuitesClient.cs b/Octokit/Clients/ICheckSuitesClient.cs index 3eb77713ed..cb95dce352 100644 --- a/Octokit/Clients/ICheckSuitesClient.cs +++ b/Octokit/Clients/ICheckSuitesClient.cs @@ -143,29 +143,6 @@ public interface ICheckSuitesClient /// Details of the Check Suite to create Task Create(long repositoryId, NewCheckSuite newCheckSuite); - /// - /// Triggers GitHub to create a new check suite, without pushing new code to a repository - /// - /// - /// See the Check Suites API documentation for more information. - /// - /// The owner of the repository - /// The name of the repository - /// Details of the Check Suite request - [Obsolete("This method has been deprecated in the GitHub Api, however can still be used on GitHub Enterprise 2.14")] - Task Request(string owner, string name, CheckSuiteTriggerRequest request); - - /// - /// Triggers GitHub to create a new check suite, without pushing new code to a repository - /// - /// - /// See the Check Suites API documentation for more information. - /// - /// The Id of the repository - /// Details of the Check Suite request - [Obsolete("This method has been deprecated in the GitHub Api, however can still be used on GitHub Enterprise 2.14")] - Task Request(long repositoryId, CheckSuiteTriggerRequest request); - /// /// Triggers GitHub to rerequest an existing check suite, without pushing new code to a repository /// @@ -187,4 +164,4 @@ public interface ICheckSuitesClient /// The Id of the check suite Task Rerequest(long repositoryId, long checkSuiteId); } -} \ No newline at end of file +} diff --git a/Octokit/Helpers/ApiUrls.cs b/Octokit/Helpers/ApiUrls.cs index 3eb96e0fd9..d10687061e 100644 --- a/Octokit/Helpers/ApiUrls.cs +++ b/Octokit/Helpers/ApiUrls.cs @@ -4090,29 +4090,6 @@ public static Uri CheckSuites(string owner, string repo) return "repos/{0}/{1}/check-suites".FormatUri(owner, repo); } - /// - /// Returns the that handles the check suite requests for the repository. - /// - /// The Id of the repository - /// The that handles the check suite requests for the repository. - [Obsolete("This method has been deprecated in the GitHub Api, however can still be used on GitHub Enterprise 2.14")] - public static Uri CheckSuiteRequests(long repositoryId) - { - return "repositories/{0}/check-suite-requests".FormatUri(repositoryId); - } - - /// - /// Returns the that handles the check suite requests for the repository. - /// - /// The owner of repo - /// The name of repo - /// The that handles the check suite requests for the repository. - [Obsolete("This method has been deprecated in the GitHub Api, however can still be used on GitHub Enterprise 2.14")] - public static Uri CheckSuiteRequests(string owner, string repo) - { - return "repos/{0}/{1}/check-suite-requests".FormatUri(owner, repo); - } - /// /// Returns the that handles the check suite requests for the repository. ///