mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-06-04 03:16:11 +00:00
provide a Delete<T>() overload that takes a Uri and accept header, but no body (#1868)
This commit is contained in:
@@ -367,7 +367,7 @@ namespace Octokit.Tests.Reactive
|
||||
|
||||
client.RemoveFromIssue("fake", "repo", 42, "label");
|
||||
|
||||
connection.Received().Delete<IReadOnlyList<Label>>(Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/issues/42/labels/label"), "application/vnd.github.symmetra-preview+json");
|
||||
connection.Received().Delete<IReadOnlyList<Label>>(Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/issues/42/labels/label"), Arg.Any<object>(), "application/vnd.github.symmetra-preview+json");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -379,7 +379,7 @@ namespace Octokit.Tests.Reactive
|
||||
|
||||
client.RemoveFromIssue(1, 42, "label");
|
||||
|
||||
connection.Received().Delete<IReadOnlyList<Label>>(Arg.Is<Uri>(u => u.ToString() == "repositories/1/issues/42/labels/label"), "application/vnd.github.symmetra-preview+json");
|
||||
connection.Received().Delete<IReadOnlyList<Label>>(Arg.Is<Uri>(u => u.ToString() == "repositories/1/issues/42/labels/label"), Arg.Any<object>(), "application/vnd.github.symmetra-preview+json");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
@@ -510,6 +510,24 @@ namespace Octokit
|
||||
return response.Body;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Performs an asynchronous HTTP DELETE request.
|
||||
/// Attempts to map the response body to an object of type <typeparamref name="T"/>
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The API resource's type.</typeparam>
|
||||
/// <param name="uri">URI endpoint to send request to</param>
|
||||
/// <param name="accepts">Specifies accept response media type</param>
|
||||
/// <returns>The returned <seealso cref="HttpStatusCode"/></returns>
|
||||
public async Task<T> Delete<T>(Uri uri, string accepts)
|
||||
{
|
||||
Ensure.ArgumentNotNull(uri, nameof(uri));
|
||||
Ensure.ArgumentNotNull(accepts, nameof(accepts));
|
||||
|
||||
var response = await Connection.Delete<T>(uri, null, accepts).ConfigureAwait(false);
|
||||
|
||||
return response.Body;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Performs an asynchronous HTTP DELETE request.
|
||||
/// Attempts to map the response body to an object of type <typeparamref name="T"/>
|
||||
|
||||
@@ -328,6 +328,16 @@ namespace Octokit
|
||||
/// <param name="data">The object to serialize as the body of the request</param>
|
||||
Task<T> Delete<T>(Uri uri, object data);
|
||||
|
||||
/// <summary>
|
||||
/// Performs an asynchronous HTTP DELETE request.
|
||||
/// Attempts to map the response body to an object of type <typeparamref name="T"/>
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The API resource's type.</typeparam>
|
||||
/// <param name="uri">URI endpoint to send request to</param>
|
||||
/// <param name="accepts">Specifies accept response media type</param>
|
||||
/// <returns>The returned <seealso cref="HttpStatusCode"/></returns>
|
||||
Task<T> Delete<T>(Uri uri, string accepts);
|
||||
|
||||
/// <summary>
|
||||
/// Performs an asynchronous HTTP DELETE request.
|
||||
/// Attempts to map the response body to an object of type <typeparamref name="T"/>
|
||||
|
||||
Reference in New Issue
Block a user