more work on api & rename to Pilz.Net

This commit is contained in:
Pilzinsel64
2024-08-16 06:59:39 +02:00
parent f57aef5f4f
commit 2efb4f141c
91 changed files with 299 additions and 241 deletions

View File

@@ -0,0 +1,110 @@
using Newtonsoft.Json;
namespace Pilz.Net.CloudProviders.Nextcloud.Client.Apps.Tables.Model;
public class Column
{
[JsonProperty("type")]
private string? type;
[JsonProperty("subtype")]
private string? subtype;
[JsonProperty("id")]
public long ColumnId { get; set; }
[JsonProperty("tableId")]
public long TableId { get; set; }
[JsonProperty("title")]
public string? Title { get; set; }
[JsonProperty("createdBy")]
public string? CreatedBy { get; set; }
[JsonProperty("createdAt")]
public DateTime CreatedAt { get; set; }
[JsonProperty("lastEditBy")]
public string? LastEditBy { get; set; }
[JsonProperty("lastEditAt")]
public DateTime LastEditAt { get; set; }
[JsonProperty("mandatory")]
public bool Mandatory { get; set; }
[JsonProperty("description")]
public string? Description { get; set; }
[JsonProperty("numberDefault")]
public float? NumberDefault { get; set; }
[JsonProperty("numberMin")]
public float? NumberMin { get; set; }
[JsonProperty("numberMax")]
public float? NumberMax { get; set; }
[JsonProperty("numberDecimals")]
public float NumberDecimals { get; set; }
[JsonProperty("numberPrefix")]
public string? NumberPrefix { get; set; }
[JsonProperty("numberSuffix")]
public string? NumberSuffix { get; set; }
[JsonProperty("textDefault")]
public string? TextDefault { get; set; }
[JsonProperty("textAllowedPattern")]
public string? TextAllowedPattern { get; set; }
[JsonProperty("textMaxLength")]
public int? TextMaxLength { get; set; }
[JsonProperty("selectionOptions")]
public List<ColumnSelectionOption> SelectionOptions { get; } = new();
[JsonProperty("selectionDefault")]
public int? SelectionDefault { get; set; }
[JsonProperty("datetimeDefault")]
public DateTime? DatetimeDefault { get; set; }
[JsonIgnore]
public ColumnType Type
{
get => type switch
{
"text" => ColumnType.Text,
"selection" => ColumnType.Selection,
"datetime" => ColumnType.DateTime,
_ => ColumnType.Unknown,
};
set => type = value switch
{
ColumnType.Text => "text",
ColumnType.Selection => "selection",
ColumnType.DateTime => "datetime",
_ => "text"
};
}
[JsonIgnore]
public ColumnSubtype Subtype
{
get => subtype switch
{
"line" => ColumnSubtype.Line,
"" => ColumnSubtype.None,
_ => ColumnSubtype.Unknown,
};
set => subtype = value switch
{
ColumnSubtype.Line => "line",
_ => ""
};
}
}

View File

@@ -0,0 +1,12 @@
using Newtonsoft.Json;
namespace Pilz.Net.CloudProviders.Nextcloud.Client.Apps.Tables.Model;
public class ColumnSelectionOption
{
[JsonProperty("id")]
public long Id { get; set; }
[JsonProperty("label")]
public string? Label { get; set; }
}

View File

@@ -0,0 +1,8 @@
namespace Pilz.Net.CloudProviders.Nextcloud.Client.Apps.Tables.Model;
public enum ColumnSubtype
{
None,
Unknown,
Line
}

View File

@@ -0,0 +1,9 @@
namespace Pilz.Net.CloudProviders.Nextcloud.Client.Apps.Tables.Model;
public enum ColumnType
{
Unknown,
Text,
Selection,
DateTime
}

View File

@@ -0,0 +1,5 @@
namespace Pilz.Net.CloudProviders.Nextcloud.Client.Apps.Tables.Model;
public class Columns : List<Column>
{
}

View File

@@ -0,0 +1,27 @@
using Newtonsoft.Json;
namespace Pilz.Net.CloudProviders.Nextcloud.Client.Apps.Tables.Model;
public class Row
{
[JsonProperty("id")]
public long RowId { get; set; } = -1;
[JsonProperty("tableId")]
public long TableId { get; set; } = -1;
[JsonProperty("createdBy")]
public string? CreatedBy { get; set; }
[JsonProperty("createdAt")]
public DateTime CreatedAt { get; set; }
[JsonProperty("lastEditBy")]
public string? LastEditBy { get; set; }
[JsonProperty("lastEditAt")]
public DateTime LastEditAt { get; set; }
[JsonProperty("data")]
public List<RowData> Data { get; set; } = new();
}

View File

@@ -0,0 +1,12 @@
using Newtonsoft.Json;
namespace Pilz.Net.CloudProviders.Nextcloud.Client.Apps.Tables.Model;
public class RowData
{
[JsonProperty("columnId")]
public long ColumnId { get; set; }
[JsonProperty("value")]
public object? Value { get; set; }
}

View File

@@ -0,0 +1,5 @@
namespace Pilz.Net.CloudProviders.Nextcloud.Client.Apps.Tables.Model;
public class RowSimple : List<object>
{
}

View File

@@ -0,0 +1,9 @@
using Newtonsoft.Json;
namespace Pilz.Net.CloudProviders.Nextcloud.Client.Apps.Tables.Model;
public class RowUpdate
{
[JsonProperty("data")]
public Dictionary<long, object?> Data { get; set; } = new();
}

View File

@@ -0,0 +1,5 @@
namespace Pilz.Net.CloudProviders.Nextcloud.Client.Apps.Tables.Model;
public class Rows : List<Row>
{
}

View File

@@ -0,0 +1,5 @@
namespace Pilz.Net.CloudProviders.Nextcloud.Client.Apps.Tables.Model;
public class RowsSimple : List<RowSimple>
{
}