Class OpenClient

java.lang.Object
de.svenkubiak.jpushover.apis.OpenClient

public class OpenClient extends Object
  • 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 address
      password - Your Pushover password
      twoFactor - 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 address
      password - 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 login
      deviceId - 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 login
      deviceId - The deviceId whom to get the messages
      messageId - 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 login
      deviceId - The deviceId from whom to get the messages
      messageListener - 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 login
      deviceName - 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