public class HelloSignClient extends Object
Modifier | Constructor and Description |
---|---|
|
HelloSignClient(Authentication auth)
Creates a new HelloSign client using then given Authentication object.
|
protected |
HelloSignClient(HttpClient client,
Authentication auth)
Default constructor for injection of dependencies (testing).
|
|
HelloSignClient(String apiKey)
Creates a new HelloSign client using your API key.
|
Modifier and Type | Method and Description |
---|---|
Template |
addTemplateUser(String templateId,
String idOrEmail)
Adds the provided user to the template indicated by the provided template
ID.
|
boolean |
cancelSignatureRequest(String id)
Cancels an existing signature request.
|
Account |
createAccount(String email)
Creates a new HelloSign account.
|
Account |
createAccount(String email,
String clientId,
String clientSecret)
Creates a new HelloSign account and provides OAuth app credentials to
automatically generate an OAuth token with the user Account response.
|
ApiApp |
createApiApp(ApiApp app)
Creates a new ApiApp using the properties set on the provided ApiApp.
|
AbstractRequest |
createEmbeddedRequest(EmbeddedRequest embeddedReq)
Creates a signature request that can be embedded within your website.
|
TemplateDraft |
createEmbeddedTemplateDraft(EmbeddedRequest req)
Creates a template draft that can be used for embedded template creation.
|
Team |
createTeam(String teamName)
Creates a new team for the current user with the given name.
|
UnclaimedDraft |
createUnclaimedDraft(UnclaimedDraft draft)
Creates an unclaimed draft using the provided request draft object.
|
boolean |
deleteApiApp(String clientId)
Attempts to delete the API app with the given client ID.
|
boolean |
deleteTemplate(String templateId)
Delete the template designated by the template id
|
boolean |
destroyTeam()
Destroys the current user's team.
|
Account |
getAccount()
Returns the current user's account information.
|
ApiApp |
getApiApp(String clientId)
Retrieves the API app configuration for the given Client ID.
|
ApiAppList |
getApiApps()
Retrieves a paged list of API apps for the authenticated account.
|
protected Authentication |
getAuth()
Retrieves the authentication details being used by this client.
|
EmbeddedResponse |
getEmbeddedSignUrl(String signatureId)
Retrieves the necessary information to build an embedded signature
request.
|
EmbeddedResponse |
getEmbeddedTemplateEditUrl(String templateId)
Retrieves the necessary information to edit an embedded template.
|
EmbeddedResponse |
getEmbeddedTemplateEditUrl(String templateId,
boolean skipSignerRoles,
boolean skipSubjectMessage)
Retrieves the necessary information to edit an embedded template.
|
EmbeddedResponse |
getEmbeddedTemplateEditUrl(String templateId,
boolean skipSignerRoles,
boolean skipSubjectMessage,
boolean testMode)
Retrieves the necessary information to edit an embedded template.
|
EmbeddedResponse |
getEmbeddedTemplateEditUrl(String templateId,
boolean skipSignerRoles,
boolean skipSubjectMessage,
boolean testMode,
Map<String,FieldType> mergeFields,
List<String> ccRoles)
Big kahuna method for editing an embedded template.
|
File |
getFiles(String requestId)
Retrieves a PDF copy of the files associated with a signature request.
|
File |
getFiles(String requestId,
String format)
Retrieves the file associated with a signature request.
|
FileUrlResponse |
getFilesUrl(String requestId)
Retrieves a URL for a file associated with a signature request.
|
File |
getFinalCopy(String requestId)
Deprecated.
Use {
getFiles(String) |
OauthData |
getOauthData(String code,
String clientId,
String secret,
String state,
boolean autoSetRequestToken)
Performs an OAuth request and returns the necessary data for authorizing
an API application, and will automatically set the access token and code
for making authenticated requests with this client.
|
SignatureRequest |
getSignatureRequest(String id)
Retrieves a Signature Request with the given ID.
|
SignatureRequestList |
getSignatureRequests()
Retrieves the current user's signature requests.
|
SignatureRequestList |
getSignatureRequests(int page)
Retrieves a specific page of the current user's signature requests.
|
Team |
getTeam()
Retrieves the Team for the current user account.
|
Template |
getTemplate(String templateId)
Retrieves a specific Template based on the provided Template ID.
|
File |
getTemplateFile(String templateId)
Retrieves the PDF file backing the Template specified by the provided
Template ID.
|
String |
getTemplateFileUrl(String templateId)
Returns a signed URL that can be used to retrieve the file backing a
template.
|
TemplateList |
getTemplates()
Retrieves the templates for the current user account.
|
TemplateList |
getTemplates(int page)
Retreives a page of templates for the current user account.
|
Team |
inviteTeamMember(String idOrEmail)
Adds the user to the current user's team.
|
boolean |
isAccountValid(String email)
Returns true if an account exists with the provided email address.
|
boolean |
isOnline()
Deprecated.
This function was previously for internal testing use only
and is no longer operational. This will be removed in the next
minor version of the SDK.
|
OauthData |
refreshOauthData(String refreshToken)
Refreshes the OauthData for this client with the provided refresh token.
|
Team |
removeTeamMember(String idOrEmail)
Removes the team member indicated by the user account ID or email
address.
|
Template |
removeTemplateUser(String templateId,
String idOrEmail)
Adds the provided user to the template indicated by the provided template
ID.
|
SignatureRequest |
requestEmailReminder(String requestId,
String email)
Instructs HelloSign to email the given address with a reminder to sign
the SignatureRequest referenced by the given request ID.
|
SignatureRequest |
sendSignatureRequest(SignatureRequest req)
Sends the provided signature request to HelloSign.
|
SignatureRequest |
sendTemplateSignatureRequest(TemplateSignatureRequest req)
Creates a new Signature Request based on the template provided.
|
void |
setAccessToken(String accessToken,
String tokenType)
Sets the access token for the OAuth user that this client will use to
perform requests.
|
void |
setAuthentication(Authentication auth)
Allows overriding of the authentication mechanism.
|
Account |
setCallback(String callback)
Update your account callback URL.
|
ApiApp |
updateApiApp(ApiApp app)
Updates the API app with the given ApiApp object properties.
|
SignatureRequest |
updateSignatureRequest(String signatureRequestId,
String signatureId,
String newEmailAddress)
Update a signer's email address.
|
Team |
updateTeamName(String teamName)
Updates the current user's team name.
|
String |
updateTemplateFiles(String existingTemplateId,
TemplateDraft newTemplate,
String clientId)
Replaces the backing documents for the given template with the given
files.
|
public static final String DEFAULT_ENCODING
public static final String DEFAULT_BASE_API_URL
public static final String DEFAULT_OAUTH_TOKEN_URL
public static final String ACCOUNT_URI
public static final String VALIDATE_ACCOUNT_URI
public static final String ACCOUNT_CREATE_URI
public static final String TEAM_URI
public static final String TEAM_CREATE_URI
public static final String TEAM_DESTROY_URI
public static final String TEAM_ADD_MEMBER_URI
public static final String TEAM_REMOVE_MEMBER_URI
public static final String SIGNATURE_REQUEST_URI
public static final String SIGNATURE_REQUEST_LIST_URI
public static final String SIGNATURE_REQUEST_SEND_URI
public static final String TEMPLATE_URI
public static final String TEMPLATE_FILE_URI
public static final String TEMPLATE_LIST_URI
public static final String TEMPLATE_ADD_USER_URI
public static final String TEMPLATE_REMOVE_USER_URI
public static final String TEMPLATE_DELETE_URI
public static final String TEMPLATE_UPDATE_FILES_URI
public static final String TEMPLATE_CREATE_EMBEDDED_DRAFT_URI
public static final String TEMPLATE_SIGNATURE_REQUEST_URI
public static final String SIGNATURE_REQUEST_CANCEL_URI
public static final String SIGNATURE_REQUEST_REMIND_URI
public static final String SIGNATURE_REQUEST_FINAL_COPY_URI
public static final String SIGNATURE_REQUEST_FILES_URI
public static final String SIGNATURE_REQUEST_UPDATE_URI
public static final String SIGNATURE_REQUEST_EMBEDDED_URI
public static final String SIGNATURE_REQUEST_EMBEDDED_TEMPLATE_URI
public static final String EMBEDDED_SIGN_URL_URI
public static final String EMBEDDED_EDIT_URL_URI
public static final String UNCLAIMED_DRAFT_CREATE_URI
public static final String UNCLAIMED_DRAFT_CREATE_EMBEDDED_URI
public static final String UNCLAIMED_DRAFT_CREATE_EMBEDDED_WITH_TEMPLATE_URI
public static final String API_APP_URI
public static final String API_APP_LIST_URI
public static final String PARAM_FILE_TYPE_URI
public static final String PARAM_GET_URL
public static final String FINAL_COPY_FILE_NAME
public static final String FINAL_COPY_FILE_EXT
public static final String FILES_FILE_NAME
public static final String FILES_FILE_EXT
public static final String TEMPLATE_FILE_NAME
public static final String TEMPLATE_FILE_EXT
public static final String OAUTH_CODE
public static final String OAUTH_STATE
public static final String OAUTH_GRANT_TYPE
public static final String OAUTH_REFRESH_TOKEN
public static final String OAUTH_GRANT_TYPE_AUTHORIZE_CODE
public static final String OAUTH_GRANT_TYPE_REFRESH_TOKEN
public static final String CLIENT_SECRET
public static final String CLIENT_ID
public static final String EMBEDDED_TEMPLATE_SKIP_SIGNER_ROLES
public static final String EMBEDDED_TEMPLATE_SKIP_SUBJECT_MESSAGE
public static final String EMBEDDED_TEMPLATE_MERGE_FIELDS
public static final String EMBEDDED_TEMPLATE_CC_ROLES
protected HelloSignClient(HttpClient client, Authentication auth)
client
- HttpClientauth
- AuthenticationHelloSignClient(String)
public HelloSignClient(String apiKey) throws HelloSignException
apiKey
- String API keyHelloSignException
- thrown if there's a problem setting the
credentialspublic HelloSignClient(Authentication auth) throws HelloSignException
auth
- Authentication used primarily for setting OAuth token/secretHelloSignException
- thrown if there's a problem setting the credentialspublic void setAuthentication(Authentication auth)
auth
- Authentication used for setting the auth method for this clientprotected Authentication getAuth()
public Account getAccount() throws HelloSignException
HelloSignException
- thrown if there's a problem processing the
HTTP request or the JSON response.public boolean isAccountValid(String email) throws HelloSignException
email
- String email addressHelloSignException
- Thrown if there's a problem communicating with
the HelloSign API.public Account setCallback(String callback) throws HelloSignException
callback
- String URLHelloSignException
- thrown if there's a problem processing the
HTTP request or the JSON response.public Account createAccount(String email) throws HelloSignException
email
- String New user's email addressHelloSignException
- thrown if there's a problem processing the
HTTP request or the JSON response.public Account createAccount(String email, String clientId, String clientSecret) throws HelloSignException
email
- String New user's email addressclientId
- String Client IDclientSecret
- String App secretHelloSignException
- thrown if there's a problem processing the
HTTP request or the JSON response.public OauthData getOauthData(String code, String clientId, String secret, String state, boolean autoSetRequestToken) throws HelloSignException
code
- String OAuth codeclientId
- String OAuth client IDsecret
- String OAuth secretstate
- String OAuth client stateautoSetRequestToken
- true if the token should be applied to this
client for future requestsHelloSignException
- thrown if there's a problem processing the
HTTP request or the JSON response.public OauthData refreshOauthData(String refreshToken) throws HelloSignException
refreshToken
- StringHelloSignException
- thrown if there's a problem processing the
HTTP request or the JSON response.public Team getTeam() throws HelloSignException
HelloSignException
- thrown if there's a problem processing the
HTTP request or the JSON response.public Team createTeam(String teamName) throws HelloSignException
teamName
- String team nameHelloSignException
- thrown if there's a problem processing the
HTTP request or the JSON response.public boolean destroyTeam() throws HelloSignException
HelloSignException
- thrown if there's a problem processing the
HTTP request or the JSON response.public Team updateTeamName(String teamName) throws HelloSignException
teamName
- String team nameHelloSignException
- thrown if there's a problem processing the
HTTP request or the JSON response.public Team inviteTeamMember(String idOrEmail) throws HelloSignException
idOrEmail
- String new team member's account ID or email addressHelloSignException
- thrown if there's a problem processing the
HTTP request or the JSON response.public Team removeTeamMember(String idOrEmail) throws HelloSignException
idOrEmail
- String removed team member's account ID or email addressHelloSignException
- thrown if there's a problem processing the
HTTP request or the JSON response.public SignatureRequest getSignatureRequest(String id) throws HelloSignException
id
- String signature IDHelloSignException
- thrown if there's a problem processing the
HTTP request or the JSON response.public SignatureRequestList getSignatureRequests() throws HelloSignException
HelloSignException
- thrown if there's a problem processing the
HTTP request or the JSON response.public SignatureRequestList getSignatureRequests(int page) throws HelloSignException
page
- intHelloSignException
- thrown if there's a problem processing the
HTTP request or the JSON response.public SignatureRequest sendSignatureRequest(SignatureRequest req) throws HelloSignException
req
- SignatureRequestHelloSignException
- thrown if there's a problem processing the
HTTP request or the JSON response.public SignatureRequest updateSignatureRequest(String signatureRequestId, String signatureId, String newEmailAddress) throws HelloSignException
signatureRequestId
- String ID of the signature request that has
already been sent and needs to be updated.signatureId
- String ID of the signer that needs to be updated.newEmailAddress
- String email address that the signer should be
changed toHelloSignException
- thrown if there's a problem processing the
HTTP request or the JSON response.public TemplateList getTemplates() throws HelloSignException
HelloSignException
- thrown if there's a problem processing the
HTTP request or the JSON response.public TemplateList getTemplates(int page) throws HelloSignException
page
- intHelloSignException
- thrown if there's a problem processing the
HTTP request or the JSON response.public File getTemplateFile(String templateId) throws HelloSignException
templateId
- String Template IDHelloSignException
- thrown if there's a problem processing the
HTTP request or the JSON response.public String getTemplateFileUrl(String templateId) throws HelloSignException
templateId
- String Template IDHelloSignException
- thrown if there's a problem processing the
HTTP request or the JSON response.public Template getTemplate(String templateId) throws HelloSignException
templateId
- String Template IDHelloSignException
- thrown if there's a problem processing the
HTTP request or the JSON response.public Template addTemplateUser(String templateId, String idOrEmail) throws HelloSignException
templateId
- String template IDidOrEmail
- String account ID or email addressHelloSignException
- thrown if there's a problem processing the
HTTP request or the JSON response.public boolean deleteTemplate(String templateId) throws HelloSignException
templateId
- String template IDHelloSignException
- thrown if there is a problem processing the
HTTP requestpublic String updateTemplateFiles(String existingTemplateId, TemplateDraft newTemplate, String clientId) throws HelloSignException
existingTemplateId
- String ID of the template from which the
overlay data (signatures, text fields, etc.) will be retrieved.newTemplate
- TemplateDraft that holds the data and documents which
will be used as the basis for the new template. The following
fields can be set in this request: files or file_urls, subject,
message, and test_mode.clientId
- String optional ID of the app which is generating this
new template. Set to null if not used.HelloSignException
- thrown if there is a problem processing the
HTTP requestpublic Template removeTemplateUser(String templateId, String idOrEmail) throws HelloSignException
templateId
- String template IDidOrEmail
- String account ID or email addressHelloSignException
- thrown if there's a problem processing the
HTTP request or the JSON response.public SignatureRequest sendTemplateSignatureRequest(TemplateSignatureRequest req) throws HelloSignException
req
- TemplateSignatureRequestHelloSignException
- thrown if there's a problem processing the
HTTP request or the JSON response.public boolean cancelSignatureRequest(String id) throws HelloSignException
id
- SignatureRequest idHelloSignException
- thrown if there's a problem processing the
HTTP request or the JSON response.public SignatureRequest requestEmailReminder(String requestId, String email) throws HelloSignException
requestId
- String SignatureRequest IDemail
- String emailHelloSignException
- thrown if there's a problem processing the
HTTP request or the JSON response.public File getFinalCopy(String requestId) throws HelloSignException
getFiles(String)
requestId
- String SignatureRequest IDHelloSignException
- thrown if there's a problem processing the
HTTP request or the JSON response.public File getFiles(String requestId) throws HelloSignException
requestId
- String signature IDHelloSignException
- thrown if there's a problem processing the
HTTP request or the JSON response.public File getFiles(String requestId, String format) throws HelloSignException
requestId
- String signature request IDformat
- String format, see SignatureRequest for available typesHelloSignException
- thrown if there's a problem processing the
HTTP request or the JSON response.public FileUrlResponse getFilesUrl(String requestId) throws HelloSignException
requestId
- String signature request IDFileUrlResponse
HelloSignException
- thrown if there's a problem processing the
HTTP request or the JSON response.public AbstractRequest createEmbeddedRequest(EmbeddedRequest embeddedReq) throws HelloSignException
embeddedReq
- EmbeddedRequestHelloSignException
- thrown if there's a problem processing the
HTTP request or the JSON response.public EmbeddedResponse getEmbeddedSignUrl(String signatureId) throws HelloSignException
signatureId
- String ID of the signature request to embedHelloSignException
- thrown if there's a problem processing the
HTTP request or the JSON response.public EmbeddedResponse getEmbeddedTemplateEditUrl(String templateId) throws HelloSignException
templateId
- String ID of the signature request to embedHelloSignException
- thrown if there's a problem processing the
HTTP request or the JSON response.public EmbeddedResponse getEmbeddedTemplateEditUrl(String templateId, boolean skipSignerRoles, boolean skipSubjectMessage) throws HelloSignException
templateId
- String ID of the signature request to embedskipSignerRoles
- true if the edited template should not allow the
user to modify the template's signer roles. Defaults to false.skipSubjectMessage
- true if the edited template should not allow
the user to modify the template's subject and message. Defaults to
false.HelloSignException
- thrown if there's a problem processing the
HTTP request or the JSON response.public EmbeddedResponse getEmbeddedTemplateEditUrl(String templateId, boolean skipSignerRoles, boolean skipSubjectMessage, boolean testMode) throws HelloSignException
templateId
- String ID of the signature request to embedskipSignerRoles
- true if the edited template should not allow the
user to modify the template's signer roles. Defaults to false.skipSubjectMessage
- true if the edited template should not allow
the user to modify the template's subject and message. Defaults to
false.testMode
- true if this request is a test request. Useful for
editing locked templates.HelloSignException
- thrown if there's a problem processing the
HTTP request or the JSON response.public EmbeddedResponse getEmbeddedTemplateEditUrl(String templateId, boolean skipSignerRoles, boolean skipSubjectMessage, boolean testMode, Map<String,FieldType> mergeFields, List<String> ccRoles) throws HelloSignException
templateId
- String ID of the signature request to embedskipSignerRoles
- true if the edited template should not allow the
user to modify the template's signer roles. Defaults to false.skipSubjectMessage
- true if the edited template should not allow
the user to modify the template's subject and message. Defaults to
false.testMode
- true if this request is a test request. Useful for
editing locked templates.mergeFields
- These will overwrite the current merge fields for the
embedded template. To remove all merge fields, pass in an empty Map.ccRoles
- These will overwrite the current CC Roles for the embedded
template. To remove all CC roles, pass in null or an empty List.HelloSignException
- thrown if there's a problem processing the
HTTP request or the JSON response.public UnclaimedDraft createUnclaimedDraft(UnclaimedDraft draft) throws HelloSignException
draft
- UnclaimedDraftHelloSignException
- thrown if there's a problem processing the
HTTP request or the JSON response.public TemplateDraft createEmbeddedTemplateDraft(EmbeddedRequest req) throws HelloSignException
req
- EmbeddedRequestHelloSignException
- thrown if there's a problem processing the
HTTP request or the JSON response.public ApiApp getApiApp(String clientId) throws HelloSignException
clientId
- StringHelloSignException
- thrown if there's a problem processing the
HTTP request or the JSON response.public ApiAppList getApiApps() throws HelloSignException
HelloSignException
- thrown if there's a problem processing the
HTTP request or the JSON response.public ApiApp createApiApp(ApiApp app) throws HelloSignException
app
- ApiAppHelloSignException
- thrown if there's a problem processing the
HTTP request or the JSON response.public boolean deleteApiApp(String clientId) throws HelloSignException
clientId
- String The Client ID of the app that should be deleted.HelloSignException
- thrown if there's a problem processing the
HTTP request or the JSON response.public ApiApp updateApiApp(ApiApp app) throws HelloSignException
app
- ApiAppHelloSignException
- thrown if there's a problem processing the
HTTP request or the JSON response.public boolean isOnline() throws HelloSignException
HelloSignException
- thrown if there's a problem processing the
HTTP request or response.public void setAccessToken(String accessToken, String tokenType) throws HelloSignException
accessToken
- String access tokentokenType
- String token typeHelloSignException
- thrown if there's a problem setting the access
token.Copyright © 2017 HelloSign. All rights reserved.