metadata

items. Namespace

metadata

Description:
  • Item metadata namespace. This namespace provides access to Item metadata.

Source:

Classes

ItemMetadata

Namespaces

itemchannellink

Methods

(static) getMetadata(itemOrName, namespaceopt) → {Object|ItemMetadata|null}

Description:
  • Gets metadata of a single namespace or of all namespaces from a given Item.

Source:
See:
  • items.Item.getMetadata
Example
// Get metadata of ALL namespaces
var meta = items.metadata.getMetadata(items.Hallway_Light);
var namespaces = Object.keys(meta); // Get metadata namespaces
// Get metadata of a single namespace
meta = items.metadata.getMetadata(items.Hallway_Light, 'expire');
Parameters:
Name Type Attributes Description
itemOrName Item | string

Item or the name of the Item

namespace string <optional>

name of the metadata: if provided, only metadata of this namespace is returned, else all metadata is returned

Returns:

all metadata as an object with the namespaces as properties OR metadata of a single namespace or null if that namespace doesn't exist; the metadata itself is of type ItemMetadata

Type
Object | ItemMetadata | null

(static) removeMetadata(itemOrName, namespaceopt) → {ItemMetadata|null}

Description:
  • Removes metadata of a single namespace or of all namespaces from a given Item.

Source:
See:
  • items.Item.removeMetadata
Parameters:
Name Type Attributes Description
itemOrName Item | string

Item or the name of the Item

namespace string <optional>

name of the metadata: if provided, only metadata of this namespace is removed, else all metadata is removed

Returns:

removed metadata OR null if the Item has no metadata under the given namespace or all metadata was removed

Type
ItemMetadata | null

(static) replaceMetadata(itemOrName, namespace, value, configurationopt) → {ItemMetadata|null}

Description:
  • Updates or adds metadata of a single namespace to an Item.

Source:
See:
  • items.Item.replaceMetadata
Parameters:
Name Type Attributes Description
itemOrName Item | string

Item or the name of the Item * @param {string} namespace name of the metadata

namespace string

name of the metadata

value string

value for this metadata

configuration object <optional>

optional metadata configuration

Returns:

old metadata or null if the Item has no metadata with the given name

Type
ItemMetadata | null