Documentation
¶
Overview ¶
Package service holds the service layer for the Proxeus core
Index ¶
- Variables
- func GetDataManager(auth model.MemoryAuth) form.DataManager
- func Init(s *sys.System)
- func NewApiService() *defaultApiService
- func NewAuthenticationService(userS UserService, workflowS WorkflowService, emailS EmailService) *defaultAuthenticationService
- func NewNodeService(workflowService WorkflowService) *defaultNodeService
- func NewUserService() *defaultUserService
- type ApiService
- type AuthenticationService
- type DefaultDocumentService
- func (me *DefaultDocumentService) Delete(auth model.MemoryAuth, id string) error
- func (me *DefaultDocumentService) Edit(auth model.Auth, userId string, formInput map[string]interface{}) error
- func (me *DefaultDocumentService) GetDocApp(auth model.MemoryAuth, id string) *app.DocumentFlowInstance
- func (me *DefaultDocumentService) GetFile(auth model.MemoryAuth, id, inputName string) (*file.IO, error)
- func (me *DefaultDocumentService) GetWorkflowSchema(auth model.Auth, workflowId string) (*model.WorkflowItem, map[string]interface{}, error)
- func (me *DefaultDocumentService) Next(auth model.MemoryAuth, id, lang string, data map[string]interface{}, ...) (*app.DocumentFlowInstance, *app.Status, error)
- func (me *DefaultDocumentService) Prev(auth model.MemoryAuth, id string) (*app.Status, error)
- func (me *DefaultDocumentService) Preview(auth model.MemoryAuth, id, templateId, lang, format string) (*app.PreviewResponse, error)
- func (me *DefaultDocumentService) Update(auth model.MemoryAuth, id string, data map[string]interface{}) (validate.ErrorMap, error)
- func (me *DefaultDocumentService) UpdateFile(auth model.MemoryAuth, id, fieldName, fileName, contentType string, ...) (*file.IO, validate.Errors, error)
- type DefaultEmailService
- type DefaultFileService
- type DefaultFormComponentService
- func (me *DefaultFormComponentService) DelComp(auth model.Auth, id string) error
- func (me *DefaultFormComponentService) EnsureDefaultFormComponents(auth model.Auth) error
- func (me *DefaultFormComponentService) GetComp(auth model.Auth, id string) (*model.FormComponentItem, error)
- func (me *DefaultFormComponentService) ListComp(auth model.Auth, contains string, options storage.Options) (map[string]*model.FormComponentItem, error)
- func (me *DefaultFormComponentService) SetComp(auth model.Auth, reader io.ReadCloser) (*model.FormComponentItem, error)
- type DefaultFormService
- func (me *DefaultFormService) Delete(auth model.Auth, id string) error
- func (me *DefaultFormService) ExportForms(auth model.Auth, id, contains string) []string
- func (me *DefaultFormService) Get(auth model.Auth, id string) (*model.FormItem, error)
- func (me *DefaultFormService) GetFormData(auth model.MemoryAuth, id string, reset bool) (map[string]interface{}, error)
- func (me *DefaultFormService) GetFormFile(auth model.MemoryAuth, id string, fieldname string, writer io.Writer) error
- func (me *DefaultFormService) List(auth model.Auth, contains string, options storage.Options) ([]*model.FormItem, error)
- func (me *DefaultFormService) PostFormFile(auth model.MemoryAuth, id string, fileName string, fieldname string, ...) (interface{}, error)
- func (me *DefaultFormService) SetFormSrc(auth model.MemoryAuth, id string, formSrc map[string]interface{}) error
- func (me *DefaultFormService) TestFormData(auth model.MemoryAuth, id string, input map[string]interface{}, submit bool) (validate.ErrorMap, error)
- func (me *DefaultFormService) UpdateForm(auth model.Auth, id string, reader io.ReadCloser) (*model.FormItem, error)
- func (me *DefaultFormService) Vars(auth model.Auth, contains string, options storage.Options) ([]string, error)
- type DefaultPaymentService
- func (me *DefaultPaymentService) All() ([]*model.WorkflowPaymentItem, error)
- func (me *DefaultPaymentService) CancelWorkflowPayment(paymentId, ethAddress string) error
- func (me *DefaultPaymentService) CheckForWorkflowPayment(auth model.Auth, workflowId string) error
- func (me *DefaultPaymentService) CheckIfWorkflowPaymentRequired(auth model.Auth, workflowId string) (bool, error)
- func (me *DefaultPaymentService) CreateWorkflowPayment(auth model.Auth, workflowId, ethAddress string) (*model.WorkflowPaymentItem, error)
- func (me *DefaultPaymentService) Delete(paymentId string) error
- func (me *DefaultPaymentService) GetWorkflowPayment(txHash, ethAddresses, status string) (*model.WorkflowPaymentItem, error)
- func (me *DefaultPaymentService) GetWorkflowPaymentById(paymentId string) (*model.WorkflowPaymentItem, error)
- func (me *DefaultPaymentService) RedeemPayment(workflowId, ethAddr string) error
- func (me *DefaultPaymentService) UpdateWorkflowPaymentPending(paymentId, txHash, ethAddress string) error
- type DefaultSignatureService
- func (me *DefaultSignatureService) AddAndNotify(auth model.Auth, translator www.Translator, ...) error
- func (me *DefaultSignatureService) GetById(id, documentId string) (SignatureRequestsMinimal, error)
- func (me *DefaultSignatureService) GetForCurrentUser(auth model.Auth) (SignatureRequestsComplete, error)
- func (me *DefaultSignatureService) RejectAndNotify(auth model.Auth, translator www.Translator, id, docId, host string) error
- func (me *DefaultSignatureService) RevokeAndNotify(auth model.Auth, translator www.Translator, ...) error
- type DefaultTemplateDocumentService
- func (me *DefaultTemplateDocumentService) Compile(template eio.Template) (*http.Response, error)
- func (me *DefaultTemplateDocumentService) DeleteTemplate(auth model.Auth, id, lang string) error
- func (me *DefaultTemplateDocumentService) DeleteTemplateFiles(auth model.Auth, id string) error
- func (me *DefaultTemplateDocumentService) DownloadExtension(os string) (resp *http.Response, err error)
- func (me *DefaultTemplateDocumentService) Exists(path string) (bool, error)
- func (me *DefaultTemplateDocumentService) Get(auth model.Auth, id string) (*model.TemplateItem, error)
- func (me *DefaultTemplateDocumentService) GetTemplate(auth model.Auth, id, lang string) (*file.IO, error)
- func (me *DefaultTemplateDocumentService) GetTemplateVars(auth model.Auth, contains string, settings storage.Options) ([]string, error)
- func (me *DefaultTemplateDocumentService) List(auth model.Auth, contains string, options storage.Options) ([]*model.TemplateItem, error)
- func (me *DefaultTemplateDocumentService) Put(auth model.Auth, item *model.TemplateItem) error
- func (me *DefaultTemplateDocumentService) ReadFile(path string, writer io.Writer) error
- func (me *DefaultTemplateDocumentService) SaveTemplate(auth model.Auth, id, lang, contentType, fileName string, data []byte) error
- type DefaultUserDocumentService
- func (me *DefaultUserDocumentService) Get(auth model.Auth, id string) (*model.UserDataItem, error)
- func (me *DefaultUserDocumentService) GetByWorkflow(auth model.Auth, wf *model.WorkflowItem, finished bool) (*model.UserDataItem, bool, error)
- func (me *DefaultUserDocumentService) GetDocFile(auth model.Auth, id, dataPath, inlineOrAttachment string) (*FileHeaderResponse, string, error)
- func (me *DefaultUserDocumentService) GetTemplateWithFormatFile(auth model.Auth, id, dataPath, format, inlineOrAttachment string) (*FileHeaderResponse, io.ReadCloser, error)
- func (me *DefaultUserDocumentService) List(auth model.Auth, contains string, settings storage.Options) ([]*model.UserDataItem, error)
- func (me *DefaultUserDocumentService) Put(auth model.Auth, userDataItem *model.UserDataItem) error
- type DefaultWorkflowService
- func (me *DefaultWorkflowService) CopyWorkflows(rootUser, newUser *model.User)
- func (me *DefaultWorkflowService) Delete(auth model.Auth, id string) error
- func (me *DefaultWorkflowService) Get(auth model.Auth, id string) (*model.WorkflowItem, error)
- func (me *DefaultWorkflowService) GetAndPopulateOwner(auth model.Auth, id string) (*model.WorkflowItem, error)
- func (me *DefaultWorkflowService) GetPublished(auth model.Auth, id string) (*model.WorkflowItem, error)
- func (me *DefaultWorkflowService) InstantiateExternalNode(auth model.Auth, nodeId, nodeName string) (*extNode.ExternalQuery, error)
- func (me *DefaultWorkflowService) List(auth model.Auth, contains string, options storage.Options) ([]*model.WorkflowItem, error)
- func (me *DefaultWorkflowService) ListIds(auth model.Auth, contains string, options storage.Options) ([]string, error)
- func (me *DefaultWorkflowService) ListPublished(auth model.Auth, contains string, options storage.Options) ([]*model.WorkflowItem, error)
- func (me *DefaultWorkflowService) Publish(auth model.Auth, wfItem *model.WorkflowItem) map[string]interface{}
- func (me *DefaultWorkflowService) Put(auth model.Auth, wfItem *model.WorkflowItem) error
- type DocumentService
- type EmailService
- type FileHeaderResponse
- type FileService
- type FormComponentService
- type FormService
- type NodeService
- type PaymentService
- type SignatureRequestItemComplete
- type SignatureRequestItemMinimal
- type SignatureRequestsComplete
- type SignatureRequestsMinimal
- type SignatureService
- type TemplateDocumentService
- type UserDocumentService
- type UserService
- type WorkflowService
Constants ¶
This section is empty.
Variables ¶
var ( ErrDocAppNotFound = errors.New("doc app not found") ErrUnableToEdit = errors.New("document edit failed") )
var ErrSignatureRequestAlreadyExists = errors.New("Request already exists")
var (
ErrTxHashEmpty = errors.New("no txHash given")
)
Functions ¶
func GetDataManager ¶
func GetDataManager(auth model.MemoryAuth) form.DataManager
GetDataManager returns the form.DataManager
func NewApiService ¶
func NewApiService() *defaultApiService
func NewAuthenticationService ¶
func NewAuthenticationService(userS UserService, workflowS WorkflowService, emailS EmailService) *defaultAuthenticationService
func NewNodeService ¶
func NewNodeService(workflowService WorkflowService) *defaultNodeService
func NewUserService ¶
func NewUserService() *defaultUserService
Types ¶
type ApiService ¶
type ApiService interface {
// CreateApiKey creates and returns a new api key
CreateApiKey(auth model.Auth, userId, apiKeyName string) (string, error)
// DeleteApiKey removes an existing API key
DeleteApiKey(auth model.Auth, userId, hiddenApiKey string) error
// AuthenticateWithApiKey tries to authenticate the user with the supplied API key and returns the user object or an error
AuthenticateWithApiKey(apiKey string) (*model.User, error)
// AuthenticateApiKeyForUser tries to authenticate with supplied API key and user ID
AuthenticateApiKeyForUser(apiKey string, userId string) (*model.User, error)
}
ApiService is an interface that provides api key functions
type AuthenticationService ¶
type AuthenticationService interface {
// LoginWithUsernamePassword performs a login with username and password
LoginWithUsernamePassword(email, password string) (*model.User, error)
// LoginWithWallet logs the user in when the login is done with a signature (e.g. Metamask)
LoginWithWallet(challenge, signature string) (bool, *model.User, error)
// ChangeEmail Changes the email of a user
ChangeEmail(tokenID string) (*model.TokenRequest, error)
// ResetPasswordRequest sends an email request to the user to reset the password
ResetPasswordRequest(translator www.Translator, scheme, host string, m *model.TokenRequest) (model.TokenRequest, error)
// ResetPassword resets the users password
ResetPassword(translator www.Translator, password, tokenID string) (error, map[string]interface{})
// RegisterRequest sends an email request to the user to register
RegisterRequest(translator www.Translator, scheme, host string, m *model.TokenRequest) (model.TokenRequest, error)
// Register registers the user on the platform
Register(translator www.Translator, tokenID, password string) (error, map[string]interface{})
// PutTokenRequest saves the tokenRequest in the sessionDB
PutTokenRequest(token *model.TokenRequest) error
}
AuthenticationService is an interface that provides user authentication functions
type DefaultDocumentService ¶
type DefaultDocumentService struct {
// contains filtered or unexported fields
}
func NewDocumentService ¶
func NewDocumentService(userS UserService, fileS FileService) *DefaultDocumentService
func (*DefaultDocumentService) Delete ¶
func (me *DefaultDocumentService) Delete(auth model.MemoryAuth, id string) error
Delete removes the existing document with the provided id
func (*DefaultDocumentService) Edit ¶
func (me *DefaultDocumentService) Edit(auth model.Auth, userId string, formInput map[string]interface{}) error
Edit modifies the document name and detail
func (*DefaultDocumentService) GetDocApp ¶
func (me *DefaultDocumentService) GetDocApp(auth model.MemoryAuth, id string) *app.DocumentFlowInstance
GetDocApp returns the DocumentFlowInstance with the passed id
func (*DefaultDocumentService) GetFile ¶
func (me *DefaultDocumentService) GetFile(auth model.MemoryAuth, id, inputName string) (*file.IO, error)
GetFile returns a file by id and input name
func (*DefaultDocumentService) GetWorkflowSchema ¶
func (me *DefaultDocumentService) GetWorkflowSchema(auth model.Auth, workflowId string) (*model.WorkflowItem, map[string]interface{}, error)
GetWorkflowSchema Returns the workflow by id
func (*DefaultDocumentService) Next ¶
func (me *DefaultDocumentService) Next(auth model.MemoryAuth, id, lang string, data map[string]interface{}, final bool) (*app.DocumentFlowInstance, *app.Status, error)
Next proceeds to the next workflow step
func (*DefaultDocumentService) Prev ¶
func (me *DefaultDocumentService) Prev(auth model.MemoryAuth, id string) (*app.Status, error)
Prev returns to the previous workflow step
func (*DefaultDocumentService) Preview ¶
func (me *DefaultDocumentService) Preview(auth model.MemoryAuth, id, templateId, lang, format string) (*app.PreviewResponse, error)
Preview gets a file Preview for a template
func (*DefaultDocumentService) Update ¶
func (me *DefaultDocumentService) Update(auth model.MemoryAuth, id string, data map[string]interface{}) (validate.ErrorMap, error)
Update changes the data of the workflow
func (*DefaultDocumentService) UpdateFile ¶
func (me *DefaultDocumentService) UpdateFile(auth model.MemoryAuth, id, fieldName, fileName, contentType string, reader io.Reader) (*file.IO, validate.Errors, error)
UpdateFile modifies the file of the current workflow
type DefaultEmailService ¶
type DefaultEmailService struct {
}
func (*DefaultEmailService) Send ¶
func (me *DefaultEmailService) Send(emailTo, subject, body string) error
Send dispatches an email. The body can contain html tags. The sender of email will be the default EmailFrom value that is configured in the settings.
func (*DefaultEmailService) SendFrom ¶
func (me *DefaultEmailService) SendFrom(emailFrom, emailTo, subject, body string) error
SendFrom dispatches an email. The body can contain html tags. Additionally specify the sender of the email with the emailFrom parameter
type DefaultFileService ¶
type DefaultFileService struct {
}
func NewFileService ¶
func NewFileService() *DefaultFileService
func (*DefaultFileService) GetDataAndFiles ¶
func (me *DefaultFileService) GetDataAndFiles(auth model.Auth, id, dataPath string) (interface{}, []string, error)
GetDataAndFiles returns the data and files by id and dataPath
func (*DefaultFileService) GetDataFile ¶
GetDataFile returns the file by id and dataPath
type DefaultFormComponentService ¶
type DefaultFormComponentService struct {
}
func NewFormComponentService ¶
func NewFormComponentService() *DefaultFormComponentService
func (*DefaultFormComponentService) DelComp ¶
func (me *DefaultFormComponentService) DelComp(auth model.Auth, id string) error
DelComp removes a form component
func (*DefaultFormComponentService) EnsureDefaultFormComponents ¶
func (me *DefaultFormComponentService) EnsureDefaultFormComponents(auth model.Auth) error
EnsureDefaultFormComponents creates all default form components
func (*DefaultFormComponentService) GetComp ¶
func (me *DefaultFormComponentService) GetComp(auth model.Auth, id string) (*model.FormComponentItem, error)
GetComp returns a form component by id
func (*DefaultFormComponentService) ListComp ¶
func (me *DefaultFormComponentService) ListComp(auth model.Auth, contains string, options storage.Options) (map[string]*model.FormComponentItem, error)
ListComp lists all components that match contains and storage.options
func (*DefaultFormComponentService) SetComp ¶
func (me *DefaultFormComponentService) SetComp(auth model.Auth, reader io.ReadCloser) (*model.FormComponentItem, error)
SetComp sets a form components
type DefaultFormService ¶
type DefaultFormService struct {
}
func NewFormService ¶
func NewFormService() *DefaultFormService
func (*DefaultFormService) Delete ¶
func (me *DefaultFormService) Delete(auth model.Auth, id string) error
Delete a form by id
func (*DefaultFormService) ExportForms ¶
func (me *DefaultFormService) ExportForms(auth model.Auth, id, contains string) []string
ExportForms returns the id of all forms
func (*DefaultFormService) GetFormData ¶
func (me *DefaultFormService) GetFormData(auth model.MemoryAuth, id string, reset bool) (map[string]interface{}, error)
GetFormData returns the data of a form If the reset flag is set the data will be cleared
func (*DefaultFormService) GetFormFile ¶
func (me *DefaultFormService) GetFormFile(auth model.MemoryAuth, id string, fieldname string, writer io.Writer) error
GetFormFile reads the contents of a form file into the writer
func (*DefaultFormService) List ¶
func (me *DefaultFormService) List(auth model.Auth, contains string, options storage.Options) ([]*model.FormItem, error)
List returns a list of all forms
func (*DefaultFormService) PostFormFile ¶
func (me *DefaultFormService) PostFormFile(auth model.MemoryAuth, id string, fileName string, fieldname string, reader io.ReadCloser, contentType string) (interface{}, error)
PostFormFile sets the form file from the reader
func (*DefaultFormService) SetFormSrc ¶
func (me *DefaultFormService) SetFormSrc(auth model.MemoryAuth, id string, formSrc map[string]interface{}) error
SetFormSrc sets the data from formSrc to the form
func (*DefaultFormService) TestFormData ¶
func (me *DefaultFormService) TestFormData(auth model.MemoryAuth, id string, input map[string]interface{}, submit bool) (validate.ErrorMap, error)
TestFormData validates and sets data
func (*DefaultFormService) UpdateForm ¶
func (me *DefaultFormService) UpdateForm(auth model.Auth, id string, reader io.ReadCloser) (*model.FormItem, error)
UpdateForm updates the form with the data from the reader
type DefaultPaymentService ¶
type DefaultPaymentService struct {
// contains filtered or unexported fields
}
func NewPaymentService ¶
func NewPaymentService(userService UserService) *DefaultPaymentService
Important: Pass system to service (and not e.g. system.DB.WorkflowPayments because system.DB variable is replaced on calling api/handlers.PostInit()
func (*DefaultPaymentService) All ¶
func (me *DefaultPaymentService) All() ([]*model.WorkflowPaymentItem, error)
All returns a list of all WorkflowPaymentItem
func (*DefaultPaymentService) CancelWorkflowPayment ¶
func (me *DefaultPaymentService) CancelWorkflowPayment(paymentId, ethAddress string) error
CancelWorkflowPayment sets the status of a WorkflowPaymentItem to "cancelled"
func (*DefaultPaymentService) CheckForWorkflowPayment ¶
func (me *DefaultPaymentService) CheckForWorkflowPayment(auth model.Auth, workflowId string) error
CheckForWorkflowPayment checks whether a workflow payment is required. If a payment is required checks whether a payment with status "confirmed" is found.
func (*DefaultPaymentService) CheckIfWorkflowPaymentRequired ¶
func (me *DefaultPaymentService) CheckIfWorkflowPaymentRequired(auth model.Auth, workflowId string) (bool, error)
CheckIfWorkflowPaymentRequired returns whether a payment is required for the user for a workflow
func (*DefaultPaymentService) CreateWorkflowPayment ¶
func (me *DefaultPaymentService) CreateWorkflowPayment(auth model.Auth, workflowId, ethAddress string) (*model.WorkflowPaymentItem, error)
CreateWorkflowPayment creates a workflow payment for a workflow by the ethAddress with the status "created".
func (*DefaultPaymentService) Delete ¶
func (me *DefaultPaymentService) Delete(paymentId string) error
Delete sets the status of a CheckForWorkflowPayment to "deleted"
func (*DefaultPaymentService) GetWorkflowPayment ¶
func (me *DefaultPaymentService) GetWorkflowPayment(txHash, ethAddresses, status string) (*model.WorkflowPaymentItem, error)
GetWorkflowPayment returns a WorkflowPaymentItem that matches the txHash, ethAddress and status
func (*DefaultPaymentService) GetWorkflowPaymentById ¶
func (me *DefaultPaymentService) GetWorkflowPaymentById(paymentId string) (*model.WorkflowPaymentItem, error)
GetWorkflowPaymentById returns a WorkflowPaymentItem for the id
func (*DefaultPaymentService) RedeemPayment ¶
func (me *DefaultPaymentService) RedeemPayment(workflowId, ethAddr string) error
RedeemPayment sets the payment status of WorkflowPaymentItem from "confirmed" to "redeemed"
func (*DefaultPaymentService) UpdateWorkflowPaymentPending ¶
func (me *DefaultPaymentService) UpdateWorkflowPaymentPending(paymentId, txHash, ethAddress string) error
UpdateWorkflowPaymentPending updates a WorkflowPaymentItem with status "created" and sets it to status "pending"
type DefaultSignatureService ¶
type DefaultSignatureService struct {
// contains filtered or unexported fields
}
func (*DefaultSignatureService) AddAndNotify ¶
func (me *DefaultSignatureService) AddAndNotify(auth model.Auth, translator www.Translator, id, docId, signatory, host, scheme string) error
AddAndNotify adds a new signature request and if the signatory has provided an email address sends an email notification.
func (*DefaultSignatureService) GetById ¶
func (me *DefaultSignatureService) GetById(id, documentId string) (SignatureRequestsMinimal, error)
GetById returns the signature request related to the provided documentId
func (*DefaultSignatureService) GetForCurrentUser ¶
func (me *DefaultSignatureService) GetForCurrentUser(auth model.Auth) (SignatureRequestsComplete, error)
GetForCurrentUser returns a list of the signature requests for the current user
func (*DefaultSignatureService) RejectAndNotify ¶
func (me *DefaultSignatureService) RejectAndNotify(auth model.Auth, translator www.Translator, id, docId, host string) error
RejectAndNotify rejects an existing signature request and if the signatory has provided an email address sends an email notification.
func (*DefaultSignatureService) RevokeAndNotify ¶
func (me *DefaultSignatureService) RevokeAndNotify(auth model.Auth, translator www.Translator, id, docId, signatory, host, scheme string) error
RevokeAndNotify revokes an existing signature request and if the signatory has provided an email address sends an email notification.
type DefaultTemplateDocumentService ¶
type DefaultTemplateDocumentService struct {
}
func NewTemplateDocumentService ¶
func NewTemplateDocumentService() *DefaultTemplateDocumentService
func (*DefaultTemplateDocumentService) Compile ¶
Compile compiles a template with the documentService
func (*DefaultTemplateDocumentService) DeleteTemplate ¶
func (me *DefaultTemplateDocumentService) DeleteTemplate(auth model.Auth, id, lang string) error
DeleteTemplate remove a template
func (*DefaultTemplateDocumentService) DeleteTemplateFiles ¶
func (me *DefaultTemplateDocumentService) DeleteTemplateFiles(auth model.Auth, id string) error
DeleteTemplateFiles removes template files
func (*DefaultTemplateDocumentService) DownloadExtension ¶
func (me *DefaultTemplateDocumentService) DownloadExtension(os string) (resp *http.Response, err error)
DownloadExtensions downloads the template assistance extension for your writer.
func (*DefaultTemplateDocumentService) Exists ¶
func (me *DefaultTemplateDocumentService) Exists(path string) (bool, error)
Exists returns whether a file under the specified path exists
func (*DefaultTemplateDocumentService) Get ¶
func (me *DefaultTemplateDocumentService) Get(auth model.Auth, id string) (*model.TemplateItem, error)
Get returns a template item
func (*DefaultTemplateDocumentService) GetTemplate ¶
func (me *DefaultTemplateDocumentService) GetTemplate(auth model.Auth, id, lang string) (*file.IO, error)
GetTemplate returns a template file
func (*DefaultTemplateDocumentService) GetTemplateVars ¶
func (me *DefaultTemplateDocumentService) GetTemplateVars(auth model.Auth, contains string, settings storage.Options) ([]string, error)
GetTemplateVars returns the template variables
func (*DefaultTemplateDocumentService) List ¶
func (me *DefaultTemplateDocumentService) List(auth model.Auth, contains string, options storage.Options) ([]*model.TemplateItem, error)
List returns a list of template items
func (*DefaultTemplateDocumentService) Put ¶
func (me *DefaultTemplateDocumentService) Put(auth model.Auth, item *model.TemplateItem) error
Put sets a template item
func (*DefaultTemplateDocumentService) ReadFile ¶
func (me *DefaultTemplateDocumentService) ReadFile(path string, writer io.Writer) error
ReadFile reads a file and writes it into the writer
func (*DefaultTemplateDocumentService) SaveTemplate ¶
func (me *DefaultTemplateDocumentService) SaveTemplate(auth model.Auth, id, lang, contentType, fileName string, data []byte) error
SaveTemplate saves the template
type DefaultUserDocumentService ¶
type DefaultUserDocumentService struct {
// contains filtered or unexported fields
}
func NewUserDocumentService ¶
func NewUserDocumentService(userS UserService, fileS FileService, templateDocumentS TemplateDocumentService) *DefaultUserDocumentService
func (*DefaultUserDocumentService) Get ¶
func (me *DefaultUserDocumentService) Get(auth model.Auth, id string) (*model.UserDataItem, error)
Get returns the UserDataItem with the id
func (*DefaultUserDocumentService) GetByWorkflow ¶
func (me *DefaultUserDocumentService) GetByWorkflow(auth model.Auth, wf *model.WorkflowItem, finished bool) (*model.UserDataItem, bool, error)
GetByWorkflow returns the userDataItem with the provided workflow
func (*DefaultUserDocumentService) GetDocFile ¶
func (me *DefaultUserDocumentService) GetDocFile(auth model.Auth, id, dataPath, inlineOrAttachment string) (*FileHeaderResponse, string, error)
GetDocFile returns file info for a pdf file that was generated from a workflow
func (*DefaultUserDocumentService) GetTemplateWithFormatFile ¶
func (me *DefaultUserDocumentService) GetTemplateWithFormatFile(auth model.Auth, id, dataPath, format, inlineOrAttachment string) (*FileHeaderResponse, io.ReadCloser, error)
GetTemplateWithFormatFile returns file info for a docx file that was generated from a workflow
func (*DefaultUserDocumentService) List ¶
func (me *DefaultUserDocumentService) List(auth model.Auth, contains string, settings storage.Options) ([]*model.UserDataItem, error)
List returns a list of UserDataItem that contain the string passed in contain. settings are used to modify the result list
func (*DefaultUserDocumentService) Put ¶
func (me *DefaultUserDocumentService) Put(auth model.Auth, userDataItem *model.UserDataItem) error
Put sets the UserDataItem
type DefaultWorkflowService ¶
type DefaultWorkflowService struct {
// contains filtered or unexported fields
}
func NewWorkflowService ¶
func NewWorkflowService(userService UserService) *DefaultWorkflowService
func (*DefaultWorkflowService) CopyWorkflows ¶
func (me *DefaultWorkflowService) CopyWorkflows(rootUser, newUser *model.User)
CopyWorkflows copies the workflow and related forms and templates to the new user
func (*DefaultWorkflowService) Delete ¶
func (me *DefaultWorkflowService) Delete(auth model.Auth, id string) error
Delete removes a WorkflowItem
func (*DefaultWorkflowService) Get ¶
func (me *DefaultWorkflowService) Get(auth model.Auth, id string) (*model.WorkflowItem, error)
Get returns a workflow by the provided id
func (*DefaultWorkflowService) GetAndPopulateOwner ¶
func (me *DefaultWorkflowService) GetAndPopulateOwner(auth model.Auth, id string) (*model.WorkflowItem, error)
GetAndPopulateOwner a workflow by the provided id and sets the OwnerEthAddress
func (*DefaultWorkflowService) GetPublished ¶
func (me *DefaultWorkflowService) GetPublished(auth model.Auth, id string) (*model.WorkflowItem, error)
GetPublished returns a workflow item matching the supplied filter options that if it is flagged as published
func (*DefaultWorkflowService) InstantiateExternalNode ¶
func (me *DefaultWorkflowService) InstantiateExternalNode(auth model.Auth, nodeId, nodeName string) (*extNode.ExternalQuery, error)
InstantiateExternalNode creates a new instance of an external node
func (*DefaultWorkflowService) List ¶
func (me *DefaultWorkflowService) List(auth model.Auth, contains string, options storage.Options) ([]*model.WorkflowItem, error)
List returns a list of all WorkflowItem that match "contains" and the provided storage.Options
func (*DefaultWorkflowService) ListIds ¶
func (me *DefaultWorkflowService) ListIds(auth model.Auth, contains string, options storage.Options) ([]string, error)
ListIds returns a list of all workflow ids that match contains and the provided storage.Options
func (*DefaultWorkflowService) ListPublished ¶
func (me *DefaultWorkflowService) ListPublished(auth model.Auth, contains string, options storage.Options) ([]*model.WorkflowItem, error)
ListPublished returns a list of published WorkflowItem that match "contains" and the provided storage.Options
func (*DefaultWorkflowService) Publish ¶
func (me *DefaultWorkflowService) Publish(auth model.Auth, wfItem *model.WorkflowItem) map[string]interface{}
Publish publishes a workflowItem
func (*DefaultWorkflowService) Put ¶
func (me *DefaultWorkflowService) Put(auth model.Auth, wfItem *model.WorkflowItem) error
Put saves a WorkflowItem
type DocumentService ¶
type DocumentService interface {
// GetWorkflowSchema Returns the workflow by id
GetWorkflowSchema(auth model.Auth, workflowId string) (*model.WorkflowItem, map[string]interface{}, error)
// GetWorkflowSchema Returns the workflow by id
Edit(auth model.Auth, userId string, formInput map[string]interface{}) error
// GetDocApp returns the DocumentFlowInstance with the passed id
GetDocApp(auth model.MemoryAuth, id string) *app.DocumentFlowInstance
// Update changes the data of the workflow
Update(auth model.MemoryAuth, id string, data map[string]interface{}) (validate.ErrorMap, error)
// UpdateFile modifies the file of the current workflow
UpdateFile(auth model.MemoryAuth, id, fieldName, fileName, contentType string, reader io.Reader) (*file.IO, validate.Errors, error)
// Next proceeds to the next workflow step
Next(auth model.MemoryAuth, id, lang string, data map[string]interface{}, final bool) (*app.DocumentFlowInstance, *app.Status, error)
// Prev returns to the previous workflow step
Prev(auth model.MemoryAuth, id string) (*app.Status, error)
// GetFile returns a file by id and input name
GetFile(auth model.MemoryAuth, id, inputName string) (*file.IO, error)
// Preview gets a file Preview for a template
Preview(auth model.MemoryAuth, id, templateId, lang, format string) (*app.PreviewResponse, error)
// Delete removes the existing document with the provided id
Delete(auth model.MemoryAuth, id string) error
}
DocumentService is an interface that provides user document functions
type EmailService ¶
type EmailService interface {
// Send dispatches an email. The body can contain html tags.
// The sender of email will be the default EmailFrom value that is configured in the settings.
Send(emailTo, subject, body string) error
// SendFrom dispatches an email. The body can contain html tags.
// Additionally specify the sender of the email with the emailFrom parameter
SendFrom(emailFrom, emailTo, subject, body string) error
}
EmailService is an interface that provides functions to send emails
func NewEmailService ¶
func NewEmailService() EmailService
type FileHeaderResponse ¶
type FileService ¶
type FileService interface {
// Read reads the file in path into writer
Read(path string, w io.Writer) error
// GetDataFile returns the file by id and dataPath
GetDataFile(auth model.Auth, id, dataPath string) (*file.IO, error)
// GetDataAndFiles returns the data and files by id and dataPath
GetDataAndFiles(auth model.Auth, id, dataPath string) (interface{}, []string, error)
}
FileService is an interface that provides file functions
type FormComponentService ¶
type FormComponentService interface {
//EnsureDefaultFormComponents creates all default form components
EnsureDefaultFormComponents(auth model.Auth) error
// DelComp removes a form component
DelComp(auth model.Auth, id string) error
// SetComp sets a form components
SetComp(auth model.Auth, reader io.ReadCloser) (*model.FormComponentItem, error)
// GetComp returns a form component by id
GetComp(auth model.Auth, id string) (*model.FormComponentItem, error)
// ListComp lists all components that match contains and storage.options
ListComp(auth model.Auth, contains string, options storage.Options) (map[string]*model.FormComponentItem, error)
}
FormComponentService is an interface that provides form component functions
type FormService ¶
type FormService interface {
// List returns a list of all forms
List(auth model.Auth, contains string, options storage.Options) ([]*model.FormItem, error)
// Get returns a form by id
Get(auth model.Auth, id string) (*model.FormItem, error)
// ExportForms returns the id of all forms
ExportForms(auth model.Auth, id, contains string) []string
// UpdateForm updates the form with the data from the reader
UpdateForm(auth model.Auth, id string, reader io.ReadCloser) (*model.FormItem, error)
// Delete a form by id
Delete(auth model.Auth, id string) error
// Returns a list of variable defined in a form
Vars(auth model.Auth, contains string, options storage.Options) ([]string, error)
// GetFormData returns the data of a form
// If the reset flag is set the data will be cleared
GetFormData(auth model.MemoryAuth, id string, reset bool) (map[string]interface{}, error)
// SetFormSrc sets the data from formSrc to the form
SetFormSrc(auth model.MemoryAuth, id string, formSrc map[string]interface{}) error
// GetFormFile reads the contents of a form file into the writer
GetFormFile(auth model.MemoryAuth, id string, fieldname string, writer io.Writer) error
// TestFormData validates and sets data
TestFormData(auth model.MemoryAuth, id string, input map[string]interface{}, submit bool) (validate.ErrorMap, error)
// PostFormFile sets the form file from the reader
PostFormFile(auth model.MemoryAuth, id string, fileName string, fieldname string, reader io.ReadCloser, contentType string) (interface{}, error)
}
FormService is an interface that provides form functions
type NodeService ¶
type NodeService interface {
//ProbeExternalNodes checks all registered external nodes health endpoint and deletes the ones that are offline
ProbeExternalNodes()
//List returns a list of workflow nodes.
List(nodeType string) []*workflow.Node
// RegisterExternalNode saves an external node definition
RegisterExternalNode(user *model.User, node *externalnode.ExternalNode) error
// ListExternalNodes return a list of all external node definitions
ListExternalNodes() []*externalnode.ExternalNode
// QueryFromInstanceID return an external node instance by machting the specified id
QueryFromInstanceID(auth model.Auth, nodeId string) (externalnode.ExternalNodeInstance, error)
// PutExternalNodeInstance saves an instance of an external node to the database
PutExternalNodeInstance(auth model.Auth, instance *externalnode.ExternalNodeInstance) error
}
NodeService is an interface that provides node functions
type PaymentService ¶
type PaymentService interface {
// CreateWorkflowPayment creates a workflow payment for a workflow by the ethAddress with the status "created".
CreateWorkflowPayment(auth model.Auth, workflowId, ethAddress string) (*model.WorkflowPaymentItem, error)
// GetWorkflowPaymentById returns a WorkflowPaymentItem for the id
GetWorkflowPaymentById(paymentId string) (*model.WorkflowPaymentItem, error)
//GetWorkflowPayment returns a WorkflowPaymentItem that matches the txHash, ethAddress and status
GetWorkflowPayment(txHash, ethAddresses, status string) (*model.WorkflowPaymentItem, error)
// UpdateWorkflowPaymentPending updates a WorkflowPaymentItem with status "created" and sets it to status "pending"
UpdateWorkflowPaymentPending(paymentId, txHash, ethAddress string) error
// CancelWorkflowPayment sets the status of a WorkflowPaymentItem to "cancelled"
CancelWorkflowPayment(paymentId, ethAddress string) error
// RedeemPayment sets the payment status of WorkflowPaymentItem from "confirmed" to "redeemed"
RedeemPayment(workflowId, ethAddr string) error
//CheckIfWorkflowPaymentRequired returns whether a payment is required for the user for a workflow
CheckIfWorkflowPaymentRequired(auth model.Auth, workflowId string) (bool, error)
// CheckForWorkflowPayment checks whether a workflow payment is required.
CheckForWorkflowPayment(auth model.Auth, workflowId string) error
// Delete sets the status of a CheckForWorkflowPayment to "deleted"
Delete(paymentId string) error
// All returns a list of all WorkflowPaymentItem
All() ([]*model.WorkflowPaymentItem, error)
}
PaymentService is an interface that provides payment functions
type SignatureRequestItemComplete ¶
type SignatureRequestItemComplete struct {
ID string `json:"id"`
DocID string `json:"docID"`
Hash string `json:"hash"`
From string `json:"requestorName"`
FromAddr string `json:"requestorAddr"`
RequestedAt *string `json:"requestedAt,omitempty"`
Rejected bool `json:"rejected"`
RejectedAt *string `json:"rejectedAt,omitempty"`
Revoked bool `json:"revoked"`
RevokedAt *string `json:"revokedAt,omitempty"`
}
type SignatureRequestItemMinimal ¶
type SignatureRequestItemMinimal struct {
SignatoryName string `json:"signatoryName"`
SignatoryAddr string `json:"signatoryAddr"`
RequestedAt *string `json:"requestedAt,omitempty"`
Rejected bool `json:"rejected"`
RejectedAt *string `json:"rejectedAt,omitempty"`
Revoked bool `json:"revoked"`
RevokedAt *string `json:"revokedAt,omitempty"`
}
type SignatureRequestsComplete ¶
type SignatureRequestsComplete []SignatureRequestItemComplete
type SignatureRequestsMinimal ¶
type SignatureRequestsMinimal []SignatureRequestItemMinimal
type SignatureService ¶
type SignatureService interface {
// GetById returns the signature request related to the provided documentId
GetById(id, docId string) (SignatureRequestsMinimal, error)
// GetForCurrentUser returns a list of the signature requests for the current user
GetForCurrentUser(auth model.Auth) (SignatureRequestsComplete, error)
// AddAndNotify adds a new signature request and if the signatory has provided an email address sends an email notification.
AddAndNotify(auth model.Auth, translator www.Translator, id, docId, signatory, host, scheme string) error
// RevokeAndNotify revokes an existing signature request and if the signatory has provided an email address sends an email notification.
RevokeAndNotify(auth model.Auth, translator www.Translator, id, docId, signatory, host, scheme string) error
// RejectAndNotify rejects an existing signature request and if the signatory has provided an email address sends an email notification.
RejectAndNotify(auth model.Auth, translator www.Translator, id, docId, host string) error
}
SignatureService is an interface that provides document signature functions
func NewSignatureService ¶
func NewSignatureService(fileService FileService, userService UserService, emailService EmailService) SignatureService
type TemplateDocumentService ¶
type TemplateDocumentService interface {
// Compile compiles a template with the documentService
Compile(template eio.Template) (*http.Response, error)
// SaveTemplate saves the template
SaveTemplate(auth model.Auth, id, lang, contentType, fileName string, data []byte) error
// GetTemplateVars returns the template variables
GetTemplateVars(auth model.Auth, contains string, settings storage.Options) ([]string, error)
// DeleteTemplate remove a template
DeleteTemplate(auth model.Auth, id, lang string) error
// DeleteTemplateFiles removes template files
DeleteTemplateFiles(auth model.Auth, id string) error
// DownloadExtensions downloads the template assistance extension for your writer.
DownloadExtension(os string) (resp *http.Response, err error)
// ReadFile reads a file and writes it into the writer
ReadFile(path string, writer io.Writer) error
// GetTemplate returns a template file
GetTemplate(auth model.Auth, id, lang string) (*file.IO, error)
// Get returns a template item
Get(auth model.Auth, id string) (*model.TemplateItem, error)
// Put sets a template item
Put(auth model.Auth, item *model.TemplateItem) error
// List returns a list of template items
List(auth model.Auth, contains string, options storage.Options) ([]*model.TemplateItem, error)
// Exists returns whether a file under the specified path exists
Exists(path string) (bool, error)
}
TemplateDocumentService is an interface that provides template document functions
type UserDocumentService ¶
type UserDocumentService interface {
// List returns a list of UserDataItem that contain the string passed in contain.
// settings are used to modify the result list
List(auth model.Auth, contains string, settings storage.Options) ([]*model.UserDataItem, error)
// Get returns the UserDataItem with the ids
Get(auth model.Auth, id string) (*model.UserDataItem, error)
// Put sets the UserDataItem
Put(auth model.Auth, userDataItem *model.UserDataItem) error
// GetDocFile returns file info for a pdf file that was generated from a workflow
GetDocFile(auth model.Auth, id, dataPath, inlineOrAttachment string) (*FileHeaderResponse, string, error)
// GetTemplateWithFormatFile returns file info for a docx file that was generated from a workflow
GetTemplateWithFormatFile(auth model.Auth, id, dataPath, format, inlineOrAttachment string) (*FileHeaderResponse, io.ReadCloser, error)
// GetByWorkflow returns the userDataItem with the provided workflow
GetByWorkflow(auth model.Auth, wf *model.WorkflowItem, finished bool) (*model.UserDataItem, bool, error)
}
UserDocumentService is an interface that provides user document functions
type UserService ¶
type UserService interface {
// Put adds a user
Put(auth model.Auth, user *model.User) error
// GetUser returns the currently logged in user
GetUser(auth model.Auth) (*model.User, error)
// GetById returns the User with the provided id
GetById(auth model.Auth, id string) (*model.User, error)
// GetById returns the UserDataItem for the provided id
GetUserDataById(auth model.Auth, id string) (*model.UserDataItem, error)
// DeleteUser removes a user and all related data from the database
DeleteUser(auth model.Auth) error
// Deletes the UserData of the user with the provided id
DeleteUserData(auth model.Auth, id string) error
// GetByBCAddress returns the user associated with the provided blockchainAddress
GetByBCAddress(blockchainAddress string) (*model.User, error)
// GetByEmail returns the user associated with the provided email
GetByEmail(email string) (*model.User, error)
// PutPassword sets the password for a user
PutPassword(userId, password string) error
// GetProfilePhoto returns the profile photo for a user
GetProfilePhoto(auth model.Auth, id string, writer io.Writer) error
// PutProfilePhoto sets the profile photo for a user
PutProfilePhoto(auth model.Auth, userId string, reader io.ReadCloser) error
// List returns references to all the user object matching the supplied filter criteria
List(sess model.Auth, contains string, settings storage.Options) ([]*model.User, error)
}
UserService is an interface that provides user functions
type WorkflowService ¶
type WorkflowService interface {
// List returns a list of all WorkflowItem that match "contains" and the provided storage.Options
List(auth model.Auth, contains string, options storage.Options) ([]*model.WorkflowItem, error)
// ListPublished returns a list of published WorkflowItem that match "contains" and the provided storage.Options
ListPublished(auth model.Auth, contains string, options storage.Options) ([]*model.WorkflowItem, error)
// ListIds returns a list of all workflow ids that match contains and the provided storage.Options
ListIds(auth model.Auth, contains string, options storage.Options) ([]string, error)
// GetAndPopulateOwner a workflow by the provided id and sets the OwnerEthAddress
GetAndPopulateOwner(auth model.Auth, id string) (*model.WorkflowItem, error)
// Get returns a workflow by the provided id
Get(auth model.Auth, id string) (*model.WorkflowItem, error)
// Publish publishes a workflowItem
Publish(auth model.Auth, wfItem *model.WorkflowItem) map[string]interface{}
// Put saves a WorkflowItem
Put(auth model.Auth, wfItem *model.WorkflowItem) error
// Delete removes a WorkflowItem
Delete(auth model.Auth, id string) error
// InstantiateExternalNode creates a new instance of an external node
InstantiateExternalNode(auth model.Auth, nodeId, nodeName string) (*extNode.ExternalQuery, error)
// CopyWorkflows copies the workflow and related forms and templates to the new user
CopyWorkflows(rootUser, newUser *model.User)
// GetPublished returns a workflow item matching the supplied filter options that if it is flagged as published
GetPublished(auth model.Auth, id string) (*model.WorkflowItem, error)
}
WorkflowService is an interface that provides workflow functions