-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathschema.js
89 lines (78 loc) · 2.08 KB
/
schema.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
const { gql } = require("apollo-server");
const typeDefs = gql`
type Query {
getAllPokemon(limit: Int, offset: Int): ResourceList
pokemon(id: Int): Pokemon
# pokemonStat(id: Int): Pokemon!
getAllMoves: ResourceList
"this searches pokemon by generation"
getPokemonByGeneration(gen: Int!): [EndpointResult]
}
type ResourceList {
"The total number of resources available from this API."
count: Int
"The URL for the next page in the list."
next: String
"The URL for the previous page in the list."
previous: String
"A list of named API resources."
results: [EndpointResult]
}
type EndpointResult {
"The name of the referenced resource."
name: String
"The URL of the referenced resource."
url: String
"gives image of the given pokemon"
image: PokemonSprite
"pokemon id grabbed from URL"
id: Int
}
type PokemonSprite {
front_default: String
}
type Pokemon {
"The pokemon's id"
id: Int
"The pokemon's name"
name: String!
"Base exp gained from defeating this pokemon"
base_experience: Int
"List of base stat values"
stats: [StatObj]
"List of abilities this pokemon can have"
abilities: [AbilityObj]
moves: [Move]
}
"Stat determines certain aspects of battles"
type StatObj {
base_stat: Int
effort: Int
stat: Name
}
"Pokemon can have multiple possible abilities but can only have one ability at a time"
type AbilityObj {
ability: Name
is_hidden: Boolean
slot: Int
}
type Move {
"The move the Pokémon can learn."
move: Name
"The details of the version in which the Pokémon can learn the move."
version_group_details: [PokemonMoveVersion]
}
type PokemonMoveVersion {
"The method by which the move is learned."
move_learn_method: Name
"The version group in which the move is learned."
version_group: Name
"The minimum level to learn the move."
level_learned_at: Int
}
"Reusable name type"
type Name {
name: String @deprecated(reason: "not needed ")
}
`;
module.exports = typeDefs;