You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1.1 KiB
41 lines
1.1 KiB
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using Readarr.Http.REST;
|
|
|
|
namespace Readarr.Api.V1.Books
|
|
{
|
|
public class RenameBookResource : RestResource
|
|
{
|
|
public int AuthorId { get; set; }
|
|
public int BookId { get; set; }
|
|
public int BookFileId { get; set; }
|
|
public string ExistingPath { get; set; }
|
|
public string NewPath { get; set; }
|
|
}
|
|
|
|
public static class RenameBookResourceMapper
|
|
{
|
|
public static RenameBookResource ToResource(this NzbDrone.Core.MediaFiles.RenameBookFilePreview model)
|
|
{
|
|
if (model == null)
|
|
{
|
|
return null;
|
|
}
|
|
|
|
return new RenameBookResource
|
|
{
|
|
AuthorId = model.AuthorId,
|
|
BookId = model.BookId,
|
|
BookFileId = model.BookFileId,
|
|
ExistingPath = model.ExistingPath,
|
|
NewPath = model.NewPath
|
|
};
|
|
}
|
|
|
|
public static List<RenameBookResource> ToResource(this IEnumerable<NzbDrone.Core.MediaFiles.RenameBookFilePreview> models)
|
|
{
|
|
return models.Select(ToResource).ToList();
|
|
}
|
|
}
|
|
}
|