Table of Contents

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

value string

The string value representing the clearance level.

Exceptions

ArgumentNullException

Thrown when value is null.

Properties

Interactive

Interactive challenge requiring user action.

public static ClearanceLevel Interactive { get; }

Property Value

ClearanceLevel

Remarks

The most secure level that requires explicit user interaction.

JsChallenge

JavaScript challenge execution.

public static ClearanceLevel JsChallenge { get; }

Property Value

ClearanceLevel

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

ClearanceLevel

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

ClearanceLevel

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

string

Methods

Create(string)

Creates a new instance of the extensible enum from the specified string value.

public static ClearanceLevel Create(string value)

Parameters

value string

The 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

other ClearanceLevel

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

Equals(object?)

Indicates whether this instance and a specified object are equal.

public override bool Equals(object? obj)

Parameters

obj object

The object to compare with the current instance.

Returns

bool

true if obj and 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

left ClearanceLevel
right ClearanceLevel

Returns

bool

implicit operator string(ClearanceLevel)

Implicitly converts a ClearanceLevel to its string value.

public static implicit operator string(ClearanceLevel level)

Parameters

level ClearanceLevel

The level to convert.

Returns

string

implicit operator ClearanceLevel(string)

Implicitly converts a string to a ClearanceLevel.

public static implicit operator ClearanceLevel(string value)

Parameters

value string

The string value to convert.

Returns

ClearanceLevel

operator !=(ClearanceLevel, ClearanceLevel)

Determines whether two ClearanceLevel values are not equal.

public static bool operator !=(ClearanceLevel left, ClearanceLevel right)

Parameters

left ClearanceLevel
right ClearanceLevel

Returns

bool