Documentation
¶
Index ¶
- Constants
- func Decode[T any](reader io.Reader) (T, error)
- func Schema(name SchemaName) ([]byte, error)
- func ValidateDescription(value Description) error
- func ValidateRequest(value Request) error
- type Authorization
- type Description
- type Execution
- type Operation
- type Problem
- type Request
- type Result
- type SchemaName
- type Service
- type Target
- type TypeReference
Constants ¶
View Source
const ( Profile01 = "https://mailschema.org/profiles/map/0.1" Context01 = "https://mailschema.org/contexts/map-0.1.jsonld" ContentReviewType = "https://mailschema.org/types/content-review" )
Variables ¶
This section is empty.
Functions ¶
func Decode ¶
Decode reads one strict JSON document. Unknown fields and trailing values are rejected.
func Schema ¶
func Schema(name SchemaName) ([]byte, error)
Schema returns an independent copy of a bundled JSON Schema document.
func ValidateDescription ¶
func ValidateDescription(value Description) error
ValidateDescription checks the fixed MAP 0.1 identifiers and core trust-relevant fields. Use the bundled JSON Schema for complete structural validation.
func ValidateRequest ¶
ValidateRequest checks a MAP 0.1 request's fixed identifiers and references. Type-specific input constraints remain in the type schema.
Types ¶
type Authorization ¶
type Description ¶
type Description struct {
Context string `json:"@context"`
Kind string `json:"@type"`
ID string `json:"@id"`
Profile string `json:"profile"`
Type TypeReference `json:"type"`
DescribedAt time.Time `json:"describedAt"`
ExpiresAt time.Time `json:"expiresAt"`
Service Service `json:"service"`
Target Target `json:"target"`
Operations []Operation `json:"operations"`
}
type Problem ¶
type Problem struct {
Type string `json:"type"`
Title string `json:"title"`
Status int `json:"status"`
Detail string `json:"detail"`
Instance string `json:"instance"`
Profile string `json:"profile"`
RequestID string `json:"requestId"`
InteractionID string `json:"interactionId"`
Code string `json:"code"`
Target *Target `json:"target,omitempty"`
}
type Request ¶
type Request struct {
Kind string `json:"kind"`
Profile string `json:"profile"`
RequestID string `json:"requestId"`
InteractionID string `json:"interactionId"`
RequestedAt time.Time `json:"requestedAt"`
Type TypeReference `json:"type"`
Operation string `json:"operation"`
Target Target `json:"target"`
Input map[string]any `json:"input"`
}
type Result ¶
type Result struct {
Kind string `json:"kind"`
Profile string `json:"profile"`
RequestID string `json:"requestId"`
InteractionID string `json:"interactionId"`
Operation string `json:"operation"`
State string `json:"state"`
Target Target `json:"target"`
RecordedAt time.Time `json:"recordedAt"`
ResultURL string `json:"resultUrl"`
Output map[string]any `json:"output"`
}
type SchemaName ¶
type SchemaName string
SchemaName identifies a schema bundled with this module.
const ( ContributionSchema SchemaName = "contribution" MAP01Schema SchemaName = "map-0.1" ContentReview01Schema SchemaName = "content-review-0.1" )
type Service ¶
type Service struct {
ID string `json:"id"`
Name string `json:"name"`
Execution Execution `json:"execution"`
HumanURL string `json:"humanUrl"`
Authorization Authorization `json:"authorization"`
}
type TypeReference ¶
Click to show internal directories.
Click to hide internal directories.