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

Function handler

src/commands/deviceprofiles/update.ts:52–68  ·  view source on GitHub ↗
(argv: ArgumentsCamelCase<CommandArgs>)

Source from the content-addressed store, hash-verified

50 .epilog(buildEpilog({ command, apiDocs: 'updateDeviceProfile' }))
51
52const handler = async (argv: ArgumentsCamelCase<CommandArgs>): Promise<void> => {
53 const command = await apiOrganizationCommand(argv)
54
55 const id = await chooseDeviceProfile(command, argv.idOrIndex)
56 const executeUpdate: ActionFunction<void, DeviceDefinitionRequest, DeviceProfile> = async (_, data) => {
57 if (data.view) {
58 return fatalError('Input contains "view" property. Use deviceprofiles:view:update instead.')
59 }
60
61 return command.client.deviceProfiles.update(id, cleanupForUpdate(data))
62 }
63 await inputAndOutputItem(
64 command,
65 { buildTableOutput: data => buildTableOutput(command.tableGenerator, data, { includePreferences: true }) },
66 executeUpdate,
67 )
68}
69
70const cmd: CommandModule<object, CommandArgs> = { command, describe, builder, handler }
71export default cmd

Callers

nothing calls this directly

Calls 3

apiOrganizationCommandFunction · 0.85
inputAndOutputItemFunction · 0.85
buildTableOutputFunction · 0.50

Tested by

no test coverage detected