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

Function builder

src/commands/edge/channels.ts:40–90  ·  view source on GitHub ↗
(yargs: Argv)

Source from the content-addressed store, hash-verified

38const describe = 'list all channels owned by you or retrieve a single channel'
39
40const builder = (yargs: Argv): Argv<CommandArgs> =>
41 outputItemOrListBuilder(allOrganizationsBuilder(apiOrganizationCommandBuilder(yargs)))
42 .option(
43 'include-read-only',
44 {
45 alias: 'I',
46 describe: 'include subscribed-to channels as well as owned channels',
47 type: 'boolean',
48 default: false,
49 })
50 .option(
51 'subscriber-type',
52 {
53 describe: 'filter results based on subscriber type',
54 type: 'string',
55 choices: ['HUB'],
56 coerce: arg => arg?.toUpperCase(),
57 })
58 .option(
59 'subscriber-id',
60 {
61 describe: 'filter results based on subscriber id (e.g. hub id)',
62 type: 'string',
63 })
64 .positional(
65 'id-or-index',
66 { describe: 'the channel id or number in list', type: 'string' },
67 )
68 .positional('driver-version', { describe: 'driver version', type: 'string' })
69 .example([
70 ['$0 edge:channels', 'list all channels you own'],
71 ['$0 edge:channels --include-read-only', 'list user-owned and subscribed channels'],
72 ['$0 edge:channels 699c7308-8c72-4363-9571-880d0f5cc725', 'display details for a driver by id'],
73 [
74 '$0 edge:channels 2',
75 'display details about the second channel listed when running "smartthings edge:channels"',
76 ],
77 [
78 '$0 edge:channels --subscriber-type HUB --subscriber-id <hub-id>',
79 'display channels subscribed to by the specified hub',
80 ],
81 ])
82 .epilog(buildEpilog({
83 command,
84 notes: [
85 'Use this command to list all drivers you own, even if they are not yet assigned to a channel.',
86 'See also drivers:installed to list installed drivers and channels:drivers to list' +
87 ' drivers that are part of a channel you own or have subscribed to.',
88 ],
89 apiDocs: ['listChannels', 'channelById'],
90 }))
91
92const handler = async (argv: ArgumentsCamelCase<CommandArgs>): Promise<void> => {
93 const command = await apiOrganizationCommand(argv)

Callers

nothing calls this directly

Calls 3

allOrganizationsBuilderFunction · 0.85
buildEpilogFunction · 0.85

Tested by

no test coverage detected