-
Notifications
You must be signed in to change notification settings - Fork 61
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
Conversation
Closes: SDK-2171 Fixes: #322
There was a problem hiding this 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; |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Closes: SDK-2171
Fixes: #322