Documentation ¶
Overview ¶
CommonCartridge allows you to manipulate IMSCC-compliant Common Cartridges through its manifest, resources and associated files.
Index ¶
- type Cartridge
- type FullItem
- type FullResource
- type IMSCC
- func (cc IMSCC) Assignments() ([]types.Assignment, error)
- func (cc IMSCC) Find(id string) (interface{}, error)
- func (cc IMSCC) FindFile(id string) (fs.File, error)
- func (cc *IMSCC) FindItem(id string) (types.Item, error)
- func (cc IMSCC) Items() ([]FullItem, error)
- func (cc IMSCC) LTIs() ([]types.CartridgeBasicltiLink, error)
- func (cc IMSCC) Manifest() (types.Manifest, error)
- func (cc IMSCC) MarshalJSON() ([]byte, error)
- func (cc IMSCC) Metadata() (string, error)
- func (cc IMSCC) QTIs() ([]types.Questestinterop, error)
- func (cc IMSCC) Resources() ([]FullResource, error)
- func (cc IMSCC) Title() string
- func (cc IMSCC) Topics() ([]types.Topic, error)
- func (cc IMSCC) Weblinks() ([]types.WebLink, error)
- type Metadata
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cartridge ¶
type Cartridge interface { // MarshalJSON returns a serialized JSON representation MarshalJSON() ([]byte, error) //-- ParseManifest finds the imsmanifest.xml in the ZipReader and marshals it into a struct Manifest() (types.Manifest, error) // Title returns the title of the loaded cartridge Title() string // Metadata returns the metadata fields of the cartridge in a structured fashion Metadata() (string, error) // Items returns a slice of structs which include the Item, the Resources and the children Items it might have Items() ([]FullItem, error) // Resources returns a slice of structs which include the resource and, if found, the item in which the resource appears. Resources() ([]FullResource, error) Weblinks() ([]types.WebLink, error) Assignments() ([]types.Assignment, error) LTIs() ([]types.CartridgeBasicltiLink, error) QTIs() ([]types.Questestinterop, error) Topics() ([]types.Topic, error) // Find takes an identifier and returns the corresponding resource. Find(string) (interface{}, error) // FindFile takes an identifier and returns the fs.File that the corresponding node refers to. FindFile(string) (fs.File, error) }
type FullItem ¶
FullItem is a union of an Item and all Resources that refer to it, along with possible children.
type FullResource ¶
FullResource is a union of a Resource and the Item that refers to it
type IMSCC ¶
IMSCC loads the IMSCC-specific cartridge into a zip.Reader from the given Path. It also stores the manifest for convenient access.
func Load ¶
Load returns a cartridge created from a given path, into a zip.Reader, and parses its `imsmanifest.xml` into a types.Manifest
func (IMSCC) Assignments ¶
func (cc IMSCC) Assignments() ([]types.Assignment, error)
Assignments returns a slice of all resources of type assignment_xmlv1p\d, using a regular expression to account for different versions of the IMSCC standard. A necessary check of the actual XMLName is made for avoiding other files in the folder that are returned by the findResourcesByType() (e.g. `assignment.xml` also has `assignment_meta.html`)
func (IMSCC) Find ¶
Find takes an id, finds the resource associated with it, tries to marshall it into the appropriate type, or returns the resource itself if it's a webcontent or associated-resource.
func (IMSCC) FindFile ¶
FindFile takes an ID and returns the corresponding file as a `fs.File`, as specified on the `href` attribute of the first child `<file>` node.
func (*IMSCC) FindItem ¶
FindItem loops over all Items in the manifest, and returns that the item that the argument ID points to, or returns `nil`.
func (IMSCC) Items ¶
Items returns all items with their associated resources. It goes through each item at the top level and recursively looks for FullItems at the level n-1.
func (IMSCC) LTIs ¶
func (cc IMSCC) LTIs() ([]types.CartridgeBasicltiLink, error)
LTIs returns a slice of all resources of type imsbasiclti_xmlv1p\d, using a regular expression to account for different versions of the IMSCC standard.
func (IMSCC) MarshalJSON ¶
MarshalJSON returns the JSON-encoded string representation of the Manifest
func (IMSCC) Metadata ¶
Metadata returns a user-friendly, stringified, JSON-encoded version of the Metadata field.
func (IMSCC) QTIs ¶
func (cc IMSCC) QTIs() ([]types.Questestinterop, error)
QTIs returns a slice of all resources of type imsqti_xmlv1p\d, using a regular expression to account for different versions of the IMSCC standard.
func (IMSCC) Resources ¶
func (cc IMSCC) Resources() ([]FullResource, error)
Resources returns a slice of all FullResources, each containing a resource andeither the item it can belong to, or `nil`.
func (IMSCC) Title ¶
Title returns the name of the cartridge that is stored in the `<metadata>` node.
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
the types package consists of the autogenerated structs from the IMSCC template files, and of possible member functions for the associated structs (e.g.
|
the types package consists of the autogenerated structs from the IMSCC template files, and of possible member functions for the associated structs (e.g. |