using System;
using System.Diagnostics.CodeAnalysis;
using System.Reactive;
namespace Octokit.Reactive
{
public interface IObservableAuthorizationsClient
{
///
/// Get all s for the authenticated user. This method requires basic auth.
///
///
/// See API documentation for more
/// details.
///
/// A list of s for the authenticated user.
[SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate",
Justification = "It's an API call, so it's not a property.")]
IObservable GetAll();
///
/// Get all s for the authenticated user. This method requires basic auth.
///
///
/// See API documentation for more
/// details.
///
/// Options for changing the API response
/// A list of s for the authenticated user.
[SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate",
Justification = "It's an API call, so it's not a property.")]
IObservable GetAll(ApiOptions options);
///
/// Get a specific for the authenticated user. This method requires basic auth.
///
///
/// See API documentation for
/// more details.
///
/// The id of the
/// An
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get",
Justification = "It's fiiiine. It's fine. Trust us.")]
IObservable Get(long id);
///
/// Creates a new personal token for the authenticated user.
///
///
/// This method requires authentication.
/// See the API documentation for more information.
///
/// Describes the new authorization to create
///
/// Thrown when the current user does not have permission to make this request.
///
///
/// Thrown when the current account has two-factor authentication enabled and an authentication code is required.
///
/// Thrown when a general API error occurs.
/// The created .
IObservable Create(NewAuthorization newAuthorization);
///
/// Creates a new personal token for the authenticated user.
///
///
/// This method requires authentication.
/// See the API documentation for more information.
///
/// The two-factor authentication code in response to the current user's previous challenge
/// Describes the new authorization to create
///
/// Thrown when the current user does not have permission to make this request.
///
///
/// Thrown when the current account has two-factor authentication enabled and an authentication code is required.
///
/// Thrown when a general API error occurs.
/// The created .
IObservable Create(NewAuthorization newAuthorization, string twoFactorAuthenticationCode);
///
/// Creates a new authorization for the specified OAuth application if an authorization for that application
/// doesn’t already exist for the user; otherwise, it fails.
///
///
/// This method requires authentication.
/// See the API documentation for more information.
///
/// Client Id of the OAuth application for the token
/// The client secret
/// Describes the new authorization to create
///
/// Thrown when the current user does not have permission to make this request.
///
///
/// Thrown when the current account has two-factor authentication enabled and an authentication code is required.
///
/// Thrown when a general API error occurs.
/// The created .
IObservable Create(
string clientId,
string clientSecret,
NewAuthorization newAuthorization);
///
/// Creates a new authorization for the specified OAuth application if an authorization for that application
/// doesn’t already exist for the user; otherwise, it fails.
///
///
/// This method requires authentication.
/// See the API documentation for more information.
///
/// Client Id of the OAuth application for the token
/// The client secret
/// The two-factor authentication code in response to the current user's previous challenge
/// Describes the new authorization to create
///
/// Thrown when the current user does not have permission to make this request.
///
///
/// Thrown when the current account has two-factor authentication enabled and an authentication code is required.
///
/// Thrown when a general API error occurs.
/// The created .
IObservable Create(
string clientId,
string clientSecret,
NewAuthorization newAuthorization,
string twoFactorAuthenticationCode);
///
/// This method will create a new authorization for the specified OAuth application, only if an authorization
/// for that application doesn’t already exist for the user. It returns the user’s token for the application
/// if one exists. Otherwise, it creates one.
///
///
/// See API
/// documentation for more details.
///
/// Client Id for the OAuth application that is requesting the token
/// The client secret
/// Defines the scopes and metadata for the token
/// Thrown when the user does not have permission to make
/// this request. Check
/// Thrown when the current account has two-factor
/// authentication enabled.
///
IObservable GetOrCreateApplicationAuthentication(
string clientId,
string clientSecret,
NewAuthorization newAuthorization);
///
/// This method will create a new authorization for the specified OAuth application, only if an authorization
/// for that application doesn’t already exist for the user. It returns the user’s token for the application
/// if one exists. Otherwise, it creates one.
///
///
/// See API
/// documentation for more details.
///
/// Client Id for the OAuth application that is requesting the token
/// The client secret
/// Defines the scopes and metadata for the token
/// The two-factor authentication code provided by the user
/// Thrown when the user does not have permission to make
/// this request. Check
/// Thrown when the two-factor code is not
/// valid.
///
IObservable GetOrCreateApplicationAuthentication(
string clientId,
string clientSecret,
NewAuthorization newAuthorization,
string twoFactorAuthenticationCode);
///
/// Checks the validity of an OAuth token without running afoul of normal rate limits for failed login attempts.
///
///
/// This method requires authentication.
/// See the API documentation for more information.
///
/// Client Id of the OAuth application for the token
/// The OAuth token to check
/// The valid .
IObservable CheckApplicationAuthentication(string clientId, string accessToken);
///
/// Resets a valid OAuth token for an OAuth application without end user involvement.
///
///
/// This method requires authentication.
/// See the API documentation for more information.
///
/// ClientID of the OAuth application for the token
/// The OAuth token to reset
/// The valid with a new OAuth token
IObservable ResetApplicationAuthentication(string clientId, string accessToken);
///
/// Revokes a single OAuth token for an OAuth application.
///
///
/// This method requires authentication.
/// See the API documentation for more information.
///
/// ClientID of the OAuth application for the token
/// The OAuth token to revoke
///
IObservable RevokeApplicationAuthentication(string clientId, string accessToken);
///
/// Update the specified by the id.
///
/// The id of the
/// The changes to make to the authorization
///
IObservable Update(long id, AuthorizationUpdate authorizationUpdate);
///
/// Deletes the specified .
///
///
/// This method requires authentication.
/// See the API
/// documentation for more details.
///
/// The system-wide Id of the authorization to delete
///
/// Thrown when the current user does not have permission to make the request.
///
/// Thrown when a general API error occurs.
IObservable Delete(long id);
///
/// Deletes the specified .
///
///
/// This method requires authentication.
/// See the API
/// documentation for more details.
///
/// The system-wide Id of the authorization to delete
/// Two factor authorization code
///
/// Thrown when the current user does not have permission to make the request.
///
/// Thrown when a general API error occurs.
IObservable Delete(long id, string twoFactorAuthenticationCode);
}
}