MCPcopy Create free account
hub / github.com/SmartThingsCommunity/smartthings-cli / uniqueLocationIds

Function uniqueLocationIds

src/lib/api-helpers.ts:45–51  ·  view source on GitHub ↗
(list: WithLocation[])

Source from the content-addressed store, hash-verified

43}
44
45const uniqueLocationIds = (list: WithLocation[]): string[] => {
46 // Note -- the `.filter(notEmpty))` is here because the source types such
47 // as InstalledApp are currently defined with optional locationId even
48 // though locationId is actually always set. The filter can be removed
49 // once that issue is corrected.
50 return Array.from(new Set(list.map(item => item.locationId).filter(notEmpty)))
51}
52
53export const withLocationsAndRooms = async <T extends WithRoom>(client: SmartThingsClient, list: T[]): Promise<(T & WithNamedRoom)[]> => {
54 const locationNameById = await buildLocationNamesById(client)

Callers 1

withLocationsAndRoomsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected