Table of Contents

Class CivitaiValidation

Namespace
CivitaiSharp.Core.Validation
Assembly
CivitaiSharp.Core.dll

Provides validation methods for Civitai-specific input constraints.

public static class CivitaiValidation
Inheritance
CivitaiValidation
Inherited Members

Methods

IsValidUsername(string?)

Validates that a username conforms to Civitai's username requirements. Usernames can only contain letters (a-z, A-Z), numbers (0-9), and underscores (_).

public static bool IsValidUsername(string? username)

Parameters

username string

The username to validate.

Returns

bool

true if the username is valid; otherwise, false.

Remarks

This validation is performed client-side to provide early feedback. The server may have additional validation rules.

ThrowIfInvalidUsername(string?, string?)

Validates that a username conforms to Civitai's username requirements and throws if invalid.

public static void ThrowIfInvalidUsername(string? username, string? parameterName = null)

Parameters

username string

The username to validate.

parameterName string

The name of the parameter (for the exception).

Exceptions

ArgumentException

Thrown if the username is null, whitespace, or contains invalid characters.