Instead, expand the ServarrRequestBuilder service class to utilize a built-in client factory to manage handing out clients.pull/231/head
parent
5a8e5df890
commit
f5c659d772
@ -1,22 +0,0 @@
|
||||
using Flurl.Http;
|
||||
using Flurl.Http.Configuration;
|
||||
using Recyclarr.Config.Models;
|
||||
|
||||
namespace Recyclarr.ServarrApi.Http;
|
||||
|
||||
public class ServiceRequestBuilder : IServiceRequestBuilder
|
||||
{
|
||||
private readonly IFlurlClientFactory _clientFactory;
|
||||
|
||||
public ServiceRequestBuilder(IFlurlClientFactory clientFactory)
|
||||
{
|
||||
_clientFactory = clientFactory;
|
||||
}
|
||||
|
||||
public IFlurlRequest Request(IServiceConfiguration config, params object[] path)
|
||||
{
|
||||
var client = _clientFactory.Get(config.BaseUrl);
|
||||
return client.Request(new[] {"api", "v3"}.Concat(path).ToArray())
|
||||
.WithHeader("X-Api-Key", config.ApiKey);
|
||||
}
|
||||
}
|
Loading…
Reference in new issue