Package de.svenkubiak.jpushover.apis
Class OpenClient
- java.lang.Object
-
- de.svenkubiak.jpushover.apis.OpenClient
-
public class OpenClient extends Object
- Author:
- svenkubiak
-
-
Constructor Summary
Constructors Constructor Description OpenClient()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
close()
Closes the existing WebSocket connection to the Pushover APIPushoverResponse
deleteMessages(String secret, String deviceId, String messageId)
Deletes all messages after (and including) a given messagesIdPushoverResponse
login(String email, String password)
Performs a Pushover login; required once for working with the Open Client APIPushoverResponse
login(String email, String password, String twoFactor)
Performs a Pushover login; required once for working with the Open Client APIString
messages(String secret, String deviceId)
Retrieves all available messages for the given deviceIdboolean
open(String secret, String deviceId, MessageListener messageListener)
Establishes a WebSocket connection which listens to incoming messagesPushoverResponse
registerDevice(String secret, String deviceName)
Registers a new device at Pushover
-
-
-
Method Detail
-
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
public PushoverResponse login(String email, String password) throws JPushoverException
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
public String messages(String secret, String deviceId) throws JPushoverException
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
public boolean open(String secret, String deviceId, MessageListener messageListener)
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
public PushoverResponse registerDevice(String secret, String deviceName) throws JPushoverException
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
-
-