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

Function handler

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

Source from the content-addressed store, hash-verified

45 .epilog(buildEpilog({ command, apiDocs: 'createChannel' }))
46
47const handler = async (argv: ArgumentsCamelCase<CommandArgs>): Promise<void> => {
48 const command = await apiOrganizationCommand(argv)
49
50 const getInputFromUser = async (): Promise<ChannelCreate> => {
51 const name = await stringInput('Channel name:')
52 const description = await stringInput('Channel description:')
53 const termsOfServiceUrl = await stringInput('Channel terms of service URL:', { validate: urlValidate })
54
55 return { name, description, termsOfServiceUrl, type: 'DRIVER' }
56 }
57
58 await inputAndOutputItem<ChannelCreate, Channel>(
59 command,
60 { tableFieldDefinitions },
61 (_, input: ChannelCreate) => command.client.channels.create(input),
62 userInputProcessor(() => getInputFromUser()),
63 )
64}
65
66const cmd: CommandModule<object, CommandArgs> = { command, describe, builder, handler }
67export default cmd

Callers

nothing calls this directly

Calls 3

apiOrganizationCommandFunction · 0.85
userInputProcessorFunction · 0.85
getInputFromUserFunction · 0.70

Tested by

no test coverage detected