public async Task Send_With_Sound_Got_Ok() { var client = new PushoverClient(ApiKey); var message = client.NewMessageWithSound("Hello world", Sound.CashRegister); var response = await client.SendAsync(message, UserKey); Assert.Equal(response.StatusCode, HttpStatusCode.OK); }
public async Task Send_Default_Got_Ok() { var client = new PushoverClient(ApiKey); var message = client.NewMessage("Hello world"); var response = await client.SendAsync(message, UserKey); Assert.Equal(response.StatusCode, HttpStatusCode.OK); }
public async Task Send_With_Sound_Got_Ok() { var client = new PushoverClient(string.Empty); PushoverClient.HttpHandler = new MockHandler(); var message = client.NewMessageWithSound("Hello world", Sound.CashRegister); var response = await client.SendAsync(message, string.Empty); Assert.Equal(response.StatusCode, HttpStatusCode.OK); }
public async Task Send_Default_Got_Ok() { var client = new PushoverClient(string.Empty); PushoverClient.HttpHandler = new MockHandler(); var message = client.NewMessage("Hello world"); var response = await client.SendAsync(message, string.Empty); Assert.Equal(response.StatusCode, HttpStatusCode.OK); }
public async Task Send_Multiple_Got_Ok() { var client = new PushoverClient(ApiKey); var message = client.NewMessage("Hello world"); var responses = await client.SendAsync(message, UserKey, UserKey); foreach (var response in responses) { Assert.Equal(response.StatusCode, HttpStatusCode.OK); } }
public void Process(EventFromIftttType eventNameChanged, bool newValue) { _log.DebugFormat("Event '{0}' is processing in '{1}'", eventNameChanged, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); PushoverClient client = new PushoverClient(); if (newValue) { client.SendNotification(PushoverRequest.CreateRequest("Sotfluent arrive au travail", "Presence", PushoverPriorityNotificationType.NormalPriority, PushoverSoundType.pushover)); } else { client.SendNotification(PushoverRequest.CreateRequest("Sotfluent part du travail", "Presence", PushoverPriorityNotificationType.NormalPriority, PushoverSoundType.pushover)); } }
public NotificationService( ClusterConfig clusterConfig, PushoverClient pushoverClient, IMessageBus messageBus) { Contract.RequiresNonNull(clusterConfig, nameof(clusterConfig)); Contract.RequiresNonNull(messageBus, nameof(messageBus)); this.clusterConfig = clusterConfig; this.emailSenderConfig = clusterConfig.Notifications.Email; this.messageBus = messageBus; this.pushoverClient = pushoverClient; poolConfigs = clusterConfig.Pools.ToDictionary(x => x.Id, x => x); adminEmail = clusterConfig.Notifications?.Admin?.EmailAddress; }
static void Main(string[] args) { PushoverClient api = new PushoverClient("token"); PushoverMessage message = new PushoverMessage() { Title = "title", Message = "message", Priority = Priority.High, Sound = "magic", Url = "https://www.github.com", UrlTitle = "Github", }; bool result = api.Send("token", message); Console.Read(); }
static void Main(string[] args) { log4net.Config.XmlConfigurator.Configure(); System.ServiceModel.ServiceHost _hostApplication = new System.ServiceModel.ServiceHost(typeof(SoftFluent.Presence.Service.PresenceRestService)); _hostApplication.Open(); PushoverClient client = new PushoverClient(); client.SendNotification("first message"); PushoverRequest request = PushoverRequest.CreateRequest("Test", "Presence", PushoverPriorityNotificationType.LowPriority, "Tel_Softfluent"); //PushoverRequest request = PushoverRequest.CreateRequest("Test", null, 30, 120, PushoverPriorityNotificationType.EmergencyPriority, "Tel_Softfluent"); //request.TimeStamp = new DateTime(2016, 1, 31, 10, 5, 0); PushoverResponse response = client.SendNotification(request); if (response != null && response.Status == 1) { //OK client.CancelEmergency(""); } }
private void SentNotification(Item item) { PushoverClient client = new PushoverClient(this.AppApiKey); client.SendAsync(this.UserApiKey, item.Content, item.Title, new Uri(item.Url)); }