diff --git a/Octokit/Http/ApiConnection.cs b/Octokit/Http/ApiConnection.cs index 9caaad59..d5250334 100644 --- a/Octokit/Http/ApiConnection.cs +++ b/Octokit/Http/ApiConnection.cs @@ -286,6 +286,20 @@ namespace Octokit return Connection.Delete(uri); } + /// + /// Deletes the API object at the specified URI. + /// + /// URI of the API resource to delete + /// Object that describes the API resource; this will be serialized and used as the request's body + /// A for the request's execution. + public Task Delete(Uri uri, object data) + { + Ensure.ArgumentNotNull(uri, "uri"); + Ensure.ArgumentNotNull(data, "data"); + + return Connection.Delete(uri, data); + } + /// /// Executes a GET to the API object at the specified URI. This operation is appropriate for /// API calls which queue long running calculations. diff --git a/Octokit/Http/Connection.cs b/Octokit/Http/Connection.cs index c67a27e2..5644690d 100644 --- a/Octokit/Http/Connection.cs +++ b/Octokit/Http/Connection.cs @@ -295,6 +295,28 @@ namespace Octokit return response.StatusCode; } + /// + /// Performs an asynchronous HTTP DELETE request that expects an empty response. + /// + /// URI endpoint to send request to + /// The object to serialize as the body of the request + /// The returned + public async Task Delete(Uri uri, object data) + { + Ensure.ArgumentNotNull(uri, "uri"); + Ensure.ArgumentNotNull(data, "data"); + + var request = new Request + { + Method = HttpMethod.Delete, + Body = data, + BaseAddress = BaseAddress, + Endpoint = uri + }; + var response = await Run(request, CancellationToken.None); + return response.StatusCode; + } + /// /// Base address for the connection. /// diff --git a/Octokit/Http/IApiConnection.cs b/Octokit/Http/IApiConnection.cs index 9781a82d..87e48f4a 100644 --- a/Octokit/Http/IApiConnection.cs +++ b/Octokit/Http/IApiConnection.cs @@ -147,7 +147,7 @@ namespace Octokit /// /// The API resource's type. /// URI of the API resource to update - /// /// Object that describes the API resource; this will be serialized and used as the request's body + /// Object that describes the API resource; this will be serialized and used as the request's body /// The updated API resource. /// Thrown when an API error occurs. Task Patch(Uri uri, object data); @@ -170,6 +170,14 @@ namespace Octokit /// A for the request's execution. Task Delete(Uri uri); + /// + /// Deletes the API object at the specified URI. + /// + /// URI of the API resource to delete + /// Object that describes the API resource; this will be serialized and used as the request's body + /// A for the request's execution. + Task Delete(Uri uri, object data); + /// /// Executes a GET to the API object at the specified URI. This operation is appropriate for /// API calls which queue long running calculations. diff --git a/Octokit/Http/IConnection.cs b/Octokit/Http/IConnection.cs index b33c59f7..0e99814f 100644 --- a/Octokit/Http/IConnection.cs +++ b/Octokit/Http/IConnection.cs @@ -130,6 +130,14 @@ namespace Octokit /// The returned Task Delete(Uri uri); + /// + /// Performs an asynchronous HTTP DELETE request that expects an empty response. + /// + /// URI endpoint to send request to + /// The object to serialize as the body of the request + /// The returned + Task Delete(Uri uri, object data); + /// /// Base address for the connection. ///