implement settings api
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
namespace TorchRemote.Models.Responses;
|
||||
|
||||
public record struct LogLineResponse(DateTime Time, LogLineLevel Level, string Logger, string Message);
|
||||
public record LogLineResponse(DateTime Time, LogLineLevel Level, string Logger, string Message);
|
||||
|
||||
public enum LogLineLevel
|
||||
{
|
||||
|
@@ -1,15 +1,6 @@
|
||||
namespace TorchRemote.Models.Responses;
|
||||
using Json.Schema;
|
||||
|
||||
public record SettingInfoResponse(string Name, ICollection<SettingPropertyInfo> Properties);
|
||||
public record SettingPropertyInfo(string Name, string? Description, int? Order, Guid Type);
|
||||
namespace TorchRemote.Models.Responses;
|
||||
|
||||
public struct SettingPropertyTypeEnum
|
||||
{
|
||||
public static readonly Guid Integer = new("95c0d25b-e44d-4505-9549-48ee9c14bce8");
|
||||
public static readonly Guid Boolean = new("028ef347-1fc3-486a-b70b-3d3b1dcdb538");
|
||||
public static readonly Guid Number = new("009ced71-4a69-4af0-abb9-ec3339fffce0");
|
||||
public static readonly Guid String = new("22dbed1b-b976-44b4-98c9-d1b742a93f0c");
|
||||
public static readonly Guid DateTime = new("f0978b29-9da9-4289-85c9-41d5b92056e8");
|
||||
public static readonly Guid TimeSpan = new("7a2bebf1-78f5-4e4e-8d83-18914dbee55c");
|
||||
public static readonly Guid Color = new("99c74632-0fa9-469b-ba05-825ba21a017b");
|
||||
}
|
||||
public record SettingInfoResponse(string Name, JsonSchema Schema, ICollection<SettingPropertyInfo> PropertyInfos);
|
||||
public record SettingPropertyInfo(string Name, string PropertyName, string? Description, int? Order);
|
27
TorchRemote.Models/Shared/Settings/Property.cs
Normal file
27
TorchRemote.Models/Shared/Settings/Property.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace TorchRemote.Models.Shared.Settings;
|
||||
|
||||
[JsonDerivedType(typeof(IntegerProperty), "integer")]
|
||||
[JsonDerivedType(typeof(StringProperty), "string")]
|
||||
[JsonDerivedType(typeof(BooleanProperty), "boolean")]
|
||||
[JsonDerivedType(typeof(NumberProperty), "number")]
|
||||
[JsonDerivedType(typeof(ObjectProperty), "object")]
|
||||
[JsonDerivedType(typeof(EnumProperty), "enum")]
|
||||
[JsonDerivedType(typeof(DateTimeProperty), "date-time")]
|
||||
[JsonDerivedType(typeof(DurationProperty), "duration")]
|
||||
[JsonDerivedType(typeof(UriProperty), "uri")]
|
||||
[JsonDerivedType(typeof(UuidProperty), "uuid")]
|
||||
public abstract record PropertyBase(string Name);
|
||||
|
||||
public record IntegerProperty(string Name, int? Value) : PropertyBase(Name);
|
||||
public record NumberProperty(string Name, double? Value) : PropertyBase(Name);
|
||||
public record StringProperty(string Name, string? Value) : PropertyBase(Name);
|
||||
public record EnumProperty(string Name, string Value) : PropertyBase(Name);
|
||||
public record BooleanProperty(string Name, bool? Value) : PropertyBase(Name);
|
||||
public record ObjectProperty(string Name, JsonElement Value) : PropertyBase(Name);
|
||||
public record DateTimeProperty(string Name, DateTime? Value) : PropertyBase(Name);
|
||||
public record DurationProperty(string Name, TimeSpan? Value) : PropertyBase(Name);
|
||||
public record UriProperty(string Name, Uri? Value) : PropertyBase(Name);
|
||||
public record UuidProperty(string Name, Guid? Value) : PropertyBase(Name);
|
@@ -8,6 +8,8 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="System.Text.Json" Version="7.0.0-preview.6.22324.4" />
|
||||
<PackageReference Include="Json.More.Net" Version="1.7.1" />
|
||||
<PackageReference Include="JsonSchema.Net" Version="3.2.1" />
|
||||
<PackageReference Include="System.Text.Json" Version="7.0.0-rc.1.22426.10" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
Reference in New Issue
Block a user