mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-14 00:53:57 -07:00
Change API Version from V3 to V1
This commit is contained in:
parent
db10057f2c
commit
aae9f3cfc3
155 changed files with 248 additions and 248 deletions
35
src/Lidarr.Api.V1/System/Backup/BackupModule.cs
Normal file
35
src/Lidarr.Api.V1/System/Backup/BackupModule.cs
Normal file
|
@ -0,0 +1,35 @@
|
|||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using NzbDrone.Core.Backup;
|
||||
using Lidarr.Http;
|
||||
|
||||
namespace Lidarr.Api.V1.System.Backup
|
||||
{
|
||||
public class BackupModule : LidarrRestModule<BackupResource>
|
||||
{
|
||||
private readonly IBackupService _backupService;
|
||||
|
||||
public BackupModule(IBackupService backupService) : base("system/backup")
|
||||
{
|
||||
_backupService = backupService;
|
||||
GetResourceAll = GetBackupFiles;
|
||||
}
|
||||
|
||||
public List<BackupResource> GetBackupFiles()
|
||||
{
|
||||
var backups = _backupService.GetBackups();
|
||||
|
||||
return backups.Select(b => new BackupResource
|
||||
{
|
||||
Id = b.Name.GetHashCode(),
|
||||
Name = b.Name,
|
||||
Path = $"/backup/{b.Type.ToString().ToLower()}/{b.Name}",
|
||||
Type = b.Type,
|
||||
Time = b.Time
|
||||
})
|
||||
.OrderByDescending(b => b.Time)
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue