handler

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2019 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AnnotationsAPI

type AnnotationsAPI interface {
	GetAll(context.Context, string) ([]annotations.Annotation, error)
	GetAllButV2(context.Context, string) ([]annotations.Annotation, error)
}

AnnotationsAPI interface encapsulates logic for getting published annotations from API

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

Handler provides endpoints for reading annotations - draft or published, and writing draft annotations.

func New

func New(rw annotations.RW, annotationsAPI AnnotationsAPI, c14n *annotations.Canonicalizer, augmenter annotations.Augmenter, httpTimeout time.Duration) *Handler

New initializes Handler.

func (*Handler) DeleteAnnotation

func (h *Handler) DeleteAnnotation(w http.ResponseWriter, r *http.Request)

DeleteAnnotation deletes a given annotation for a given content uuid. It gets the annotations only from UPP skipping V2 annotations because they are not editorially curated.

func (*Handler) ReadAnnotations

func (h *Handler) ReadAnnotations(w http.ResponseWriter, r *http.Request)

ReadAnnotations gets the annotations for a given content uuid. If there are draft annotations, they are returned, otherwise the published annotations are returned.

func (*Handler) WriteAnnotations

func (h *Handler) WriteAnnotations(w http.ResponseWriter, r *http.Request)

WriteAnnotations writes draft annotations for given content.

Jump to

Keyboard shortcuts

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