2016-12-23 21:45:24 +00:00
|
|
|
|
using System.Collections.Generic;
|
2016-03-25 00:56:29 +00:00
|
|
|
|
using System.Linq;
|
|
|
|
|
using NzbDrone.Core.RemotePathMappings;
|
2019-12-22 22:08:53 +00:00
|
|
|
|
using Radarr.Http.REST;
|
2014-09-11 20:24:00 +00:00
|
|
|
|
|
2014-10-03 04:40:32 +00:00
|
|
|
|
namespace NzbDrone.Api.RemotePathMappings
|
2014-09-11 20:24:00 +00:00
|
|
|
|
{
|
|
|
|
|
public class RemotePathMappingResource : RestResource
|
|
|
|
|
{
|
2015-10-03 17:45:26 +00:00
|
|
|
|
public string Host { get; set; }
|
|
|
|
|
public string RemotePath { get; set; }
|
|
|
|
|
public string LocalPath { get; set; }
|
2014-09-11 20:24:00 +00:00
|
|
|
|
}
|
2016-03-25 00:56:29 +00:00
|
|
|
|
|
|
|
|
|
public static class RemotePathMappingResourceMapper
|
|
|
|
|
{
|
|
|
|
|
public static RemotePathMappingResource ToResource(this RemotePathMapping model)
|
|
|
|
|
{
|
2019-12-22 22:08:53 +00:00
|
|
|
|
if (model == null)
|
|
|
|
|
{
|
|
|
|
|
return null;
|
|
|
|
|
}
|
2016-03-25 00:56:29 +00:00
|
|
|
|
|
|
|
|
|
return new RemotePathMappingResource
|
|
|
|
|
{
|
|
|
|
|
Id = model.Id,
|
|
|
|
|
|
|
|
|
|
Host = model.Host,
|
|
|
|
|
RemotePath = model.RemotePath,
|
|
|
|
|
LocalPath = model.LocalPath
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static RemotePathMapping ToModel(this RemotePathMappingResource resource)
|
|
|
|
|
{
|
2019-12-22 22:08:53 +00:00
|
|
|
|
if (resource == null)
|
|
|
|
|
{
|
|
|
|
|
return null;
|
|
|
|
|
}
|
2016-03-25 00:56:29 +00:00
|
|
|
|
|
|
|
|
|
return new RemotePathMapping
|
|
|
|
|
{
|
|
|
|
|
Id = resource.Id,
|
|
|
|
|
|
|
|
|
|
Host = resource.Host,
|
|
|
|
|
RemotePath = resource.RemotePath,
|
|
|
|
|
LocalPath = resource.LocalPath
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static List<RemotePathMappingResource> ToResource(this IEnumerable<RemotePathMapping> models)
|
|
|
|
|
{
|
|
|
|
|
return models.Select(ToResource).ToList();
|
|
|
|
|
}
|
|
|
|
|
}
|
2014-09-11 20:24:00 +00:00
|
|
|
|
}
|