Documentation ¶
Overview ¶
Package types provide types for format-independent codelab data model.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Codelab ¶
Codelab is a top-level structure containing metadata and codelab steps.
func NewCodelab ¶
func NewCodelab() *Codelab
type Context ¶
type Context struct { Env string `json:"environment"` // Current export environment Format string `json:"format"` // Output format, e.g. "html" Prefix string `json:"prefix,omitempty"` // Assets URL prefix for HTML-based formats MainGA string `json:"mainga,omitempty"` // Global Google Analytics ID Updated *ContextTime `json:"updated,omitempty"` // Last update timestamp }
Context is an export context. It is defined in this package so that it can be used by both cli and a server.
type ContextMeta ¶
ContextMeta is a composition of export context and meta data.
type ContextTime ¶
ContextTime is a wrapper around time.Time so we can implement JSON marshalling.
func (ContextTime) MarshalJSON ¶
func (ct ContextTime) MarshalJSON() ([]byte, error)
MarshalJSON implements Marshaler interface. The output format is RFC3339.
func (*ContextTime) UnmarshalJSON ¶
func (ct *ContextTime) UnmarshalJSON(b []byte) error
UnmarshalJSON implements Unmarshaler interface. Accepted formats: - RFC3339 - YYYY-MM-DD
type LegacyStatus ¶
type LegacyStatus []string
LegacyStatus supports legacy status values which are strings as opposed to an array, e.g. "['one', u'two', ...]".
func (LegacyStatus) MarshalJSON ¶
func (s LegacyStatus) MarshalJSON() ([]byte, error)
MarshalJSON implements Marshaler interface.
func (LegacyStatus) String ¶
func (s LegacyStatus) String() string
String turns a status into a string
func (*LegacyStatus) UnmarshalJSON ¶
func (s *LegacyStatus) UnmarshalJSON(b []byte) error
UnmarshalJSON implements Unmarshaler interface.
type Meta ¶
type Meta struct { ID string `json:"id"` // ID is also part of codelab URL Duration int `json:"duration"` // Codelab duration in minutes Title string `json:"title"` // Codelab title Authors string `json:"authors,omitempty"` // Arbitrary authorship text Summary string `json:"summary"` // Short summary Source string `json:"source"` // Codelab source doc Theme string `json:"theme"` // Usually first item of Categories Status *LegacyStatus `json:"status"` // Draft, Published, Hidden, etc. Categories []string `json:"category"` // Categories from the meta table Tags []string `json:"tags"` // All environments supported by the codelab Feedback string `json:"feedback,omitempty"` // Issues and bugs are sent here GA string `json:"ga,omitempty"` // Codelab-specific GA tracking ID Extra map[string]string `json:"extra,omitempty"` // Extra metadata specified in pass_metadata URL string `json:"url"` // Legacy ID; TODO: remove }
Meta contains a single codelab metadata.