I agree with OP. It’s totally doable on the client side, but the documentation suggests that the /cards endpoint returns a flat list of cards, each of which has a field for the card set anyway. If anything, the API should return a list of {set, cards} objects so that consumers can provide strict type definitions. As it is, each new set requires a new field definition since the set name is being used as the property name. Does that make sense?
I’m not sure if there is another way to do it or not (I’m pretty new to this). My issue is that right now I have a class that I deserialize the JSON into. The class contains “IList<Card> Basic” and “IList<Card> Classic” and “IList<Card> Naxxramas” and so on. Basically I have a new IList for each set. This is not a huge problem now, but the issue is that when the set list changes (new sets are added), I have to update the app to accommodate it, or else I don’t get the new cards.
I agree with OP. It’s totally doable on the client side, but the documentation suggests that the /cards endpoint returns a flat list of cards, each of which has a field for the card set anyway. If anything, the API should return a list of {set, cards} objects so that consumers can provide strict type definitions. As it is, each new set requires a new field definition since the set name is being used as the property name. Does that make sense?
Get all cards, iterate available sets, loop through sets and create a new list, should be fairly easy client side.
I’m not sure if there is another way to do it or not (I’m pretty new to this). My issue is that right now I have a class that I deserialize the JSON into. The class contains “IList<Card> Basic” and “IList<Card> Classic” and “IList<Card> Naxxramas” and so on. Basically I have a new IList for each set. This is not a huge problem now, but the issue is that when the set list changes (new sets are added), I have to update the app to accommodate it, or else I don’t get the new cards.
Could you explain the benefit of this versus looping through it on your end?