1 | 'use strict';
|
2 |
|
3 | let co = require('co');
|
4 | let cli = require('heroku-cli-util');
|
5 | let lib = require('../../lib');
|
6 |
|
7 | function* run (context, heroku) {
|
8 | let url = context.args['redirect_uri'];
|
9 | lib.validateURL(url);
|
10 | let request = heroku.request({
|
11 | method: 'POST',
|
12 | path: '/oauth/clients',
|
13 | body: {
|
14 | name: context.args.name,
|
15 | redirect_uri: url,
|
16 | }
|
17 | });
|
18 | let client = yield cli.action(`Creating ${context.args.name}`, request);
|
19 | cli.log(`Get details with ${cli.color.cyan('heroku clients:info ' + client.id)}`);
|
20 | }
|
21 |
|
22 | module.exports = {
|
23 | topic: 'clients',
|
24 | command: 'create',
|
25 | description: 'create a new OAuth client',
|
26 | needsAuth: true,
|
27 | args: [{name: 'name'}, {name: 'redirect_uri'}],
|
28 | run: cli.command(co.wrap(run))
|
29 | };
|