Package de.svenkubiak.jpushover.apis
Class Message
- java.lang.Object
-
- de.svenkubiak.jpushover.apis.Message
-
-
Constructor Summary
Constructors Constructor Description Message()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Message
enableHtml()
Enables HTML in the pushover message Either HTML or monospace can be enabled (optional)Message
enableMonospace()
Enables HTML in the pushover message Either HTML or monospace can be enabled (optional)String
getValue(String param)
PushoverResponse
push()
Sends a message to pushoverFuture<PushoverResponse>
pushAsync()
Sends a message to pushover asynchronouslyboolean
validate()
Sends a validation request to pushover ensuring that the token and user is correct, that there is at least one active device on the account.Message
withCallback(String callback)
Callback parameter may be supplied with a publicly-accessible URL that the pushover servers will send a request to when the user has acknowledged your notification.Message
withDevice(String device)
Your user's device name to send the message directly to that device, rather than all of the user's devices (optional)Message
withExpire(int expire)
Specifies how many seconds your notification will continue to be retried for (every retry seconds).Message
withMessage(String message)
Your message (required)Message
withPriority(Priority priority)
Priority of the message based on the @see documentation (optional)Message
withProxy(String proxyHost, int proxyPort)
Uses a given proxy for the HTTP requests to PushoverMessage
withRetry(int retry)
Specifies how often (in seconds) the Pushover servers will send the same notification to the user.Message
withSound(Sound sound)
The name of one of the sounds supported by device clients to override the user's default sound choice (optional)Message
withTimestamp(int timestamp)
A Unix timestamp of your message's date and time to display to the user, rather than the time your message is received by our API (optional)Message
withTitle(String title)
Your message's title, otherwise your app's name is used (optional)Message
withToken(String token)
Your application's API token (required)Message
withTTL(int ttl)
Adds a ttl to the Pushover messageMessage
withUrl(String url)
A supplementary URL to show with your message (optional)Message
withUrlTitle(String urlTitle)
A title for your supplementary URL, otherwise just the URL is shown (optional)Message
withUser(String user)
The user/group key (not e-mail address) of your user (or you), viewable when logged into the @see pushover dashboard (required)
-
-
-
Method Detail
-
withToken
public Message withToken(String token)
Your application's API token (required)- Parameters:
token
- The pushover API token- Returns:
- Message instance
-
withUser
public Message withUser(String user)
The user/group key (not e-mail address) of your user (or you), viewable when logged into the @see pushover dashboard (required)- Parameters:
user
- The username- Returns:
- Message instance
-
withRetry
public Message withRetry(int retry)
Specifies how often (in seconds) the Pushover servers will send the same notification to the user. Only required if priority is set to emergency. (optional)- Parameters:
retry
- Number of seconds- Returns:
- Message instance
-
withExpire
public Message withExpire(int expire)
Specifies how many seconds your notification will continue to be retried for (every retry seconds). Only required if priority is set to emergency. (optional)- Parameters:
expire
- Number of seconds- Returns:
- Message instance
-
withMessage
public Message withMessage(String message)
Your message (required)- Parameters:
message
- The message to sent- Returns:
- Message instance
-
withDevice
public Message withDevice(String device)
Your user's device name to send the message directly to that device, rather than all of the user's devices (optional)- Parameters:
device
- The device name- Returns:
- Message instance
-
withTitle
public Message withTitle(String title)
Your message's title, otherwise your app's name is used (optional)- Parameters:
title
- The title- Returns:
- Message instance
-
withUrl
public Message withUrl(String url)
A supplementary URL to show with your message (optional)- Parameters:
url
- The url- Returns:
- Message instance
-
enableMonospace
public Message enableMonospace()
Enables HTML in the pushover message Either HTML or monospace can be enabled (optional)- Returns:
- Message instance
-
enableHtml
public Message enableHtml()
Enables HTML in the pushover message Either HTML or monospace can be enabled (optional)- Returns:
- Message instance
-
withUrlTitle
public Message withUrlTitle(String urlTitle)
A title for your supplementary URL, otherwise just the URL is shown (optional)- Parameters:
urlTitle
- The url title- Returns:
- Message instance
-
withTimestamp
public Message withTimestamp(int timestamp)
A Unix timestamp of your message's date and time to display to the user, rather than the time your message is received by our API (optional)- Parameters:
timestamp
- The Unix timestamp- Returns:
- Message instance
-
withPriority
public Message withPriority(Priority priority)
Priority of the message based on the @see documentation (optional)- Parameters:
priority
- The priority enum- Returns:
- Message instance
-
withSound
public Message withSound(Sound sound)
The name of one of the sounds supported by device clients to override the user's default sound choice (optional)- Parameters:
sound
- THe sound enum- Returns:
- Message instance
-
withCallback
public Message withCallback(String callback)
Callback parameter may be supplied with a publicly-accessible URL that the pushover servers will send a request to when the user has acknowledged your notification. Only used if priority is set to emergency. (optional)- Parameters:
callback
- The callback URL- Returns:
- Message instance
-
withTTL
public Message withTTL(int ttl)
Adds a ttl to the Pushover message- Parameters:
ttl
- Seconds until this message should be automatically removed from the device. Needs to be positive- Returns:
- Message instance
-
withProxy
public Message withProxy(String proxyHost, int proxyPort)
Uses a given proxy for the HTTP requests to Pushover- Parameters:
proxyHost
- The host that should be used for the ProxyproxyPort
- The port that should be used for the Proxy- Returns:
- Message instance
-
validate
public boolean validate() throws JPushoverException
Sends a validation request to pushover ensuring that the token and user is correct, that there is at least one active device on the account. Requires token parameter Requires user parameter Optional device parameter to check specific device- Returns:
- true if token and user are valid and at least on device is on the account, false otherwise
- Throws:
JPushoverException
-
push
public PushoverResponse push() throws JPushoverException
Sends a message to pushover- Specified by:
push
in interfaceAPI
- Returns:
- PushoverResponse instance
- Throws:
JPushoverException
-
pushAsync
public Future<PushoverResponse> pushAsync() throws InterruptedException, ExecutionException
Sends a message to pushover asynchronously- Returns:
- PushoverResponse instance
- Throws:
InterruptedException
- if sending the message failsExecutionException
- if sending the message fails
-
-