diff --git a/DTOs/AlbumList2DTO.cs b/DTOs/AlbumList2DTO.cs new file mode 100644 index 0000000..497d464 --- /dev/null +++ b/DTOs/AlbumList2DTO.cs @@ -0,0 +1,11 @@ +using System.Text.Json.Serialization; +using System.Xml.Serialization; + +namespace Shadow.DTOs; + +public class AlbumList2DTO +{ + [JsonPropertyName("album")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public List? album { get; set; } = null; +} diff --git a/DTOs/AlbumViewShortDTO.cs b/DTOs/AlbumViewShortDTO.cs new file mode 100644 index 0000000..f2323cd --- /dev/null +++ b/DTOs/AlbumViewShortDTO.cs @@ -0,0 +1,51 @@ +using System.Text.Json.Serialization; +using System.Xml.Serialization; + +namespace Shadow.DTOs; + +public class AlbumViewShortDTO +{ + [JsonPropertyName("id")] + public string id { get; set; } = string.Empty; + + [JsonPropertyName("name")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public string? name { get; set; } = null; + + [JsonPropertyName("artist")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public string? artist { get; set; } = string.Empty; + + [JsonPropertyName("artistId")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public string? artistId { get; set; } = string.Empty; + + [JsonPropertyName("coverArt")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public string? coverArt { get; set; } = "default.png"; + + [JsonPropertyName("songCount")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public int? songCount { get; set; } = null; + + [JsonPropertyName("duration")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public int? duration { get; set; } = 0; + + [JsonPropertyName("playCount")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public int? playCount { get; set; } = 0; + + [JsonPropertyName("year")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public int? year { get; set; } = null; + + [JsonPropertyName("genre")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public string? genre { get; set; } = null; + + [JsonPropertyName("played")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public string? played { get; set; } = null; + +} diff --git a/DTOs/ErrorDTO.cs b/DTOs/ErrorDTO.cs new file mode 100644 index 0000000..8cc356b --- /dev/null +++ b/DTOs/ErrorDTO.cs @@ -0,0 +1,13 @@ +using System.Text.Json.Serialization; +using System.Xml.Serialization; + +namespace Shadow.DTOs; + +public class ErrorDTO +{ + [JsonPropertyName("code")] + public int code { get; set; } = 0; + + [JsonPropertyName("message")] + public string message { get; set; } = "Generic error"; +} diff --git a/DTOs/ResponseWrapper.cs b/DTOs/ResponseWrapper.cs new file mode 100644 index 0000000..ca86755 --- /dev/null +++ b/DTOs/ResponseWrapper.cs @@ -0,0 +1,9 @@ +using System.Text.Json.Serialization; + +namespace Shadow.DTOs; + +public class ResponseWrapper +{ + [JsonPropertyName("subsonic-response")] + required public SubsonicResponseDTO SubsonicResponse { get; set; } +} diff --git a/DTOs/SubsonicResponseDTO.cs b/DTOs/SubsonicResponseDTO.cs new file mode 100644 index 0000000..5fa07b7 --- /dev/null +++ b/DTOs/SubsonicResponseDTO.cs @@ -0,0 +1,36 @@ +using System.Text.Json.Serialization; +using System.Xml.Linq; +using System.Xml.Serialization; + +namespace Shadow.DTOs; + +public class SubsonicResponseDTO +{ + [JsonPropertyName("status")] + public string Status { get; set; } = "ok"; + + [JsonPropertyName("version")] + public string version { get; set; } = "1.15.0"; + + [JsonPropertyName("type")] + public string type { get; set; } = "shadow"; + + [JsonPropertyName("serverVersion")] + public string serverVersion { get; set; } = $"0.0.1 ({ThisAssembly.Git.Commit})"; + + [JsonPropertyName("openSubsonic")] + public bool openSubsonic { get; set; } = true; + + [JsonPropertyName("error")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public ErrorDTO? error { get; set; } = null; + + [JsonPropertyName("albumList2")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public AlbumList2DTO? albumList2 { get; set; } = null; + + [JsonPropertyName("user")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public UserPingDTO? userPing { get; set; } = null; + +} diff --git a/DTOs/UserPingDTO.cs b/DTOs/UserPingDTO.cs new file mode 100644 index 0000000..4384720 --- /dev/null +++ b/DTOs/UserPingDTO.cs @@ -0,0 +1,49 @@ +using System.Text.Json.Serialization; + +namespace Shadow.DTOs; + +public class UserPingDTO +{ + [JsonPropertyName("username")] + public string? username { get; set; } + + [JsonPropertyName("scrobblingEnabled")] + public bool scrobblingEnabled { get; set; } = false; + + [JsonPropertyName("adminRole")] + public bool adminRole { get; set; } = false; + + [JsonPropertyName("settingsRole")] + public bool settingsRole { get; set; } = false; + + [JsonPropertyName("downloadRole")] + public bool downlaodRole { get; set; } = true; + + [JsonPropertyName("uploadRole")] + public bool uploadRole { get; set; } = false; + + [JsonPropertyName("playlistRole")] + public bool playlistRole { get; set; } = false; + + [JsonPropertyName("coverArtRole")] + public bool coverArtRole { get; set; } = false; + + [JsonPropertyName("commentRole")] + public bool commentRole { get; set; } = false; + + [JsonPropertyName("podcastRole")] + public bool podcastRole { get; set; } = false; + + [JsonPropertyName("streamRole")] + public bool streamRole { get; set; } = false; + + [JsonPropertyName("jukeboxRole")] + public bool jukeboxRole { get; set; } = false; + + [JsonPropertyName("shareRole")] + public bool shareRole { get; set; } = false; + + [JsonPropertyName("videoConversionRole")] + public bool videoConversionRole { get; set; } = false; + +}