-
Notifications
You must be signed in to change notification settings - Fork 0
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
Support Multiple Query Include Values #84
Comments
Thanks so much for the feedback, Aaron! Very happy to hear that the client's been of use to you 🙂 Apologies for the delay in getting back to you, just got back from a couple of weeks on travel for work. I like your suggestion a lot, and will play around with some generics/the generate script to see if I can automate this! Hope to get back to you soon 👍 |
Hi @nowlena! I opened a pull request in the bigcommerce/api-specs repository that should fix the issue you raised: If the PR is accepted, the const product = await bc.v3.GET("/catalog/products/{product_id}", {
params: {
path: { product_id: 77 },
header: { Accept: "application/json" },
query: { include: ["options", "images", "primary_image", "variants"] },
},
}); Before (error):After (no error):I wanted to first try to fix the root cause of this issue at its source, hoping that the fix may help other developers using the api-specs repo for their own use cases; but, in the event that my PR can't be merged due to some unintended side effect, I'll re-explore a workaround implemented directly in this library like the one you suggested 🙂 |
Hi again, @nowlena! 👋 After a good bit of hard work from the BigCommerce DevDocs team, the team has gone through and fixed this problem for all query parameters in bigcommerce/docs#221. To incorporate this work, I just released bc.v3
.GET("/catalog/products/{product_id}", {
params: {
path: { product_id: 77 },
header: { Accept: "application/json" },
query: { include: ["variants", "images", "primary_image"] },
},
})
.then((res) => {
console.log(res.data);
}); If you have a chance, feel free to test this on your end and let me know if you run into any problems! I'll mark this issue as completed in a couple weeks if I don't hear back. All the best 🍻 |
Works perfect! Thank you and the other BC members who helped out, what a great DX! |
Very much liking the package! I think we'll move to using it given it's complete generated type safety approach that should always align with the actual BigCommerce APIs. Well done!
As for this issue... It'd be great to allow multiple "include" values to be used:
If you're able to target the query "include" values and make them their own type I believe you could do something like below:
I'm sure there's a generic that can be written to improve things but I think you get the point.
Thanks!
The text was updated successfully, but these errors were encountered: