Files
octokit.net/Octokit.Reactive/IObservableAuthorizationsClient.cs
Haacked 33ad79c0fe Implement GetOrCreateApplicationAuthentication
Implements the endpoint for creating an application authorization token.
2013-10-09 19:54:05 -07:00

59 lines
3.1 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Reactive;
namespace Octokit.Reactive
{
public interface IObservableAuthorizationsClient
{
[SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate",
Justification = "It's an API call, so it's not a property.")]
IObservable<IReadOnlyList<Authorization>> GetAll();
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get",
Justification = "It's fiiiine. It's fine. Trust us.")]
IObservable<Authorization> Get(int id);
/// <summary>
/// This method will create a new authorization for the specified OAuth application, only if an authorization
/// for that application doesnt already exist for the user. It returns the users token for the application
/// if one exists. Otherwise, it creates one.
/// </summary>
/// <param name="clientId">Client ID for the OAuth application that is requesting the token.</param>
/// <param name="clientSecret">The client secret</param>
/// <param name="authorization">Defines the scopes and metadata for the token</param>
/// <exception cref="AuthorizationException">Thrown when the user does not have permission to make
/// this request. Check </exception>
/// <exception cref="TwoFactorRequiredException">Thrown when the current account has two-factor
/// authentication enabled.</exception>
/// <returns></returns>
IObservable<Authorization> GetOrCreateApplicationAuthentication(
string clientId,
string clientSecret,
AuthorizationUpdate authorization);
/// <summary>
/// This method will create a new authorization for the specified OAuth application, only if an authorization
/// for that application doesnt already exist for the user. It returns the users token for the application
/// if one exists. Otherwise, it creates one.
/// </summary>
/// <param name="clientId">Client ID for the OAuth application that is requesting the token.</param>
/// <param name="clientSecret">The client secret</param>
/// <param name="authorization">Defines the scopes and metadata for the token</param>
/// <param name="twoFactorAuthenticationCode"></param>
/// <exception cref="AuthorizationException">Thrown when the user does not have permission to make
/// this request. Check </exception>
/// <exception cref="TwoFactorChallengeFailedException">Thrown when the two-factor code is not
/// valid.</exception>
/// <returns></returns>
IObservable<Authorization> GetOrCreateApplicationAuthentication(
string clientId,
string clientSecret,
AuthorizationUpdate authorization,
string twoFactorAuthenticationCode);
IObservable<Authorization> Update(int id, AuthorizationUpdate authorization);
IObservable<Authorization> Create(AuthorizationUpdate authorization);
IObservable<Unit> Delete(int id);
}
}