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/TrashLib/Radarr/CustomFormat/Api/QualityProfileService.cs

37 lines
1000 B

using System.Collections.Generic;
using System.Threading.Tasks;
using Flurl;
using Flurl.Http;
using Newtonsoft.Json.Linq;
using TrashLib.Config;
namespace TrashLib.Radarr.CustomFormat.Api
{
internal class QualityProfileService : IQualityProfileService
{
private readonly IServerInfo _serverInfo;
public QualityProfileService(IServerInfo serverInfo)
{
_serverInfo = serverInfo;
}
private string BaseUrl => _serverInfo.BuildUrl();
public async Task<List<JObject>> GetQualityProfiles()
{
return await BaseUrl
.AppendPathSegment("qualityprofile")
.GetJsonAsync<List<JObject>>();
}
public async Task<JObject> UpdateQualityProfile(JObject profileJson, int id)
{
return await BaseUrl
.AppendPathSegment($"qualityprofile/{id}")
.PutJsonAsync(profileJson)
.ReceiveJson<JObject>();
}
}
}