Assets, Spaces & Zones
Assets
Returns all assets for the project. Optionally filter by a list of asset IDs.
assets({ asset_ids })Options
| Option | Default | Description |
|---|---|---|
asset_ids |
— | Optional array of asset IDs to filter |
Returns
AssetList with proj_id,
currency, and an assets array. Each
Asset has:
| Field | Type | Description |
|---|---|---|
id |
string |
Asset ID |
name |
string |
Asset name |
type |
string |
Asset type |
parent_space_id |
string |
Space the asset is located in |
parent_zone_ids |
string[] |
Zones the asset belongs to |
fed_by_asset_ids |
string[] |
Upstream assets that feed this asset |
props |
object |
Optional properties |
ontology |
Ontology |
Optional ontology classification |
source_ids |
string[] |
Associated source IDs |
Example
// all assets
const { assets } = await client.assets();
for (const asset of assets) {
console.log(asset.id, asset.name, asset.type);
}
// filter by ID
const res = await client.assets({ asset_ids: ["a.1", "a.2"] });
const asset = res.assets.find((a) => a.id === "a.1");
console.log(asset.name);Spaces
Returns all spaces for the project. Optionally filter by a list of space IDs.
spaces({ space_ids })Options
| Option | Default | Description |
|---|---|---|
space_ids |
— | Optional array of space IDs to filter |
Returns
SpaceList with proj_id and a
spaces array. Each Space has:
| Field | Type | Description |
|---|---|---|
id |
string |
Space ID |
name |
string |
Space name |
type |
string |
Space type |
parent_space_id |
string |
Parent space ID if nested |
parent_zone_ids |
string[] |
Zones the space belongs to |
contains_asset_ids |
string[] |
Asset IDs located in this space |
fed_by_asset_ids |
string[] |
Assets serving this space |
props |
object |
Optional properties |
ontology |
Ontology |
Optional ontology classification |
Example
// all spaces
const { spaces } = await client.spaces();
for (const space of spaces) {
console.log(space.id, space.name);
}
// child spaces of a floor
const rooms = spaces.filter((s) => s.parent_space_id === "sp.3");Zones
Returns all zones for the project. Optionally filter by a list of zone IDs.
zones({ zone_ids })Options
| Option | Default | Description |
|---|---|---|
zone_ids |
— | Optional array of zone IDs to filter |
Returns
ZoneList with proj_id and a
zones array. Each Zone has:
| Field | Type | Description |
|---|---|---|
id |
string |
Zone ID |
name |
string |
Zone name |
type |
string |
Zone type |
parent_zone_id |
string |
Parent zone ID if nested |
fed_by_asset_ids |
string[] |
Assets that feed this zone |
feeds_space_ids |
string[] |
Spaces fed by this zone |
ontology |
Ontology |
Optional ontology classification |
Example
// all zones
const { zones } = await client.zones();
for (const zone of zones) {
console.log(zone.id, zone.name);
}
// lookup by ID
const zone = zones.find((z) => z.id === "z.2");
console.log(zone.feeds_space_ids);