-
Notifications
You must be signed in to change notification settings - Fork 61
/
Copy pathadd.js
39 lines (31 loc) · 1.19 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
'use strict';
const { Args } = require('@oclif/core');
const BoxCommand = require('../../../box-command');
const CollaborationsCreateCommand = require('../../collaborations/create');
const CollaborationModule = require('../../../modules/collaboration');
class FoldersCollaborationsAddCommand extends BoxCommand {
async run() {
const { args, flags } = await this.parse(FoldersCollaborationsAddCommand);
// Transform arguments for generic module
args.itemType = 'folder';
args.itemID = args.id;
delete args.id;
let collabModule = new CollaborationModule(this.client);
let collaboration = await collabModule.createCollaboration(args, flags);
await this.output(collaboration);
}
}
FoldersCollaborationsAddCommand.description = 'Create a collaboration for a folder';
FoldersCollaborationsAddCommand.examples = ['box folders:collaborations:add 22222 --role editor --user-id 33333'];
FoldersCollaborationsAddCommand.flags = {
...CollaborationsCreateCommand.flags,
};
FoldersCollaborationsAddCommand.args = {
id: Args.string({
name: 'id',
required: true,
hidden: false,
description: 'ID of the folder to add a collaboration to',
}),
};
module.exports = FoldersCollaborationsAddCommand;