|
| 1 | +'use strict'; |
| 2 | + |
| 3 | +const BoxCommand = require('../../../box-command'); |
| 4 | +const { Flags } = require('@oclif/core'); |
| 5 | +const PaginationUtils = require('../../../pagination-utils'); |
| 6 | + |
| 7 | +class IntegrationMappingsTeamsListCommand extends BoxCommand { |
| 8 | + async run() { |
| 9 | + const { flags } = await this.parse(IntegrationMappingsTeamsListCommand); |
| 10 | + let options = {}; |
| 11 | + |
| 12 | + if (flags['partner-item-id']) { |
| 13 | + options.partnerItemId = flags['partner-item-id']; |
| 14 | + } |
| 15 | + if (flags['partner-item-type']) { |
| 16 | + options.partnerItemType = flags['partner-item-type']; |
| 17 | + } |
| 18 | + if (flags['box-item-id']) { |
| 19 | + options.boxItemId = flags['box-item-id']; |
| 20 | + } |
| 21 | + if (flags['box-item-type']) { |
| 22 | + options.boxItemType = flags['box-item-type']; |
| 23 | + } |
| 24 | + |
| 25 | + let teamsIntegrationMappings = await this.tsClient.integrationMappings.getTeamsIntegrationMapping(options); |
| 26 | + delete teamsIntegrationMappings.rawData; |
| 27 | + await this.output(teamsIntegrationMappings); |
| 28 | + } |
| 29 | +} |
| 30 | + |
| 31 | +IntegrationMappingsTeamsListCommand.aliases = [ 'integration-mappings:teams:list' ]; |
| 32 | + |
| 33 | +IntegrationMappingsTeamsListCommand.description = 'List Teams integration mappings'; |
| 34 | +IntegrationMappingsTeamsListCommand.examples = [ |
| 35 | + 'box integration-mappings:teams --partner-item-id 123 --partner-item-type channel', |
| 36 | + 'box integration-mappings:teams --box-item-id 456 --box-item-type folder' |
| 37 | +]; |
| 38 | +IntegrationMappingsTeamsListCommand._endpoint = 'get_integration_mappings_teams'; |
| 39 | + |
| 40 | +IntegrationMappingsTeamsListCommand.flags = { |
| 41 | + ...BoxCommand.flags, |
| 42 | + ...PaginationUtils.flags, |
| 43 | + 'partner-item-id': Flags.string({ |
| 44 | + hidden: false, |
| 45 | + description: 'ID of the mapped item, for which the mapping should be returned', |
| 46 | + }), |
| 47 | + 'partner-item-type': Flags.string({ |
| 48 | + hidden: false, |
| 49 | + description: 'Mapped item type, for which the mapping should be returned, value is one of: channel, team', |
| 50 | + }), |
| 51 | + 'box-item-id': Flags.string({ |
| 52 | + hidden: false, |
| 53 | + description: 'Box item ID, for which the mappings should be returned', |
| 54 | + }), |
| 55 | + 'box-item-type': Flags.string({ |
| 56 | + hidden: false, |
| 57 | + description: 'Box item type, for which the mappings should be returned, value is one of: folder', |
| 58 | + }) |
| 59 | +}; |
| 60 | + |
| 61 | +module.exports = IntegrationMappingsTeamsListCommand; |
0 commit comments