feat: add DTOs for basic endpoints
This commit is contained in:
11
DTOs/AlbumList2DTO.cs
Normal file
11
DTOs/AlbumList2DTO.cs
Normal file
@@ -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<AlbumViewShortDTO>? album { get; set; } = null;
|
||||||
|
}
|
||||||
51
DTOs/AlbumViewShortDTO.cs
Normal file
51
DTOs/AlbumViewShortDTO.cs
Normal file
@@ -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;
|
||||||
|
|
||||||
|
}
|
||||||
13
DTOs/ErrorDTO.cs
Normal file
13
DTOs/ErrorDTO.cs
Normal file
@@ -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";
|
||||||
|
}
|
||||||
9
DTOs/ResponseWrapper.cs
Normal file
9
DTOs/ResponseWrapper.cs
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace Shadow.DTOs;
|
||||||
|
|
||||||
|
public class ResponseWrapper
|
||||||
|
{
|
||||||
|
[JsonPropertyName("subsonic-response")]
|
||||||
|
required public SubsonicResponseDTO SubsonicResponse { get; set; }
|
||||||
|
}
|
||||||
36
DTOs/SubsonicResponseDTO.cs
Normal file
36
DTOs/SubsonicResponseDTO.cs
Normal file
@@ -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;
|
||||||
|
|
||||||
|
}
|
||||||
49
DTOs/UserPingDTO.cs
Normal file
49
DTOs/UserPingDTO.cs
Normal file
@@ -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;
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user