github.com/elliott5/community@v0.14.1-0.20160709191136-823126fb026a/wordsmith/api/convertapi.go (about) 1 // Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved. 2 // 3 // This software (Documize Community Edition) is licensed under 4 // GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html 5 // 6 // You can operate outside the AGPL restrictions by purchasing 7 // Documize Enterprise Edition and obtaining a commercial license 8 // by contacting <sales@documize.com>. 9 // 10 // https://documize.com 11 12 // Package api provides the defininitions of types used for communication between different components of the Documize system. 13 package api 14 15 // DocumentConversionRequest is what is passed to a Convert plugin. 16 type DocumentConversionRequest struct { 17 Filename string 18 Filedata []byte 19 PageBreakLevel uint 20 Token string // authorisation token 21 } 22 23 // Page holds the contents of a Documize page, 24 // which is a Body of html with a Title and a Level, 25 type Page struct { 26 Level uint64 // overall document is level 1, <H1> => level 2 27 Title string 28 Body []byte 29 } 30 31 // EmbeddedFile holds the contents of an embedded file. 32 type EmbeddedFile struct { 33 ID, Type, Name string // name must have the same extension as the type e.g. Type="txt" Name="foo.txt" 34 Data []byte 35 } 36 37 // DocumentConversionResponse is the response from a Convert plugin. 38 type DocumentConversionResponse struct { 39 Err string 40 PagesHTML []byte // If empty, use Pages 41 Pages []Page 42 EmbeddedFiles []EmbeddedFile 43 Excerpt string 44 }