-
Notifications
You must be signed in to change notification settings - Fork 61
/
Copy pathgroups.js
41 lines (32 loc) · 1.05 KB
/
groups.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
'use strict';
const { Args } = require('@oclif/core');
const BoxCommand = require('../../box-command');
const PaginationUtils = require('../../pagination-utils');
class UsersListGroupsCommand extends BoxCommand {
async run() {
const { flags, args } = await this.parse(UsersListGroupsCommand);
let options = PaginationUtils.handlePagination(flags);
if (flags.fields) {
options.fields = flags.fields;
}
let groups = await this.client.users.getGroupMemberships(args.id, options);
await this.output(groups);
}
}
UsersListGroupsCommand.aliases = [ 'users:list-groups' ];
UsersListGroupsCommand.description = 'List groups a user belongs to';
UsersListGroupsCommand.examples = ['box users:groups 33333'];
UsersListGroupsCommand._endpoint = 'get_users_id_memberships';
UsersListGroupsCommand.flags = {
...BoxCommand.flags,
...PaginationUtils.flags,
};
UsersListGroupsCommand.args = {
id: Args.string({
name: 'id',
required: true,
hidden: false,
description: 'ID of the user to get groups for',
}),
};
module.exports = UsersListGroupsCommand;