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
usernamestringThe username to validate.
Returns
- bool
trueif 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
usernamestringThe username to validate.
parameterNamestringThe name of the parameter (for the exception).
Exceptions
- ArgumentException
Thrown if the username is null, whitespace, or contains invalid characters.