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

Function handler

src/commands/rules/delete.ts:35–44  ·  view source on GitHub ↗
(argv: ArgumentsCamelCase<CommandArgs>)

Source from the content-addressed store, hash-verified

33 .epilog(buildEpilog({ command, apiDocs: ['deleteRule'] }))
34
35const handler = async (argv: ArgumentsCamelCase<CommandArgs>): Promise<void> => {
36 const command = await apiCommand(argv)
37
38 const ruleId = await chooseRuleFn(argv.location)(command, argv.id, { promptMessage: 'Select a rule to delete.' })
39
40 const locationId = argv.location ?? (await getRuleWithLocation(command.client, ruleId)).locationId
41
42 await command.client.rules.delete(ruleId, locationId)
43 console.log(`Rule ${ruleId} deleted.`)
44}
45
46const cmd: CommandModule<object, CommandArgs> = { command, describe, builder, handler }
47export default cmd

Callers

nothing calls this directly

Calls 3

apiCommandFunction · 0.85
chooseRuleFnFunction · 0.85
getRuleWithLocationFunction · 0.85

Tested by

no test coverage detected