-
Notifications
You must be signed in to change notification settings - Fork 228
/
Copy pathinfo.ts
38 lines (28 loc) · 1.07 KB
/
info.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
31
32
33
34
35
36
37
38
import {flags} from '@heroku-cli/command'
import {Args, ux} from '@oclif/core'
import BaseCommand from '../../../lib/webhooks/base'
export default class Info extends BaseCommand {
static description = 'info for a webhook event on an app'
static examples = [
'$ heroku webhooks:events:info 99999999-9999-9999-9999-999999999999',
]
static flags = {
app: flags.app(),
remote: flags.remote(),
pipeline: flags.pipeline({char: 'p', description: 'pipeline on which to list', hidden: true}),
}
static args = {
id: Args.string({required: true, description: 'ID of the webhook event'}),
}
async run() {
const {flags, args} = await this.parse(Info)
const {path} = this.webhookType(flags)
ux.warn('heroku webhooks:event:info is deprecated, please use heroku webhooks:deliveries:info')
const {body: webhookEvent}: {body: any} = await this.webhooksClient.get(`${path}/webhook-events/${args.id}`)
const obj = {
payload: JSON.stringify(webhookEvent.payload, null, 2),
}
ux.styledHeader(webhookEvent.id)
ux.styledObject(obj)
}
}