87 lines
2.7 KiB
C#
Raw Normal View History

using System.Text.Json.Serialization;
namespace Avalonia_Services.Services.FileLibrary
{
public sealed record AddLibraryRootRequest(
[property: JsonPropertyName("path")] string? Path,
[property: JsonPropertyName("displayName")] string? DisplayName = null,
[property: JsonPropertyName("scanIntervalMinutes")] int? ScanIntervalMinutes = null);
public sealed record UpdateLibraryRootRequest(
[property: JsonPropertyName("id")] int Id,
[property: JsonPropertyName("isEnabled")] bool IsEnabled);
public sealed record ScanLibraryRootRequest(
[property: JsonPropertyName("id")] int Id);
public sealed record DeleteLibraryRootRequest(
[property: JsonPropertyName("id")] int Id);
public sealed record DirectoryQueryRequest(
[property: JsonPropertyName("path")] string? Path);
public sealed record FileQueryRequest(
[property: JsonPropertyName("id")] int Id);
public sealed record SearchFilesRequest(
[property: JsonPropertyName("page")] int Page = 1,
[property: JsonPropertyName("pageSize")] int PageSize = 24,
[property: JsonPropertyName("mediaType")] string? MediaType = null,
[property: JsonPropertyName("keyword")] string? Keyword = null,
[property: JsonPropertyName("rootId")] int RootId = 0);
public sealed record DriveDto(
string Name,
string DisplayName,
string RootDirectory,
string DriveType,
long? TotalSize,
long? AvailableFreeSpace,
bool IsReady);
public sealed record DirectoryDto(
string Name,
string FullPath);
public sealed record LibraryRootDto(
int Id,
string Path,
string DisplayName,
bool IsEnabled,
bool IsAvailable,
int ScanIntervalMinutes,
DateTime? LastScanStartedAt,
DateTime? LastScanCompletedAt,
string? LastScanError,
int FileCount);
public sealed record FileRecordDto(
int Id,
int LibraryRootId,
string FileName,
string RelativePath,
string Extension,
long SizeBytes,
DateTime LastWriteTimeUtc,
string MediaType,
string ContentType,
string StreamUrl,
string? TextUrl,
bool BrowserPlayable);
public sealed record BrowseDirectoryRequest(
[property: JsonPropertyName("rootId")] int RootId = 0,
[property: JsonPropertyName("path")] string? Path = null);
public sealed record BrowseDirectoryResponse(
string CurrentPath,
List<string> Subdirectories,
List<FileRecordDto> Files);
public sealed record TextPreviewDto(
int Id,
string FileName,
string Content,
bool Truncated);
}