-
Notifications
You must be signed in to change notification settings - Fork 61
/
Copy pathunshare.js
43 lines (34 loc) · 1.21 KB
/
unshare.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
'use strict';
const { Args } = require('@oclif/core');
const BoxCommand = require('../../box-command');
const SharedLinksDeleteCommand = require('../shared-links/delete');
const SharedLinksModule = require('../../modules/shared-links');
const chalk = require('chalk');
class FilesUnshareCommand extends BoxCommand {
async run() {
const { args } = await this.parse(FilesUnshareCommand);
// Transform arguments for generic module
args.itemType = 'file';
args.itemID = args.id;
delete args.id;
let sharedLinksModule = new SharedLinksModule(this.client);
let item = await sharedLinksModule.removeSharedLink(args);
this.info(chalk`{green Removed shared link from ${args.itemType} "${item.name}"}`);
}
}
FilesUnshareCommand.aliases = ['files:shared-links:delete'];
FilesUnshareCommand.description = 'Delete a shared link for a file';
FilesUnshareCommand.examples = ['box files:unshare 11111'];
FilesUnshareCommand._endpoint = 'put_files_id delete_shared_link';
FilesUnshareCommand.flags = {
...SharedLinksDeleteCommand.flags,
};
FilesUnshareCommand.args = {
id: Args.string({
name: 'id',
required: true,
hidden: false,
description: 'ID of the file to unshare'
})
};
module.exports = FilesUnshareCommand;