-
Notifications
You must be signed in to change notification settings - Fork 104
/
update.ts
26 lines (19 loc) · 1.09 KB
/
update.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import { CapabilityPresentation, CapabilityPresentationUpdate } from '@smartthings/core-sdk'
import { APIOrganizationCommand, inputAndOutputItem } from '@smartthings/cli-lib'
import { buildTableOutput } from '../presentation'
import { capabilityIdInputArgs, chooseCapability } from '../../../lib/commands/capabilities-util'
export default class CapabilitiesPresentationUpdate extends APIOrganizationCommand<typeof CapabilitiesPresentationUpdate.flags> {
static description = 'update presentation information of a capability' +
this.apiDocsURL('updateCustomCapabilityPresentation')
static flags = {
...APIOrganizationCommand.flags,
...inputAndOutputItem.flags,
}
static args = capabilityIdInputArgs
async run(): Promise<void> {
const id = await chooseCapability(this, this.args.id, this.args.version)
await inputAndOutputItem<CapabilityPresentationUpdate, CapabilityPresentation>(this,
{ buildTableOutput: data => buildTableOutput(this.tableGenerator, data) },
(_, capabilityPresentation) => this.client.capabilities.updatePresentation(id.id, id.version, capabilityPresentation))
}
}