provide a Delete<T>() overload that takes a Uri and accept header, but no body (#1868)

This commit is contained in:
Ryan Gribble
2018-09-09 09:59:31 +10:00
committed by GitHub
parent d166a8c142
commit cee6635861
3 changed files with 30 additions and 2 deletions
@@ -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]
+18
View File
@@ -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"/>
+10
View File
@@ -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"/>