Class Event


  • public class Event
    extends AbstractResource
    This is a utility class for assisting with the development of callback services to respond to HelloSign events.
    • Constructor Detail

      • Event

        public Event​(org.json.JSONObject json)
              throws HelloSignException
        Default constructor. Provide this constructor with the JSONObject created from the API response.
        Parameters:
        json - JSONObject
        Throws:
        HelloSignException - thrown if there is a problem parsing the JSONObject.
    • Method Detail

      • getAccountId

        public java.lang.String getAccountId()
                                      throws HelloSignException
        Returns the account ID that this event is reporting for.
        Returns:
        String
        Throws:
        HelloSignException - thrown if there is a problem parsing the backing JSON object.
      • hasAccountId

        public boolean hasAccountId()
        Returns true if this event has a "reported_for_account_id" field.
        Returns:
        true or false if it does not have an account ID
      • getAppId

        public java.lang.String getAppId()
                                  throws HelloSignException
        Returns the API app ID for which this event is reported.
        Returns:
        String
        Throws:
        HelloSignException - thrown if there is a problem parsing the backing JSONObject.
      • hasAppId

        public boolean hasAppId()
        Returns true if this event has a "reported_for_app_id" field.
        Returns:
        boolean
      • getEventDate

        public java.util.Date getEventDate()
        Returns the event time as a Java Date object.
        Returns:
        Date
      • getEventMessage

        public java.lang.String getEventMessage()
                                         throws HelloSignException
        Returns the message if any from the event
        Returns:
        String
        Throws:
        HelloSignException - thrown if there is a problem parsing the backing JSONObject.
      • getRelatedSignatureId

        public java.lang.String getRelatedSignatureId()
        Returns the signature ID to which this event is associated.
        Returns:
        String
      • hasRelatedSignatureId

        public boolean hasRelatedSignatureId()
        Utility method to determine if this event has a related signature ID.
        Returns:
        true if this field exists and is set, false otherwise
      • getRelatedSignature

        public Signature getRelatedSignature()
                                      throws HelloSignException
        Returns the associated Signature object with this event, if the event is associated with a Signature Request.
        Returns:
        Signature
        Throws:
        HelloSignException - thrown if there is a problem parsing the backing JSONObject.
      • getSignatureRequest

        public SignatureRequest getSignatureRequest()
        Returns a reference to the SignatureRequest that is attached to the Event.
        Returns:
        SignatureRequest
      • hasSignatureRequest

        public boolean hasSignatureRequest()
        Returns true if this Event is associated with a Signature Request.
        Returns:
        boolean
      • getTemplate

        public Template getTemplate()
        Returns a reference to the Template that is attached to the Event.
        Returns:
        Template
      • hasTemplate

        public boolean hasTemplate()
        Returns true if this event is associated with a Template.
        Returns:
        boolean
      • getType

        public EventType getType()
        Returns the EventType for this event.
        Returns:
        EventType enum
      • getTypeString

        public java.lang.String getTypeString()
        Returns the event type String.
        Returns:
        String event type
      • getHash

        public java.lang.String getHash()
        Returns the unique hash string identifying this event.
        Returns:
        String hash
      • isValid

        public boolean isValid​(java.lang.String apiKey)
                        throws HelloSignException
        Returns true if the event hash matches the computed hash using the provided API key.
        Parameters:
        apiKey - String api key.
        Returns:
        true if the hashes match, false otherwise
        Throws:
        HelloSignException - thrown if there is a problem parsing the API key.
      • toString

        public java.lang.String toString()
        Displays the Signature Request in addition to the Event data.
        Overrides:
        toString in class AbstractResource