mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-06-01 10:25:36 +00:00
added overloads for Delete to accept a payload
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user