mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-06-07 12:26:18 +00:00
document a bunch of the Exceptions namespace
This commit is contained in:
@@ -7,6 +7,9 @@ using Octokit.Internal;
|
||||
|
||||
namespace Octokit
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
#if !NETFX_CORE
|
||||
[Serializable]
|
||||
#endif
|
||||
@@ -14,15 +17,27 @@ namespace Octokit
|
||||
Justification = "These exceptions are specific to the GitHub API and not general purpose exceptions")]
|
||||
public class TwoFactorRequiredException : AuthorizationException
|
||||
{
|
||||
/// <summary>
|
||||
/// Constructs an instance of TwoFactorRequiredException.
|
||||
/// </summary>
|
||||
public TwoFactorRequiredException() : this(TwoFactorType.None)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructs an instance of TwoFactorRequiredException.
|
||||
/// </summary>
|
||||
/// <param name="twoFactorType">Expected 2FA response type</param>
|
||||
public TwoFactorRequiredException(TwoFactorType twoFactorType)
|
||||
: this(new ApiResponse<object> { StatusCode = HttpStatusCode.Unauthorized}, twoFactorType)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructs an instance of TwoFactorRequiredException.
|
||||
/// </summary>
|
||||
/// <param name="response">The HTTP payload from the server</param>
|
||||
/// <param name="twoFactorType">Expected 2FA response type</param>
|
||||
public TwoFactorRequiredException(IResponse response, TwoFactorType twoFactorType) : base(response)
|
||||
{
|
||||
Debug.Assert(response != null && response.StatusCode == HttpStatusCode.Unauthorized,
|
||||
@@ -37,6 +52,17 @@ namespace Octokit
|
||||
}
|
||||
|
||||
#if !NETFX_CORE
|
||||
/// <summary>
|
||||
/// Constructs an instance of TwoFactorRequiredException.
|
||||
/// </summary>
|
||||
/// <param name="info">
|
||||
/// The <see cref="SerializationInfo"/> that holds the
|
||||
/// serialized object data about the exception being thrown.
|
||||
/// </param>
|
||||
/// <param name="context">
|
||||
/// The <see cref="StreamingContext"/> that contains
|
||||
/// contextual information about the source or destination.
|
||||
/// </param>
|
||||
protected TwoFactorRequiredException(SerializationInfo info, StreamingContext context)
|
||||
: base(info, context)
|
||||
{
|
||||
@@ -51,14 +77,33 @@ namespace Octokit
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Expected 2FA response type
|
||||
/// </summary>
|
||||
public TwoFactorType TwoFactorType { get; private set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Methods for receiving 2FA authentication codes
|
||||
/// </summary>
|
||||
public enum TwoFactorType
|
||||
{
|
||||
/// <summary>
|
||||
/// No method configured
|
||||
/// </summary>
|
||||
None,
|
||||
/// <summary>
|
||||
/// Unknown method
|
||||
/// </summary>
|
||||
Unknown,
|
||||
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Sms")] Sms,
|
||||
/// <summary>
|
||||
/// Receive via SMS
|
||||
/// </summary>
|
||||
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Sms")]
|
||||
Sms,
|
||||
/// <summary>
|
||||
/// Receive via application
|
||||
/// </summary>
|
||||
AuthenticatorApp
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user