Exemplo n.º 1
0
/*
RegisterHandlers - Register an endpoint for obtaining a list of available files.
*/
func (f *File) RegisterHandlers(register register.PubPrivEndpointRegister) error {
	if len(f.config.FileConfig.Path) > 0 {
		return register.RegisterPublic(
			f.config.FileConfig.Path,
			"Get a list of files available for editing",
			f.servePaths,
		)
	}
	return nil
}
Exemplo n.º 2
0
/*
RegisterHandlers - Register endpoints for adding new auth tokens.
*/
func (h *HTTP) RegisterHandlers(register register.PubPrivEndpointRegister) error {
	if err := register.RegisterPrivate(
		path.Join(h.config.HTTPConfig.Path, "create"),
		`Generate an authentication token for creating a new document, POST: {"key_value":"<user_id>"}`,
		h.createHandler,
	); err != nil {
		return err
	}
	if err := register.RegisterPrivate(
		path.Join(h.config.HTTPConfig.Path, "read"),
		`Generate an authentication token for joining an existing document in read only mode, POST: {"key_value":"<document_id>"}`,
		h.readOnlyHandler,
	); err != nil {
		return err
	}
	return register.RegisterPrivate(
		path.Join(h.config.HTTPConfig.Path, "join"),
		`Generate an authentication token for joining an existing document, POST: {"key_value":"<document_id>"}`,
		h.joinHandler,
	)
}