Prowlin.Notification.AddApiKey C# (CSharp) Метод

AddApiKey() публичный Метод

public AddApiKey ( string key ) : void
key string
Результат void
        public void AddApiKey(string key)
        {
            _apiKeys.Add(key);
        }

Usage Example

Пример #1
0
        public void SendNotification(string title, string message, string apiKey, NotificationPriority priority = NotificationPriority.Normal, string url = null)
        {
            try
            {
                var notification = new Prowlin.Notification
                {
                    Application = BuildInfo.AppName,
                    Description = message,
                    Event       = title,
                    Priority    = priority,
                    Url         = url
                };

                notification.AddApiKey(apiKey.Trim());

                var client = new ProwlClient();

                _logger.Debug("Sending Prowl Notification");

                var notificationResult = client.SendNotification(notification);

                if (!string.IsNullOrWhiteSpace(notificationResult.ErrorMessage))
                {
                    throw new InvalidApiKeyException("API Key: " + apiKey + " is invalid");
                }
            }

            catch (Exception ex)
            {
                _logger.Debug(ex, ex.Message);
                _logger.Warn("Invalid API Key: {0}", apiKey);
            }
        }
All Usage Examples Of Prowlin.Notification::AddApiKey
Notification