Class UnclaimedDraft


  • public class UnclaimedDraft
    extends AbstractRequest
    Represents an unclaimed draft response and request. The UnclaimedDraft object essentially "wraps" a SignatureRequest. There are two types of unclaimed drafts that can be created:
    1. "send_document" - simply creates a claimable file. Use the addFile(File) and addFile(File, int) methods to add files to be claimed.
    2. "request_signature" - creates a claimable signature request. If this type is chosen, the signers name(s) and email address(es) are not optional.
    • Field Detail

      • UNCLAIMED_DRAFT_KEY

        public static final java.lang.String UNCLAIMED_DRAFT_KEY
        See Also:
        Constant Field Values
      • UNCLAIMED_DRAFT_CLAIM_URL

        public static final java.lang.String UNCLAIMED_DRAFT_CLAIM_URL
        See Also:
        Constant Field Values
      • UNCLAIMED_DRAFT_TYPE

        public static final java.lang.String UNCLAIMED_DRAFT_TYPE
        See Also:
        Constant Field Values
      • UNCLAIMED_DRAFT_REQUESTER_EMAIL

        public static final java.lang.String UNCLAIMED_DRAFT_REQUESTER_EMAIL
        See Also:
        Constant Field Values
      • UNCLAIMED_DRAFT_IS_FOR_EMBEDDED_SIGNING

        public static final java.lang.String UNCLAIMED_DRAFT_IS_FOR_EMBEDDED_SIGNING
        See Also:
        Constant Field Values
      • UNCLAIMED_DRAFT_SIGNATURE_REQUEST_ID

        public static final java.lang.String UNCLAIMED_DRAFT_SIGNATURE_REQUEST_ID
        See Also:
        Constant Field Values
      • UNCLAIMED_DRAFT_EXPIRES_AT

        public static final java.lang.String UNCLAIMED_DRAFT_EXPIRES_AT
        See Also:
        Constant Field Values
      • UNCLAIMED_DRAFT_TEST_MODE

        public static final java.lang.String UNCLAIMED_DRAFT_TEST_MODE
        See Also:
        Constant Field Values
    • Constructor Detail

      • UnclaimedDraft

        public UnclaimedDraft()
        Default constructor. This will instantiate the unclaimed draft with a SignatureRequest and the UnclaimedDraftType.send_document.
      • UnclaimedDraft

        public UnclaimedDraft​(AbstractRequest request)
        Creates an unclaimed draft with the provided AbstractRequest, and defaults the type to UnclaimedDraftType.send_document.
        Parameters:
        request - AbstractRequest
      • UnclaimedDraft

        public UnclaimedDraft​(AbstractRequest request,
                              UnclaimedDraftType type)
        Creates an unclaimed draft with the provided AbstractRequest and UnclaimedDraftType.
        Parameters:
        request - AbstractRequest
        type - UnclaimedDraftType
      • UnclaimedDraft

        public UnclaimedDraft​(org.json.JSONObject json)
                       throws HelloSignException
        Constructor to provide a way to store the API response JSON information.
        Parameters:
        json - JSONObject API response object
        Throws:
        HelloSignException - thrown if there is a problem parsing the JSONObject.
    • Method Detail

      • getTypeString

        public java.lang.String getTypeString()
        Gets the string value of the unclaimed draft type.
        Returns:
        String
      • getType

        public UnclaimedDraftType getType()
        Gets the unclaimed draft type.
        Returns:
        UnclaimedDraft.UNCLAIMED_DRAFT_TYPE
      • setType

        public void setType​(UnclaimedDraftType type)
        Sets the unclaimed draft type. Use the public enum: UnclaimedDraft.UNCLAIMED_DRAFT_TYPE.
        Parameters:
        type - UnclaimedDraft.UNCLAIMED_DRAFT_TYPE
      • getRequest

        public AbstractRequest getRequest()
        Gets the associated request object. Currently this will always be a SignatureRequest.
        Returns:
        AbstractRequest
      • setRequest

        public void setRequest​(AbstractRequest request)
        Sets the associated request object from which this unclaimed draft will be created.
        Parameters:
        request - AbstractRequest
      • getClaimUrl

        public java.lang.String getClaimUrl()
        Gets the claim URL if the draft has been created.
        Returns:
        String claim URL
      • hasClaimUrl

        public boolean hasClaimUrl()
        Returns true if the draft has been created and a claim URL exists.
        Returns:
        true or false, if not set
      • addFile

        public void addFile​(java.io.File file,
                            int order)
                     throws HelloSignException
        Adds a file to the unclaimed draft at the given document order.
        Parameters:
        file - File
        order - int
        Throws:
        HelloSignException - thrown if there is a problem adding the File.
      • isForEmbeddedSigning

        public boolean isForEmbeddedSigning()
        Returns true if this Unclaimed Draft is to be embedded.
        Returns:
        true if this Unclaimed Draft is to be embedded, false otherwise
      • setIsForEmbeddedSigning

        public void setIsForEmbeddedSigning​(boolean b)
        Sets whether this Unclaimed Draft is to be embedded.
        Parameters:
        b - boolean
      • hasSignatureRequestId

        public boolean hasSignatureRequestId()
      • getSignatureRequestId

        public java.lang.String getSignatureRequestId()
      • getRequesterEmail

        public java.lang.String getRequesterEmail()
      • setRequesterEmail

        public void setRequesterEmail​(java.lang.String email)
      • hasRequesterEmail

        public boolean hasRequesterEmail()
      • addCustomField

        public void addCustomField​(CustomField field)
        Description copied from class: AbstractRequest
        Add the custom field to this request. This is useful for specifying a pre-filled value and/or a field editor.
        Overrides:
        addCustomField in class AbstractRequest
        Parameters:
        field - CustomField
      • setCustomFieldValue

        public void setCustomFieldValue​(java.lang.String fieldNameOrApiId,
                                        java.lang.String value)
        Description copied from class: AbstractRequest
        Adds the value to fill in for a custom field with the given field name.
        Overrides:
        setCustomFieldValue in class AbstractRequest
        Parameters:
        fieldNameOrApiId - String name (or "Field Label") of the custom field to be filled in. The "api_id" can also be used instead of the name.
        value - String value
      • getCustomFields

        public java.util.List<CustomField> getCustomFields()
        Description copied from class: AbstractRequest
        Gets the custom fields associated with this request, set when sending the request.
        Overrides:
        getCustomFields in class AbstractRequest
        Returns:
        List CustomFields
      • setCustomFields

        public void setCustomFields​(java.util.Map<java.lang.String,​java.lang.String> fields)
        Description copied from class: AbstractRequest
        Overwrites the current map of custom fields to the provided map. This is a map of String field names to String field values.
        Overrides:
        setCustomFields in class AbstractRequest
        Parameters:
        fields - Map
      • getCustomFieldsMap

        public java.util.Map<java.lang.String,​java.lang.String> getCustomFieldsMap()
        Description copied from class: AbstractRequest
        Returns the map of custom fields for the request. This is a map of String field names to String field values.
        Overrides:
        getCustomFieldsMap in class AbstractRequest
        Returns:
        Map
      • getExpiresAt

        public java.util.Date getExpiresAt()