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:
Haacked
2015-04-21 13:40:26 -07:00
parent 4ca3db562a
commit 23bb76a112
7 changed files with 123 additions and 6 deletions
+20
View File
@@ -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>