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.Notifications/Apprise/AppriseNotificationApiServi...

22 lines
683 B

using Flurl.Http;
using Recyclarr.Notifications.Apprise.Dto;
using Recyclarr.Settings;
namespace Recyclarr.Notifications.Apprise;
public class AppriseNotificationApiService(IAppriseRequestBuilder api, ISettingsProvider settingsProvider)
: IAppriseNotificationApiService
{
public async Task Notify(string key, AppriseNotification notification)
{
var settings = settingsProvider.Settings.Notifications?.Apprise;
if (settings?.Key is null)
{
throw new ArgumentException("No apprise notification settings have been defined");
}
await api.Request("notify", settings.Key)
.PostJsonAsync(notification);
}
}