LibraryStorageDto.cs 1022 B

12345678910111213141516171819202122232425262728293031323334353637
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using MediaBrowser.Model.System;
  5. namespace Jellyfin.Api.Models.SystemInfoDtos;
  6. /// <summary>
  7. /// Contains informations about a libraries storage informations.
  8. /// </summary>
  9. public record LibraryStorageDto
  10. {
  11. /// <summary>
  12. /// Gets or sets the Library Id.
  13. /// </summary>
  14. public required Guid Id { get; set; }
  15. /// <summary>
  16. /// Gets or sets the name of the library.
  17. /// </summary>
  18. public required string Name { get; set; }
  19. /// <summary>
  20. /// Gets or sets the storage informations about the folders used in a library.
  21. /// </summary>
  22. public required IReadOnlyCollection<FolderStorageDto> Folders { get; set; }
  23. internal static LibraryStorageDto FromLibraryStorageModel(LibraryStorageInfo model)
  24. {
  25. return new()
  26. {
  27. Id = model.Id,
  28. Name = model.Name,
  29. Folders = model.Folders.Select(FolderStorageDto.FromFolderStorageInfo).ToArray()
  30. };
  31. }
  32. }