handler

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2023 License: MIT Imports: 15 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 Augmenter added in v1.4.4

type Augmenter interface {
	AugmentAnnotations(ctx context.Context, depletedAnnotations []annotations.Annotation) ([]annotations.Annotation, error)
}

Interface for the annotations augmenter (currently only functionality in the annotations package)

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 Augmenter, httpTimeout time.Duration) *Handler

New initializes Handler.

func (*Handler) AddAnnotation added in v1.2.0

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

AddAnnotation adds an annotation for a specific content uuid. It gets the annotations only from UPP skipping V2 annotations because they are not editorially curated.

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) ReplaceAnnotation added in v1.4.0

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

ReplaceAnnotation deletes an annotation for a specific content uuid and adds a new one. It gets the annotations only from UPP skipping V2 annotations because they are not editorially curated.

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