Documentation
¶
Overview ¶
Package contentref defines the reference vocabulary every ContentKit package and port shares: a tenant-scoped reference to host-owned content and the identity of a generic taxonomy record.
Index ¶
- type ContentKey
- type ContentRef
- func (r ContentRef) Content() ContentRef
- func (r ContentRef) Equal(o ContentRef) bool
- func (r ContentRef) Key() ContentKey
- func (r ContentRef) String() string
- func (r ContentRef) Validate() error
- func (r ContentRef) Version() string
- func (r ContentRef) WithVersion(contentVersionID string) ContentRef
- type TaxonomyID
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ContentKey ¶
type ContentKey struct {
TenantID string
ContentKind string
ContentID string
ContentVersionID string
}
ContentKey is the comparable form of a ContentRef; ContentVersionID is "" for the work. Storage keys use the same encoding.
func (ContentKey) Ref ¶
func (k ContentKey) Ref() ContentRef
Ref converts the key back into a reference.
type ContentRef ¶
type ContentRef struct {
TenantID string `json:"tenant_id"`
ContentKind string `json:"content_kind"`
ContentID string `json:"content_id"`
ContentVersionID *string `json:"content_version_id,omitempty"`
}
ContentRef identifies host-owned content: the work (a gallery, a video, a listing) or, when ContentVersionID is set, one selectable version of it. The host owns the meaning of ContentKind and the ids; ContentKit stores them opaquely. A language is never part of the reference.
func New ¶
func New(tenantID, contentKind, contentID string) ContentRef
New returns a reference to the work itself.
func NewVersion ¶
func NewVersion(tenantID, contentKind, contentID, contentVersionID string) ContentRef
NewVersion returns a reference to one version of the work.
func (ContentRef) Content ¶
func (r ContentRef) Content() ContentRef
Content returns the work-level reference.
func (ContentRef) Equal ¶
func (r ContentRef) Equal(o ContentRef) bool
Equal reports whether both references name the same content and version.
func (ContentRef) Key ¶
func (r ContentRef) Key() ContentKey
Key returns the comparable form used for map keys and equality.
func (ContentRef) String ¶
func (r ContentRef) String() string
func (ContentRef) Validate ¶
func (r ContentRef) Validate() error
Validate requires a tenant, kind and id; a set version must be non-empty.
func (ContentRef) Version ¶
func (r ContentRef) Version() string
Version returns the version id, "" for the work itself.
func (ContentRef) WithVersion ¶
func (r ContentRef) WithVersion(contentVersionID string) ContentRef
WithVersion returns the reference scoped to contentVersionID ("" = the work).
type TaxonomyID ¶
type TaxonomyID string
TaxonomyID identifies a generic ContentKit catalog record (tag, artist, series, creator, character, voice actor). Until the taxonomy module lands, taxonomy records are indexed and referenced through ContentRef with the taxonomy kind as ContentKind and the TaxonomyID as ContentID.