using System.Threading.Tasks; using Jellyfin.Data.Events.Users; using Jellyfin.Plugin.Webhook.Destinations; using Jellyfin.Plugin.Webhook.Helpers; using MediaBrowser.Controller; using MediaBrowser.Controller.Events; namespace Jellyfin.Plugin.Webhook.Notifiers; /// /// User deleted notifier. /// public class UserDeletedNotifier : IEventConsumer { private readonly IServerApplicationHost _applicationHost; private readonly IWebhookSender _webhookSender; /// /// Initializes a new instance of the class. /// /// Instance of the interface. /// Instance of the interface. public UserDeletedNotifier( IServerApplicationHost applicationHost, IWebhookSender webhookSender) { _applicationHost = applicationHost; _webhookSender = webhookSender; } /// public async Task OnEvent(UserDeletedEventArgs eventArgs) { var dataObject = DataObjectHelpers .GetBaseDataObject(_applicationHost, NotificationType.UserDeleted) .AddUserData(eventArgs.Argument); await _webhookSender.SendNotification(NotificationType.UserDeleted, dataObject) .ConfigureAwait(false); } }