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.
recyclarr/src/Recyclarr.TrashLib/Http/ServiceRequestBuilder.cs

22 lines
635 B

using Flurl.Http;
using Recyclarr.TrashLib.Config.Services;
namespace Recyclarr.TrashLib.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.BuildClient(config.BaseUrl);
return client.Request(new[] {"api", "v3"}.Concat(path).ToArray())
.SetQueryParams(new {apikey = config.ApiKey});
}
}