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

Function listItemsWrapper

src/lib/command/util/util-util.ts:66–72  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

64 itemIdOrIndexFromArg?: string,
65 options?: Partial<ChooseOptions<T>>,
66 ): Promise<string> => {
67 const opts = chooseOptionsWithDefaults(options)
68
69 // Listing items usually makes an API call which we only want to happen once so we do it
70 // now and just use stub functions that return these items later as needed.
71 let filteredItems: T[] | undefined = undefined
72 const listItemsWrapper = async (): Promise<T[]> => {
73 if (!filteredItems) {
74 const items = await (opts.listItems ?? listItems)(command)
75 filteredItems = opts.listFilter ? items.filter(opts.listFilter) : items

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected