Restructure responses and remove File entity

File does not exist on Put.io API anymore
This commit is contained in:
Michael Feinbier 2023-09-17 11:14:37 +02:00
parent 16ccff35bc
commit c77566fc43
8 changed files with 17 additions and 60 deletions

View File

@ -137,15 +137,6 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.PutioTests
.Returns(torrents); .Returns(torrents);
} }
protected virtual void GivenFile(PutioFile file)
{
file ??= new PutioFile();
Mocker.GetMock<IPutioProxy>()
.Setup(s => s.GetFile(file.Id, It.IsAny<PutioSettings>()))
.Returns(file);
}
[Test] [Test]
public void getItems_contains_all_items() public void getItems_contains_all_items()
{ {

View File

@ -18,13 +18,14 @@ namespace NzbDrone.Core.Download.Clients.Putio
{ {
private readonly IPutioProxy _proxy; private readonly IPutioProxy _proxy;
public Putio(IPutioProxy proxy, public Putio(
ITorrentFileInfoReader torrentFileInfoReader, IPutioProxy proxy,
IHttpClient httpClient, ITorrentFileInfoReader torrentFileInfoReader,
IConfigService configService, IHttpClient httpClient,
IDiskProvider diskProvider, IConfigService configService,
IRemotePathMappingService remotePathMappingService, IDiskProvider diskProvider,
Logger logger) IRemotePathMappingService remotePathMappingService,
Logger logger)
: base(torrentFileInfoReader, httpClient, configService, diskProvider, remotePathMappingService, logger) : base(torrentFileInfoReader, httpClient, configService, diskProvider, remotePathMappingService, logger)
{ {
_proxy = proxy; _proxy = proxy;

View File

@ -1,8 +0,0 @@
namespace NzbDrone.Core.Download.Clients.Putio
{
public class PutioFile
{
public long Id { get; set; }
public string Name { get; set; }
}
}

View File

@ -1,7 +0,0 @@
namespace NzbDrone.Core.Download.Clients.Putio
{
public class PutioFileResponse : PutioGenericResponse
{
public PutioFile File { get; set; }
}
}

View File

@ -1,8 +0,0 @@
namespace NzbDrone.Core.Download.Clients.Putio
{
public enum PutioPriority
{
Last = 0,
First = 1
}
}

View File

@ -10,7 +10,6 @@ namespace NzbDrone.Core.Download.Clients.Putio
public interface IPutioProxy public interface IPutioProxy
{ {
List<PutioTorrent> GetTorrents(PutioSettings settings); List<PutioTorrent> GetTorrents(PutioSettings settings);
PutioFile GetFile(long fileId, PutioSettings settings);
void AddTorrentFromUrl(string torrentUrl, PutioSettings settings); void AddTorrentFromUrl(string torrentUrl, PutioSettings settings);
void AddTorrentFromData(byte[] torrentData, PutioSettings settings); void AddTorrentFromData(byte[] torrentData, PutioSettings settings);
void RemoveTorrent(string hash, PutioSettings settings); void RemoveTorrent(string hash, PutioSettings settings);
@ -30,16 +29,8 @@ namespace NzbDrone.Core.Download.Clients.Putio
public List<PutioTorrent> GetTorrents(PutioSettings settings) public List<PutioTorrent> GetTorrents(PutioSettings settings)
{ {
// var result = ProcessRequest<PutioTransfersResponse>(Method.GET, "transfers/list", null, settings); var result = Execute<PutioTransfersResponse>(BuildRequest(HttpMethod.Get, "transfers/list", settings));
// return result.Transfers; return result.Resource.Transfers;
return new List<PutioTorrent>();
}
public PutioFile GetFile(long fileId, PutioSettings settings)
{
// var result = ProcessRequest<PutioFileResponse>(Method.GET, "files/" + fileId, null, settings);
// return result.File;
return new PutioFile();
} }
public void AddTorrentFromUrl(string torrentUrl, PutioSettings settings) public void AddTorrentFromUrl(string torrentUrl, PutioSettings settings)
@ -65,7 +56,6 @@ namespace NzbDrone.Core.Download.Clients.Putio
public void GetAccountSettings(PutioSettings settings) public void GetAccountSettings(PutioSettings settings)
{ {
// ProcessRequest<PutioGenericResponse>(Method.GET, "account/settings", null, settings);
Execute<PutioGenericResponse>(BuildRequest(HttpMethod.Get, "account/settings", settings)); Execute<PutioGenericResponse>(BuildRequest(HttpMethod.Get, "account/settings", settings));
} }

View File

@ -1,4 +1,5 @@
using Newtonsoft.Json; using System.Collections.Generic;
using Newtonsoft.Json;
namespace NzbDrone.Core.Download.Clients.Putio namespace NzbDrone.Core.Download.Clients.Putio
{ {
@ -9,4 +10,9 @@ namespace NzbDrone.Core.Download.Clients.Putio
public string Status { get; set; } public string Status { get; set; }
} }
public class PutioTransfersResponse : PutioGenericResponse
{
public List<PutioTorrent> Transfers { get; set; }
}
} }

View File

@ -1,8 +0,0 @@
using System.Collections.Generic;
namespace NzbDrone.Core.Download.Clients.Putio
{
public class PutioTransfersResponse : PutioGenericResponse
{
public List<PutioTorrent> Transfers { get; set; }
}
}