mirror of
https://github.com/zoriya/octokit.net.git
synced 2025-12-06 07:16:09 +00:00
remove deprecated code for old Check Suites API (#2130)
This commit is contained in:
@@ -142,29 +142,6 @@ namespace Octokit.Reactive
|
||||
/// <param name="newCheckSuite">Details of the Check Suite to create</param>
|
||||
IObservable<CheckSuite> Create(long repositoryId, NewCheckSuite newCheckSuite);
|
||||
|
||||
/// <summary>
|
||||
/// Triggers GitHub to create a new check suite, without pushing new code to a repository
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// See the <a href="https://developer.github.com/v3/checks/suites/#request-check-suites">Check Suites API documentation</a> for more information.
|
||||
/// </remarks>
|
||||
/// <param name="owner">The owner of the repository</param>
|
||||
/// <param name="name">The name of the repository</param>
|
||||
/// <param name="request">Details of the Check Suite request</param>
|
||||
[Obsolete("This method has been deprecated in the GitHub Api, however can still be used on GitHub Enterprise 2.14")]
|
||||
IObservable<bool> Request(string owner, string name, CheckSuiteTriggerRequest request);
|
||||
|
||||
/// <summary>
|
||||
/// Triggers GitHub to create a new check suite, without pushing new code to a repository
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// See the <a href="https://developer.github.com/v3/checks/suites/#request-check-suites">Check Suites API documentation</a> for more information.
|
||||
/// </remarks>
|
||||
/// <param name="repositoryId">The Id of the repository</param>
|
||||
/// <param name="request">Details of the Check Suite request</param>
|
||||
[Obsolete("This method has been deprecated in the GitHub Api, however can still be used on GitHub Enterprise 2.14")]
|
||||
IObservable<bool> Request(long repositoryId, CheckSuiteTriggerRequest request);
|
||||
|
||||
/// <summary>
|
||||
/// Triggers GitHub to rerequest an existing check suite, without pushing new code to a repository
|
||||
/// </summary>
|
||||
@@ -186,4 +163,4 @@ namespace Octokit.Reactive
|
||||
/// <param name="checkSuiteId">The Id of the check suite</param>
|
||||
IObservable<bool> Rerequest(long repositoryId, long checkSuiteId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -234,41 +234,6 @@ namespace Octokit.Reactive
|
||||
return _client.Create(repositoryId, newCheckSuite).ToObservable();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Triggers GitHub to create a new check suite, without pushing new code to a repository
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// See the <a href="https://developer.github.com/v3/checks/suites/#request-check-suites">Check Suites API documentation</a> for more information.
|
||||
/// </remarks>
|
||||
/// <param name="owner">The owner of the repository</param>
|
||||
/// <param name="name">The name of the repository</param>
|
||||
/// <param name="request">Details of the Check Suite request</param>
|
||||
[Obsolete("This method has been deprecated in the GitHub Api, however can still be used on GitHub Enterprise 2.14")]
|
||||
public IObservable<bool> 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();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Triggers GitHub to create a new check suite, without pushing new code to a repository
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// See the <a href="https://developer.github.com/v3/checks/suites/#request-check-suites">Check Suites API documentation</a> for more information.
|
||||
/// </remarks>
|
||||
/// <param name="repositoryId">The Id of the repository</param>
|
||||
/// <param name="request">Details of the Check Suite request</param>
|
||||
[Obsolete("This method has been deprecated in the GitHub Api, however can still be used on GitHub Enterprise 2.14")]
|
||||
public IObservable<bool> Request(long repositoryId, CheckSuiteTriggerRequest request)
|
||||
{
|
||||
Ensure.ArgumentNotNull(request, nameof(request));
|
||||
|
||||
return _client.Request(repositoryId, request).ToObservable();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Triggers GitHub to rerequest an existing check suite, without pushing new code to a repository
|
||||
/// </summary>
|
||||
@@ -299,4 +264,4 @@ namespace Octokit.Reactive
|
||||
return _client.Rerequest(repositoryId, checkSuiteId).ToObservable();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -332,70 +332,6 @@ namespace Octokit.Tests.Clients
|
||||
}
|
||||
}
|
||||
|
||||
#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<Uri>(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<Uri>(u => u.ToString() == "repositories/1/check-suite-requests"),
|
||||
request,
|
||||
"application/vnd.github.antiope-preview+json");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task EnsuresNonNullArguments()
|
||||
{
|
||||
var connection = Substitute.For<IApiConnection>();
|
||||
var client = new CheckSuitesClient(connection);
|
||||
|
||||
var request = new CheckSuiteTriggerRequest("123abc");
|
||||
|
||||
await Assert.ThrowsAsync<ArgumentNullException>(() => client.Request(null, "repo", request));
|
||||
await Assert.ThrowsAsync<ArgumentNullException>(() => client.Request("fake", null, request));
|
||||
await Assert.ThrowsAsync<ArgumentNullException>(() => client.Request("fake", "repo", null));
|
||||
|
||||
await Assert.ThrowsAsync<ArgumentNullException>(() => client.Request(1, null));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task EnsuresNonEmptyArguments()
|
||||
{
|
||||
var connection = Substitute.For<IApiConnection>();
|
||||
var client = new CheckSuitesClient(connection);
|
||||
|
||||
var request = new CheckSuiteTriggerRequest("123abc");
|
||||
|
||||
await Assert.ThrowsAsync<ArgumentException>(() => client.Request("", "repo", request));
|
||||
await Assert.ThrowsAsync<ArgumentException>(() => client.Request("fake", "", request));
|
||||
}
|
||||
}
|
||||
#pragma warning restore CS0618 // Type or member is obsolete
|
||||
|
||||
public class TheRerequestMethod
|
||||
{
|
||||
[Fact]
|
||||
@@ -447,4 +383,4 @@ namespace Octokit.Tests.Clients
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -313,64 +313,6 @@ namespace Octokit.Tests.Clients
|
||||
}
|
||||
}
|
||||
|
||||
#pragma warning disable CS0618 // Type or member is obsolete
|
||||
public class TheRequestMethod
|
||||
{
|
||||
[Fact]
|
||||
public async Task RequestsCorrectUrl()
|
||||
{
|
||||
var gitHubClient = Substitute.For<IGitHubClient>();
|
||||
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<IGitHubClient>();
|
||||
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<IGitHubClient>();
|
||||
var client = new ObservableCheckSuitesClient(gitHubClient);
|
||||
|
||||
var request = new CheckSuiteTriggerRequest("123abc");
|
||||
|
||||
Assert.Throws<ArgumentNullException>(() => client.Request(null, "repo", request));
|
||||
Assert.Throws<ArgumentNullException>(() => client.Request("fake", null, request));
|
||||
Assert.Throws<ArgumentNullException>(() => client.Request("fake", "repo", null));
|
||||
|
||||
Assert.Throws<ArgumentNullException>(() => client.Request(1, null));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task EnsuresNonEmptyArguments()
|
||||
{
|
||||
var gitHubClient = Substitute.For<IGitHubClient>();
|
||||
var client = new ObservableCheckSuitesClient(gitHubClient);
|
||||
|
||||
var request = new CheckSuiteTriggerRequest("123abc");
|
||||
|
||||
Assert.Throws<ArgumentException>(() => client.Request("", "repo", request));
|
||||
Assert.Throws<ArgumentException>(() => client.Request("fake", "", request));
|
||||
}
|
||||
}
|
||||
#pragma warning restore CS0618 // Type or member is obsolete
|
||||
|
||||
public class TheRerequestMethod
|
||||
{
|
||||
[Fact]
|
||||
|
||||
@@ -248,55 +248,6 @@ namespace Octokit
|
||||
return ApiConnection.Post<CheckSuite>(ApiUrls.CheckSuites(repositoryId), newCheckSuite, AcceptHeaders.ChecksApiPreview);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Triggers GitHub to create a new check suite, without pushing new code to a repository
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// See the <a href="https://developer.github.com/v3/checks/suites/#request-check-suites">Check Suites API documentation</a> for more information.
|
||||
/// </remarks>
|
||||
/// <param name="owner">The owner of the repository</param>
|
||||
/// <param name="name">The name of the repository</param>
|
||||
/// <param name="request">Details of the Check Suite request</param>
|
||||
[Obsolete("This method has been deprecated in the GitHub Api, however can still be used on GitHub Enterprise 2.14")]
|
||||
public async Task<bool> 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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Triggers GitHub to create a new check suite, without pushing new code to a repository
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// See the <a href="https://developer.github.com/v3/checks/suites/#request-check-suites">Check Suites API documentation</a> for more information.
|
||||
/// </remarks>
|
||||
/// <param name="repositoryId">The Id of the repository</param>
|
||||
/// <param name="request">Details of the Check Suite request</param>
|
||||
[Obsolete("This method has been deprecated in the GitHub Api, however can still be used on GitHub Enterprise 2.14")]
|
||||
public async Task<bool> 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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Triggers GitHub to rerequest an existing check suite, without pushing new code to a repository
|
||||
/// </summary>
|
||||
|
||||
@@ -143,29 +143,6 @@ namespace Octokit
|
||||
/// <param name="newCheckSuite">Details of the Check Suite to create</param>
|
||||
Task<CheckSuite> Create(long repositoryId, NewCheckSuite newCheckSuite);
|
||||
|
||||
/// <summary>
|
||||
/// Triggers GitHub to create a new check suite, without pushing new code to a repository
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// See the <a href="https://developer.github.com/v3/checks/suites/#request-check-suites">Check Suites API documentation</a> for more information.
|
||||
/// </remarks>
|
||||
/// <param name="owner">The owner of the repository</param>
|
||||
/// <param name="name">The name of the repository</param>
|
||||
/// <param name="request">Details of the Check Suite request</param>
|
||||
[Obsolete("This method has been deprecated in the GitHub Api, however can still be used on GitHub Enterprise 2.14")]
|
||||
Task<bool> Request(string owner, string name, CheckSuiteTriggerRequest request);
|
||||
|
||||
/// <summary>
|
||||
/// Triggers GitHub to create a new check suite, without pushing new code to a repository
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// See the <a href="https://developer.github.com/v3/checks/suites/#request-check-suites">Check Suites API documentation</a> for more information.
|
||||
/// </remarks>
|
||||
/// <param name="repositoryId">The Id of the repository</param>
|
||||
/// <param name="request">Details of the Check Suite request</param>
|
||||
[Obsolete("This method has been deprecated in the GitHub Api, however can still be used on GitHub Enterprise 2.14")]
|
||||
Task<bool> Request(long repositoryId, CheckSuiteTriggerRequest request);
|
||||
|
||||
/// <summary>
|
||||
/// Triggers GitHub to rerequest an existing check suite, without pushing new code to a repository
|
||||
/// </summary>
|
||||
@@ -187,4 +164,4 @@ namespace Octokit
|
||||
/// <param name="checkSuiteId">The Id of the check suite</param>
|
||||
Task<bool> Rerequest(long repositoryId, long checkSuiteId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4090,29 +4090,6 @@ namespace Octokit
|
||||
return "repos/{0}/{1}/check-suites".FormatUri(owner, repo);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the <see cref="Uri"/> that handles the check suite requests for the repository.
|
||||
/// </summary>
|
||||
/// <param name="repositoryId">The Id of the repository</param>
|
||||
/// <returns>The <see cref="Uri"/> that handles the check suite requests for the repository.</returns>
|
||||
[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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the <see cref="Uri"/> that handles the check suite requests for the repository.
|
||||
/// </summary>
|
||||
/// <param name="owner">The owner of repo</param>
|
||||
/// <param name="repo">The name of repo</param>
|
||||
/// <returns>The <see cref="Uri"/> that handles the check suite requests for the repository.</returns>
|
||||
[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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the <see cref="Uri"/> that handles the check suite requests for the repository.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user