You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
620 B
22 lines
620 B
2 years ago
|
using Flurl.Http;
|
||
1 year ago
|
using Recyclarr.Config.Models;
|
||
2 years ago
|
|
||
1 year ago
|
namespace Recyclarr.ServarrApi.Http;
|
||
2 years ago
|
|
||
|
public class ServiceRequestBuilder : IServiceRequestBuilder
|
||
|
{
|
||
|
private readonly IFlurlClientFactory _clientFactory;
|
||
|
|
||
2 years ago
|
public ServiceRequestBuilder(IFlurlClientFactory clientFactory)
|
||
2 years ago
|
{
|
||
|
_clientFactory = clientFactory;
|
||
|
}
|
||
|
|
||
2 years ago
|
public IFlurlRequest Request(IServiceConfiguration config, params object[] path)
|
||
2 years ago
|
{
|
||
2 years ago
|
var client = _clientFactory.BuildClient(config.BaseUrl);
|
||
2 years ago
|
return client.Request(new[] {"api", "v3"}.Concat(path).ToArray())
|
||
1 year ago
|
.WithHeader("X-Api-Key", config.ApiKey);
|
||
2 years ago
|
}
|
||
|
}
|