createMetadataType

Create a MetadataType object from a metadata object

createMetadataType
Parameters
metadata (Object = {}) ={} - object with metadata to create MetadataType object of
Returns
Object: MetadataType

parseMetadataType

Parses MetadataType according to specified options. The attributes can be targeted for each sub-type.

parseMetadataType
Parameters
metadataType (Object = {}) The MetadataType response from the API.
options (Object = {}) Options which change how the metadataType is parsed.
Name Description
options.joinValue string String to join the values, eg ','.
options.includeAttributes boolean Include attributes on all objects.
options.includeMetadataAttributes boolean Include attributes on root.
options.includeTimespanAttributes boolean Include attributes on timespans.
options.includeGroupAttributes boolean Include attributes on groups.
options.includeFieldAttributes boolean Include attributes on fields.
options.includeValueAttributes boolean Include attributes on values.
options.flat boolean Flatten to key/value (Note: keys may be overwritten).
options.flatTimespan boolean Flatten timespan.
options.flatGroup boolean Flatten group.
options.sortTimespan boolean Sort timespan by start time.
options.timespanAsList boolean Return timespans as list.
options.groupAsList boolean Return groups as list.
options.fieldAsList boolean Return fields as list.
options.arrayOnSingle boolean =true - Return fields as array even if single field.
options.arrayOnSingleValue boolean =true - Return fields as array even if single field value.
Returns
Object: Metadata object parsed according to options.

parseTimespanList

Parses timespanList according to specified options. The attributes can be targeted for each sub-type.

parseTimespanList
Parameters
timespanList (Array<Object> = []) The timespanList response from the API.
options (Object = {}) Options which change how the metadataType is parsed.
Name Description
options.joinValue string String to join the values, eg ','.
options.includeAttributes boolean Include attributes on all objects.
options.includeMetadataAttributes boolean Include attributes on root.
options.includeTimespanAttributes boolean Include attributes on timespans.
options.includeGroupAttributes boolean Include attributes on groups.
options.includeFieldAttributes boolean Include attributes on fields.
options.includeValueAttributes boolean Include attributes on values.
options.flat boolean Flatten to key/value (Note: keys may be overwritten).
options.flatTimespan boolean Flatten timespan.
options.flatGroup boolean Flatten group.
options.sortTimespan boolean Sort timespan by start time.
options.timespanAsList boolean Return timespans as list.
options.groupAsList boolean Return groups as list.
options.fieldAsList boolean Return fields as list.
options.arrayOnSingle boolean =true - Return fields as array even if single field.
options.arrayOnSingleValue boolean =true - Return fields as array even if single field value.
Returns
Object: Metadata object parsed according to options.

parseTimespan

Parses timespan according to specified options. The attributes can be targeted for each sub-type.

parseTimespan
Parameters
timespan (Object = {}) ={} - The timespan response from the API.
options (Object = {}) ={} - Options which change how the metadataType is parsed.
Name Description
options.joinValue string =undefined - String to join the values, eg ','.
options.includeAttributes boolean =false - Include attributes on all objects.
options.includeTimespanAttributes boolean =false - Include attributes on timespans.
options.includeGroupAttributes boolean =false - Include attributes on groups.
options.includeFieldAttributes boolean =false - Include attributes on fields.
options.includeValueAttributes boolean =false - Include attributes on values.
options.flat boolean =false - Flatten to key/value (Note: keys may be overwritten).
options.flatTimespan boolean =false - Flatten timespan.
options.flatGroup boolean =false - Flatten group.
options.groupAsList boolean =false - Return groups as list.
options.fieldAsList boolean =false - Return fields as list.
options.arrayOnSingle boolean =true - Return fields as array even if single field.
options.arrayOnSingleValue boolean =true - Return fields as array even if single field value.
Returns
Object: Metadata object parsed according to options.

parseHighlightTimespanList

Parses highlight timespans responses from the api into key/value object. The attributes can be targeted for each sub-type.

parseHighlightTimespanList
Parameters
highlightTimespanList (Object = []) A list of timespans from the api response.
opts (any = {})
options (Object) Options which change how the timespans are parsed.
Name Description
options.arrayOnSingle boolean =true - Return an array if there is a single value.
options.joinValue string String to join the values, eg ','.
options.timespanAsList boolean =false - Return timespans as list.
options.flat boolean =false - Flatten to field-name/field-value (Note: field-values may be overwritten).
options.flatTimespan boolean =false - Flatten timespan to object with start/end as key.
options.joinTimespan string =_ - Character to join the start/end timecodes.

parseHighlightTimespan

Parses highlight timespan responses from the api into key/value object. The attributes can be targeted for each sub-type.

parseHighlightTimespan
Parameters
highlightTimespan (Array<Object> = {}) A timespan object from the api response.
Name Description
highlightTimespan.field any (default [])
highlightTimespan.start any
highlightTimespan.end any
opts (any = {})
options (Object) Options which change how the timespans are parsed.
Name Description
options.arrayOnSingle boolean =true - Return an array if there is a single value.
options.timespanAsList boolean =false - Return timespans as list.
options.joinValue string String to join the values, eg ','.

metadataTypeToWebVtt

Convert subtitle groups to WebVtt subtitle format

metadataTypeToWebVtt(input: Object): string
Parameters
input (Object) ={}
Name Description
input.metadataType Object MetadataType response from API.
input.subtitleGroup string (default 'stl_subtitle') =stl_subtitle - Name of group containing subtitle field/text.
input.subtitleField string (default 'stl_text') =stl_text - Name of field (text) to use for the subtitles.
Returns
string: WebVtt subtitles