public class TemplateDraft extends AbstractRequest
Modifier and Type | Field and Description |
---|---|
static String |
TEMPLATE_DRAFT_ID |
static String |
TEMPLATE_DRAFT_KEY |
static String |
TEMPLATE_EDIT_URL |
static String |
TEMPLATE_EXPIRES_AT |
REQUEST_ALLOW_DECLINE, REQUEST_CLIENT_ID, REQUEST_HIDE_TEXT_TAGS, REQUEST_MESSAGE, REQUEST_METADATA, REQUEST_REDIRECT_URL, REQUEST_SUBJECT, REQUEST_TEST_MODE, REQUEST_TITLE, REQUEST_USE_PREEXISTING_FIELDS, REQUEST_USE_TEXT_TAGS, REQUEST_UX_VERSION, UX_VERSION_1, UX_VERSION_2
dataObj, warnings
Constructor and Description |
---|
TemplateDraft() |
TemplateDraft(org.json.JSONObject json) |
Modifier and Type | Method and Description |
---|---|
void |
addCCRole(String ccRole)
Adds a named role for a CC recipient that must be specified when the
template is used.
|
void |
addMergeField(String name,
FieldType type)
Add merge fields to the template draft.
|
void |
addSignerRole(String signerRole)
Adds the signer role to the template draft.
|
void |
addSignerRole(String role,
int order)
Adds the signer role with the given order to the list of signers for this
request.
|
void |
clearMergeFields()
Clears the current merge field map.
|
List<String> |
getCCRoles()
Returns the CC roles for this request.
|
String |
getEditUrl()
Returns the edit URL for creating an embedded template draft.
|
String |
getExpiresAt()
Returns the expiration time for the edit URL of this template.
|
String |
getId()
Returns the ID for this request.
|
Map<String,FieldType> |
getMergeFields()
Returns the current map of merge field names to types.
|
Map<String,Serializable> |
getPostFields()
Internal method used to retrieve the necessary POST fields.
|
List<String> |
getSignerRoles()
Returns the signer roles specified for this template draft.
|
boolean |
hasEditUrl()
Utility method to detect whether the "edit_url" parameter is set on this
template object.
|
boolean |
hasExpiresAt()
Utility method to detect whether the "expires_at" parameter is set on
this template object.
|
boolean |
hasId()
Returns true if this request has an ID.
|
boolean |
removeSignerRole(String signerRole)
Removes the signer role.
|
static String |
serializeMergeFields(Map<String,FieldType> mergeFields)
Helper method to convert a Java Map into the JSON string required
by the HelloSign API.
|
void |
setSignerRoles(List<String> signerRoles)
Overwrites the current list of signer roles.
|
addDocument, addDocument, addFile, addFile, addFileUrl, addMetadata, clearDocuments, getClientId, getDocuments, getFileUrls, getIsDeclinable, getMessage, getMetadata, getMetadata, getOrderMatters, getRedirectUrl, getSubject, getTitle, getUxVersion, hasHideTextTags, hasMessage, hasRedirectUrl, hasSubject, hasTitle, hasUsePreexistingFields, hasUseTextTags, isHidingTextTags, isTestMode, isUsingPreexistingFields, isUsingTextTags, setClientId, setDocuments, setFileUrls, setHideTextTags, setIsDeclinable, setMessage, setOrderMatters, setRedirectUrl, setSubject, setTestMode, setTitle, setUsePreexistingFields, setUseTextTags, setUxVersion
add, addToList, clearList, get, getBoolean, getConstructor, getDate, getInteger, getJSONObject, getList, getList, getLong, getString, getWarnings, has, hasString, set, toString, toString
public static final String TEMPLATE_DRAFT_KEY
public static final String TEMPLATE_DRAFT_ID
public static final String TEMPLATE_EDIT_URL
public static final String TEMPLATE_EXPIRES_AT
public TemplateDraft()
public TemplateDraft(org.json.JSONObject json) throws HelloSignException
HelloSignException
public String getId()
getId
in class AbstractRequest
public boolean hasId()
public void addCCRole(String ccRole)
ccRole
- Stringpublic void addSignerRole(String signerRole)
signerRole
- Stringpublic List<String> getSignerRoles()
public void addSignerRole(String role, int order) throws HelloSignException
role
- Stringorder
- intHelloSignException
- thrown if there is a problem adding the signer
role.public void setSignerRoles(List<String> signerRoles)
signerRoles
- Listpublic boolean removeSignerRole(String signerRole) throws HelloSignException
signerRole
- StringHelloSignException
- thrown if there is a problem removing the
signer role.public void addMergeField(String name, FieldType type) throws HelloSignException
name
- String name of the merge field that will be displayed to the
user and used to key off the custom field when populating the
value.type
- FieldType (currently only "text" and "checkbox" are allowed)HelloSignException
- thrown if there is a problem adding the merge
field.public Map<String,FieldType> getMergeFields()
public void clearMergeFields()
public boolean hasEditUrl()
public String getEditUrl()
public boolean hasExpiresAt()
public String getExpiresAt()
public static String serializeMergeFields(Map<String,FieldType> mergeFields) throws HelloSignException
mergeFields
- MapHelloSignException
- Thrown if there's a problem parsing JSONObjectspublic Map<String,Serializable> getPostFields() throws HelloSignException
getPostFields
in class AbstractRequest
HelloSignException
- thrown if there is a problem serializing the
POST fields.Copyright © 2017 HelloSign. All rights reserved.