using LCU.Library.Internal.LcuHttpClient.HttpRequest; using LCU.API.Internal.Operations.IncentiveApi.Configuration; using LCU.API.Internal.NotificationsApiLib.Models; namespace LCU.API.Internal.Operations.IncentiveApi.DataAccess; public class NotificationApiDao : INotificationApiDao { private readonly NotificationApiConfiguration _notificationApiConfiguration; private readonly IPostRequest _postRequest; public NotificationApiDao(NotificationApiConfiguration notificationApiConfiguration, IPostRequest postRequest) { _notificationApiConfiguration = notificationApiConfiguration; _postRequest = postRequest; } public async Task SendMessageAsync(EmailRequest request) { try { await _postRequest.Async(new Uri(_notificationApiConfiguration.EmailUrl), request, _notificationApiConfiguration.RetryCount); } catch (Exception ex) { Log.Error(ex, "An exception was caught trying to send an email via Notifications API."); throw; } } }