using System.Diagnostics.CodeAnalysis; namespace Octokit { /// /// Represents the response to a 2FA challenge from the API /// public class TwoFactorChallengeResult { /// /// Helper action for resending the 2FA code /// [SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes", Justification = "It really is immutable yo!")] public static readonly TwoFactorChallengeResult RequestResendCode = new TwoFactorChallengeResult(null, true); /// /// Construct an instance of TwoFactorChallengeResult /// /// public TwoFactorChallengeResult(string authenticationCode) : this(authenticationCode, false) { Ensure.ArgumentNotNull(authenticationCode, nameof(authenticationCode)); } TwoFactorChallengeResult(string authenticationCode, bool resendCodeRequested) { AuthenticationCode = authenticationCode; ResendCodeRequested = resendCodeRequested; } /// /// True if this request should resent an authentication code /// public bool ResendCodeRequested { get; private set; } /// /// The user-specified authentication code /// public string AuthenticationCode { get; private set; } } }