itemChannelLink
- Description:
Item channel link namespace. This namespace provides access to Item channel links.
- Source:
Classes
Methods
(static) addItemChannelLink(itemOrName, channelUID, configurationopt, persistopt) → {ItemChannelLink}
- Description:
Adds a new channel link to an Item.
If this is called from file-based scripts, the Item -> channel link is registered with the ScriptedItemChannelLinkProvider and shares the same lifecycle as the script. You can still persist the Item -> channel link permanently in this case by setting the
persist
parameter totrue
. If this is called from UI-based scripts, the Item -> channel link is stored to the ManagedItemChannelLinkProvider and independent of the script's lifecycle.
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
itemOrName |
Item | string |
|
||
channelUID |
string | |||
configuration |
object |
<optional> |
channel configuration |
|
persist |
boolean |
<optional> |
false
|
whether to persist the Item -> channel link permanently (only respected for file-based scripts) |
Throws:
-
if the Item -> channel link already exists
- Type
- Error
Returns:
the ItemChannelLink
- Type
- ItemChannelLink
(static) getItemChannelLink(itemOrName, channelUID) → {ItemChannelLink|null}
- Description:
Gets a channel link of from an Item.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
itemOrName |
Item | string |
|
channelUID |
string |
Returns:
the ItemChannelLink or null
if none exists
- Type
- ItemChannelLink | null
(static) removeItemChannelLink(itemOrName, channelUID) → {ItemChannelLink|null}
- Description:
Removes a channel link from an Item.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
itemOrName |
Item | string |
|
channelUID |
string |
Returns:
the removed ItemChannelLink or null
if none exists, or it cannot be removed
- Type
- ItemChannelLink | null
(static) removeLinksForItem(itemName) → {number}
- Description:
Removes all channel links from the given Item.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
itemName |
string | the name of the Item |
Returns:
number of links removed
- Type
- number
(static) removeOrphanedItemChannelLinks() → {number}
- Description:
Removes all orphaned (Item or channel missing) links.
- Source:
Returns:
number of links removed
- Type
- number
(static) replaceItemChannelLink(itemOrName, channelUID, configurationopt) → {ItemChannelLink|null}
- Description:
Adds or updates a channel link of an Item. If you use this in file-based scripts, better use
addItemChannelLink
to provide channel links.If an Item -> channel link is not provided by this script or the ManagedItemChannelLinkProvider, it is not editable and a warning is logged.
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
itemOrName |
Item | string |
|
|
channelUID |
string | ||
configuration |
object |
<optional> |
channel configuration |
Returns:
the old ItemChannelLink or null
if it did not exist
- Type
- ItemChannelLink | null