documize

package
v1.49.1 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2017 License: AGPL-3.0 Imports: 16 Imported by: 0

README

SDK for the Documize system

The SDK is in development, please do not use in a live environment.

documize command

The directory "documize" contains a command line utility to load files onto the Documize server. Run the command with "--help" to see the available flags.

test suite (currently disabled)

The directory "exttest" contains a set of tests that are used both to test this package and to test the main documize code.

In order to run these tests two environment variables must be set:

  • DOCUMIZEAPI - the url of the endpoint, which must be http://localhost:5002 at present
  • DOCUMIZEAUTH - the authorization credentials in the form domain:email:password, which must be of the form :mick@jagger.com:demo123 at present, with the Documize DB organistion record having the default (empty) subdomain.

There must also be a single folder named "Test" for code to find and use. TODO(Elliott) remove this restriction.

Documentation

Index

Constants

View Source
const HeaderAuthTokenName = "Authorization"

HeaderAuthTokenName is the name of the authorization token required in the http header

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	BaseURL string
	Domain  string
	Client  *http.Client
	Auth    models.AuthenticationModel
}

Client holds the data for a sustained connection to Documize.

func NewClient

func NewClient(baseurl, domainEmailPassword string) (*Client, error)

NewClient authorizes the user on Documize and returns the Client type whose methods allow API access the Documize system.

func (*Client) AddAttachment

func (c *Client) AddAttachment(documentID, filename string, data []byte) error

AddAttachment adds a new attachement to a document

func (*Client) AddDocumentPage

func (c *Client) AddDocumentPage(documentID string, pg *entity.Page) (*entity.Page, error)

AddDocumentPage adds the given page into the indicated document.

func (*Client) AddFolder

func (c *Client) AddFolder(fldr *entity.Label) error

AddFolder adds the given folder for the current user. Fields added by the host are added to the folder structure referenced.

func (*Client) AddUser

func (c *Client) AddUser(usrp *entity.User) error

AddUser adds the given user to the system. The version of the user record written to the database is written into the referenced User record.

func (*Client) ChangeDocumentPageLevel

func (c *Client) ChangeDocumentPageLevel(documentID string, plrm *[]models.PageLevelRequestModel) error

ChangeDocumentPageLevel sets the levels of the pages in the PageLevelRequestModel for the given document.

func (*Client) ChangeDocumentPageSequence

func (c *Client) ChangeDocumentPageSequence(documentID string, psrm *[]models.PageSequenceRequestModel) error

ChangeDocumentPageSequence sets the sequences of the pages in the PageSequenceRequestModel for the given document.

func (*Client) DeleteAttachment

func (c *Client) DeleteAttachment(att *entity.Attachment) error

DeleteAttachment removes a file attachment.

func (*Client) DeleteDocument

func (c *Client) DeleteDocument(documentID string) error

DeleteDocument removes the given document from the Documize database.

func (*Client) DeleteDocumentPage

func (c *Client) DeleteDocumentPage(documentID, pageID string) error

DeleteDocumentPage deletes the given page from the indicated document.

func (*Client) DeleteDocumentPages

func (c *Client) DeleteDocumentPages(documentID string, pageIDlist []string) error

DeleteDocumentPages deletes the given pageIDs in a slice from the indicated document.

func (*Client) DeleteUser

func (c *Client) DeleteUser(userID string) error

DeleteUser deletes the given user.

func (*Client) GetAttachmentData

func (c *Client) GetAttachmentData(att *entity.Attachment) error

GetAttachmentData get the data of a file attachement.

func (*Client) GetAttachments

func (c *Client) GetAttachments(documentID string) (entAtts []entity.Attachment, err error)

GetAttachments gets a slice of the attachments for a document ID.

func (*Client) GetDocument

func (c *Client) GetDocument(documentID string) (*entity.Document, error)

GetDocument gets the document information.

func (*Client) GetDocumentAsDocx

func (c *Client) GetDocumentAsDocx(documentID string) (string, []byte, error)

GetDocumentAsDocx returns a file-name and content for the given documentID. TODO allow the selection of either HTML or DOCX format.

func (*Client) GetDocumentMeta

func (c *Client) GetDocumentMeta(documentID string) (*entity.DocumentMeta, error)

GetDocumentMeta gets the metadata for a document.

func (*Client) GetDocumentPages

func (c *Client) GetDocumentPages(documentID string) ([]entity.Page, error)

GetDocumentPages returns all the pages in a document.

func (*Client) GetDocumentPagesBatch

func (c *Client) GetDocumentPagesBatch(documentID, pageIDlist string) ([]entity.Page, error)

GetDocumentPagesBatch returns those pages in a document whose RefIDs are in a comma-separated list.

func (*Client) GetDocumentsByFolder

func (c *Client) GetDocumentsByFolder(folderID string) ([]entity.Document, error)

GetDocumentsByFolder returns a slice of document information for a given folder.

func (*Client) GetFolder

func (c *Client) GetFolder(folderID string) (*entity.Label, error)

GetFolder returns the documents in the given folder that the current user can see.

func (*Client) GetFolderPermissions

func (c *Client) GetFolderPermissions(folderID string) (*[]entity.LabelRole, error)

GetFolderPermissions returns the given user's permissions.

func (*Client) GetFolders

func (c *Client) GetFolders() ([]entity.Label, error)

GetFolders returns the folders that the current user can see.

func (*Client) GetFoldersVisibility

func (c *Client) GetFoldersVisibility() ([]entity.Label, error)

GetFoldersVisibility returns the visibility of folders that the current user can see.

func (*Client) GetNamedFolderIDs

func (c *Client) GetNamedFolderIDs(name string) ([]string, error)

GetNamedFolderIDs returns those folder IDs with the given name (folder names are not unique).

func (*Client) GetOrganizations

func (c *Client) GetOrganizations() ([]entity.Organization, error)

GetOrganizations returns the user's organizations.

func (*Client) GetRobots

func (c *Client) GetRobots() ([]byte, error)

GetRobots returns the site map information based on the domain supplied in the URL called.

func (*Client) GetSitemap

func (c *Client) GetSitemap() ([]byte, error)

GetSitemap returns the site map information based on the domain supplied in the URL called.

func (*Client) GetTemplates

func (c *Client) GetTemplates(useStock bool) (temps []entity.Template, err error)

GetTemplates returns the available templates; from the stock templates if useStock is set.

func (*Client) GetUserFolderPermissions

func (c *Client) GetUserFolderPermissions() (*[]entity.LabelRole, error)

GetUserFolderPermissions gets the folder permissions for the current user.

func (*Client) GetUserInfo

func (c *Client) GetUserInfo() (*entity.User, error)

GetUserInfo returns the user's information.

func (*Client) GetUsers

func (c *Client) GetUsers() ([]entity.User, error)

GetUsers returns the users in the user's organization.

func (*Client) LoadData

func (c *Client) LoadData(folderID, docName string, docData *api.DocumentConversionResponse) (*entity.Document, error)

LoadData uploads and converts the raw data comprising a Documize document into Documize, returning a fileID and error.

func (*Client) LoadFile

func (c *Client) LoadFile(folderID, targetFile string) (*entity.Document, error)

LoadFile uploads and converts a file into Documize, returning a fileID and error.

func (*Client) RemoveFolder

func (c *Client) RemoveFolder(folderID, moveToID string) error

RemoveFolder removes the given folder and moves its contents to another.

func (*Client) SearchDocuments

func (c *Client) SearchDocuments(keywords string) ([]entity.DocumentSearch, error)

SearchDocuments returns a list of documements which contain the supplied keywords. TODO explain the format of the keywords string (when not just the single word sought).

func (*Client) SetFolderPermissions

func (c *Client) SetFolderPermissions(folderID, msg string, perms *[]entity.LabelRole) error

SetFolderPermissions sets the given user's permissions.

func (*Client) StartDocumentFromTemplate

func (c *Client) StartDocumentFromTemplate(isStock bool, templateID, folderID string) (DocumentID string, err error)

StartDocumentFromTemplate returns the documentID created in the given folderID from the given templateID, using either a stock template if isStock==true or a saved template.

func (*Client) UpdateDocument

func (c *Client) UpdateDocument(document *entity.Document) error

UpdateDocument updates document information obtained from GetDocument.

func (*Client) UpdateDocumentPage

func (c *Client) UpdateDocumentPage(pg *entity.Page) error

UpdateDocumentPage updates the given page from the indicated document.

func (*Client) UpdateFolder

func (c *Client) UpdateFolder(fldr *entity.Label) error

UpdateFolder changes the folder info the given folder for the current user, returning the changed version in the referenced folder structure.

func (*Client) UpdateOrganization

func (c *Client) UpdateOrganization(org *entity.Organization) error

UpdateOrganization returns the user's organization information.

func (*Client) UpdateUser

func (c *Client) UpdateUser(usrp *entity.User) error

UpdateUser updates the given user, writing the changed version back into the given User structure.

func (*Client) Validate

func (c *Client) Validate() error

Validate the current user credentials.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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