-
Notifications
You must be signed in to change notification settings - Fork 227
/
Copy pathupdate.js
39 lines (35 loc) · 1.09 KB
/
update.js
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
39
'use strict'
let co = require('co')
let cli = require('heroku-cli-util')
let authorizations = require('../../authorizations')
function * run (context, heroku) {
let client
if (context.flags['client-id']) {
client = {
id: context.flags['client-id'],
secret: context.flags['client-secret']
}
}
let auth = yield cli.action('Updating OAuth Authorization', heroku.request({
method: 'PATCH',
path: `/oauth/authorizations/${encodeURIComponent(context.args.id)}`,
body: {
client,
description: context.flags.description
}
}))
authorizations.display(auth)
}
module.exports = {
topic: 'authorizations',
command: 'update',
description: 'updates an OAuth authorization',
needsAuth: true,
args: [{name: 'id'}],
flags: [
{char: 'd', name: 'description', hasValue: true, description: 'set a custom authorization description'},
{name: 'client-id', hasValue: true, description: 'identifier of OAuth client to set'},
{name: 'client-secret', hasValue: true, description: 'secret of OAuth client to set'}
],
run: cli.command(co.wrap(run))
}