-
Notifications
You must be signed in to change notification settings - Fork 7
[CI 4155] getRecommendations support variation id param #220
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
[CI 4155] getRecommendations support variation id param #220
Conversation
Mudaafi
left a comment
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.
Looks good for the most part. I had a couple of questions but would you mind adding variation_id to RecommendationsRequestType and updating item_id to have the type string | Array as well?
| @@ -1,9 +1,10 @@ | |||
| import { ConstructorClientOptions, NetworkParameters, UserParameters, VariationsMap } from '.'; | |||
| import { ConstructorClientOptions, NetworkParameters, UserParameters, VariationsMap, FilterExpression } from '.'; | |||
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.
Thanks for fixing this! I wonder how long it was missing :x
src/modules/recommendations.js
Outdated
| @@ -120,6 +129,7 @@ class Recommendations { | |||
| * @param {string} podId - Pod identifier | |||
| * @param {object} [parameters] - Additional parameters to refine results | |||
| * @param {string|array} [parameters.itemIds] - Item ID(s) to retrieve recommendations for (strategy specific) | |||
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.
For the itemIds field, can we add "required if passing variationId"?
| } | ||
|
|
||
| if (variationId) { | ||
| if (!itemIds) { |
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.
Should we check if it's an empty array here and error out if it is?
src/modules/recommendations.js
Outdated
| * @param {string} podId - Pod identifier | ||
| * @param {object} [parameters] - Additional parameters to refine results | ||
| * @param {string|array} [parameters.itemIds] - Item ID(s) to retrieve recommendations for (strategy specific) | ||
| * @param {string|array} [parameters.variationId] - Variation ID to retrieve recommendations for (strategy specific) |
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 believe the type for this should just be string? I saw the RFC stating they'd want to prohibit multiple variation ids too.
Mudaafi
left a comment
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!
jjl014
left a comment
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 went ahead and added a red path test, but otherwise LGTM! 🚀
https://constructor.slab.com/posts/adding-variation-id-as-request-parameter-for-recommendation-requests-1sxpt91x#hcqxk-open-questions-uncertainties-risks