Comments (4)
Hmm, how should we do this... You think just returning a list would be appropriate?
Shopify.CollectionListing.get_product_ids(session, collection_id)
# => %{product_ids: [123123, 987786, ...]}
@lewisf It's pretty easy to implement, question is should we add a generic section for things that do not really justify a resource struct.
EDIT: What I mean is, are there any other endpoints that return something like this outside of count
? If so, we should probably look into it.
from shopify.
returning a list is good but maybe also in the standard %Shopify.Response struct with code/data?
I just clicked through the api docs there's only one other instance of this:
https://help.shopify.com/en/api/reference/sales-channels/productlisting#product_ids
and I also need it :P lucky me I guess?
from shopify.
@Ninigi if you agree then we can move forward with this. so far it doesn't look like there are any other endpoints that return a list of ids, so maybe it makes sense to build a general escape hatch?
here's my quick analysis of the changes that need to be made:
since it seems like this is only local to these resources, we can manually add functions to make the right calls here:
https://github.com/nsweeting/shopify/blob/master/lib/shopify/resources/collection_listing.ex
https://github.com/nsweeting/shopify/blob/master/lib/shopify/resources/product_listing.ex
we'd also need to overload Shopify.Request.new
to handle the case where resource
isn't specified. Would it be sufficient to pass in nil
as the resource
here? https://github.com/nsweeting/shopify/blob/master/lib/shopify/request.ex#L30-L40
and change Shopify.Response
to handle responses where something other than Shopify.resources are returned as data.
The one thing I think needs to be configured is the "singular" / "plural" of the returned data to handle parsing {product_ids: [...]}
into the proper %Shopify.Response{code: 200, data: [...]}
struct.
from shopify.
@lewisf If you have the time to look into it, it would be very much appreciated 👍
I think it might actually be not that different from a call to the count
resources or spam
in this resource
So it might actually not need many modifications, but if you want to come up with a fancy solution I'll be happy to do a review 👍
from shopify.
Related Issues (20)
- Is this project dead? HOT 1
- Set timeout for HTTPoison requests HOT 2
- More detailed documentation HOT 4
- Order fulfillment event is using the wrong resource parser HOT 1
- Add tests to validate structs
- Shop info should be dynamically configurable HOT 1
- ScripTags Not Working HOT 1
- cost missing from InventoryItem resource
- OAuth flow in test mock adapter seems incomplete HOT 1
- Feature: Multipass support HOT 1
- [PriceRule] Missing field HOT 1
- [Multipass] Clear up API HOT 1
- Add Versioning Support HOT 4
- Order resource is missing endpoints
- Support Shopify's new cursor-based pagination HOT 2
- Failing travis-ci checks
- How ready is it? All API calls? HOT 1
- Unhandled CaseClauseError from bug in Posion
- Problems With OAuth Flow using Explicit API Version
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from shopify.