mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-06-08 04:40:54 +00:00
Implement Authorizations Delete method with 2fa code
When we delete an authorization, we often need to use basic authentication because the client might not have the associated token stored anymore. If 2fa is enabled, the client needs to be able to pass that along.
This commit is contained in:
@@ -332,6 +332,19 @@ 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="twoFactorAuthenticationCode">Two Factor Code</param>
|
||||
/// <returns>A <see cref="Task"/> for the request's execution.</returns>
|
||||
public Task Delete(Uri uri, string twoFactorAuthenticationCode)
|
||||
{
|
||||
Ensure.ArgumentNotNull(uri, "uri");
|
||||
|
||||
return Connection.Delete(uri, twoFactorAuthenticationCode);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deletes the API object at the specified URI.
|
||||
/// </summary>
|
||||
|
||||
@@ -361,6 +361,26 @@ namespace Octokit
|
||||
return response.HttpResponse.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="twoFactorAuthenticationCode">Two Factor Code</param>
|
||||
/// <returns>The returned <seealso cref="HttpStatusCode"/></returns>
|
||||
public async Task<HttpStatusCode> Delete(Uri uri, string twoFactorAuthenticationCode)
|
||||
{
|
||||
Ensure.ArgumentNotNull(uri, "uri");
|
||||
|
||||
var response = await SendData<object>(
|
||||
uri,
|
||||
HttpMethod.Delete,
|
||||
null,
|
||||
null,
|
||||
CancellationToken.None,
|
||||
twoFactorAuthenticationCode);
|
||||
return response.HttpResponse.StatusCode;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Performs an asynchronous HTTP DELETE request that expects an empty response.
|
||||
/// </summary>
|
||||
|
||||
@@ -203,6 +203,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="twoFactorAuthenticationCode">Two Factor Code</param>
|
||||
/// <returns>A <see cref="Task"/> for the request's execution.</returns>
|
||||
Task Delete(Uri uri, string twoFactorAuthenticationCode);
|
||||
|
||||
/// <summary>
|
||||
/// Deletes the API object at the specified URI.
|
||||
/// </summary>
|
||||
|
||||
@@ -164,6 +164,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="twoFactorAuthenticationCode">Two Factor Code</param>
|
||||
/// <returns>The returned <seealso cref="HttpStatusCode"/></returns>
|
||||
Task<HttpStatusCode> Delete(Uri uri, string twoFactorAuthenticationCode);
|
||||
|
||||
/// <summary>
|
||||
/// Performs an asynchronous HTTP DELETE request that expects an empty response.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user