-
Notifications
You must be signed in to change notification settings - Fork 61
/
Copy pathitems.js
63 lines (53 loc) · 1.45 KB
/
items.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
51
52
53
54
55
56
57
58
59
60
61
62
63
'use strict';
const BoxCommand = require('../../box-command');
const { Flags, Args } = require('@oclif/core');
const PaginationUtils = require('../../pagination-utils');
class FoldersListItemsCommand extends BoxCommand {
async run() {
const { flags, args } = await this.parse(FoldersListItemsCommand);
let options = PaginationUtils.forceMarkerPagination(flags);
if (flags.fields) {
options.fields = flags.fields;
}
if (flags.direction) {
options.direction = flags.direction;
}
if (flags.sort) {
options.sort = flags.sort;
}
let items = await this.client.folders.getItems(args.id, options);
await this.output(items);
}
}
FoldersListItemsCommand.aliases = [ 'folders:list-items' ];
FoldersListItemsCommand.description = 'List items in a folder';
FoldersListItemsCommand.examples = ['box folders:items 22222'];
FoldersListItemsCommand._endpoint = 'get_folders_id_items';
FoldersListItemsCommand.flags = {
...BoxCommand.flags,
...PaginationUtils.flags,
direction: Flags.string({
description: 'The direction to order returned items',
options: [
'ASC',
'DESC'
]
}),
sort: Flags.string({
description: 'The parameter to sort returned items',
options: [
'id',
'name',
'date'
]
}),
};
FoldersListItemsCommand.args = {
id: Args.string({
name: 'id',
required: true,
hidden: false,
description: 'ID of the folder to get the items in, use 0 for the root folder',
})
};
module.exports = FoldersListItemsCommand;