/
delete.ts
30 lines (24 loc) · 880 Bytes
/
delete.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
27
28
29
30
import { SchemaApp } from '@smartthings/core-sdk'
import { APICommand, selectFromList, SelectFromListConfig } from '@smartthings/cli-lib'
export default class SchemaAppDeleteCommand extends APICommand<typeof SchemaAppDeleteCommand.flags> {
static description = 'delete an ST Schema connector' +
this.apiDocsURL('deleteAppsByEndpointAppId')
static flags = APICommand.flags
static args = [{
name: 'id',
description: 'schema app id',
}]
async run(): Promise<void> {
const config: SelectFromListConfig<SchemaApp> = {
primaryKeyName: 'endpointAppId',
sortKeyName: 'appName',
}
const id = await selectFromList(this, config, {
preselectedId: this.args.id,
listItems: async () => await this.client.schema.list(),
promptMessage: 'Select a schema app to delete.',
})
await this.client.schema.delete(id)
this.log(`Schema app ${id} deleted.`)
}
}