office

package
v0.0.0-...-4b98c26 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2021 License: AGPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// StatusReadyForSaving is used when the file should be saved after being
	// edited.
	StatusReadyForSaving = 2
	// StatusForceSaveRequested is used when the file has been modified and
	// should be saved, even if the document is still opened and can be edited
	// by users.
	StatusForceSaveRequested = 6
)

Status list is described on https://api.onlyoffice.com/editors/callback#status

Variables

View Source
var (
	// ErrNoServer is used when no OnlyOnffice server is configured for the
	// current context
	ErrNoServer = errors.New("No OnlyOnffice server is configured")
	// ErrInvalidFile is used when a file is not an office document
	ErrInvalidFile = errors.New("Invalid file, not an office document")
	// ErrInternalServerError is used when something goes wrong (like no
	// connection to redis)
	ErrInternalServerError = errors.New("Internal server error")
)

Functions

func Callback

func Callback(inst *instance.Instance, params CallbackParameters) error

Callback will manage the callback from the document server.

Types

type CallbackParameters

type CallbackParameters struct {
	Key    string `json:"key"`
	Status int    `json:"status"`
	URL    string `json:"url"`
	Token  string `json:"-"` // From the Authorization header
}

CallbackParameters is a struct for the parameters sent by the document server to the stack. Cf https://api.onlyoffice.com/editors/callback

type Opener

type Opener struct {
	*sharing.FileOpener
}

Opener can be used to find the parameters for opening an office document.

func Open

func Open(inst *instance.Instance, fileID string) (*Opener, error)

Open will return an Opener for the given file.

func (*Opener) GetResult

func (o *Opener) GetResult(memberIndex int, readOnly bool) (jsonapi.Object, error)

GetResult looks if the file can be opened locally or not, which code can be used in case of a shared office document, and other parameters.. and returns the information.

type Store

type Store interface {
	AddDoc(db prefixer.Prefixer, payload conflictDetector) (string, error)
	GetDoc(db prefixer.Prefixer, secret string) (*conflictDetector, error)
	UpdateDoc(db prefixer.Prefixer, secret string, payload conflictDetector) error
	RemoveDoc(db prefixer.Prefixer, secret string) error
}

Store is an object to store and retrieve document server keys <-> id,rev

func GetStore

func GetStore() Store

GetStore returns the store for temporary move objects.

Jump to

Keyboard shortcuts

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