Struct ClearanceLevel
- Namespace
- Cloudflare.NET.Turnstile.Models
- Assembly
- Cloudflare.NET.dll
Clearance level determining challenge difficulty.
Clearance levels control the complexity of the challenge presented to users based on security requirements.
[JsonConverter(typeof(ExtensibleEnumConverter<ClearanceLevel>))]
public readonly struct ClearanceLevel : IExtensibleEnum<ClearanceLevel>, IEquatable<ClearanceLevel>
- Implements
- Inherited Members
Remarks
This is an extensible enum that provides IntelliSense for known values while allowing custom values for new levels that may be added to the Cloudflare API in the future.
Constructors
ClearanceLevel(string)
Creates a new ClearanceLevel with the specified value.
public ClearanceLevel(string value)
Parameters
valuestringThe string value representing the clearance level.
Exceptions
- ArgumentNullException
Thrown when
valueis null.
Properties
Interactive
Interactive challenge requiring user action.
public static ClearanceLevel Interactive { get; }
Property Value
Remarks
The most secure level that requires explicit user interaction.
JsChallenge
JavaScript challenge execution.
public static ClearanceLevel JsChallenge { get; }
Property Value
Remarks
Requires the client to execute JavaScript to prove it's a real browser.
Managed
Managed challenge level.
public static ClearanceLevel Managed { get; }
Property Value
Remarks
Cloudflare manages the challenge difficulty based on risk assessment.
NoClearance
No challenge - simply checks for bot behavior.
public static ClearanceLevel NoClearance { get; }
Property Value
Remarks
The least intrusive level that only monitors for obvious bot patterns.
Value
Gets the underlying string value of this clearance level.
public string Value { get; }
Property Value
Methods
Create(string)
Creates a new instance of the extensible enum from the specified string value.
public static ClearanceLevel Create(string value)
Parameters
valuestringThe string value to wrap.
Returns
- ClearanceLevel
A new instance of ClearanceLevel containing the specified value.
Equals(ClearanceLevel)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(ClearanceLevel other)
Parameters
otherClearanceLevelAn object to compare with this object.
Returns
Equals(object?)
Indicates whether this instance and a specified object are equal.
public override bool Equals(object? obj)
Parameters
objobjectThe object to compare with the current instance.
Returns
- bool
true if
objand this instance are the same type and represent the same value; otherwise, false.
GetHashCode()
Returns the hash code for this instance.
public override int GetHashCode()
Returns
- int
A 32-bit signed integer that is the hash code for this instance.
ToString()
Returns the fully qualified type name of this instance.
public override string ToString()
Returns
- string
The fully qualified type name.
Operators
operator ==(ClearanceLevel, ClearanceLevel)
Determines whether two ClearanceLevel values are equal.
public static bool operator ==(ClearanceLevel left, ClearanceLevel right)
Parameters
leftClearanceLevelrightClearanceLevel
Returns
implicit operator string(ClearanceLevel)
Implicitly converts a ClearanceLevel to its string value.
public static implicit operator string(ClearanceLevel level)
Parameters
levelClearanceLevelThe level to convert.
Returns
implicit operator ClearanceLevel(string)
Implicitly converts a string to a ClearanceLevel.
public static implicit operator ClearanceLevel(string value)
Parameters
valuestringThe string value to convert.
Returns
operator !=(ClearanceLevel, ClearanceLevel)
Determines whether two ClearanceLevel values are not equal.
public static bool operator !=(ClearanceLevel left, ClearanceLevel right)
Parameters
leftClearanceLevelrightClearanceLevel