Add methods to interface 😶 and observable client

This commit is contained in:
Henrik Andersson
2015-03-15 09:44:24 +10:00
parent d5ba7b2737
commit 9faaf53304
4 changed files with 167 additions and 1 deletions
@@ -77,6 +77,52 @@ namespace Octokit.Reactive
NewAuthorization newAuthorization,
string twoFactorAuthenticationCode);
/// <summary>
/// </summary>
/// <remarks>
/// This method requires authentication.
/// See the <a href="https://developer.github.com/v3/oauth_authorizations/#check-an-authorization">API documentation</a> for more information.
/// </remarks>
/// <param name="clientId">Client ID of the OAuth application for the token</param>
/// <param name="accessToken">The OAuth token to check</param>
/// <returns>The valid <see cref="ApplicationAuthorization"/>.</returns>
IObservable<ApplicationAuthorization> CheckApplicationAuthentication(string clientId, string accessToken);
/// <summary>
/// Resets a valid OAuth token for an OAuth application without end user involvment.
/// </summary>
/// <remarks>
/// This method requires authentication.
/// See the <a href="https://developer.github.com/v3/oauth_authorizations/#reset-an-authorization">API documentation</a> for more information.
/// </remarks>
/// <param name="clientId">ClientID of the OAuth application for the token</param>
/// <param name="accessToken">The OAuth token to reset</param>
/// <returns>The valid <see cref="ApplicationAuthorization"/> with a new OAuth token</returns>
IObservable<ApplicationAuthorization> ResetApplicationAuthentication(string clientId, string accessToken);
/// <summary>
/// Revokes a single OAuth token for an OAuth application.
/// </summary>
/// <remarks>
/// This method requires authentication.
/// See the <a href="https://developer.github.com/v3/oauth_authorizations/#revoke-an-authorization-for-an-application">API documentation for more information.</a>
/// </remarks>
/// <param name="clientId">ClientID of the OAuth application for the token</param>
/// <param name="accessToken">The OAuth token to revoke</param>
/// <returns></returns>
IObservable<Unit> RevokeApplicationAuthentication(string clientId, string accessToken);
/// <summary>
/// Revokes every OAuth token for an OAuth application.
/// </summary>
/// <remarks>
/// This method requires authentication.
/// See the <a href="https://developer.github.com/v3/oauth_authorizations/#revoke-all-authorizations-for-an-application">API documentation for more information.</a>
/// </remarks>
/// <param name="clientId">ClientID of the OAuth application for the token</param>
/// <returns></returns>
IObservable<Unit> RevokeAllApplicationAuthentications(string clientId);
/// <summary>
/// Update the <see cref="Authorization"/> specified by the id.
/// </summary>
@@ -112,6 +112,80 @@ namespace Octokit.Reactive
.ToObservable();
}
/// <summary>
/// </summary>
/// <remarks>
/// This method requires authentication.
/// See the <a href="https://developer.github.com/v3/oauth_authorizations/#check-an-authorization">API documentation</a> for more information.
/// </remarks>
/// <param name="clientId">Client ID of the OAuth application for the token</param>
/// <param name="accessToken">The OAuth token to check</param>
/// <returns>The valid <see cref="ApplicationAuthorization"/>.</returns>
public IObservable<ApplicationAuthorization> CheckApplicationAuthentication(string clientId, string accessToken)
{
Ensure.ArgumentNotNullOrEmptyString("clientId", clientId);
Ensure.ArgumentNotNullOrEmptyString("accessToken", accessToken);
return _client.CheckApplicationAuthentication(clientId, accessToken)
.ToObservable();
}
/// <summary>
/// Resets a valid OAuth token for an OAuth application without end user involvment.
/// </summary>
/// <remarks>
/// This method requires authentication.
/// See the <a href="https://developer.github.com/v3/oauth_authorizations/#reset-an-authorization">API documentation</a> for more information.
/// </remarks>
/// <param name="clientId">ClientID of the OAuth application for the token</param>
/// <param name="accessToken">The OAuth token to reset</param>
/// <returns>The valid <see cref="ApplicationAuthorization"/> with a new OAuth token</returns>
public IObservable<ApplicationAuthorization> ResetApplicationAuthentication(string clientId, string accessToken)
{
Ensure.ArgumentNotNullOrEmptyString("clientId", clientId);
Ensure.ArgumentNotNullOrEmptyString("accessToken", accessToken);
return _client.ResetApplicationAuthentication(clientId, accessToken)
.ToObservable();
}
/// <summary>
/// Revokes a single OAuth token for an OAuth application.
/// </summary>
/// <remarks>
/// This method requires authentication.
/// See the <a href="https://developer.github.com/v3/oauth_authorizations/#revoke-an-authorization-for-an-application">API documentation for more information.</a>
/// </remarks>
/// <param name="clientId">ClientID of the OAuth application for the token</param>
/// <param name="accessToken">The OAuth token to revoke</param>
/// <returns></returns>
public IObservable<Unit> RevokeApplicationAuthentication(string clientId, string accessToken)
{
Ensure.ArgumentNotNullOrEmptyString("clientId", clientId);
Ensure.ArgumentNotNullOrEmptyString("accessToken", accessToken);
return _client.RevokeApplicationAuthentication(clientId, accessToken)
.ToObservable();
}
/// <summary>
/// Revokes every OAuth token for an OAuth application.
/// </summary>
/// <remarks>
/// This method requires authentication.
/// See the <a href="https://developer.github.com/v3/oauth_authorizations/#revoke-all-authorizations-for-an-application">API documentation for more information.</a>
/// </remarks>
/// <param name="clientId">ClientID of the OAuth application for the token</param>
/// <returns></returns>
public IObservable<Unit> RevokeAllApplicationAuthentications(string clientId)
{
Ensure.ArgumentNotNullOrEmptyString("clientId", clientId);
return _client.RevokeAllApplicationAuthentications(clientId)
.ToObservable();
}
/// <summary>
/// Update the <see cref="Authorization"/> specified by the id.
/// </summary>
+1 -1
View File
@@ -175,6 +175,7 @@ namespace Octokit
throw new TwoFactorChallengeFailedException(e);
}
}
/// <summary>
/// </summary>
/// <remarks>
@@ -182,7 +183,6 @@ namespace Octokit
/// See the <a href="https://developer.github.com/v3/oauth_authorizations/#check-an-authorization">API documentation</a> for more information.
/// </remarks>
/// <param name="clientId">Client ID of the OAuth application for the token</param>
/// <param name="clientSecret">The client secret</param>
/// <param name="accessToken">The OAuth token to check</param>
/// <returns>The valid <see cref="ApplicationAuthorization"/>.</returns>
public async Task<ApplicationAuthorization> CheckApplicationAuthentication(string clientId, string accessToken)
+46
View File
@@ -99,6 +99,52 @@ namespace Octokit
NewAuthorization newAuthorization,
string twoFactorAuthenticationCode);
/// <summary>
/// </summary>
/// <remarks>
/// This method requires authentication.
/// See the <a href="https://developer.github.com/v3/oauth_authorizations/#check-an-authorization">API documentation</a> for more information.
/// </remarks>
/// <param name="clientId">Client ID of the OAuth application for the token</param>
/// <param name="accessToken">The OAuth token to check</param>
/// <returns>The valid <see cref="ApplicationAuthorization"/>.</returns>
Task<ApplicationAuthorization> CheckApplicationAuthentication(string clientId, string accessToken);
/// <summary>
/// Resets a valid OAuth token for an OAuth application without end user involvment.
/// </summary>
/// <remarks>
/// This method requires authentication.
/// See the <a href="https://developer.github.com/v3/oauth_authorizations/#reset-an-authorization">API documentation</a> for more information.
/// </remarks>
/// <param name="clientId">ClientID of the OAuth application for the token</param>
/// <param name="accessToken">The OAuth token to reset</param>
/// <returns>The valid <see cref="ApplicationAuthorization"/> with a new OAuth token</returns>
Task<ApplicationAuthorization> ResetApplicationAuthentication(string clientId, string accessToken);
/// <summary>
/// Revokes a single OAuth token for an OAuth application.
/// </summary>
/// <remarks>
/// This method requires authentication.
/// See the <a href="https://developer.github.com/v3/oauth_authorizations/#revoke-an-authorization-for-an-application">API documentation for more information.</a>
/// </remarks>
/// <param name="clientId">ClientID of the OAuth application for the token</param>
/// <param name="accessToken">The OAuth token to revoke</param>
/// <returns>A <see cref="Task"/> for the request's execution.</returns>
Task RevokeApplicationAuthentication(string clientId, string accessToken);
/// <summary>
/// Revokes every OAuth token for an OAuth application.
/// </summary>
/// <remarks>
/// This method requires authentication.
/// See the <a href="https://developer.github.com/v3/oauth_authorizations/#revoke-all-authorizations-for-an-application">API documentation for more information.</a>
/// </remarks>
/// <param name="clientId">ClientID of the OAuth application for the token</param>
/// <returns>A <see cref="Task"/> for the request's execution.</returns>
Task RevokeAllApplicationAuthentications(string clientId);
/// <summary>
/// Updates the specified <see cref="Authorization"/>.
/// </summary>