-
Notifications
You must be signed in to change notification settings - Fork 61
/
Copy pathadd.js
50 lines (40 loc) · 1.26 KB
/
add.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
40
41
42
43
44
45
46
47
48
49
50
'use strict';
const BoxCommand = require('../../../box-command');
const { flags } = require('@oclif/command');
class UsersAddEmailAliasCommand extends BoxCommand {
async run() {
const { flags, args } = this.parse(UsersAddEmailAliasCommand);
let options = {};
if (flags.hasOwnProperty('confirm')) {
options.is_confirmed = flags.confirm;
}
let alias = await this.client.users.addEmailAlias(args.userID, args.email, options);
await this.output(alias);
}
}
UsersAddEmailAliasCommand.aliases = [ 'users:add-email-alias' ];
UsersAddEmailAliasCommand.description = 'Add a new email alias to a user';
UsersAddEmailAliasCommand.examples = ['box users:email-aliases:add 33333 user+alias@example.com'];
UsersAddEmailAliasCommand._endpoint = 'post_users_id_email_aliases';
UsersAddEmailAliasCommand.flags = {
...BoxCommand.flags,
confirm: flags.boolean({
allowNo: true,
description: 'Whether or not to confirm the email alias. Only Admins may automatically confirm an alias.'
}),
};
UsersAddEmailAliasCommand.args = [
{
name: 'userID',
required: true,
hidden: false,
description: 'User ID to add email alias'
},
{
name: 'email',
required: true,
hidden: false,
description: 'Email to add as alias'
}
];
module.exports = UsersAddEmailAliasCommand;