1
0
mirror of https://github.com/tcgdex/cards-database.git synced 2025-04-23 03:12:10 +00:00

chore: Document the GraphQL definition (#461)

This commit is contained in:
Florian Bouillon 2024-01-03 03:11:50 +01:00 committed by GitHub
parent 5c8ca20a41
commit b7e150fe45
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,6 +4,7 @@
# Locale Directive ex: {sets @locale(fr)} # Locale Directive ex: {sets @locale(fr)}
directive @locale ( directive @locale (
"""The language to use"""
lang: String! lang: String!
) on FIELD ) on FIELD
@ -69,95 +70,243 @@ input Sort {
# Card # # Card #
################## ##################
# Filters to be used with the Card query """a Card filters"""
input CardsFilters { input CardsFilters {
"""Filter on the card's category (Pokemon, Trainer or Energy)"""
category: String category: String
"""Filter on the card's decription"""
description: String description: String
"""Filter for the card energy type (normal or special)"""
energyType: String energyType: String
"""Filter for the previous evolution of the current pokémon"""
evolveFrom: String evolveFrom: String
"""Filter on the Pokémon's HPs"""
hp: Int hp: Int
"""Filter on the card id"""
id: ID id: ID
"""Filter for the card's local id"""
localId: String localId: String
"""Filter on the pokémon national pokédex number"""
dexId: Int dexId: Int
"""Filter on the illustrator name"""
illustrator: String illustrator: String
image: String
image: String @deprecated(reason: "this only indicate if a file is present or not, it should not be a filter")
"""Filter on ths Pokémon's level"""
level: Int level: Int
levelId: String
"""Filter on the Card's name"""
name: String name: String
"""
Filter on the card's rarity
see: https://api.tcgdex.net/v2/en/rarities for the full list
"""
rarity: String rarity: String
"""Filter on the card's regulation mark"""
regulationMark: String regulationMark: String
"""Filter on the Card evolution stage"""
stage: String stage: String
"""Filter on the card suffix"""
suffix: String suffix: String
"""Filter on the trainer type"""
trainerType: String trainerType: String
"""Filter on the retreat point cost"""
retreat: Int retreat: Int
} }
"""
Define what is a card for GraphQL
"""
type Card { type Card {
"""The pokémon abilities"""
abilities: [AbilitiesListItem] abilities: [AbilitiesListItem]
"""The pokémon attacks"""
attacks: [AttacksListItem] attacks: [AttacksListItem]
"""The card category ('Pokemon' | 'Trainer' | 'Energy')"""
category: String! category: String!
"""The card description (mostly the Poédex description)"""
description: String description: String
"""The pokémon(s) Pokédex IDs (Pokémons appearing on the card image & name)"""
dexId: [Int] dexId: [Int]
"""the energy/trainer effect"""
effect: String effect: String
"""the energy type ('Normal' | 'Special')"""
energyType: String energyType: String
"""the previous evolution of the current pokémon"""
evolveFrom: String evolveFrom: String
"""the Pokémon's HPs"""
hp: Int hp: Int
"""the card id"""
id: String! id: String!
"""the illustrator name"""
illustrator: String illustrator: String
"""The card's image if available (see the docs for more details)"""
image: String image: String
"""The Pokémon's item"""
item: Item item: Item
"""The card legality in tournaments"""
legal: Legal! legal: Legal!
"""The Pokémon level"""
level: Int level: Int
"""the card's local id"""
localId: String! localId: String!
"""the Card's name"""
name: String! name: String!
"""
the card's rarity
see: https://api.tcgdex.net/v2/en/rarities for the full list
"""
rarity: String! rarity: String!
"""the card's regulation mark"""
regulationMark: String regulationMark: String
"""The pokémon resistances"""
resistances: [WeakResListItem] resistances: [WeakResListItem]
"""The Card retreat cost"""
retreat: Int retreat: Int
"The card's set"
set: Set! set: Set!
"""the Card evolution stage"""
stage: String stage: String
"""the card suffix"""
suffix: String suffix: String
"""the trainer type"""
trainerType: String trainerType: String
"""The pokémon type(s) (trivia: Even the TCG implemented at some point multiple types for a single card)"""
types: [String] types: [String]
"""The card variants"""
variants: Variants variants: Variants
"""The pokémon weaknesses"""
weaknesses: [WeakResListItem] weaknesses: [WeakResListItem]
# Currently not in any cards # Currently not in any cards
# weight: String! # weight: String!
} }
"""
define a single ability
"""
type AbilitiesListItem { type AbilitiesListItem {
"""The ability effect"""
effect: String effect: String
"""The ability name"""
name: String name: String
"""the ability type ('Pokemon Power' | 'Poke-BODY' | 'Poke-POWER' | 'Ability' | 'Ancient Trait')"""
type: String type: String
} }
"""
define a single attack
"""
type AttacksListItem { type AttacksListItem {
"""The attack cost in energies (can be affected by the effect)"""
cost: [String] cost: [String]
"""The attack damage (can be affected by the effect)"""
damage: String damage: String
"""The attack additionnal effect"""
effect: String effect: String
"""The attack name"""
name: String! name: String!
} }
"""
Indicate the item a pokémon has on him
"""
type Item { type Item {
"""the item effect"""
effect: String! effect: String!
"""the item name"""
name: String! name: String!
} }
"""
Indicate the legality of a card for official tournaments
"""
type Legal { type Legal {
"""Is the card playable in expanded tournaments?"""
expanded: Boolean expanded: Boolean
"""Is the card playable in standard tournaments?"""
standard: Boolean standard: Boolean
} }
"""
Definition for the Weakness and REsistance elements
"""
type WeakResListItem { type WeakResListItem {
"""the Weakness/resistance type"""
type: String! type: String!
"""the Weakness/resistance modifier (can be 2x or 30+ or nothing)"""
value: String value: String
} }
"""
All the card variants
"""
type Variants { type Variants {
"""is the card available in a first edition version?"""
firstEdition: Boolean! firstEdition: Boolean!
"""can the card be found has an holo?"""
holo: Boolean! holo: Boolean!
"""can the card be found without special elements?"""
normal: Boolean! normal: Boolean!
"""Can the card be found a a reverse holo version?"""
reverse: Boolean! reverse: Boolean!
"""was the card a wPromo card?"""
wPromo: Boolean! wPromo: Boolean!
} }
@ -165,32 +314,80 @@ type Variants {
# Set # # Set #
################## ##################
"""
Describe a single set
"""
type Set { type Set {
"""Indicate how much cards is in the set"""
cardCount: CardCount! cardCount: CardCount!
"""list the cards in the set"""
cards: [Card]! cards: [Card]!
"""The Set id"""
id: String! id: String!
"""The set logo if available"""
logo: String logo: String
"""The set's name"""
name: String! name: String!
"""The set's symbol if available"""
symbol: String symbol: String
"""The Set serie"""
serie: Serie! serie: Serie!
"""The set official release date"""
releaseDate: String! releaseDate: String!
"""The set tcgOnline code if available in the APP"""
tcgOnline: String tcgOnline: String
} }
"""
Filters for the set query
"""
input SetFilters { input SetFilters {
"""The Set id"""
id: String id: String
"""The set's name"""
name: String name: String
"""The Set serie"""
serie: String serie: String
"""The set official release date"""
releaseDate: String releaseDate: String
"""The set tcgOnline code if available in the APP"""
tcgOnline: String tcgOnline: String
} }
"""
Indicate how much cards a set contains
It also indicate how much card for a specific variant
"""
type CardCount { type CardCount {
"""The number of first edition cards in the set"""
firstEd: Int firstEd: Int
"""The number of holo cards in the set"""
holo: Int holo: Int
"""The number of normal cards in the set"""
normal: Int normal: Int
"""The number of cards that are not hidden (generally in the bottom left/right)"""
official: Int! official: Int!
"""The number of reverse cards in the set"""
reverse: Int reverse: Int
"""The total number of cards in the set"""
total: Int! total: Int!
} }
@ -198,15 +395,30 @@ type CardCount {
# Serie # # Serie #
################## ##################
"""
A Pokémon TCG serie
"""
type Serie { type Serie {
"""The Serie ID"""
id: String! id: String!
"""The serie's logo if available"""
logo: String logo: String
"""the serie's name"""
name: String! name: String!
"""the list of sets that are part of the serie"""
sets: [Set]! sets: [Set]!
} }
"""
The Serie filters
"""
input SerieFilters { input SerieFilters {
"""the serie's id"""
id: String id: String
"""The name of the serie"""
name: String name: String
} }
@ -214,7 +426,13 @@ input SerieFilters {
# StringEndpoint # # StringEndpoint #
################## ##################
"""
currently unused but is the general endpoint for every other elements
"""
type StringEndpoint { type StringEndpoint {
"""The list of cards that are available in the endpoint"""
cards: [Card]! cards: [Card]!
"""The endpoint element name"""
name: String! name: String!
} }