Documentation
¶
Overview ¶
Package odp provides protocol models and transport-independent behavior for the Offering Discovery Protocol.
Index ¶
- Constants
- Variables
- func BuildOperationURL(endpointBase string, operation Operation, serviceOrigin, id string) (*url.URL, error)
- func DeriveServiceOrigin(serviceDocumentURL string) (string, error)
- func IsLocalResourceIdentifier(value string) bool
- func IsPaymentOption(value PaymentOption) bool
- func IterateItems[Item any](ctx context.Context, first Page[Item], load PageLoader[Item]) iter.Seq2[Item, error]
- func IteratePages[Item any](ctx context.Context, first Page[Item], load PageLoader[Item]) iter.Seq2[Page[Item], error]
- func OperationMethod(operation Operation) (string, bool)
- func ResolveContinuation(reference, serviceOrigin string) (*url.URL, error)
- func ResolveResourceReference(reference, serviceOrigin string) (*url.URL, error)
- type Action
- type ActionRelation
- type ActionRequest
- type AdditionalMembers
- type AuthenticationRequirement
- type CapabilityLink
- type Collection
- type CollectionSearchRequest
- type EnrollmentProtocol
- type FilterCapabilitySource
- type FilterDefinition
- type FilterExpression
- type FilterOperator
- type FilterType
- type FilterUnit
- type HTTPActionTarget
- type HTTPConfiguration
- type InvalidParameter
- type MissingPlacement
- type Offering
- type OfferingPage
- type OfferingSearchRequest
- type OpenAPIActionTarget
- type Operation
- type OperationDescriptor
- type Optional
- func (optional Optional[Value]) Get() (Value, bool)
- func (optional Optional[Value]) IsNull() bool
- func (optional Optional[Value]) IsPresent() bool
- func (optional Optional[Value]) IsZero() bool
- func (optional Optional[Value]) MarshalJSON() ([]byte, error)
- func (optional *Optional[Value]) UnmarshalJSON(data []byte) error
- type Page
- type PageLoader
- type PaymentOption
- type PaymentProtocol
- type PricePreview
- type PriceType
- type ProblemDetails
- type Protocol
- type RefinementBucket
- type RefinementGroup
- type Representation
- type ResourceIdentity
- type ResourceType
- type SchemaReference
- type SearchCapabilities
- type ServiceBranding
- type ServiceBrandingImage
- type ServiceBrandingImageType
- type ServiceDocument
- type ServiceOpenAPI
- type ServiceProtocols
- type SortCapabilitySource
- type SortDefinition
- type SortDirection
- type SortKey
- type ValidationError
- type ValidationIssue
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 DeriveServiceOrigin ¶
func IsPaymentOption ¶ added in v0.3.2
func IsPaymentOption(value PaymentOption) bool
func IterateItems ¶
func IteratePages ¶
func OperationMethod ¶
func ResolveContinuation ¶
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 ¶
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 (Offering) MarshalJSON ¶
func (*Offering) UnmarshalJSON ¶
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 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 (Optional[Value]) MarshalJSON ¶
func (*Optional[Value]) UnmarshalJSON ¶
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 ParseSortDefinitionPage ¶
func ParseSortDefinitionPage(data []byte) (Page[SortDefinition], error)
func (Page[Item]) MarshalJSON ¶
func (*Page[Item]) UnmarshalJSON ¶
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 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 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"`
Logo ServiceBrandingImage `json:"logo"`
}
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 (*SortKey) UnmarshalJSON ¶
type ValidationError ¶
type ValidationError struct {
DocumentType string `json:"document_type"`
Issues []ValidationIssue `json:"issues"`
}
func (*ValidationError) Error ¶
func (err *ValidationError) Error() string
Source Files
¶
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
|
|
|
odp-conformance-adapter
command
|
|
|
odp-node-interop
command
|
|
|
Package directory provides the canonical ODP Service directory client.
|
Package directory provides the canonical ODP Service directory client. |
|
examples
|
|
|
odp-agent-discovery
command
|
|
|
odp-service-small
command
|
|
|
internal
|
|
|
Package service provides framework-neutral HTTP integration for ODP Services.
|
Package service provides framework-neutral HTTP integration for ODP Services. |
Click to show internal directories.
Click to hide internal directories.