odp

package module
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2026 License: MIT Imports: 21 Imported by: 0

README

Offering Discovery Protocol for Go

CI Go Reference Go

Official Go software development kit for the Offering Discovery Protocol, the open protocol for discovering Services and navigating their Offerings.

ODP separates Service discovery from catalog discovery. An Agent searches the canonical directory for candidate Services, inspects each Service's live ODP document, and then navigates or searches that Service's Collections and Offerings.

Module

github.com/offering-protocol/odp-go
├── odp        Protocol models, validation, identity, references, and pagination
├── agent      Agent-oriented discovery and catalog navigation
├── directory  Canonical production and sandbox directory client
└── service    Service document, catalog operations, and integration helpers

The root import path uses package name odp.

import (
	odp "github.com/offering-protocol/odp-go"
	"github.com/offering-protocol/odp-go/agent"
	"github.com/offering-protocol/odp-go/directory"
	"github.com/offering-protocol/odp-go/service"
)

Role packages depend toward the root odp package; agent composes directory. The root package does not depend on role packages, and service does not depend on Agent or directory behavior.

Protocol core

The root package validates wire documents against the exact schemas published by odp-specs, then decodes them into typed Go values. JSON members permitted by the protocol's additive evolution rules are preserved in Additional and survive a marshal round trip.

document, err := odp.ParseServiceDocument(body)
if err != nil {
	var validation *odp.ValidationError
	if errors.As(err, &validation) {
		log.Printf("invalid Service Document: %+v", validation.Issues)
	}
	return err
}

origin, err := odp.DeriveServiceOrigin(serviceDocumentURL)
if err != nil {
	return err
}

offeringURL, err := odp.BuildOperationURL(
	document.HTTP.EndpointBase,
	odp.OperationGetOffering,
	origin,
	"gpu-a100",
)

Pagination uses Go iterators, carries cancellation through context.Context, rejects continuation loops, and enforces the protocol's 16-page traversal limit.

Service payment descriptors may advertise payment-option labels such as PaymentOptionInflow, PaymentOptionSolana, or PaymentOptionBase. IsPaymentOption checks the closed ODP vocabulary. These labels summarize compatibility; live MPP and x402 responses provide the authoritative payment terms.

for offering, err := range odp.IterateItems(ctx, firstPage, loadPage) {
	if err != nil {
		return err
	}
	consume(offering)
}

Collection search distinguishes an omitted hierarchy constraint, a root-Collection constraint, and a specific parent:

unconstrained := odp.CollectionSearchRequest{ODPVersion: odp.Version, Query: "desk"}
roots := odp.CollectionSearchRequest{ODPVersion: odp.Version, ParentID: odp.Null[string]()}
children := odp.CollectionSearchRequest{ODPVersion: odp.Version, ParentID: odp.Some("office")}

Directory discovery

Package directory searches candidate Services through the canonical production directory or its fixed sandbox environment. It validates cached Service summaries, follows opaque same-origin continuations, exposes structured facets, and provides keyword suggestions.

directoryClient, err := directory.New(directory.Options{})
if err != nil {
	return err
}

for candidate, err := range directoryClient.SearchServices(ctx, directory.SearchRequest{
	Filters: &directory.ServiceFilters{
		Keywords: []string{"gpu"},
		Payments: []directory.PaymentFilter{{
			Name: odp.ProtocolMPP,
			Options: []odp.PaymentOption{odp.PaymentOptionInflow, odp.PaymentOptionSolana},
		}},
	},
}, directory.IterationOptions{MaxItems: 20}) {
	if err != nil {
		return err
	}
	inspect(candidate.ServiceOrigin)
}

See the directory package guide for page traversal, suggestions, and sandbox usage.

Agent integration

Package agent inspects live Service Documents and provides validated, lazy Collection and Offering navigation. Its federated discovery client searches candidate Services through directory, queries their catalogs with bounded concurrency, and emits results in directory order.

Run the small Service and Agent examples in separate terminals:

go run ./examples/odp-service-small
go run ./examples/odp-agent-discovery

The Agent example uses a clearly labeled mock directory and performs live inspection, listing, and full Offering retrieval against every reachable configured Service. See the Agent package guide for caching, transport composition, and API usage.

Service integration

Package service implements the ODP HTTP runtime for Go's standard net/http stack. Small Services can use its validated static catalog; large Services provide storage-backed operation functions. Optional functions directly control the operations advertised by the Service Document.

Run the complete small-Service example with:

go run ./examples/odp-service-small

See the Service package guide and runnable example.

Development

Go 1.25 or newer is required. Run the complete merge gate with:

make verify

When an odp-specs checkout is available, verify the bundled schemas and conformance vectors with ODP_SPECS_DIR=/path/to/odp-specs make spec-sync. Continuous integration runs both gates.

Generate Agent and Service conformance reports with:

ODP_SPECS_DIR=/path/to/odp-specs make conformance

The language-neutral harness executes the module's public behavior and writes release evidence to .conformance/reports/.

Run the Go Agent against the Node.js reference Service with:

ODP_NODE_DIR=/path/to/odp-node make interoperability

Version tags publish a GitHub release after the complete verification, clean consumer-module, and shared conformance gates pass. Each release includes its Agent and Service conformance reports.

See DEVELOPMENT.md for the contributor workflow and odp-specs for the normative draft, schemas, examples, and test vectors.

Security

See SECURITY.md for vulnerability reporting.

License

MIT.

Documentation

Overview

Package odp provides protocol models and transport-independent behavior for the Offering Discovery Protocol.

Index

Constants

View Source
const MaxTraversalPages = 16
View Source
const Version = "1.0"

Variables

View Source
var ErrPaginationLoop = errors.New("ODP pagination loop detected")

Functions

func BuildOperationURL

func BuildOperationURL(endpointBase string, operation Operation, serviceOrigin, id string) (*url.URL, error)

func DeriveServiceOrigin

func DeriveServiceOrigin(serviceDocumentURL string) (string, error)

func IsLocalResourceIdentifier

func IsLocalResourceIdentifier(value string) bool

func IsPaymentOption added in v0.3.2

func IsPaymentOption(value PaymentOption) bool

func IterateItems

func IterateItems[Item any](ctx context.Context, first Page[Item], load PageLoader[Item]) iter.Seq2[Item, error]

func IteratePages

func IteratePages[Item any](ctx context.Context, first Page[Item], load PageLoader[Item]) iter.Seq2[Page[Item], error]

func OperationMethod

func OperationMethod(operation Operation) (string, bool)

func ResolveContinuation

func ResolveContinuation(reference, serviceOrigin string) (*url.URL, error)

func ResolveResourceReference

func ResolveResourceReference(reference, serviceOrigin string) (*url.URL, error)

Types

type Action

type Action struct {
	Authentication AuthenticationRequirement `json:"authentication"`
	Description    string                    `json:"description,omitempty"`
	HTTP           *HTTPActionTarget         `json:"http,omitempty"`
	ID             string                    `json:"id"`
	OpenAPI        *OpenAPIActionTarget      `json:"openapi,omitempty"`
	Rel            ActionRelation            `json:"rel"`
}

type ActionRelation

type ActionRelation string
const (
	ActionDownload ActionRelation = "download"
	ActionInvoke   ActionRelation = "invoke"
	ActionPurchase ActionRelation = "purchase"
	ActionQuote    ActionRelation = "quote"
	ActionReserve  ActionRelation = "reserve"
)

type ActionRequest

type ActionRequest struct {
	ContentType string           `json:"content_type,omitempty"`
	Schema      *SchemaReference `json:"schema,omitempty"`
}

type AdditionalMembers

type AdditionalMembers map[string]json.RawMessage

type AuthenticationRequirement added in v0.2.0

type AuthenticationRequirement string
const (
	AuthenticationNotRequired AuthenticationRequirement = "not-required"
	AuthenticationOptional    AuthenticationRequirement = "optional"
	AuthenticationRequired    AuthenticationRequirement = "required"
)
type CapabilityLink struct {
	Additional AdditionalMembers `json:"-"`
	Href       string            `json:"href"`
}

func (CapabilityLink) MarshalJSON

func (value CapabilityLink) MarshalJSON() ([]byte, error)

func (*CapabilityLink) UnmarshalJSON

func (value *CapabilityLink) UnmarshalJSON(data []byte) error

type Collection

type Collection struct {
	Additional         AdditionalMembers   `json:"-"`
	AuthExpands        bool                `json:"auth_expands,omitempty"`
	Description        string              `json:"description,omitempty"`
	DetailFields       []string            `json:"detail_fields,omitempty"`
	ID                 string              `json:"id"`
	Language           string              `json:"language,omitempty"`
	Localizations      []string            `json:"localizations,omitempty"`
	Name               string              `json:"name"`
	ODPVersion         string              `json:"odp_version,omitempty"`
	ParentIDs          []string            `json:"parent_ids,omitempty"`
	SearchCapabilities *SearchCapabilities `json:"search_capabilities,omitempty"`
	WebURL             string              `json:"web_url,omitempty"`
}

func ParseCollection

func ParseCollection(data []byte) (Collection, error)

func (Collection) MarshalJSON

func (value Collection) MarshalJSON() ([]byte, error)

func (*Collection) UnmarshalJSON

func (value *Collection) UnmarshalJSON(data []byte) error

type CollectionSearchRequest

type CollectionSearchRequest struct {
	Additional AdditionalMembers `json:"-"`
	Limit      int               `json:"limit,omitempty"`
	ODPVersion string            `json:"odp_version"`
	ParentID   Optional[string]  `json:"parent_id,omitzero"`
	Query      string            `json:"query,omitempty"`
}

func ParseCollectionSearchRequest

func ParseCollectionSearchRequest(data []byte) (CollectionSearchRequest, error)

func (CollectionSearchRequest) MarshalJSON

func (value CollectionSearchRequest) MarshalJSON() ([]byte, error)

func (*CollectionSearchRequest) UnmarshalJSON

func (value *CollectionSearchRequest) UnmarshalJSON(data []byte) error

type EnrollmentProtocol added in v0.2.0

type EnrollmentProtocol struct {
	Name Protocol `json:"name"`
}

type FilterCapabilitySource

type FilterCapabilitySource struct {
	Additional AdditionalMembers  `json:"-"`
	Inline     []FilterDefinition `json:"inline,omitempty"`
	Linked     *CapabilityLink    `json:"linked,omitempty"`
}

func (FilterCapabilitySource) MarshalJSON

func (value FilterCapabilitySource) MarshalJSON() ([]byte, error)

func (*FilterCapabilitySource) UnmarshalJSON

func (value *FilterCapabilitySource) UnmarshalJSON(data []byte) error

type FilterDefinition

type FilterDefinition struct {
	Additional  AdditionalMembers `json:"-"`
	Description string            `json:"description"`
	ID          string            `json:"id"`
	Operators   []FilterOperator  `json:"operators"`
	Refinable   bool              `json:"refinable,omitempty"`
	Title       string            `json:"title"`
	Type        FilterType        `json:"type"`
	Unit        *FilterUnit       `json:"unit,omitempty"`
}

func ParseFilterDefinition

func ParseFilterDefinition(data []byte) (FilterDefinition, error)

func (FilterDefinition) MarshalJSON

func (value FilterDefinition) MarshalJSON() ([]byte, error)

func (*FilterDefinition) UnmarshalJSON

func (value *FilterDefinition) UnmarshalJSON(data []byte) error

type FilterExpression

type FilterExpression struct {
	Additional AdditionalMembers `json:"-"`
	ID         string            `json:"id"`
	Operator   FilterOperator    `json:"operator"`
	Value      json.RawMessage   `json:"value"`
}

func (FilterExpression) MarshalJSON

func (value FilterExpression) MarshalJSON() ([]byte, error)

func (*FilterExpression) UnmarshalJSON

func (value *FilterExpression) UnmarshalJSON(data []byte) error

type FilterOperator

type FilterOperator string
const (
	OperatorEqual              FilterOperator = "eq"
	OperatorExists             FilterOperator = "exists"
	OperatorGreaterThan        FilterOperator = "gt"
	OperatorGreaterThanOrEqual FilterOperator = "gte"
	OperatorIn                 FilterOperator = "in"
	OperatorLessThan           FilterOperator = "lt"
	OperatorLessThanOrEqual    FilterOperator = "lte"
)

type FilterType

type FilterType string
const (
	FilterBoolean  FilterType = "boolean"
	FilterDate     FilterType = "date"
	FilterDateTime FilterType = "date-time"
	FilterDecimal  FilterType = "decimal"
	FilterInteger  FilterType = "integer"
	FilterNumber   FilterType = "number"
	FilterString   FilterType = "string"
)

type FilterUnit

type FilterUnit struct {
	Additional AdditionalMembers `json:"-"`
	Code       string            `json:"code"`
	System     string            `json:"system"`
	Title      string            `json:"title,omitempty"`
}

func (FilterUnit) MarshalJSON

func (value FilterUnit) MarshalJSON() ([]byte, error)

func (*FilterUnit) UnmarshalJSON

func (value *FilterUnit) UnmarshalJSON(data []byte) error

type HTTPActionTarget

type HTTPActionTarget struct {
	Href                 string         `json:"href"`
	Method               string         `json:"method"`
	Request              *ActionRequest `json:"request,omitempty"`
	ResponseContentTypes []string       `json:"response_content_types,omitempty"`
}

type HTTPConfiguration

type HTTPConfiguration struct {
	Additional   AdditionalMembers `json:"-"`
	EndpointBase string            `json:"endpoint_base"`
	OpenAPI      *ServiceOpenAPI   `json:"openapi,omitempty"`
}

func (HTTPConfiguration) MarshalJSON

func (value HTTPConfiguration) MarshalJSON() ([]byte, error)

func (*HTTPConfiguration) UnmarshalJSON

func (value *HTTPConfiguration) UnmarshalJSON(data []byte) error

type InvalidParameter

type InvalidParameter struct {
	Additional AdditionalMembers `json:"-"`
	In         string            `json:"in"`
	Name       string            `json:"name"`
	Reason     string            `json:"reason"`
}

func (InvalidParameter) MarshalJSON

func (value InvalidParameter) MarshalJSON() ([]byte, error)

func (*InvalidParameter) UnmarshalJSON

func (value *InvalidParameter) UnmarshalJSON(data []byte) error

type MissingPlacement

type MissingPlacement string
const (
	MissingFirst MissingPlacement = "first"
	MissingLast  MissingPlacement = "last"
)

type Offering

type Offering struct {
	Actions       []Action                   `json:"actions,omitempty"`
	Additional    AdditionalMembers          `json:"-"`
	AuthExpands   bool                       `json:"auth_expands,omitempty"`
	Attributes    map[string]json.RawMessage `json:"attributes,omitempty"`
	CollectionIDs []string                   `json:"collection_ids,omitempty"`
	Description   string                     `json:"description,omitempty"`
	DetailFields  []string                   `json:"detail_fields,omitempty"`
	ID            string                     `json:"id"`
	Language      string                     `json:"language,omitempty"`
	Localizations []string                   `json:"localizations,omitempty"`
	Name          string                     `json:"name"`
	ODPVersion    string                     `json:"odp_version,omitempty"`
	Price         *PricePreview              `json:"price,omitempty"`
	Schema        *SchemaReference           `json:"schema,omitempty"`
	WebURL        string                     `json:"web_url,omitempty"`
}

func ParseOffering

func ParseOffering(data []byte) (Offering, error)

func (Offering) MarshalJSON

func (value Offering) MarshalJSON() ([]byte, error)

func (*Offering) UnmarshalJSON

func (value *Offering) UnmarshalJSON(data []byte) error

type OfferingPage

type OfferingPage[Item any] struct {
	Additional  AdditionalMembers `json:"-"`
	AuthExpands bool              `json:"auth_expands,omitempty"`
	Items       []Item            `json:"items"`
	Next        string            `json:"next,omitempty"`
	ODPVersion  string            `json:"odp_version"`
	Refinements []RefinementGroup `json:"refinements,omitempty"`
}

func ParseOfferingSearchResponse

func ParseOfferingSearchResponse(data []byte) (OfferingPage[Offering], error)

func (OfferingPage[Item]) MarshalJSON

func (value OfferingPage[Item]) MarshalJSON() ([]byte, error)

func (*OfferingPage[Item]) UnmarshalJSON

func (value *OfferingPage[Item]) UnmarshalJSON(data []byte) error

type OfferingSearchRequest

type OfferingSearchRequest struct {
	Additional         AdditionalMembers  `json:"-"`
	CollectionID       string             `json:"collection_id,omitempty"`
	Filters            []FilterExpression `json:"filters,omitempty"`
	IncludeDescendants bool               `json:"include_descendants,omitempty"`
	Limit              int                `json:"limit,omitempty"`
	ODPVersion         string             `json:"odp_version"`
	Query              string             `json:"query,omitempty"`
	Refinements        []string           `json:"refinements,omitempty"`
	Sort               string             `json:"sort,omitempty"`
}

func ParseOfferingSearchRequest

func ParseOfferingSearchRequest(data []byte) (OfferingSearchRequest, error)

func (OfferingSearchRequest) MarshalJSON

func (value OfferingSearchRequest) MarshalJSON() ([]byte, error)

func (*OfferingSearchRequest) UnmarshalJSON

func (value *OfferingSearchRequest) UnmarshalJSON(data []byte) error

type OpenAPIActionTarget

type OpenAPIActionTarget struct {
	OperationID string `json:"operation_id"`
	URL         string `json:"url,omitempty"`
}

type Operation

type Operation string
const (
	OperationGetCollection           Operation = "get-collection"
	OperationGetOffering             Operation = "get-offering"
	OperationListCollectionOfferings Operation = "list-collection-offerings"
	OperationListCollections         Operation = "list-collections"
	OperationListOfferings           Operation = "list-offerings"
	OperationSearchCollections       Operation = "search-collections"
	OperationSearchOfferings         Operation = "search-offerings"
)

type OperationDescriptor added in v0.2.0

type OperationDescriptor struct {
	Authentication AuthenticationRequirement `json:"authentication"`
	Name           Operation                 `json:"name"`
}

type Optional

type Optional[Value any] struct {
	// contains filtered or unexported fields
}

func Null

func Null[Value any]() Optional[Value]

func Some

func Some[Value any](value Value) Optional[Value]

func (Optional[Value]) Get

func (optional Optional[Value]) Get() (Value, bool)

func (Optional[Value]) IsNull

func (optional Optional[Value]) IsNull() bool

func (Optional[Value]) IsPresent

func (optional Optional[Value]) IsPresent() bool

func (Optional[Value]) IsZero

func (optional Optional[Value]) IsZero() bool

func (Optional[Value]) MarshalJSON

func (optional Optional[Value]) MarshalJSON() ([]byte, error)

func (*Optional[Value]) UnmarshalJSON

func (optional *Optional[Value]) UnmarshalJSON(data []byte) error

type Page

type Page[Item any] struct {
	Additional  AdditionalMembers `json:"-"`
	AuthExpands bool              `json:"auth_expands,omitempty"`
	Items       []Item            `json:"items"`
	Next        string            `json:"next,omitempty"`
	ODPVersion  string            `json:"odp_version"`
}

func ParseFilterDefinitionPage

func ParseFilterDefinitionPage(data []byte) (Page[FilterDefinition], error)

func ParsePage

func ParsePage[Item any](data []byte) (Page[Item], error)

func ParseSortDefinitionPage

func ParseSortDefinitionPage(data []byte) (Page[SortDefinition], error)

func (Page[Item]) MarshalJSON

func (value Page[Item]) MarshalJSON() ([]byte, error)

func (*Page[Item]) UnmarshalJSON

func (value *Page[Item]) UnmarshalJSON(data []byte) error

type PageLoader

type PageLoader[Item any] func(context.Context, string) (Page[Item], error)

type PaymentOption added in v0.3.2

type PaymentOption string
const (
	PaymentOptionAlgorand  PaymentOption = "algorand"
	PaymentOptionAptos     PaymentOption = "aptos"
	PaymentOptionArbitrum  PaymentOption = "arbitrum"
	PaymentOptionAvalanche PaymentOption = "avalanche"
	PaymentOptionBase      PaymentOption = "base"
	PaymentOptionCard      PaymentOption = "card"
	PaymentOptionEthereum  PaymentOption = "ethereum"
	PaymentOptionHedera    PaymentOption = "hedera"
	PaymentOptionInflow    PaymentOption = "inflow"
	PaymentOptionLightning PaymentOption = "lightning"
	PaymentOptionPolygon   PaymentOption = "polygon"
	PaymentOptionSolana    PaymentOption = "solana"
	PaymentOptionStellar   PaymentOption = "stellar"
	PaymentOptionStripe    PaymentOption = "stripe"
	PaymentOptionTempo     PaymentOption = "tempo"
	PaymentOptionTON       PaymentOption = "ton"
)

type PaymentProtocol added in v0.2.0

type PaymentProtocol struct {
	Authentication AuthenticationRequirement `json:"authentication"`
	Name           Protocol                  `json:"name"`
	Options        []PaymentOption           `json:"options,omitempty"`
}

type PricePreview

type PricePreview struct {
	Additional AdditionalMembers `json:"-"`
	Amount     string            `json:"amount,omitempty"`
	Currency   string            `json:"currency,omitempty"`
	Maximum    string            `json:"maximum,omitempty"`
	Minimum    string            `json:"minimum,omitempty"`
	Type       PriceType         `json:"type"`
	Unit       string            `json:"unit,omitempty"`
}

func (PricePreview) MarshalJSON

func (value PricePreview) MarshalJSON() ([]byte, error)

func (*PricePreview) UnmarshalJSON

func (value *PricePreview) UnmarshalJSON(data []byte) error

type PriceType

type PriceType string
const (
	PriceFixed      PriceType = "fixed"
	PriceFree       PriceType = "free"
	PriceMetered    PriceType = "metered"
	PriceQuote      PriceType = "quote"
	PriceRange      PriceType = "range"
	PriceStartingAt PriceType = "starting_at"
)

type ProblemDetails

type ProblemDetails struct {
	Additional    AdditionalMembers  `json:"-"`
	Code          string             `json:"code"`
	Detail        string             `json:"detail,omitempty"`
	Instance      string             `json:"instance,omitempty"`
	InvalidParams []InvalidParameter `json:"invalid_params,omitempty"`
	Status        int                `json:"status"`
	Title         string             `json:"title"`
	Type          string             `json:"type"`
}

func ParseProblemDetails

func ParseProblemDetails(data []byte) (ProblemDetails, error)

func ParseProblemResponse

func ParseProblemResponse(data []byte, status int) (ProblemDetails, error)

func (ProblemDetails) MarshalJSON

func (value ProblemDetails) MarshalJSON() ([]byte, error)

func (*ProblemDetails) UnmarshalJSON

func (value *ProblemDetails) UnmarshalJSON(data []byte) error

type Protocol

type Protocol string
const (
	ProtocolAEP  Protocol = "aep"
	ProtocolMPP  Protocol = "mpp"
	ProtocolX402 Protocol = "x402"
)

type RefinementBucket

type RefinementBucket struct {
	Additional    AdditionalMembers `json:"-"`
	Count         int               `json:"count"`
	CountRelation string            `json:"count_relation,omitempty"`
	Value         any               `json:"value"`
}

func (RefinementBucket) MarshalJSON

func (value RefinementBucket) MarshalJSON() ([]byte, error)

func (*RefinementBucket) UnmarshalJSON

func (value *RefinementBucket) UnmarshalJSON(data []byte) error

type RefinementGroup

type RefinementGroup struct {
	Additional AdditionalMembers  `json:"-"`
	FilterID   string             `json:"filter_id"`
	Values     []RefinementBucket `json:"values"`
}

func (RefinementGroup) MarshalJSON

func (value RefinementGroup) MarshalJSON() ([]byte, error)

func (*RefinementGroup) UnmarshalJSON

func (value *RefinementGroup) UnmarshalJSON(data []byte) error

type Representation

type Representation string
const (
	RepresentationTerse Representation = "terse"
	RepresentationFull  Representation = "full"
)

type ResourceIdentity

type ResourceIdentity struct {
	ID      string       `json:"id"`
	Service string       `json:"service"`
	Type    ResourceType `json:"type"`
}

func NewResourceIdentity

func NewResourceIdentity(serviceDocumentURL string, resourceType ResourceType, id string) (ResourceIdentity, error)

func ParseResourceIdentity

func ParseResourceIdentity(data []byte) (ResourceIdentity, error)

func (ResourceIdentity) Equal

func (identity ResourceIdentity) Equal(other ResourceIdentity) bool

func (ResourceIdentity) Key

func (identity ResourceIdentity) Key() string

type ResourceType

type ResourceType string
const (
	ResourceCollection ResourceType = "collection"
	ResourceOffering   ResourceType = "offering"
)

type SchemaReference

type SchemaReference struct {
	URL string `json:"url"`
}

type SearchCapabilities

type SearchCapabilities struct {
	Additional AdditionalMembers       `json:"-"`
	Filters    *FilterCapabilitySource `json:"filters,omitempty"`
	Sorts      *SortCapabilitySource   `json:"sorts,omitempty"`
}

func (SearchCapabilities) MarshalJSON

func (value SearchCapabilities) MarshalJSON() ([]byte, error)

func (*SearchCapabilities) UnmarshalJSON

func (value *SearchCapabilities) UnmarshalJSON(data []byte) error

type ServiceBranding added in v0.3.0

type ServiceBranding struct {
	Icon ServiceBrandingImage `json:"icon"`
}

type ServiceBrandingImage added in v0.3.0

type ServiceBrandingImage struct {
	Source string                   `json:"src"`
	Type   ServiceBrandingImageType `json:"type"`
}

type ServiceBrandingImageType added in v0.3.0

type ServiceBrandingImageType string
const (
	ServiceBrandingPNG  ServiceBrandingImageType = "image/png"
	ServiceBrandingSVG  ServiceBrandingImageType = "image/svg+xml"
	ServiceBrandingWebP ServiceBrandingImageType = "image/webp"
)

type ServiceDocument

type ServiceDocument struct {
	Additional         AdditionalMembers     `json:"-"`
	Branding           *ServiceBranding      `json:"branding,omitempty"`
	Description        string                `json:"description"`
	HTTP               HTTPConfiguration     `json:"http"`
	Keywords           []string              `json:"keywords,omitempty"`
	Language           string                `json:"language"`
	Localizations      []string              `json:"localizations"`
	Name               string                `json:"name"`
	ODPVersion         string                `json:"odp_version"`
	Operations         []OperationDescriptor `json:"operations"`
	Protocols          *ServiceProtocols     `json:"protocols,omitempty"`
	SearchCapabilities *SearchCapabilities   `json:"search_capabilities,omitempty"`
}

func ParseServiceDocument

func ParseServiceDocument(data []byte) (ServiceDocument, error)

func (ServiceDocument) MarshalJSON

func (value ServiceDocument) MarshalJSON() ([]byte, error)

func (*ServiceDocument) UnmarshalJSON

func (value *ServiceDocument) UnmarshalJSON(data []byte) error

type ServiceOpenAPI added in v0.3.0

type ServiceOpenAPI struct {
	URL string `json:"url"`
}

type ServiceProtocols

type ServiceProtocols struct {
	Enrollment []EnrollmentProtocol `json:"enrollment,omitempty"`
	Payments   []PaymentProtocol    `json:"payments,omitempty"`
}

type SortCapabilitySource

type SortCapabilitySource struct {
	Additional AdditionalMembers `json:"-"`
	Inline     []SortDefinition  `json:"inline,omitempty"`
	Linked     *CapabilityLink   `json:"linked,omitempty"`
}

func (SortCapabilitySource) MarshalJSON

func (value SortCapabilitySource) MarshalJSON() ([]byte, error)

func (*SortCapabilitySource) UnmarshalJSON

func (value *SortCapabilitySource) UnmarshalJSON(data []byte) error

type SortDefinition

type SortDefinition struct {
	Additional  AdditionalMembers `json:"-"`
	Description string            `json:"description"`
	ID          string            `json:"id"`
	Keys        []SortKey         `json:"keys"`
	Title       string            `json:"title"`
}

func ParseSortDefinition

func ParseSortDefinition(data []byte) (SortDefinition, error)

func (SortDefinition) MarshalJSON

func (value SortDefinition) MarshalJSON() ([]byte, error)

func (*SortDefinition) UnmarshalJSON

func (value *SortDefinition) UnmarshalJSON(data []byte) error

type SortDirection

type SortDirection string
const (
	SortAscending  SortDirection = "ascending"
	SortDescending SortDirection = "descending"
)

type SortKey

type SortKey struct {
	Additional AdditionalMembers `json:"-"`
	Direction  SortDirection     `json:"direction"`
	FilterID   string            `json:"filter_id"`
	Missing    MissingPlacement  `json:"missing"`
}

func (SortKey) MarshalJSON

func (value SortKey) MarshalJSON() ([]byte, error)

func (*SortKey) UnmarshalJSON

func (value *SortKey) UnmarshalJSON(data []byte) error

type ValidationError

type ValidationError struct {
	DocumentType string            `json:"document_type"`
	Issues       []ValidationIssue `json:"issues"`
}

func (*ValidationError) Error

func (err *ValidationError) Error() string

type ValidationIssue

type ValidationIssue struct {
	Keyword string         `json:"keyword"`
	Message string         `json:"message"`
	Params  map[string]any `json:"params"`
	Path    string         `json:"path"`
}

Directories

Path Synopsis
Package agent provides Agent-side ODP Service inspection, catalog navigation, and discovery.
Package agent provides Agent-side ODP Service inspection, catalog navigation, and discovery.
cmd
Package directory provides the canonical ODP Service directory client.
Package directory provides the canonical ODP Service directory client.
examples
internal
Package service provides framework-neutral HTTP integration for ODP Services.
Package service provides framework-neutral HTTP integration for ODP Services.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL