Example #1
0
        private async Task SendAsync <T>(NotificationRequest <T> request, [CallerMemberName] string callerMemberName = "") where T : class
        {
            if (!_isEnabled)
            {
                _logger.LogWarning($"Skipped '{callerMemberName}' because Email sending is disabled.");
                return;
            }

            var req      = BuildRequest(() => request);
            var response = await _httpClient.SendAsync(req);

            if (!response.IsSuccessStatusCode)
            {
                _logger.LogError($"Error executing request '{callerMemberName}', response: {response.StatusCode}");
            }
        }
Example #2
0
 public NotificationContent(NotificationRequest <T> req) :
     base(req.ToJson(), Encoding.UTF8, "application/json")
 {
 }