added overloads for Delete to accept a payload

This commit is contained in:
Brendan Forster
2014-07-08 10:09:34 +09:30
parent d5b6d45562
commit f777bc5b63
4 changed files with 53 additions and 1 deletions
+14
View File
@@ -286,6 +286,20 @@ namespace Octokit
return Connection.Delete(uri);
}
/// <summary>
/// Deletes the API object at the specified URI.
/// </summary>
/// <param name="uri">URI of the API resource to delete</param>
/// <param name="data">Object that describes the API resource; this will be serialized and used as the request's body</param>
/// <returns>A <see cref="Task"/> for the request's execution.</returns>
public Task Delete(Uri uri, object data)
{
Ensure.ArgumentNotNull(uri, "uri");
Ensure.ArgumentNotNull(data, "data");
return Connection.Delete(uri, data);
}
/// <summary>
/// Executes a GET to the API object at the specified URI. This operation is appropriate for
/// API calls which queue long running calculations.
+22
View File
@@ -295,6 +295,28 @@ namespace Octokit
return response.StatusCode;
}
/// <summary>
/// Performs an asynchronous HTTP DELETE request that expects an empty response.
/// </summary>
/// <param name="uri">URI endpoint to send request to</param>
/// <param name="data">The object to serialize as the body of the request</param>
/// <returns>The returned <seealso cref="HttpStatusCode"/></returns>
public async Task<HttpStatusCode> 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<object>(request, CancellationToken.None);
return response.StatusCode;
}
/// <summary>
/// Base address for the connection.
/// </summary>
+9 -1
View File
@@ -147,7 +147,7 @@ namespace Octokit
/// </summary>
/// <typeparam name="T">The API resource's type.</typeparam>
/// <param name="uri">URI of the API resource to update</param>
/// /// <param name="data">Object that describes the API resource; this will be serialized and used as the request's body</param>
/// <param name="data">Object that describes the API resource; this will be serialized and used as the request's body</param>
/// <returns>The updated API resource.</returns>
/// <exception cref="ApiException">Thrown when an API error occurs.</exception>
Task<T> Patch<T>(Uri uri, object data);
@@ -170,6 +170,14 @@ namespace Octokit
/// <returns>A <see cref="Task"/> for the request's execution.</returns>
Task Delete(Uri uri);
/// <summary>
/// Deletes the API object at the specified URI.
/// </summary>
/// <param name="uri">URI of the API resource to delete</param>
/// <param name="data">Object that describes the API resource; this will be serialized and used as the request's body</param>
/// <returns>A <see cref="Task"/> for the request's execution.</returns>
Task Delete(Uri uri, object data);
/// <summary>
/// Executes a GET to the API object at the specified URI. This operation is appropriate for
/// API calls which queue long running calculations.
+8
View File
@@ -130,6 +130,14 @@ namespace Octokit
/// <returns>The returned <seealso cref="HttpStatusCode"/></returns>
Task<HttpStatusCode> Delete(Uri uri);
/// <summary>
/// Performs an asynchronous HTTP DELETE request that expects an empty response.
/// </summary>
/// <param name="uri">URI endpoint to send request to</param>
/// <param name="data">The object to serialize as the body of the request</param>
/// <returns>The returned <seealso cref="HttpStatusCode"/></returns>
Task<HttpStatusCode> Delete(Uri uri, object data);
/// <summary>
/// Base address for the connection.
/// </summary>