(argv: ArgumentsCamelCase<CommandArgs>)
| 49 | })) |
| 50 | |
| 51 | const handler = async (argv: ArgumentsCamelCase<CommandArgs>): Promise<void> => { |
| 52 | const command = await apiOrganizationCommand(argv) |
| 53 | |
| 54 | const createDeviceProfile = async (_: void, data: DeviceDefinitionRequest): Promise<DeviceProfile> => { |
| 55 | if (data.view) { |
| 56 | throw new Error('Input contains "view" property. Use deviceprofiles:view:create instead.') |
| 57 | } |
| 58 | |
| 59 | if (!data.metadata?.vid) { |
| 60 | const profileAndConfig = await createWithDefaultConfig(command.client, data) |
| 61 | return profileAndConfig.deviceProfile |
| 62 | } |
| 63 | |
| 64 | return await command.client.deviceProfiles.create(cleanupForCreate(data)) |
| 65 | } |
| 66 | await inputAndOutputItem( |
| 67 | command, |
| 68 | { buildTableOutput: data => buildTableOutput(command.tableGenerator, data) }, |
| 69 | createDeviceProfile, userInputProcessor(() => getInputFromUser(command)), |
| 70 | ) |
| 71 | } |
| 72 | |
| 73 | const cmd: CommandModule<object, CommandArgs> = { command, describe, builder, handler } |
| 74 | export default cmd |
nothing calls this directly
no test coverage detected