Struct XapiVersion
- Namespace
- Xapi
- Assembly
- Xapi.Core.dll
An xAPI version profile. Reading, writing and validation take one explicitly, so one process can serve both versions.
public readonly struct XapiVersion : IEquatable<XapiVersion>
- Implements
- Inherited Members
Remarks
Only two profiles exist: xAPI 1.0.3 and xAPI 2.0.0 (IEEE 9274.1.1). Patch versions map onto these profiles, see TryParseHeader(string?, out XapiVersion).
Properties
HeaderValue
The value for the X-Experience-API-Version header and the statement version property:
1.0.3 or 2.0.0. The default struct value reports 2.0.0.
public string HeaderValue { get; }
Property Value
IsV2
Whether this is the xAPI 2.0.0 profile (also true for the default struct value).
public bool IsV2 { get; }
Property Value
V1_0_3
xAPI 1.0.3.
public static XapiVersion V1_0_3 { get; }
Property Value
V2_0_0
xAPI 2.0.0, published as IEEE 9274.1.1-2023.
public static XapiVersion V2_0_0 { get; }
Property Value
Methods
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.
Equals(XapiVersion)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(XapiVersion other)
Parameters
otherXapiVersionAn object to compare with this object.
Returns
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 HeaderValue.
public override string ToString()
Returns
- string
The version string.
TryParseHeader(string?, out XapiVersion)
Maps an X-Experience-API-Version header value onto a profile: 1.0 and 1.0.x map to
1.0.3, 2.0 and 2.0.x map to 2.0.0. Anything else (including 0.9x and 2.1.0 or later) fails.
public static bool TryParseHeader(string? value, out XapiVersion version)
Parameters
valuestringThe header value.
versionXapiVersionThe matching profile when the method returns true.
Returns
Remarks
IEEE 9274.1.1, 4.1.7: "2.0" is accepted as 2.0.0 and versions 2.1.0 or greater are rejected.
Operators
operator ==(XapiVersion, XapiVersion)
Equality operator.
public static bool operator ==(XapiVersion left, XapiVersion right)
Parameters
leftXapiVersionThe first version.
rightXapiVersionThe second version.
Returns
operator !=(XapiVersion, XapiVersion)
Inequality operator.
public static bool operator !=(XapiVersion left, XapiVersion right)
Parameters
leftXapiVersionThe first version.
rightXapiVersionThe second version.