Documentation
¶
Overview ¶
Package office is for interactions with an OnlyOffice server to allow users to view/edit their office documents online.
Index ¶
Constants ¶
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
const OOSlug = "onlyoffice-server"
OOSlug is the slug for uploadedBy field of the CozyMetadata when a file has been modified in the online OnlyOffice.
Variables ¶
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") // ErrInvalidKey is used when the key is not found in the store ErrInvalidKey = errors.New("invalid key") )
Functions ¶
func Callback ¶
func Callback(inst *instance.Instance, params CallbackParameters) error
Callback will manage the callback from the document server.
func EnsureFileForKey ¶
EnsureFileForKey returns the file that will be written when OnlyOffice will save a document with the given key. The general case is that is the file that has been opened. But, it can also be a new file if a conflict has happened because a new version has been uploaded for this file (by the desktop client for example).
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 ConflictDetector ¶
type Store ¶
type Store interface {
GetSecretByID(db prefixer.Prefixer, id string) (string, error)
UpdateSecret(db prefixer.Prefixer, secret, oldID, newID string) error
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