using Flurl.Http; using Recyclarr.Common; using Recyclarr.Config.Models; using Recyclarr.ServarrApi.Http.Servarr; namespace Recyclarr.ServarrApi.MediaNaming; public class MediaNamingApiService(IServarrRequestBuilder service) : IMediaNamingApiService { public async Task GetNaming(IServiceConfiguration config) { var response = await service.Request(config, "config", "naming") .GetAsync(); return config.ServiceType switch { SupportedServices.Radarr => await response.GetJsonAsync(), SupportedServices.Sonarr => await response.GetJsonAsync(), _ => throw new ArgumentException("Configuration type unsupported in GetNaming() API") }; } public async Task UpdateNaming(IServiceConfiguration config, MediaNamingDto dto) { await service.Request(config, "config", "naming") .PutJsonAsync(dto); } }