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

Function buildLocationNamesById

src/lib/api-helpers.ts:24–27  ·  view source on GitHub ↗
(client: SmartThingsClient)

Source from the content-addressed store, hash-verified

22}
23
24const buildLocationNamesById = async (client: SmartThingsClient): Promise<Map<string, string>> => {
25 const locations = await client.locations.list()
26 return new Map(locations.map(location => [location.locationId, location.name]))
27}
28
29export const withLocations = async <T>(client: SmartThingsClient, list: (T & WithLocation)[]): Promise<(T & WithNamedLocation)[]> => {
30 const locationNameById = await buildLocationNamesById(client)

Callers 2

withLocationsFunction · 0.85
withLocationsAndRoomsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected