Class OpenClient
java.lang.Object
de.svenkubiak.jpushover.apis.OpenClient
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanclose()Closes the existing WebSocket connection to the Pushover APIdeleteMessages(String secret, String deviceId, String messageId) Deletes all messages after (and including) a given messagesIdPerforms a Pushover login; required once for working with the Open Client APIPerforms a Pushover login; required once for working with the Open Client APIRetrieves all available messages for the given deviceIdbooleanopen(String secret, String deviceId, MessageListener messageListener) Establishes a WebSocket connection which listens to incoming messagesregisterDevice(String secret, String deviceName) Registers a new device at Pushover
-
Constructor Details
-
OpenClient
public OpenClient()
-
-
Method Details
-
login
public PushoverResponse login(String email, String password, String twoFactor) throws JPushoverException Performs a Pushover login; required once for working with the Open Client API- Parameters:
email- Your Pushover email addresspassword- Your Pushover passwordtwoFactor- Your current Pushover two-factor code (if enabled)- Returns:
- A PushoverResponse
- Throws:
JPushoverException- if something went wrong with the HTTP request
-
login
Performs a Pushover login; required once for working with the Open Client API- Parameters:
email- Your Pushover email addresspassword- Your Pushover password- Returns:
- A PushoverResponse
- Throws:
JPushoverException- if something went wrong with the HTTP request
-
messages
Retrieves all available messages for the given deviceId- Parameters:
secret- Your Pushover secret retrieved after logindeviceId- The deviceId from whom to get the messages- Returns:
- A String containing raw Json with all available messages or null
- Throws:
JPushoverException- if something went wrong with the HTTP request
-
deleteMessages
public PushoverResponse deleteMessages(String secret, String deviceId, String messageId) throws JPushoverException Deletes all messages after (and including) a given messagesId- Parameters:
secret- Your Pushover secret retrieved after logindeviceId- The deviceId whom to get the messagesmessageId- The messagesId- Returns:
- A PushoverResponse
- Throws:
JPushoverException- if something went wrong with the HTTP request
-
open
Establishes a WebSocket connection which listens to incoming messages- Parameters:
secret- Your Pushover secret retrieved after logindeviceId- The deviceId from whom to get the messagesmessageListener- Your instance of a MessagesListener- Returns:
- True if the connection was established successfully
-
registerDevice
Registers a new device at Pushover- Parameters:
secret- Your Pushover secret retrieved after logindeviceName- The name of the device to register- Returns:
- A PushoverResponse
- Throws:
JPushoverException- if something went wrong with the HTTP request
-
close
public boolean close()Closes the existing WebSocket connection to the Pushover API- Returns:
- true if close was successful, false otherwise
-