using System;
using System.Reflection;
using Semver;
namespace Umbraco.ModelsBuilder.Embedded
{
///
/// Manages API version handshake between client and server.
///
public class ApiVersion
{
///
/// Initializes a new instance of the class.
///
/// The currently executing version.
///
internal ApiVersion(SemVersion executingVersion)
{
Version = executingVersion ?? throw new ArgumentNullException(nameof(executingVersion));
}
private static SemVersion CurrentAssemblyVersion
=> SemVersion.Parse(Assembly.GetExecutingAssembly().GetCustomAttribute().InformationalVersion);
///
/// Gets the currently executing API version.
///
public static ApiVersion Current { get; }
= new ApiVersion(CurrentAssemblyVersion);
///
/// Gets the executing version of the API.
///
public SemVersion Version { get; }
}
}