Documentation
¶
Overview ¶
Package aeo provides parse, build, and serialization support for AEO Protocol v0.1 declaration documents.
Specification: https://github.com/mizcausevic-dev/aeo-protocol-spec
Index ¶
- Constants
- func IsHTTPStatusError(err error) bool
- func WellKnownURL(origin string) string
- type AnswerConstraints
- type Audit
- type AuditMode
- type Authority
- type CitationPreferences
- type Claim
- type Client
- type Confidence
- type Document
- type Entity
- type EntityType
- type HTTPStatusError
- type Verification
- type VerificationType
Constants ¶
const AcceptHeader = "application/aeo+json, application/json"
AcceptHeader is the value the SDK sends in the HTTP Accept header.
const DefaultTimeout = 10 * time.Second
DefaultTimeout is the HTTP timeout used by the default client.
const ProtocolVersion = "0.1"
ProtocolVersion is the AEO Protocol version this SDK targets.
const SDKVersion = "0.1.0"
SDKVersion is the version of this SDK module.
const WellKnownPath = "/.well-known/aeo.json"
WellKnownPath is the canonical well-known URL path for AEO declarations.
Variables ¶
This section is empty.
Functions ¶
func IsHTTPStatusError ¶
IsHTTPStatusError reports whether the error is an HTTPStatusError.
func WellKnownURL ¶
WellKnownURL returns the canonical well-known URL for the given origin. Trailing slashes on the origin are stripped before appending the path.
Types ¶
type AnswerConstraints ¶
type AnswerConstraints struct {
MustInclude []string `json:"must_include,omitempty"`
MustNotInclude []string `json:"must_not_include,omitempty"`
FreshnessWindowDays int `json:"freshness_window_days,omitempty"`
}
AnswerConstraints expresses soft constraints for answer engines.
type Audit ¶
type Audit struct {
Mode AuditMode `json:"mode"`
SigningKeyURI string `json:"signing_key_uri,omitempty"`
Signature string `json:"signature,omitempty"`
EndpointURI string `json:"endpoint_uri,omitempty"`
EndpointSchema string `json:"endpoint_schema,omitempty"`
}
Audit configures the audit surface for the declaration.
type Authority ¶
type Authority struct {
PrimarySources []string `json:"primary_sources"`
EvidenceLinks []string `json:"evidence_links,omitempty"`
Verifications []Verification `json:"verifications,omitempty"`
}
Authority captures what the entity considers authoritative about itself.
type CitationPreferences ¶
type CitationPreferences struct {
PreferredAttribution string `json:"preferred_attribution,omitempty"`
CanonicalLinks []string `json:"canonical_links,omitempty"`
DoNotCite []string `json:"do_not_cite,omitempty"`
}
CitationPreferences expresses how the entity prefers to be cited.
type Claim ¶
type Claim struct {
ID string `json:"id"`
Predicate string `json:"predicate"`
Value interface{} `json:"value"`
Evidence []string `json:"evidence,omitempty"`
ValidFrom string `json:"valid_from,omitempty"`
ValidUntil *string `json:"valid_until,omitempty"`
Confidence Confidence `json:"confidence,omitempty"`
}
Claim is a single asserted fact about the entity.
type Client ¶
Client is a configurable HTTP fetcher for AEO declarations.
func DefaultClient ¶
func DefaultClient() *Client
DefaultClient returns a Client with a sensible default timeout.
type Confidence ¶
type Confidence string
Confidence enumerates a claim's confidence level.
const ( ConfidenceHigh Confidence = "high" ConfidenceMedium Confidence = "medium" ConfidenceLow Confidence = "low" )
Permitted Confidence values.
type Document ¶
type Document struct {
AEOVersion string `json:"aeo_version"`
Entity Entity `json:"entity"`
Authority Authority `json:"authority"`
Claims []Claim `json:"claims"`
CitationPreferences *CitationPreferences `json:"citation_preferences,omitempty"`
AnswerConstraints *AnswerConstraints `json:"answer_constraints,omitempty"`
Audit *Audit `json:"audit,omitempty"`
}
Document is a complete AEO Protocol v0.1 declaration document.
func FetchWellKnown ¶
FetchWellKnown fetches and parses the AEO declaration at origin's well-known URL using the package-level default client.
func LoadDocument ¶
LoadDocument reads and parses a document from a file path.
func ParseDocument ¶
ParseDocument parses a byte slice into a Document. It rejects unknown top-level fields and unknown fields anywhere in the structure.
func ParseDocumentString ¶
ParseDocumentString is a convenience wrapper around ParseDocument.
type Entity ¶
type Entity struct {
ID string `json:"id"`
Type EntityType `json:"type"`
Name string `json:"name"`
Aliases []string `json:"aliases,omitempty"`
CanonicalURL string `json:"canonical_url"`
}
Entity is the subject of an AEO declaration.
type EntityType ¶
type EntityType string
EntityType enumerates the entity kinds the AEO Protocol defines.
const ( EntityPerson EntityType = "Person" EntityOrganization EntityType = "Organization" EntityProduct EntityType = "Product" EntityPlace EntityType = "Place" EntityConcept EntityType = "Concept" )
Permitted EntityType values.
type HTTPStatusError ¶
HTTPStatusError is returned when an origin responds with a non-2xx status.
func (*HTTPStatusError) Error ¶
func (e *HTTPStatusError) Error() string
Error implements the error interface.
type Verification ¶
type Verification struct {
Type VerificationType `json:"type"`
Value string `json:"value"`
ProofURI string `json:"proof_uri,omitempty"`
}
Verification is a proof of ownership or control over an identifier.
type VerificationType ¶
type VerificationType string
VerificationType enumerates the verification mechanisms an authority block can declare.
const ( VerificationDomain VerificationType = "domain" VerificationDNS VerificationType = "dns" VerificationGitHub VerificationType = "github" VerificationLinkedIn VerificationType = "linkedin" VerificationGPG VerificationType = "gpg" VerificationWellKnownURI VerificationType = "well-known-uri" )
Permitted VerificationType values.