Table of Contents

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

string

IsV2

Whether this is the xAPI 2.0.0 profile (also true for the default struct value).

public bool IsV2 { get; }

Property Value

bool

V1_0_3

xAPI 1.0.3.

public static XapiVersion V1_0_3 { get; }

Property Value

XapiVersion

V2_0_0

xAPI 2.0.0, published as IEEE 9274.1.1-2023.

public static XapiVersion V2_0_0 { get; }

Property Value

XapiVersion

Methods

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.

Equals(XapiVersion)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(XapiVersion other)

Parameters

other XapiVersion

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; 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 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

value string

The header value.

version XapiVersion

The matching profile when the method returns true.

Returns

bool

true when the value names a supported version.

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

left XapiVersion

The first version.

right XapiVersion

The second version.

Returns

bool

true when both are the same profile.

operator !=(XapiVersion, XapiVersion)

Inequality operator.

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

Parameters

left XapiVersion

The first version.

right XapiVersion

The second version.

Returns

bool

true when the profiles differ.