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

Function handler

src/commands/edge/channels.ts:92–122  ·  view source on GitHub ↗
(argv: ArgumentsCamelCase<CommandArgs>)

Source from the content-addressed store, hash-verified

90 }))
91
92const handler = async (argv: ArgumentsCamelCase<CommandArgs>): Promise<void> => {
93 const command = await apiOrganizationCommand(argv)
94
95 const config: OutputItemOrListConfig<Channel & WithOrganization> = {
96 primaryKeyName: 'channelId',
97 sortKeyName: 'name',
98 listTableFieldDefinitions,
99 tableFieldDefinitions,
100 }
101 if (argv.allOrganizations) {
102 config.listTableFieldDefinitions = [...listTableFieldDefinitions, 'organization']
103 }
104
105 const subscriberType = (argv.subscriberType as SubscriberType | undefined)
106 ?? (argv.subscriberId ? 'HUB' : undefined)
107 await outputItemOrList<Channel & WithOrganization>(
108 command,
109 config,
110 argv.idOrIndex,
111 async () => listChannels(
112 command.client,
113 {
114 allOrganizations: argv.allOrganizations,
115 subscriberType,
116 subscriberId: argv.subscriberId,
117 includeReadOnly: argv.includeReadOnly,
118 },
119 ),
120 id => command.client.channels.get(id),
121 )
122}
123
124const cmd: CommandModule<object, CommandArgs> = { command, describe, builder, handler }
125export default cmd

Callers

nothing calls this directly

Calls 2

apiOrganizationCommandFunction · 0.85
listChannelsFunction · 0.85

Tested by

no test coverage detected