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

Function forAllNamespaces

src/lib/api-helpers.ts:90–96  ·  view source on GitHub ↗
(
		client: SmartThingsClient,
		query: (namespace: CapabilityNamespace) => Promise<T[]>)

Source from the content-addressed store, hash-verified

88}
89
90export async function forAllNamespaces<T>(
91 client: SmartThingsClient,
92 query: (namespace: CapabilityNamespace) => Promise<T[]>): Promise<T[]> {
93 const namespaces = await client.capabilities.listNamespaces()
94 const nestedItems = await Promise.all(namespaces.map(async (namespace) => query(namespace)))
95 return nestedItems.flat()
96}
97
98export type WithLocales = {
99 locales?: string

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected