Documentation ¶
Index ¶
- type AnnotationsAPI
- type Augmenter
- type Handler
- func (h *Handler) AddAnnotation(w http.ResponseWriter, r *http.Request)
- func (h *Handler) DeleteAnnotation(w http.ResponseWriter, r *http.Request)
- func (h *Handler) ReadAnnotations(w http.ResponseWriter, r *http.Request)
- func (h *Handler) ReplaceAnnotation(w http.ResponseWriter, r *http.Request)
- func (h *Handler) WriteAnnotations(w http.ResponseWriter, r *http.Request)
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.