tcgdex/cards-database

enhancement: add category to Card brief object

Closed this issue · 1 comments

Data affected

  • Card
  • Set
  • Serie
  • Other
  • new Data Type

Please explain in more details what idea you have

I have a use case that I wanted to get all the cards from the /cards endpoint but if wanted to filter by category I will have to query each card to see what category it is, is this doable? If yes, I can totally get assign to this and help

Hey, thanks for the request,

To be honest, I want to keep the /cards endpoint lightweight as it is already ~2MB and will keep getting bigger as cards are being added.

Adding the category field will add ~320KB and it is a lot.

BUT that's what the GraphQL API is for ! https://api.tcgdex.net/v2/graphql

You can simulate the /cards URL by using the following GraphQL and just adding category gives you the request you wanted :D

{
  cards {
    id
    localId
    name
    image
    category
  }
}