Struct AirIdentifier
- Namespace
- CivitaiSharp.Sdk.Air
- Assembly
- CivitaiSharp.Sdk.dll
Represents an AIR (Artificial Intelligence Resource) identifier for Civitai models and assets.
Format: urn:air:{ecosystem}:{type}:{source}:{modelId}@{versionId}
(e.g., urn:air:sdxl:checkpoint:civitai:4201@130072)
public readonly struct AirIdentifier : IEquatable<AirIdentifier>, IParsable<AirIdentifier>
- Implements
- Inherited Members
Constructors
AirIdentifier(AirEcosystem, AirAssetType, AirSource, long, long)
Initializes a new instance of the AirIdentifier struct.
public AirIdentifier(AirEcosystem ecosystem, AirAssetType assetType, AirSource source, long modelId, long versionId)
Parameters
ecosystemAirEcosystemThe model ecosystem.
assetTypeAirAssetTypeThe asset type.
sourceAirSourceThe source platform.
modelIdlongThe model ID.
versionIdlongThe version ID.
Exceptions
- ArgumentOutOfRangeException
Thrown when modelId or versionId is less than 1.
Fields
DefaultSource
The default source for Civitai assets.
public const AirSource DefaultSource = Civitai
Field Value
Properties
AssetType
Gets the asset type (e.g., checkpoint, lora).
public AirAssetType AssetType { get; }
Property Value
Ecosystem
Gets the model ecosystem (e.g., sd1, sdxl, flux1).
public AirEcosystem Ecosystem { get; }
Property Value
ModelId
Gets the model ID on Civitai.
public long ModelId { get; }
Property Value
Source
Gets the source platform of the asset.
public AirSource Source { get; }
Property Value
VersionId
Gets the model version ID on Civitai.
public long VersionId { get; }
Property Value
Methods
Create(AirEcosystem, AirAssetType, long, long)
Creates an AIR identifier for a Civitai model.
public static AirIdentifier Create(AirEcosystem ecosystem, AirAssetType assetType, long modelId, long versionId)
Parameters
ecosystemAirEcosystemThe model ecosystem.
assetTypeAirAssetTypeThe asset type.
modelIdlongThe Civitai model ID.
versionIdlongThe Civitai version ID.
Returns
- AirIdentifier
A new AirIdentifier instance.
Equals(AirIdentifier)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(AirIdentifier other)
Parameters
otherAirIdentifierAn 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.
Parse(string)
Parses a string as an AIR identifier.
public static AirIdentifier Parse(string value)
Parameters
valuestringThe string to parse.
Returns
- AirIdentifier
The parsed AirIdentifier.
Exceptions
- ArgumentNullException
Thrown when value is null.
- ArgumentException
Thrown when value is empty or whitespace.
- FormatException
Thrown when value is not a valid AIR identifier.
ToString()
Returns the string representation of this AIR identifier.
public override string ToString()
Returns
- string
The AIR identifier string in the format
urn:air:{ecosystem}:{type}:{source}:{modelId}@{versionId}.
TryParse(string?, out AirIdentifier)
Attempts to parse a string as an AIR identifier.
public static bool TryParse(string? value, out AirIdentifier result)
Parameters
valuestringThe string to parse.
resultAirIdentifierWhen this method returns, contains the parsed identifier if successful.
Returns
- bool
True if parsing succeeded; otherwise, false.
Operators
operator ==(AirIdentifier, AirIdentifier)
Determines whether two AIR identifiers are equal.
public static bool operator ==(AirIdentifier left, AirIdentifier right)
Parameters
leftAirIdentifierrightAirIdentifier
Returns
implicit operator string(AirIdentifier)
Implicitly converts an AIR identifier to its string representation.
public static implicit operator string(AirIdentifier air)
Parameters
airAirIdentifier
Returns
operator !=(AirIdentifier, AirIdentifier)
Determines whether two AIR identifiers are not equal.
public static bool operator !=(AirIdentifier left, AirIdentifier right)
Parameters
leftAirIdentifierrightAirIdentifier