Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Support limit flag for Box Search #323

Merged
merged 8 commits into from
May 4, 2022

Conversation

lukaszsocha2
Copy link
Contributor

Closes: SDK-2171
Fixes: #322

Copy link
Contributor

@mwwoda mwwoda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left a question regarding options.limit value passed to the node sdk function.

@@ -148,11 +148,12 @@ class SearchCommand extends BoxCommand {

let results = await this.client.search.query(args.query || null, options);

// Hard limit the search results to avoid slamming the API
// Limit the search results according to the --limit flag value (if specified) or RESULTS_LIMIT value
const itemsLimit = flags.limit || RESULTS_LIMIT;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't you also need to modify line 30 where options.limit is set to use flags.limit instead of the hardcoded RESULTS_LIMIT?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually no. We don't want to use limit parameter the same as API understands that. For API limit means number of items per page, but CLI makes pagination for us. So in our case limit means total number of items returned by CLI. You can also read this thread: https://box.slack.com/archives/C6KSD7C91/p1651243355904129

Copy link
Contributor

@mwwoda mwwoda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@lukaszsocha2 lukaszsocha2 merged commit 0009a77 into main May 4, 2022
@lukaszsocha2 lukaszsocha2 deleted the sdk-2171-add-limit-flag-for-search branch May 4, 2022 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Box Search: Limit param not supported
2 participants