From d61e4ab740603a5f6748641f4405e9d43a8563b6 Mon Sep 17 00:00:00 2001 From: Artur Jankowski Date: Wed, 15 Apr 2026 16:46:08 +0200 Subject: [PATCH 1/3] feat: Add support for `Box Hubs` endpoints --- README.md | 1 + docs/files.md | 4 +- docs/folders.md | 4 +- docs/hubs.md | 355 ++++++++++++++++++++++++ docs/tokens.md | 4 +- package-lock.json | 10 +- package.json | 2 +- src/box-command.js | 53 ++++ src/commands/files/metadata/update.js | 2 +- src/commands/folders/metadata/update.js | 2 +- src/commands/hubs/copy.js | 53 ++++ src/commands/hubs/create.js | 46 +++ src/commands/hubs/delete.js | 31 +++ src/commands/hubs/enterprise.js | 62 +++++ src/commands/hubs/get.js | 32 +++ src/commands/hubs/index.js | 69 +++++ src/commands/hubs/update.js | 98 +++++++ src/commands/tokens/exchange.js | 2 +- test/commands/hubs.test.js | 293 +++++++++++++++++++ test/fixtures/hubs/get_hubs_id.json | 26 ++ test/fixtures/hubs/put_hubs_id.json | 26 ++ 21 files changed, 1160 insertions(+), 15 deletions(-) create mode 100644 docs/hubs.md create mode 100644 src/commands/hubs/copy.js create mode 100644 src/commands/hubs/create.js create mode 100644 src/commands/hubs/delete.js create mode 100644 src/commands/hubs/enterprise.js create mode 100644 src/commands/hubs/get.js create mode 100644 src/commands/hubs/index.js create mode 100644 src/commands/hubs/update.js create mode 100644 test/commands/hubs.test.js create mode 100644 test/fixtures/hubs/get_hubs_id.json create mode 100644 test/fixtures/hubs/put_hubs_id.json diff --git a/README.md b/README.md index dccdf5f4..4b8ad841 100644 --- a/README.md +++ b/README.md @@ -212,6 +212,7 @@ Avatar URL: 'https://app.box.com/api/avatar/large/77777' * [`box folders`](docs/folders.md) - Manage folders * [`box groups`](docs/groups.md) - List all groups * [`box help`](docs/help.md) - Display help for the Box CLI +* [`box hubs`](docs/hubs.md) - List Box Hubs for the current user * [`box integration-mappings`](docs/integration-mappings.md) - List Slack integration mappings * [`box legal-hold-policies`](docs/legal-hold-policies.md) - List legal hold policies * [`box login`](docs/login.md) - Sign in with OAuth 2.0 and create a new environment (or update an existing one with --reauthorize). diff --git a/docs/files.md b/docs/files.md index dc27419c..4456826e 100644 --- a/docs/files.md +++ b/docs/files.md @@ -833,12 +833,13 @@ Update the metadata attached to a file USAGE $ box files:metadata:update ID --template-key [-t ] [--as-user ] [--no-color] [--json | --csv] [-s | --save-to-file-path ] [--fields ] [--bulk-file-path ] [-h] [-v] [-y] [-q] [--scope ] - [-a ...] [-c ...] [-m ...] [--remove ...] [--replace ...] [-t ...] + [-a ...] [-c ...] [-m ...] [--remove ...] [--replace ...] [-T ...] ARGUMENTS ID ID of the file to update metadata on FLAGS + -T, --test=... Test that a metadata key contains a specific value; must be in the form key=value -a, --add=... Add a key to the metadata document; must be in the form key=value -c, --copy=... Copy a metadata value to another key; must be in the form sourceKey>destinationKey -h, --help Show CLI help @@ -846,7 +847,6 @@ FLAGS sourceKey>destinationKey -q, --quiet Suppress any non-error output to stderr -s, --save Save report to default reports folder on disk - -t, --test=... Test that a metadata key contains a specific value; must be in the form key=value -t, --token= Provide a token to perform this call -v, --verbose Show verbose output, which can be helpful for debugging -y, --yes Automatically respond yes to all confirmation prompts diff --git a/docs/folders.md b/docs/folders.md index f9a9a868..ac987663 100644 --- a/docs/folders.md +++ b/docs/folders.md @@ -1018,12 +1018,13 @@ Update the metadata attached to a folder USAGE $ box folders:metadata:update ID --template-key [-t ] [--as-user ] [--no-color] [--json | --csv] [-s | --save-to-file-path ] [--fields ] [--bulk-file-path ] [-h] [-v] [-y] [-q] [--scope ] - [-a ...] [-c ...] [-m ...] [--remove ...] [--replace ...] [-t ...] + [-a ...] [-c ...] [-m ...] [--remove ...] [--replace ...] [-T ...] ARGUMENTS ID ID of the folder to update metadata on FLAGS + -T, --test=... Test that a metadata key contains a specific value; must be in the form key=value -a, --add=... Add a key to the metadata document; must be in the form key=value -c, --copy=... Copy a metadata value to another key; must be in the form sourceKey>destinationKey -h, --help Show CLI help @@ -1031,7 +1032,6 @@ FLAGS sourceKey>destinationKey -q, --quiet Suppress any non-error output to stderr -s, --save Save report to default reports folder on disk - -t, --test=... Test that a metadata key contains a specific value; must be in the form key=value -t, --token= Provide a token to perform this call -v, --verbose Show verbose output, which can be helpful for debugging -y, --yes Automatically respond yes to all confirmation prompts diff --git a/docs/hubs.md b/docs/hubs.md new file mode 100644 index 00000000..2ccac455 --- /dev/null +++ b/docs/hubs.md @@ -0,0 +1,355 @@ +`box hubs` +========== + +List Box Hubs for the current user + +* [`box hubs`](#box-hubs) +* [`box hubs:copy ID`](#box-hubscopy-id) +* [`box hubs:create TITLE`](#box-hubscreate-title) +* [`box hubs:delete ID`](#box-hubsdelete-id) +* [`box hubs:enterprise`](#box-hubsenterprise) +* [`box hubs:get ID`](#box-hubsget-id) +* [`box hubs:list`](#box-hubslist) +* [`box hubs:update ID`](#box-hubsupdate-id) + +## `box hubs` + +List Box Hubs for the current user + +``` +USAGE + $ box hubs [-t ] [--as-user ] [--no-color] [--json | --csv] [-s | --save-to-file-path + ] [--fields ] [--bulk-file-path ] [-h] [-v] [-y] [-q] [--max-items ] [--query ] + [--scope editable|view_only|all] [--sort name|updated_at|last_accessed_at|view_count|relevance] [--direction + ASC|DESC] + +FLAGS + -h, --help Show CLI help + -q, --quiet Suppress any non-error output to stderr + -s, --save Save report to default reports folder on disk + -t, --token= Provide a token to perform this call + -v, --verbose Show verbose output, which can be helpful for debugging + -y, --yes Automatically respond yes to all confirmation prompts + --as-user= Provide an ID for a user + --bulk-file-path= File path to bulk .csv or .json objects + --csv Output formatted CSV + --direction=