hellosign

package module
v0.0.0-...-48fbf15 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 27, 2020 License: MIT Imports: 13 Imported by: 0

README

hellosign

Go Hellosign api client

Very much a work in progress and largely untested

Documentation

Overview

Package hellosign implements various API clients for the HelloSign platform.

Charges

The creation of live signature requests is not free and requires a paid API plan (https://www.hellosign.com/api/pricing). The API will return HTTP 402 if such requests are made without a proper plan. The api can still be used for testing purposes by setting TestMode in parameters to endpoints that create signature requests.

Rate Limits

By default, you can make up to 2000 requests per hour for standard API requests, and 500 requests per hour for higher tier API requests. In test mode, you can do 50 requests per hour. Exceptions can be made for customers with higher volumes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BoolToInt

func BoolToInt(v bool) int8

BoolToInt converts a boolean value to a value appropriate for api interaction.

func DumpRequest

func DumpRequest(req *http.Request)

func GetEptURL

func GetEptURL(ept string) string

GetEptURL returns the full HelloSign api url for a given endpoint.

Types

type APIApp

type APIApp struct {
	CallbackURL *string `json:"callback_url"`
	ClientID    string  `json:"client_id"`
	CreatedAt   uint64  `json:"created_at"`
	Domain      string  `json:"domain"`
	IsApproved  bool    `json:"is_approved"`
	Name        string  `json:"name"`
	Oauth       *struct {
		CallbackURL string   `json:"callback_url"`
		Scopes      []string `json:"scopes"`
		Secret      string   `json:"string"`
	} `json:"oauth"`
	OwnerAccount struct {
		AccountID    string `json:"account_id"`
		EmailAddress string `json:"email_address"`
	} `json:"owner_account"`
}

APIApp Contains information about an API App.

type APIAppAPI

type APIAppAPI struct {
	// contains filtered or unexported fields
}

APIAppAPI used for api app manipulations.

func NewAPIAppAPI

func NewAPIAppAPI(apiKey string) *APIAppAPI

NewAPIAppAPI creates a new api client for api app operations.

func (*APIAppAPI) Create

func (c *APIAppAPI) Create(parms APIAppCreateParms) (*APIApp, error)

Create Creates a new API App.

func (*APIAppAPI) Delete

func (c *APIAppAPI) Delete(clientID string) (bool, error)

Delete deletes an API App. Can only be invoked for apps you own.

func (*APIAppAPI) Get

func (c *APIAppAPI) Get(clientID string) (*APIApp, error)

Get returns a struct with information about an API App.

func (*APIAppAPI) List

func (c *APIAppAPI) List(parms ListParms) (*APIAppLst, error)

List returns a list of API Apps that are accessible by you. If you are on a team with an Admin or Developer role, this list will include apps owned by teammates.

func (*APIAppAPI) Update

func (c *APIAppAPI) Update(clientID string, parms APIAppUpdateParms) (*APIApp, error)

Update Updates an existing API App. Can only be invoked for apps you own. Only the fields you provide will be updated. If you wish to clear an existing optional field, provide an empty string.

type APIAppCreateOauth

type APIAppCreateOauth struct {
	CallbackURL string   `form:"callback_url,omitempty"`
	Scopes      []string `form:"scopes,omitempty"`
}

APIAppCreateOauth OAuth params that can be provided when creating an app.

type APIAppCreateParms

type APIAppCreateParms struct {
	Name                 string             `form:"name"`
	Domain               string             `form:"domain"`
	CallbackURL          string             `form:"callback_url,omitempty"`
	CustomLogoFile       []byte             `form:"custom_logo_file,omitempty"`
	OAuth                *APIAppCreateOauth `form:"oauth,omitempty"`
	WhiteLabelingOptions string             `form:"white_labeling_options,omitempty"`
}

APIAppCreateParms parameters for creating an api app.

type APIAppLst

type APIAppLst struct {
	ListInfo ListInfo `json:"list_info"`
	APIApps  []APIApp `json:"api_apps"`
}

APIAppLst is a list of api apps managed by this account.

type APIAppUpdateOauth

type APIAppUpdateOauth struct {
	CallbackURL string   `form:"callback_url,omitempty"`
	Scopes      []string `form:"scopes,omitempty"`
}

APIAppUpdateOauth OAuth params that can be provided when updating an app.

type APIAppUpdateParms

type APIAppUpdateParms struct {
	Name                 string              `form:"name,omitempty"`
	Domain               string              `form:"domain,omitempty"`
	CallbackURL          string              `form:"callback_url,omitempty"`
	CustomLogoFile       []byte              `form:"custom_logo_file,omitempty"`
	OAuth                []APIAppUpdateOauth `form:"oauth,omitempty"`
	WhiteLabelingOptions string              `form:"white_labeling_options,omitempty"`
}

APIAppUpdateParms parameters for updating an api app.

type APIErr

type APIErr struct {
	Code    int // HTTP response code
	Message string
	Name    string
}

APIErr an error returned from the Hellosign API.

func (APIErr) Error

func (a APIErr) Error() string

type APIWarn

type APIWarn struct {
	Code     int // HTTP response code
	Warnings []struct {
		Message string
		Name    string
	}
}

APIWarn a list of warnings returned from the HelloSign API.

func (APIWarn) Error

func (a APIWarn) Error() string

type Acc

type Acc struct {
	AccountID    string  `json:"account_id"`
	EmailAddress string  `json:"email_address"`
	CallbackURL  *string `json:"callback_url"`
	IsPaidHS     bool    `json:"is_paid_hs"`
	IsPaidHF     bool    `json:"is_paid_hf"`
	Quotas       struct {
		TemplatesLeft            *uint64 `json:"templates_left"`
		APISignatureRequestsLeft *uint64 `json:"api_signature_requests_left"`
		DocumentsLeft            *uint64 `json:"documents_left"`
	} `json:"quotas"`
	RoleCode *string `json:"role_code"`
}

Acc contains information about an account and its settings.

type AccountAPI

type AccountAPI struct {
	// contains filtered or unexported fields
}

AccountAPI used for account manipulations.

func NewAccountAPI

func NewAccountAPI(apiKey string) *AccountAPI

NewAccountAPI creates a new api client for account operations.

func (*AccountAPI) Create

func (c *AccountAPI) Create(emailAddress string) (*Acc, error)

Create signs up for a new HelloSign Account.

func (*AccountAPI) Get

func (c *AccountAPI) Get() (*Acc, error)

Get returns your Account settings.

func (*AccountAPI) Update

func (c *AccountAPI) Update(callbackURL string) (*Acc, error)

Update sets your account settings.

func (*AccountAPI) Verify

func (c *AccountAPI) Verify(emailAddress string) (*Acc, error)

Verify whether a HelloSign Account exists.

type EmbeddedAPI

type EmbeddedAPI struct {
	// contains filtered or unexported fields
}

EmbeddedAPI used for embedded signature manipulations.

func NewEmbeddedAPI

func NewEmbeddedAPI(apiKey string) *EmbeddedAPI

NewEmbeddedAPI creates a new api client for embedded operations.

func (*EmbeddedAPI) GetSignURL

func (c *EmbeddedAPI) GetSignURL(signatureID string) (*EmbeddedURL, error)

GetSignURL retrieves an embedded object containing a signature url that can be opened in an iFrame.

func (*EmbeddedAPI) GetTemplateEditURL

func (c *EmbeddedAPI) GetTemplateEditURL(templateID string) (*EmbeddedURL, error)

GetTemplateEditURL retrieves an embedded object containing a template url that can be opened in an iFrame. Note that only templates created via the embedded template process are available to be edited with this endpoint.

type EmbeddedURL

type EmbeddedURL struct {
	SignURL   string `json:"sign_url"`
	ExpiresAt uint64 `json:"expires_at"`
}

EmbeddedURL is an URL with an expiration time.

type FileURL

type FileURL struct {
	FileURL   string `json:"file_url"`
	ExpiresAt uint64 `json:"expires_at"`
}

FileURL is an URL with an expiration time.

type FormField

type FormField struct {
	APIID    string `json:"api_id"`
	Name     string `json:"name"`
	Type     string `json:"type"`
	X        uint64 `json:"x"`
	Y        uint64 `json:"y"`
	Width    uint64 `json:"width"`
	Height   uint64 `json:"height"`
	Required bool   `json:"required"`
}

FormField a field where some kind of action needs to be taken.

type ListInfo

type ListInfo struct {
	Page       uint64 `json:"page"`
	NumPages   uint64 `json:"num_pages"`
	NumResults uint64 `json:"num_results"`
	PageSize   uint64 `json:"page_size"`
}

ListInfo struct with properties for all list epts.

type ListParms

type ListParms struct {
	AccountID string `form:"account_id,omitempty"`
	Page      uint64 `form:"page,omitempty"`
	PageSize  uint64 `form:"page_size,omitempty"`
	Query     string `form:"query,omitempty"`
}

ListParms struct with options for performing list operations.

type SigReq

type SigReq struct {
	SignatureRequestID string        `json:"signature_request_id"`
	Title              string        `json:"title"`
	Subject            string        `json:"subject"`
	Message            string        `json:"message"`
	IsComplete         bool          `json:"is_complete"`
	IsDeclined         bool          `json:"is_declined"`
	HasError           bool          `json:"has_error"`
	CustomFields       []interface{} `json:"custom_fields"`
	ResponseData       []struct {
		APIID       string `json:"api_id"`
		Name        string `json:"name"`
		SignatureID string `json:"signature_id"`
		Value       bool   `json:"value"`
		Type        string `json:"type"`
	} `json:"response_data"`
	SigningURL            *string `json:"signing_url"`
	SigningRedirectURL    *string `json:"signing_redirect_url"`
	DetailsURL            string  `json:"details_url"`
	RequesterEmailAddress string  `json:"requester_email_address"`
	Signatures            []struct {
		SignatureID        string  `json:"signature_id"`
		SignerEmailAddress string  `json:"signer_email_address"`
		SignerName         string  `json:"signer_name"`
		Order              *uint64 `json:"order"`
		StatusCode         string  `json:"status_code"`
		SignedAt           *uint64 `json:"signed_at"`
		LastViewedAt       *uint64 `json:"last_viewed_at"`
		LastRemindedAt     *uint64 `json:"last_reminded_at"`
		HasPin             bool    `json:"has_pin"`
	} `json:"signatures"`
	CCEmailAddresses []string `json:"cc_email_addresses"`
}

SigReq contains information regarding documents that need to be signed.

type SigReqEmbSendParms

type SigReqEmbSendParms struct {
	Title                 string            `form:"title,omitempty"`
	Subject               string            `form:"subject,omitempty"`
	Message               string            `form:"message,omitempty"`
	Metadata              map[string]string `form:"metadata,omitempty"`
	TestMode              int8              `form:"test_mode,omitempty"`
	AllowDecline          int8              `form:"allow_decline,omitempty"`
	File                  [][]byte          `form:"file,omitempty"`
	FileURL               []string          `form:"file_url,omitempty"`
	FileIO                []io.Reader       `form:"-"`
	Signers               []SigReqSigner    `form:"signers"`
	CCEmailAddresses      []string          `form:"cc_email_addresses,omitempty"`
	ClientID              string            `form:"client_id,omitempty"`
	FormFieldsPerDocument string            `form:"form_fields_per_documents,omitempty"`
	UseTextTags           int8              `form:"use_text_tags,omitempty"`
	HideTextTags          int8              `form:"hide_text_tags,omitempty"`
}

SigReqEmbSendParms parameters for creating an embedded signature request.

type SigReqLst

type SigReqLst struct {
	ListInfo          ListInfo `json:"list_info"`
	SignatureRequests []SigReq `json:"signature_requests"`
}

SigReqLst is a list of signature requests managed by this account.

type SigReqSendParms

type SigReqSendParms struct {
	Title                 string            `form:"title,omitempty"`
	Subject               string            `form:"subject,omitempty"`
	Message               string            `form:"message,omitempty"`
	Metadata              map[string]string `form:"metadata,omitempty"`
	TestMode              int8              `form:"test_mode,omitempty"`
	AllowDecline          int8              `form:"allow_decline,omitempty"`
	File                  [][]byte          `form:"file,omitempty"`
	FileURL               []string          `form:"file_url,omitempty"`
	FileIO                []io.Reader       `form:"-"`
	Signers               []SigReqSigner    `form:"signers"`
	CCEmailAddresses      []string          `form:"cc_email_addresses,omitempty"`
	ClientID              string            `form:"client_id,omitempty"`
	FormFieldsPerDocument string            `form:"form_fields_per_documents,omitempty"`
	UseTextTags           int8              `form:"use_text_tags,omitempty"`
	HideTextTags          int8              `form:"hide_text_tags,omitempty"`
	SigningRedirectURL    string            `form:"message,omitempty"`
}

SigReqSendParms parameters for creating a new signature request.

type SigReqSendTplParms

type SigReqSendTplParms struct {
	Title              string                              `form:"title,omitempty"`
	Subject            string                              `form:"subject,omitempty"`
	Message            string                              `form:"message,omitempty"`
	Metadata           map[string]string                   `form:"metadata,omitempty"`
	TestMode           int8                                `form:"test_mode,omitempty"`
	AllowDecline       int8                                `form:"allow_decline,omitempty"`
	TemplateID         string                              `form:"template_id,omitempty"`
	TemplateIds        []string                            `form:"template_ids,omitempty"`
	SigningRedirectURL string                              `form:"signing_redirect_url,omitempty"`
	Signers            map[string]SigReqSendTplParmsSigner `form:"signers"`
	Ccs                map[string]SigReqSendTplParmsCcs    `form:"ccs,omitempty"`
	CustomFields       string                              `form:"custom_fields,omitempty"`
	ClientID           string                              `form:"client_id,omitempty"`
}

SigReqSendTplParms parameters for creating a signature request from a template.

type SigReqSendTplParmsCcs

type SigReqSendTplParmsCcs struct {
	EmailAddress string `form:"email_address"`
}

SigReqSendTplParmsCcs an email address that should be cc'd when the template signature request is signed.

type SigReqSendTplParmsSigner

type SigReqSendTplParmsSigner struct {
	Name         string `form:"name"`
	EmailAddress string `form:"email_address"`
	Pin          string `form:"pin,omitempty"`
}

SigReqSendTplParmsSigner represents a person that should sign the template signature request.

type SigReqSigner

type SigReqSigner struct {
	Name         string  `form:"name"`
	EmailAddress string  `form:"email_address"`
	Order        *uint64 `form:"order,omitempty"`
	Pin          string  `form:"pin,omitempty"`
}

SigReqSigner represents a person that should sign a document. Each signer must be unique.

type SignatureRequestAPI

type SignatureRequestAPI struct {
	// contains filtered or unexported fields
}

SignatureRequestAPI used for signature request manipulations.

func NewSignatureRequestAPI

func NewSignatureRequestAPI(apiKey string) *SignatureRequestAPI

NewSignatureRequestAPI creates a new api client for signature request manipulations.

func (*SignatureRequestAPI) Cancel

func (c *SignatureRequestAPI) Cancel(signatureRequestID string) (ok bool, err error)

Cancel Queues a SignatureRequest to be canceled. The cancelation is asynchronous and a successful call to this endpoint will return a 200 OK response if the signature request is eligible to be canceled and has been successfully queued. To be eligible for cancelation, a signature request must have been sent successfully and must be unsigned. Once canceled, signers will not be able to sign the signature request or access its documents. Canceling a signature request is not reversible.

Configuring a callback handler to listen for the SIGNATURE_REQUEST_CANCELED event is recommended to receive a notification when the cancelation has taken place. If a callback handler has been configured and this event has not been received within 60 minutes of making the call, please check the status of the request in the API Dashboard and retry the request if necessary.

func (*SignatureRequestAPI) Files

func (c *SignatureRequestAPI) Files(signatureRequestID, fileType string, getURL bool) ([]byte, *FileURL, error)

Files obtain a copy of the current documents specified by the signatureRequestID parameter.

func (*SignatureRequestAPI) Get

func (c *SignatureRequestAPI) Get(signatureRequestID string) (*SigReq, error)

Get returns the status of the SignatureRequest specified by the signatureRequestID parameter.

func (*SignatureRequestAPI) List

func (c *SignatureRequestAPI) List(parms ListParms) (*SigReqLst, error)

List returns a list of SignatureRequests that you can access. This includes SignatureRequests you have sent as well as received, but not ones that you have been CCed on.

func (*SignatureRequestAPI) Send

func (c *SignatureRequestAPI) Send(parms SigReqSendParms) (*SigReq, error)

Send creates and sends a new SignatureRequest with the submitted documents. If FormFieldsPerDocument is not specified, a signature page will be affixed where all signers will be required to add their signature, signifying their agreement to all contained documents.

func (*SignatureRequestAPI) SendEmbedded

func (c *SignatureRequestAPI) SendEmbedded(parms SigReqEmbSendParms) (*SigReq, error)

SendEmbedded creates a new SignatureRequest with the submitted documents to be signed in an embedded iFrame. If FormFieldsPerDocument is not specified, a signature page will be affixed where all signers will be required to add their signature, signifying their agreement to all contained documents. Note that embedded signature requests can only be signed in embedded iFrames whereas normal signature requests can only be signed on HelloSign.

func (*SignatureRequestAPI) SendReminder

func (c *SignatureRequestAPI) SendReminder(signatureRequestID, emailAddress string, name *string) (*SigReq, error)

SendReminder sends an email to the signer reminding them to sign the signature request. You cannot send a reminder within 1 hour of the last reminder that was sent. This includes manual AND automatic reminders.

func (*SignatureRequestAPI) SendWithTemplate

func (c *SignatureRequestAPI) SendWithTemplate(parms SigReqSendTplParms) (*SigReq, error)

SendWithTemplate creates and sends a new SignatureRequest based off of the Template specified with the TemplateID parameter.

func (*SignatureRequestAPI) Update

func (c *SignatureRequestAPI) Update(signatureRequestID, signatureID, email string) (*SigReq, error)

Update updates the email address for a given signer on a signature request. You can listen for the "signature_request_email_bounce" event on your app or account to detect bounced emails, and respond with this method.

type Team

type Team struct {
	Name            string    `json:"name"`
	Accounts        []TeamAcc `json:"accounts"`
	InvitedAccounts []TeamAcc `json:"invited_accounts"`
}

Team contains information about your team and its members.

type TeamAPI

type TeamAPI struct {
	// contains filtered or unexported fields
}

TeamAPI used for team manipulations

func NewTeamAPI

func NewTeamAPI(apiKey string) *TeamAPI

NewTeamAPI creates a new api client for team endpoints.

func (*TeamAPI) AddUser

func (c *TeamAPI) AddUser(accountID, emailAddress *string) (*Team, error)

AddUser adds or invites a user (specified using the EmailAddress parameter) to your Team. If the user does not currently have a HelloSign Account, a new one will be created for them. If the user currently has a paid subscription, they will not automatically join the Team but instead will be sent an invitation to join. If a user is already a part of another Team, a "team_invite_failed" error will be returned.

func (*TeamAPI) Create

func (c *TeamAPI) Create(name string) (*Team, error)

Create creates a new Team and makes you a member. You must not currently belong to a Team to invoke.

func (*TeamAPI) Delete

func (c *TeamAPI) Delete() (ok bool, err error)

Delete deletes your Team. Can only be invoked when you have a Team with only one member (yourself).

func (*TeamAPI) Get

func (c *TeamAPI) Get() (*Team, error)

Get returns information about your Team as well as a list of its members. If you do not belong to a Team, a 404 error with an error_name of "not_found" will be returned.

func (*TeamAPI) RemoveUser

func (c *TeamAPI) RemoveUser(accountID, emailAddress *string) (*Team, error)

RemoveUser removes a user from your Team. If the user had an outstanding invitation to your Team the invitation will be expired.

func (*TeamAPI) Update

func (c *TeamAPI) Update(name string) (*Team, error)

Update updates the name of your Team.

type TeamAcc

type TeamAcc struct {
	AccountID    string `json:"account_id"`
	EmailAddress string `json:"email_address"`
	RoleCode     string `json:"role_code"`
}

TeamAcc a team member.

type TemplateAPI

type TemplateAPI struct {
	// contains filtered or unexported fields
}

TemplateAPI used for manipulating templates.

func NewTemplateAPI

func NewTemplateAPI(apiKey string) *TemplateAPI

NewTemplateAPI creates a new api client for template endpoints.

func (*TemplateAPI) AddUser

func (c *TemplateAPI) AddUser(templateID string, accountID, emailAddress *string) (*Tpl, error)

AddUser gives the specified Account access to the specified Template. The specified Account must be a part of your Team.

func (*TemplateAPI) CreateEmbeddedDraft

func (c *TemplateAPI) CreateEmbeddedDraft(parms TplEmbCreateParms) (*Tpl, error)

CreateEmbeddedDraft he first step in an embedded template workflow. Creates a draft template that can then be further set up in the template 'edit' stage.

func (*TemplateAPI) Delete

func (c *TemplateAPI) Delete(templateID string) (ok bool, err error)

Delete completely deletes the template specified from the account.

func (*TemplateAPI) Files

func (c *TemplateAPI) Files(templateID, fileType string, getURL bool) ([]byte, *FileURL, error)

Files obtain a copy of the original files specified by the template_id parameter.

func (*TemplateAPI) Get

func (c *TemplateAPI) Get(templateID string) (*Tpl, error)

Get returns the Template specified by the id parameter.

func (*TemplateAPI) List

func (c *TemplateAPI) List(parms ListParms) (*TplLst, error)

List returns a list of the Templates that are accessible by you.

func (*TemplateAPI) RemoveUser

func (c *TemplateAPI) RemoveUser(templateID string, accountID, emailAddress *string) (*Tpl, error)

RemoveUser removes the specified Account's access to the specified Template.

type Tpl

type Tpl struct {
	TemplateID  string `json:"template_id"`
	Title       string `json:"title"`
	Message     string `json:"message"`
	SignerRoles []struct {
		Name  string  `json:"name"`
		Order *uint64 `json:"order"`
	} `json:"signer_roles"`
	CCRoles []struct {
		Name string `json:"name"`
	}
	Documents []struct {
		Index        uint64      `json:"index"`
		Name         string      `json:"name"`
		FormFields   []FormField `json:"form_fields"`
		CustomFields []struct {
			Name string `json:"name"`
			Type string `json:"type"`
		} `json:"custom_fields"`
	} `json:"documents"`
	Accounts []struct {
		AccountID    string `json:"account_id"`
		EmailAddress string `json:"email_address"`
	} `json:"accounts"`
}

Tpl contains information about the templates you and your team have created

type TplEmbCreateParms

type TplEmbCreateParms struct {
	TestMode    int8               `form:"test_mode,omitempty"`
	ClientID    string             `form:"client_id"`
	File        [][]byte           `form:"file,omitempty"`
	FileURL     []string           `form:"file_url,omitempty"`
	Title       string             `form:"title,omitempty"`
	Subject     string             `form:"subject,omitempty"`
	Message     string             `form:"message,omitempty"`
	SignerRoles []TplEmbSignerRole `form:"signer_roles,omitempty"`
	CCRoles     []string           `form:"cc_email_addresses,omitempty"`
	MergeFields []TplEmbMergeField `form:"merge_fields,omitempty"`
	Metadata    map[string]string  `form:"metadata,omitempty"`
}

TplEmbCreateParms parameters for creating template drafts.

type TplEmbMergeField

type TplEmbMergeField struct {
	Name string `form:"name"`
	Type string `form:"type"`
}

TplEmbMergeField the merge fields that can be placed on the template's document(s) by the user claiming the template draft.

type TplEmbSignerRole

type TplEmbSignerRole struct {
	Name  string  `form:"name"`
	Order *uint64 `form:"order,omitempty"`
}

TplEmbSignerRole role parameter for template.

type TplLst

type TplLst struct {
	ListInfo  ListInfo `json:"list_info"`
	Templates []Tpl    `json:"templates"`
}

TplLst is a list of templates accessible by this account.

type UnclaimedDraftAPI

type UnclaimedDraftAPI struct {
	// contains filtered or unexported fields
}

func NewUnclaimedDraftAPI

func NewUnclaimedDraftAPI(apiKey string) *UnclaimedDraftAPI

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL