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

Function listChannels

src/lib/command/util/edge/channels.ts:13–27  ·  view source on GitHub ↗
(
		client: SmartThingsClient,
		options?: Partial<ListChannelOptions>,
)

Source from the content-addressed store, hash-verified

11 subscriberId?: string
12}
13export const listChannels = async (
14 client: SmartThingsClient,
15 options?: Partial<ListChannelOptions>,
16): Promise<(Channel & WithOrganization)[]> => {
17 const includeReadOnly = options?.includeReadOnly
18 const subscriberType = options?.subscriberType
19 const subscriberId = options?.subscriberId
20 if (options?.allOrganizations) {
21 if (includeReadOnly) {
22 return fatalError('--includeReadOnly (-I) and --allOrganizations (-A) options are incompatible')
23 }
24 return forAllOrganizations(client, orgClient => orgClient.channels.list({ subscriberType, subscriberId }))
25 }
26 return client.channels.list({ includeReadOnly, subscriberType, subscriberId })
27}
28
29export type WithChannel = {
30 channelId: string

Callers 4

handlerFunction · 0.85
listItemsFunction · 0.85
withChannelNamesFunction · 0.85
channels.test.tsFile · 0.85

Calls 2

fatalErrorFunction · 0.85
forAllOrganizationsFunction · 0.85

Tested by

no test coverage detected