Closed nullndr closed 7 months ago
May I open a PR for this?
Hi, thanks for raising this! This method is a bit of an odd one out because that API behaves a little different to the others.
Instead of changing the all
method (which would be a breaking change), I wonder if it would be better to create a brand new method (Shop.current()
?) that returns the first instance in data
, similar to Customer.find()
.
I'll add this to our tracking, but to be transparent there are other things that would be done before this, so it might be a while before we can get to it. If you can open a PR, we'll be happy to review / merge it!
Hi @paulomarg, I do think that the use of Shop.all()
is a bit confusioning to retrieve the store info, so I agree with the Shop.current()
method.
I'll open a PR.
The call to
admin.rest.resources.Shop.all({ session })
returns the whole response, and not just thedata[0]
object:https://github.com/Shopify/shopify-api-js/blob/eae4573cbe6991c4bda8044c1668dde9980bc9a3/packages/shopify-api/rest/admin/2024-01/shop.ts#L44
Like the
Customer
resurce, it should returns the following: