diff --git a/PushoverClient/PushOverRequestArguments.cs b/PushoverClient/PushOverRequestArguments.cs
index 25b6479..c5701af 100644
--- a/PushoverClient/PushOverRequestArguments.cs
+++ b/PushoverClient/PushOverRequestArguments.cs
@@ -9,6 +9,7 @@ public class PushoverRequestArguments
public string title { get; set; }
public string message { get; set; }
public int priority { get; set; }
+ public int timestamp { get; set; }
public string sound { get; set; }
}
}
\ No newline at end of file
diff --git a/PushoverClient/Pushover.cs b/PushoverClient/Pushover.cs
index 29b6003..37cfae6 100644
--- a/PushoverClient/Pushover.cs
+++ b/PushoverClient/Pushover.cs
@@ -64,9 +64,9 @@ public Pushover(string appKey, string defaultSendKey) : this(appKey)
/// Priority of the message (optional) default value set to Normal
/// If set sends the notification sound
///
- public PushResponse Push(string title, string message, string userKey = "", string device = "", Priority priority = Priority.Normal, NotificationSound notificationSound = NotificationSound.NotSet)
+ public PushResponse Push(string title, string message, string userKey = "", string device = "", Priority priority = Priority.Normal, DateTime? timestamp = null, NotificationSound notificationSound = NotificationSound.NotSet)
{
- var args = CreateArgs(title, message, userKey, device, priority, notificationSound);
+ var args = CreateArgs(title, message, userKey, device, priority, timestamp ?? DateTime.UtcNow, notificationSound);
try
{
return BASE_API_URL.PostToUrl(args).FromJson();
@@ -87,9 +87,9 @@ public PushResponse Push(string title, string message, string userKey = "", stri
/// Priority of the message (optional) default value set to Normal
/// If set sends the notification sound
///
- public async Task PushAsync(string title, string message, string userKey = "", string device = "", Priority priority = Priority.Normal, NotificationSound notificationSound = NotificationSound.NotSet)
+ public async Task PushAsync(string title, string message, string userKey = "", string device = "", Priority priority = Priority.Normal, DateTime? timestamp = null, NotificationSound notificationSound = NotificationSound.NotSet)
{
- var args = CreateArgs(title, message, userKey, device, priority, notificationSound);
+ var args = CreateArgs(title, message, userKey, device, priority, timestamp?? DateTime.UtcNow, notificationSound);
try
{
return (await BASE_API_URL.PostToUrlAsync(args)).FromJson();
@@ -102,7 +102,7 @@ public async Task PushAsync(string title, string message, string u
- private object CreateArgs(string title, string message, string userKey, string device, Priority priority, NotificationSound notificationSound)
+ private object CreateArgs(string title, string message, string userKey, string device, Priority priority, DateTime timestamp, NotificationSound notificationSound)
{
// Try the passed user key or fall back to default
var userGroupKey = string.IsNullOrEmpty(userKey) ? DefaultUserGroupSendKey : userKey;
@@ -119,6 +119,7 @@ private object CreateArgs(string title, string message, string userKey, string d
device = device,
title = title,
message = message,
+ timestamp = (int)timestamp.Subtract(new DateTime(1970, 1, 1)).TotalSeconds,
priority = (int)priority
};