mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-06-06 20:13:40 +00:00
Implement GetOrCreateApplicationAuthentication
Implements the endpoint for creating an application authorization token.
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace Octokit
|
||||
{
|
||||
#if !NETFX_CORE
|
||||
[Serializable]
|
||||
#endif
|
||||
public class TwoFactorRequiredException : AuthorizationException
|
||||
{
|
||||
public TwoFactorRequiredException()
|
||||
{
|
||||
}
|
||||
|
||||
public TwoFactorRequiredException(string message) : base(message)
|
||||
{
|
||||
}
|
||||
|
||||
public TwoFactorRequiredException(string message, Exception innerException) : base(message, innerException)
|
||||
{
|
||||
}
|
||||
|
||||
public TwoFactorRequiredException(string message, TwoFactorType twoFactorType)
|
||||
: base(message)
|
||||
{
|
||||
TwoFactorType = twoFactorType;
|
||||
}
|
||||
|
||||
#if !NETFX_CORE
|
||||
protected TwoFactorRequiredException(SerializationInfo info, StreamingContext context)
|
||||
: base(info, context)
|
||||
{
|
||||
if (info == null) return;
|
||||
TwoFactorType = (TwoFactorType) (info.GetInt32("TwoFactorType"));
|
||||
}
|
||||
|
||||
public override void GetObjectData(SerializationInfo info, StreamingContext context)
|
||||
{
|
||||
base.GetObjectData(info, context);
|
||||
info.AddValue("TwoFactorType", TwoFactorType);
|
||||
}
|
||||
#endif
|
||||
|
||||
public TwoFactorType TwoFactorType { get; private set; }
|
||||
}
|
||||
|
||||
public enum TwoFactorType
|
||||
{
|
||||
None,
|
||||
Unknown,
|
||||
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Sms")] Sms,
|
||||
AuthenticatorApp
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user