|
|
@ -1,3 +1,4 @@
|
|
|
|
|
|
|
|
using Flurl;
|
|
|
|
using Flurl.Http;
|
|
|
|
using Flurl.Http;
|
|
|
|
using Flurl.Http.Configuration;
|
|
|
|
using Flurl.Http.Configuration;
|
|
|
|
using Recyclarr.Common.Networking;
|
|
|
|
using Recyclarr.Common.Networking;
|
|
|
@ -7,7 +8,7 @@ using Serilog;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Recyclarr.ServarrApi.Http;
|
|
|
|
namespace Recyclarr.ServarrApi.Http;
|
|
|
|
|
|
|
|
|
|
|
|
public class FlurlClientFactory : IFlurlClientFactory
|
|
|
|
public sealed class FlurlClientFactory : IFlurlClientFactory
|
|
|
|
{
|
|
|
|
{
|
|
|
|
private readonly ILogger _log;
|
|
|
|
private readonly ILogger _log;
|
|
|
|
private readonly ISettingsProvider _settingsProvider;
|
|
|
|
private readonly ISettingsProvider _settingsProvider;
|
|
|
@ -20,9 +21,9 @@ public class FlurlClientFactory : IFlurlClientFactory
|
|
|
|
_factory = new PerBaseUrlFlurlClientFactory();
|
|
|
|
_factory = new PerBaseUrlFlurlClientFactory();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public IFlurlClient BuildClient(Uri baseUrl)
|
|
|
|
public IFlurlClient Get(Url url)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var client = _factory.Get(baseUrl);
|
|
|
|
var client = _factory.Get(url);
|
|
|
|
client.Settings = GetClientSettings();
|
|
|
|
client.Settings = GetClientSettings();
|
|
|
|
return client;
|
|
|
|
return client;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -47,4 +48,9 @@ public class FlurlClientFactory : IFlurlClientFactory
|
|
|
|
|
|
|
|
|
|
|
|
return settings;
|
|
|
|
return settings;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void Dispose()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_factory.Dispose();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|