Documentation ¶
Index ¶
Constants ¶
const ( // NoAnnotationsMsg is error message used when there are no processed annotations. NoAnnotationsMsg = "No annotations found" // UPPBadRequestMsg is error message used when UPP annotations endpoint returns bad request. UPPBadRequestMsg = "UPP responded with a client error" // UPPNotFoundMsg is error message used when UPP annotations endpoint returns not found. UPPNotFoundMsg = "UPP responded with not found" // different from bad request and not found UPPServiceUnavailableMsg = "Service unavailable" )
const DocumentHashHeader = "Document-Hash"
const PreviousDocumentHashHeader = "Previous-Document-Hash"
Variables ¶
var ErrGTGNotOK = errors.New("gtg returned a non-200 HTTP status")
var ErrUnexpectedStatusRead = errors.New("annotations RW returned an unexpected HTTP status code in read operation")
var ErrUnexpectedStatusWrite = errors.New("annotations RW returned an unexpected HTTP status code in write operation")
Functions ¶
func NewCanonicalAnnotationSorter ¶
func NewCanonicalAnnotationSorter(ann []Annotation) sort.Interface
Types ¶
type Annotation ¶
type Annotations ¶
type Annotations struct {
Annotations []Annotation `json:"annotations"`
}
type Augmenter ¶
type Augmenter struct {
// contains filtered or unexported fields
}
func NewAugmenter ¶
func (*Augmenter) AugmentAnnotations ¶
func (a *Augmenter) AugmentAnnotations(ctx context.Context, canonicalAnnotations []Annotation) ([]Annotation, error)
type Canonicalizer ¶
type Canonicalizer struct {
// contains filtered or unexported fields
}
func NewCanonicalizer ¶
func NewCanonicalizer(sorterFactory func(ann []Annotation) sort.Interface) *Canonicalizer
func (*Canonicalizer) Canonicalize ¶
func (c *Canonicalizer) Canonicalize(in []Annotation) []Annotation
type RW ¶
type UPPAnnotationsAPI ¶
type UPPAnnotationsAPI struct {
// contains filtered or unexported fields
}
UPPAnnotationsAPI retrieves published annotations from UPP.
func NewUPPAnnotationsAPI ¶
func NewUPPAnnotationsAPI(client *http.Client, endpoint string, username string, password string) *UPPAnnotationsAPI
NewUPPAnnotationsAPI initializes UPPAnnotationsAPI by given http client, the url of the UPP public endpoint for getting published annotations and UPP API key.
func (*UPPAnnotationsAPI) Endpoint ¶
func (api *UPPAnnotationsAPI) Endpoint() string
Endpoint retrieves the template for UPP annotations endpoint
func (*UPPAnnotationsAPI) GTG ¶
func (api *UPPAnnotationsAPI) GTG() error
GTG is making call the UPP annotations endpoint for predefined synthetic content UUID and check that response is returned
func (*UPPAnnotationsAPI) GetAll ¶
func (api *UPPAnnotationsAPI) GetAll(ctx context.Context, contentUUID string) ([]Annotation, error)
GetAll retrieves the list of published annotations for given contentUUID. The returned list contains the annotations returned by UPP without filtering.
func (*UPPAnnotationsAPI) GetAllButV2 ¶
func (api *UPPAnnotationsAPI) GetAllButV2(ctx context.Context, contentUUID string) ([]Annotation, error)
GetAllButV2 retrieves the list of published annotations for given contentUUID but filtering v2 annotations.
type UPPError ¶
type UPPError struct {
// contains filtered or unexported fields
}
UPPError encapsulates error information for errors originating from calls to UPP annotations endpoint.
func NewUPPError ¶ added in v1.4.9
NewUPPError initializes UPPError