pokenode-ts 1.16.1 → 1.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -11
- package/lib/index.d.ts +4106 -0
- package/lib/index.global.js +133 -0
- package/lib/index.js +14 -0
- package/lib/index.mjs +14 -0
- package/package.json +71 -58
- package/CHANGELOG.md +0 -6
- package/dist/clients/berry.client.js +0 -156
- package/dist/clients/contest.client.js +0 -133
- package/dist/clients/encounter.client.js +0 -163
- package/dist/clients/evolution.client.js +0 -103
- package/dist/clients/game.client.js +0 -210
- package/dist/clients/index.js +0 -15
- package/dist/clients/item.client.js +0 -257
- package/dist/clients/location.client.js +0 -210
- package/dist/clients/machine.client.js +0 -54
- package/dist/clients/main.client.js +0 -48
- package/dist/clients/move.client.js +0 -351
- package/dist/clients/pokemon.client.js +0 -728
- package/dist/clients/utility.client.js +0 -82
- package/dist/config/logger.js +0 -28
- package/dist/constants/base.js +0 -7
- package/dist/constants/berries.js +0 -88
- package/dist/constants/contests.js +0 -11
- package/dist/constants/encounters.js +0 -88
- package/dist/constants/endpoints.js +0 -58
- package/dist/constants/evolutions.js +0 -16
- package/dist/constants/games.js +0 -114
- package/dist/constants/index.js +0 -15
- package/dist/constants/items.js +0 -88
- package/dist/constants/locations.js +0 -23
- package/dist/constants/moves.js +0 -88
- package/dist/constants/pokemons.js +0 -148
- package/dist/constants/utilities.js +0 -19
- package/dist/index.d.ts +0 -3933
- package/dist/index.js +0 -9
- package/dist/models/Berry/berry.js +0 -2
- package/dist/models/Berry/index.js +0 -4
- package/dist/models/Common/description.js +0 -2
- package/dist/models/Common/effect.js +0 -2
- package/dist/models/Common/encounter.js +0 -2
- package/dist/models/Common/flavor-text.js +0 -2
- package/dist/models/Common/generation.js +0 -2
- package/dist/models/Common/index.js +0 -14
- package/dist/models/Common/language.js +0 -2
- package/dist/models/Common/machine.js +0 -2
- package/dist/models/Common/name.js +0 -2
- package/dist/models/Common/resource.js +0 -2
- package/dist/models/Common/verbose.js +0 -2
- package/dist/models/Common/version.js +0 -2
- package/dist/models/Contest/contest.js +0 -2
- package/dist/models/Contest/index.js +0 -4
- package/dist/models/Encounter/encounter.js +0 -2
- package/dist/models/Encounter/index.js +0 -4
- package/dist/models/Evolution/evolution.js +0 -2
- package/dist/models/Evolution/index.js +0 -4
- package/dist/models/Game/generation.js +0 -2
- package/dist/models/Game/index.js +0 -7
- package/dist/models/Game/pokedex.js +0 -2
- package/dist/models/Game/pokemon-entry.js +0 -2
- package/dist/models/Game/version.js +0 -2
- package/dist/models/Item/index.js +0 -4
- package/dist/models/Item/item.js +0 -2
- package/dist/models/Location/encounter.js +0 -2
- package/dist/models/Location/index.js +0 -7
- package/dist/models/Location/location.js +0 -2
- package/dist/models/Location/palpark.js +0 -2
- package/dist/models/Location/region.js +0 -2
- package/dist/models/Machine/index.js +0 -4
- package/dist/models/Machine/machine.js +0 -2
- package/dist/models/Moves/index.js +0 -4
- package/dist/models/Moves/moves.js +0 -2
- package/dist/models/Pokemon/ability.js +0 -2
- package/dist/models/Pokemon/characteristics.js +0 -2
- package/dist/models/Pokemon/egg-group.js +0 -2
- package/dist/models/Pokemon/gender.js +0 -2
- package/dist/models/Pokemon/growth-rates.js +0 -2
- package/dist/models/Pokemon/index.js +0 -13
- package/dist/models/Pokemon/nature.js +0 -2
- package/dist/models/Pokemon/pokeathlon-stat.js +0 -2
- package/dist/models/Pokemon/pokemon.js +0 -2
- package/dist/models/Pokemon/stats.js +0 -2
- package/dist/models/Pokemon/type.js +0 -2
- package/dist/models/index.js +0 -14
- package/dist/structures/base.js +0 -29
- package/dist/structures/index.js +0 -4
- package/jest.config.js +0 -25
|
@@ -1,728 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PokemonClient = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const constants_1 = require("../constants");
|
|
6
|
-
const base_1 = require("../structures/base");
|
|
7
|
-
/**
|
|
8
|
-
* ### Pokemon Client
|
|
9
|
-
*
|
|
10
|
-
* Client used to access the Pokemon Endpoints:
|
|
11
|
-
* - [Abilities](https://pokeapi.co/docs/v2#abilities)
|
|
12
|
-
* - [Characteristics](https://pokeapi.co/docs/v2#characteristics)
|
|
13
|
-
* - [Egg Groups](https://pokeapi.co/docs/v2#egg-groups)
|
|
14
|
-
* - [Genders](https://pokeapi.co/docs/v2#genders)
|
|
15
|
-
* - [Growth Rates](https://pokeapi.co/docs/v2#growth-rates)
|
|
16
|
-
* - [Natures](https://pokeapi.co/docs/v2#natures)
|
|
17
|
-
* - [Pokeathlon Stats](https://pokeapi.co/docs/v2#pokeathlon-stats)
|
|
18
|
-
* - [Pokemon](https://pokeapi.co/docs/v2#pokemon)
|
|
19
|
-
* - [Pokemon Location Areas](https://pokeapi.co/docs/v2#pokemon-location-areas)
|
|
20
|
-
* - [Pokemon Colors](https://pokeapi.co/docs/v2#pokemon-colors)
|
|
21
|
-
* - [Pokemon Forms](https://pokeapi.co/docs/v2#pokemon-forms)
|
|
22
|
-
* - [Pokemon Habitats](https://pokeapi.co/docs/v2#pokemon-habitats)
|
|
23
|
-
* - [Pokemon Shapes](https://pokeapi.co/docs/v2#pokemon-shapes)
|
|
24
|
-
* - [Pokemon Species](https://pokeapi.co/docs/v2#pokemon-species)
|
|
25
|
-
* - [Stats](https://pokeapi.co/docs/v2#stats)
|
|
26
|
-
* - [Types](https://pokeapi.co/docs/v2#types)
|
|
27
|
-
* ---
|
|
28
|
-
* See [PokéAPI Documentation](https://pokeapi.co/docs/v2#pokemon-section)
|
|
29
|
-
*/
|
|
30
|
-
class PokemonClient extends base_1.BaseClient {
|
|
31
|
-
/**
|
|
32
|
-
* @argument clientOptions Options for the client.
|
|
33
|
-
*/
|
|
34
|
-
constructor(clientOptions) {
|
|
35
|
-
super(clientOptions);
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Get an Ability by it's name
|
|
39
|
-
* @param name The Ability name
|
|
40
|
-
* @returns An Ability
|
|
41
|
-
*/
|
|
42
|
-
getAbilityByName(name) {
|
|
43
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
44
|
-
return new Promise((resolve, reject) => {
|
|
45
|
-
this.api
|
|
46
|
-
.get(`${constants_1.Endpoints.Ability}/${name}`)
|
|
47
|
-
.then((response) => resolve(response.data))
|
|
48
|
-
.catch((error) => reject(error));
|
|
49
|
-
});
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Get an Ability by it's ID
|
|
54
|
-
* @param id The Ability ID
|
|
55
|
-
* @returns An Ability
|
|
56
|
-
*/
|
|
57
|
-
getAbilityById(id) {
|
|
58
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
59
|
-
return new Promise((resolve, reject) => {
|
|
60
|
-
this.api
|
|
61
|
-
.get(`${constants_1.Endpoints.Ability}/${id}`)
|
|
62
|
-
.then((response) => resolve(response.data))
|
|
63
|
-
.catch((error) => reject(error));
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Get a Characteristic by it's ID
|
|
69
|
-
* @param id The Characteristic ID
|
|
70
|
-
* @returns A Characteristic
|
|
71
|
-
*/
|
|
72
|
-
getCharacteristicById(id) {
|
|
73
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
74
|
-
return new Promise((resolve, reject) => {
|
|
75
|
-
this.api
|
|
76
|
-
.get(`${constants_1.Endpoints.Characteristic}/${id}`)
|
|
77
|
-
.then((response) => resolve(response.data))
|
|
78
|
-
.catch((error) => reject(error));
|
|
79
|
-
});
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Get an Egg Group by it's name
|
|
84
|
-
* @param name The Egg Group name
|
|
85
|
-
* @returns An Egg Group
|
|
86
|
-
*/
|
|
87
|
-
getEggGroupByName(name) {
|
|
88
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
89
|
-
return new Promise((resolve, reject) => {
|
|
90
|
-
this.api
|
|
91
|
-
.get(`${constants_1.Endpoints.EggGroup}/${name}`)
|
|
92
|
-
.then((response) => resolve(response.data))
|
|
93
|
-
.catch((error) => reject(error));
|
|
94
|
-
});
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* Get an Egg Group by it's ID
|
|
99
|
-
* @param id The Egg Group ID
|
|
100
|
-
* @returns An Egg Group
|
|
101
|
-
*/
|
|
102
|
-
getEggGroupById(id) {
|
|
103
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
104
|
-
return new Promise((resolve, reject) => {
|
|
105
|
-
this.api
|
|
106
|
-
.get(`${constants_1.Endpoints.EggGroup}/${id}`)
|
|
107
|
-
.then((response) => resolve(response.data))
|
|
108
|
-
.catch((error) => reject(error));
|
|
109
|
-
});
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Get a Gender by it's name
|
|
114
|
-
* @param name The gender name
|
|
115
|
-
* @returns An Egg Group
|
|
116
|
-
*/
|
|
117
|
-
getGenderByName(name) {
|
|
118
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
119
|
-
return new Promise((resolve, reject) => {
|
|
120
|
-
this.api
|
|
121
|
-
.get(`${constants_1.Endpoints.Gender}/${name}`)
|
|
122
|
-
.then((response) => resolve(response.data))
|
|
123
|
-
.catch((error) => reject(error));
|
|
124
|
-
});
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
/**
|
|
128
|
-
* Get a Gender by it's ID
|
|
129
|
-
* @param id The Gender ID
|
|
130
|
-
* @returns A Gender
|
|
131
|
-
*/
|
|
132
|
-
getGenderById(id) {
|
|
133
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
134
|
-
return new Promise((resolve, reject) => {
|
|
135
|
-
this.api
|
|
136
|
-
.get(`${constants_1.Endpoints.Gender}/${id}`)
|
|
137
|
-
.then((response) => resolve(response.data))
|
|
138
|
-
.catch((error) => reject(error));
|
|
139
|
-
});
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
/**
|
|
143
|
-
* Get a Growth Rate by it's name
|
|
144
|
-
* @param name The Growth Rate name
|
|
145
|
-
* @returns A Growth Rate
|
|
146
|
-
*/
|
|
147
|
-
getGrowthRateByName(name) {
|
|
148
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
149
|
-
return new Promise((resolve, reject) => {
|
|
150
|
-
this.api
|
|
151
|
-
.get(`${constants_1.Endpoints.GrowthRate}/${name}`)
|
|
152
|
-
.then((response) => resolve(response.data))
|
|
153
|
-
.catch((error) => reject(error));
|
|
154
|
-
});
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
/**
|
|
158
|
-
* Get a Growth Rate by it's ID
|
|
159
|
-
* @param id The Growth Rate ID
|
|
160
|
-
* @returns A Growth Rate
|
|
161
|
-
*/
|
|
162
|
-
getGrowthRateById(id) {
|
|
163
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
164
|
-
return new Promise((resolve, reject) => {
|
|
165
|
-
this.api
|
|
166
|
-
.get(`${constants_1.Endpoints.GrowthRate}/${id}`)
|
|
167
|
-
.then((response) => resolve(response.data))
|
|
168
|
-
.catch((error) => reject(error));
|
|
169
|
-
});
|
|
170
|
-
});
|
|
171
|
-
}
|
|
172
|
-
/**
|
|
173
|
-
* Get a Nature by it's name
|
|
174
|
-
* @param name The Nature name
|
|
175
|
-
* @returns A Nature
|
|
176
|
-
*/
|
|
177
|
-
getNatureByName(name) {
|
|
178
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
179
|
-
return new Promise((resolve, reject) => {
|
|
180
|
-
this.api
|
|
181
|
-
.get(`${constants_1.Endpoints.Nature}/${name}`)
|
|
182
|
-
.then((response) => resolve(response.data))
|
|
183
|
-
.catch((error) => reject(error));
|
|
184
|
-
});
|
|
185
|
-
});
|
|
186
|
-
}
|
|
187
|
-
/**
|
|
188
|
-
* Get a Nature by it's ID
|
|
189
|
-
* @param id The Nature ID
|
|
190
|
-
* @returns A Nature
|
|
191
|
-
*/
|
|
192
|
-
getNatureById(id) {
|
|
193
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
194
|
-
return new Promise((resolve, reject) => {
|
|
195
|
-
this.api
|
|
196
|
-
.get(`${constants_1.Endpoints.Nature}/${id}`)
|
|
197
|
-
.then((response) => resolve(response.data))
|
|
198
|
-
.catch((error) => reject(error));
|
|
199
|
-
});
|
|
200
|
-
});
|
|
201
|
-
}
|
|
202
|
-
/**
|
|
203
|
-
* Get a Pokeathlon Stat by it's name
|
|
204
|
-
* @param name The Pokeathlon Stat name
|
|
205
|
-
* @returns A Pokeathlon Stat
|
|
206
|
-
*/
|
|
207
|
-
getPokeathlonStatByName(name) {
|
|
208
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
209
|
-
return new Promise((resolve, reject) => {
|
|
210
|
-
this.api
|
|
211
|
-
.get(`${constants_1.Endpoints.PokeathlonStat}/${name}`)
|
|
212
|
-
.then((response) => resolve(response.data))
|
|
213
|
-
.catch((error) => reject(error));
|
|
214
|
-
});
|
|
215
|
-
});
|
|
216
|
-
}
|
|
217
|
-
/**
|
|
218
|
-
* Get a Pokeathlon Stat by it's ID
|
|
219
|
-
* @param id The Pokeathlon Stat ID
|
|
220
|
-
* @returns A Pokeathlon Stat
|
|
221
|
-
*/
|
|
222
|
-
getPokeathlonStatById(id) {
|
|
223
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
224
|
-
return new Promise((resolve, reject) => {
|
|
225
|
-
this.api
|
|
226
|
-
.get(`${constants_1.Endpoints.PokeathlonStat}/${id}`)
|
|
227
|
-
.then((response) => resolve(response.data))
|
|
228
|
-
.catch((error) => reject(error));
|
|
229
|
-
});
|
|
230
|
-
});
|
|
231
|
-
}
|
|
232
|
-
/**
|
|
233
|
-
* Get a Pokemon by it's name
|
|
234
|
-
* @param name The Pokemon name
|
|
235
|
-
* @returns A Pokemon Stat
|
|
236
|
-
*/
|
|
237
|
-
getPokemonByName(name) {
|
|
238
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
239
|
-
return new Promise((resolve, reject) => {
|
|
240
|
-
this.api
|
|
241
|
-
.get(`${constants_1.Endpoints.Pokemon}/${name}`)
|
|
242
|
-
.then((response) => resolve(response.data))
|
|
243
|
-
.catch((error) => reject(error));
|
|
244
|
-
});
|
|
245
|
-
});
|
|
246
|
-
}
|
|
247
|
-
/**
|
|
248
|
-
* Get a Pokemon by it's ID
|
|
249
|
-
* @param id The Pokemon ID
|
|
250
|
-
* @returns A Pokemon
|
|
251
|
-
*/
|
|
252
|
-
getPokemonById(id) {
|
|
253
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
254
|
-
return new Promise((resolve, reject) => {
|
|
255
|
-
this.api
|
|
256
|
-
.get(`${constants_1.Endpoints.Pokemon}/${id}`)
|
|
257
|
-
.then((response) => resolve(response.data))
|
|
258
|
-
.catch((error) => reject(error));
|
|
259
|
-
});
|
|
260
|
-
});
|
|
261
|
-
}
|
|
262
|
-
/**
|
|
263
|
-
* Get a Pokemon Location Area by it's ID
|
|
264
|
-
* @param id The Pokemon Location Area ID
|
|
265
|
-
* @returns A Pokemon Location Area
|
|
266
|
-
*/
|
|
267
|
-
getPokemonLocationAreaById(id) {
|
|
268
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
269
|
-
return new Promise((resolve, reject) => {
|
|
270
|
-
this.api
|
|
271
|
-
.get(`${constants_1.Endpoints.PokemonLocationArea.replace(':id', id.toString())}`)
|
|
272
|
-
.then((response) => resolve(response.data))
|
|
273
|
-
.catch((error) => reject(error));
|
|
274
|
-
});
|
|
275
|
-
});
|
|
276
|
-
}
|
|
277
|
-
/**
|
|
278
|
-
* Get a Pokemon Color by it's name
|
|
279
|
-
* @param name The Pokemon Color name
|
|
280
|
-
* @returns A Pokemon Color
|
|
281
|
-
*/
|
|
282
|
-
getPokemonColorByName(name) {
|
|
283
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
284
|
-
return new Promise((resolve, reject) => {
|
|
285
|
-
this.api
|
|
286
|
-
.get(`${constants_1.Endpoints.PokemonColor}/${name}`)
|
|
287
|
-
.then((response) => resolve(response.data))
|
|
288
|
-
.catch((error) => reject(error));
|
|
289
|
-
});
|
|
290
|
-
});
|
|
291
|
-
}
|
|
292
|
-
/**
|
|
293
|
-
* Get a Pokemon Color by it's ID
|
|
294
|
-
* @param id The Pokemon Color ID
|
|
295
|
-
* @returns A Pokemon Color
|
|
296
|
-
*/
|
|
297
|
-
getPokemonColorById(id) {
|
|
298
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
299
|
-
return new Promise((resolve, reject) => {
|
|
300
|
-
this.api
|
|
301
|
-
.get(`${constants_1.Endpoints.PokemonColor}/${id}`)
|
|
302
|
-
.then((response) => resolve(response.data))
|
|
303
|
-
.catch((error) => reject(error));
|
|
304
|
-
});
|
|
305
|
-
});
|
|
306
|
-
}
|
|
307
|
-
/**
|
|
308
|
-
* Get a Pokemon Form by it's name
|
|
309
|
-
* @param name The Pokemon Form name
|
|
310
|
-
* @returns A Pokemon Form
|
|
311
|
-
*/
|
|
312
|
-
getPokemonFormByName(name) {
|
|
313
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
314
|
-
return new Promise((resolve, reject) => {
|
|
315
|
-
this.api
|
|
316
|
-
.get(`${constants_1.Endpoints.PokemonForm}/${name}`)
|
|
317
|
-
.then((response) => resolve(response.data))
|
|
318
|
-
.catch((error) => reject(error));
|
|
319
|
-
});
|
|
320
|
-
});
|
|
321
|
-
}
|
|
322
|
-
/**
|
|
323
|
-
* Get a Pokemon Form by it's ID
|
|
324
|
-
* @param id The Pokemon Form ID
|
|
325
|
-
* @returns A Pokemon Form
|
|
326
|
-
*/
|
|
327
|
-
getPokemonFormById(id) {
|
|
328
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
329
|
-
return new Promise((resolve, reject) => {
|
|
330
|
-
this.api
|
|
331
|
-
.get(`${constants_1.Endpoints.PokemonForm}/${id}`)
|
|
332
|
-
.then((response) => resolve(response.data))
|
|
333
|
-
.catch((error) => reject(error));
|
|
334
|
-
});
|
|
335
|
-
});
|
|
336
|
-
}
|
|
337
|
-
/**
|
|
338
|
-
* Get a Pokemon Habitat by it's name
|
|
339
|
-
* @param name The Pokemon Habitat name
|
|
340
|
-
* @returns A Pokemon Habitat
|
|
341
|
-
*/
|
|
342
|
-
getPokemonHabitatByName(name) {
|
|
343
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
344
|
-
return new Promise((resolve, reject) => {
|
|
345
|
-
this.api
|
|
346
|
-
.get(`${constants_1.Endpoints.PokemonHabitat}/${name}`)
|
|
347
|
-
.then((response) => resolve(response.data))
|
|
348
|
-
.catch((error) => reject(error));
|
|
349
|
-
});
|
|
350
|
-
});
|
|
351
|
-
}
|
|
352
|
-
/**
|
|
353
|
-
* Get a Pokemon Habitat by it's ID
|
|
354
|
-
* @param id The Pokemon Habitat Form ID
|
|
355
|
-
* @returns A Pokemon Habitat
|
|
356
|
-
*/
|
|
357
|
-
getPokemonHabitatById(id) {
|
|
358
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
359
|
-
return new Promise((resolve, reject) => {
|
|
360
|
-
this.api
|
|
361
|
-
.get(`${constants_1.Endpoints.PokemonHabitat}/${id}`)
|
|
362
|
-
.then((response) => resolve(response.data))
|
|
363
|
-
.catch((error) => reject(error));
|
|
364
|
-
});
|
|
365
|
-
});
|
|
366
|
-
}
|
|
367
|
-
/**
|
|
368
|
-
* Get a Pokemon Shape by it's name
|
|
369
|
-
* @param name The Pokemon Shape name
|
|
370
|
-
* @returns A Pokemon Shape
|
|
371
|
-
*/
|
|
372
|
-
getPokemonShapeByName(name) {
|
|
373
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
374
|
-
return new Promise((resolve, reject) => {
|
|
375
|
-
this.api
|
|
376
|
-
.get(`${constants_1.Endpoints.PokemonShape}/${name}`)
|
|
377
|
-
.then((response) => resolve(response.data))
|
|
378
|
-
.catch((error) => reject(error));
|
|
379
|
-
});
|
|
380
|
-
});
|
|
381
|
-
}
|
|
382
|
-
/**
|
|
383
|
-
* Get a Pokemon Shape by it's ID
|
|
384
|
-
* @param id The Pokemon Shape Form ID
|
|
385
|
-
* @returns A Pokemon Shape
|
|
386
|
-
*/
|
|
387
|
-
getPokemonShapeById(id) {
|
|
388
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
389
|
-
return new Promise((resolve, reject) => {
|
|
390
|
-
this.api
|
|
391
|
-
.get(`${constants_1.Endpoints.PokemonShape}/${id}`)
|
|
392
|
-
.then((response) => resolve(response.data))
|
|
393
|
-
.catch((error) => reject(error));
|
|
394
|
-
});
|
|
395
|
-
});
|
|
396
|
-
}
|
|
397
|
-
/**
|
|
398
|
-
* Get a Pokemon Species by it's name
|
|
399
|
-
* @param name The Pokemon Species name
|
|
400
|
-
* @returns A Pokemon Species
|
|
401
|
-
*/
|
|
402
|
-
getPokemonSpeciesByName(name) {
|
|
403
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
404
|
-
return new Promise((resolve, reject) => {
|
|
405
|
-
this.api
|
|
406
|
-
.get(`${constants_1.Endpoints.PokemonSpecies}/${name}`)
|
|
407
|
-
.then((response) => resolve(response.data))
|
|
408
|
-
.catch((error) => reject(error));
|
|
409
|
-
});
|
|
410
|
-
});
|
|
411
|
-
}
|
|
412
|
-
/**
|
|
413
|
-
* Get a Pokemon Species by it's ID
|
|
414
|
-
* @param id The Pokemon Species Form ID
|
|
415
|
-
* @returns A Pokemon Species
|
|
416
|
-
*/
|
|
417
|
-
getPokemonSpeciesById(id) {
|
|
418
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
419
|
-
return new Promise((resolve, reject) => {
|
|
420
|
-
this.api
|
|
421
|
-
.get(`${constants_1.Endpoints.PokemonSpecies}/${id}`)
|
|
422
|
-
.then((response) => resolve(response.data))
|
|
423
|
-
.catch((error) => reject(error));
|
|
424
|
-
});
|
|
425
|
-
});
|
|
426
|
-
}
|
|
427
|
-
/**
|
|
428
|
-
* Get a Stat by it's name
|
|
429
|
-
* @param name The Stat name
|
|
430
|
-
* @returns A Stat
|
|
431
|
-
*/
|
|
432
|
-
getStatByName(name) {
|
|
433
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
434
|
-
return new Promise((resolve, reject) => {
|
|
435
|
-
this.api
|
|
436
|
-
.get(`${constants_1.Endpoints.Stat}/${name}`)
|
|
437
|
-
.then((response) => resolve(response.data))
|
|
438
|
-
.catch((error) => reject(error));
|
|
439
|
-
});
|
|
440
|
-
});
|
|
441
|
-
}
|
|
442
|
-
/**
|
|
443
|
-
* Get a Stat by it's ID
|
|
444
|
-
* @param id The Stat ID
|
|
445
|
-
* @returns A Stat
|
|
446
|
-
*/
|
|
447
|
-
getStatById(id) {
|
|
448
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
449
|
-
return new Promise((resolve, reject) => {
|
|
450
|
-
this.api
|
|
451
|
-
.get(`${constants_1.Endpoints.Stat}/${id}`)
|
|
452
|
-
.then((response) => resolve(response.data))
|
|
453
|
-
.catch((error) => reject(error));
|
|
454
|
-
});
|
|
455
|
-
});
|
|
456
|
-
}
|
|
457
|
-
/**
|
|
458
|
-
* Get a Type by it's name
|
|
459
|
-
* @param name The Type name
|
|
460
|
-
* @returns A Type
|
|
461
|
-
*/
|
|
462
|
-
getTypeByName(name) {
|
|
463
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
464
|
-
return new Promise((resolve, reject) => {
|
|
465
|
-
this.api
|
|
466
|
-
.get(`${constants_1.Endpoints.Type}/${name}`)
|
|
467
|
-
.then((response) => resolve(response.data))
|
|
468
|
-
.catch((error) => reject(error));
|
|
469
|
-
});
|
|
470
|
-
});
|
|
471
|
-
}
|
|
472
|
-
/**
|
|
473
|
-
* Get a Type by it's ID
|
|
474
|
-
* @param id The Type ID
|
|
475
|
-
* @returns A Type
|
|
476
|
-
*/
|
|
477
|
-
getTypeById(id) {
|
|
478
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
479
|
-
return new Promise((resolve, reject) => {
|
|
480
|
-
this.api
|
|
481
|
-
.get(`${constants_1.Endpoints.Type}/${id}`)
|
|
482
|
-
.then((response) => resolve(response.data))
|
|
483
|
-
.catch((error) => reject(error));
|
|
484
|
-
});
|
|
485
|
-
});
|
|
486
|
-
}
|
|
487
|
-
/**
|
|
488
|
-
* List Abilities
|
|
489
|
-
* @param offset The first item that you will get
|
|
490
|
-
* @param limit How many Abilities per page
|
|
491
|
-
* @returns A list of Abilities
|
|
492
|
-
*/
|
|
493
|
-
listAbilities(offset, limit) {
|
|
494
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
495
|
-
return new Promise((resolve, reject) => {
|
|
496
|
-
this.api
|
|
497
|
-
.get(`${constants_1.Endpoints.Ability}?offset=${offset || 0}&limit=${limit || 20}`)
|
|
498
|
-
.then((response) => resolve(response.data))
|
|
499
|
-
.catch((error) => reject(error));
|
|
500
|
-
});
|
|
501
|
-
});
|
|
502
|
-
}
|
|
503
|
-
/**
|
|
504
|
-
* List Characteristics
|
|
505
|
-
* @param offset The first item that you will get
|
|
506
|
-
* @param limit How many Characteristics per page
|
|
507
|
-
* @returns A list of Characteristics
|
|
508
|
-
*/
|
|
509
|
-
listCharacteristics(offset, limit) {
|
|
510
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
511
|
-
return new Promise((resolve, reject) => {
|
|
512
|
-
this.api
|
|
513
|
-
.get(`${constants_1.Endpoints.Characteristic}?offset=${offset || 0}&limit=${limit || 20}`)
|
|
514
|
-
.then((response) => resolve(response.data))
|
|
515
|
-
.catch((error) => reject(error));
|
|
516
|
-
});
|
|
517
|
-
});
|
|
518
|
-
}
|
|
519
|
-
/**
|
|
520
|
-
* List Egg Groups
|
|
521
|
-
* @param offset The first item that you will get
|
|
522
|
-
* @param limit How many Egg Groups per page
|
|
523
|
-
* @returns A list of Egg Groups
|
|
524
|
-
*/
|
|
525
|
-
listEggGroups(offset, limit) {
|
|
526
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
527
|
-
return new Promise((resolve, reject) => {
|
|
528
|
-
this.api
|
|
529
|
-
.get(`${constants_1.Endpoints.EggGroup}?offset=${offset || 0}&limit=${limit || 20}`)
|
|
530
|
-
.then((response) => resolve(response.data))
|
|
531
|
-
.catch((error) => reject(error));
|
|
532
|
-
});
|
|
533
|
-
});
|
|
534
|
-
}
|
|
535
|
-
/**
|
|
536
|
-
* List Genders
|
|
537
|
-
* @param offset The first item that you will get
|
|
538
|
-
* @param limit How many Genders per page
|
|
539
|
-
* @returns A list of Genders
|
|
540
|
-
*/
|
|
541
|
-
listGenders(offset, limit) {
|
|
542
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
543
|
-
return new Promise((resolve, reject) => {
|
|
544
|
-
this.api
|
|
545
|
-
.get(`${constants_1.Endpoints.Gender}?offset=${offset || 0}&limit=${limit || 20}`)
|
|
546
|
-
.then((response) => resolve(response.data))
|
|
547
|
-
.catch((error) => reject(error));
|
|
548
|
-
});
|
|
549
|
-
});
|
|
550
|
-
}
|
|
551
|
-
/**
|
|
552
|
-
* List Growth Rates
|
|
553
|
-
* @param offset The first item that you will get
|
|
554
|
-
* @param limit How many Growth Rates per page
|
|
555
|
-
* @returns A list of Growth Rates
|
|
556
|
-
*/
|
|
557
|
-
listGrowthRates(offset, limit) {
|
|
558
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
559
|
-
return new Promise((resolve, reject) => {
|
|
560
|
-
this.api
|
|
561
|
-
.get(`${constants_1.Endpoints.GrowthRate}?offset=${offset || 0}&limit=${limit || 20}`)
|
|
562
|
-
.then((response) => resolve(response.data))
|
|
563
|
-
.catch((error) => reject(error));
|
|
564
|
-
});
|
|
565
|
-
});
|
|
566
|
-
}
|
|
567
|
-
/**
|
|
568
|
-
* List Natures
|
|
569
|
-
* @param offset The first item that you will get
|
|
570
|
-
* @param limit How many Growth Natures per page
|
|
571
|
-
* @returns A list of Natures
|
|
572
|
-
*/
|
|
573
|
-
listNatures(offset, limit) {
|
|
574
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
575
|
-
return new Promise((resolve, reject) => {
|
|
576
|
-
this.api
|
|
577
|
-
.get(`${constants_1.Endpoints.Nature}?offset=${offset || 0}&limit=${limit || 20}`)
|
|
578
|
-
.then((response) => resolve(response.data))
|
|
579
|
-
.catch((error) => reject(error));
|
|
580
|
-
});
|
|
581
|
-
});
|
|
582
|
-
}
|
|
583
|
-
/**
|
|
584
|
-
* List Pokeathlon Stats
|
|
585
|
-
* @param offset The first item that you will get
|
|
586
|
-
* @param limit How many Pokeathlon Stats per page
|
|
587
|
-
* @returns A list of Pokeathlon Stats
|
|
588
|
-
*/
|
|
589
|
-
listPokeathlonStats(offset, limit) {
|
|
590
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
591
|
-
return new Promise((resolve, reject) => {
|
|
592
|
-
this.api
|
|
593
|
-
.get(`${constants_1.Endpoints.PokeathlonStat}?offset=${offset || 0}&limit=${limit || 20}`)
|
|
594
|
-
.then((response) => resolve(response.data))
|
|
595
|
-
.catch((error) => reject(error));
|
|
596
|
-
});
|
|
597
|
-
});
|
|
598
|
-
}
|
|
599
|
-
/**
|
|
600
|
-
* List Pokemons
|
|
601
|
-
* @param offset The first item that you will get
|
|
602
|
-
* @param limit How many Pokemons Stats per page
|
|
603
|
-
* @returns A list of Pokemons
|
|
604
|
-
*/
|
|
605
|
-
listPokemons(offset, limit) {
|
|
606
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
607
|
-
return new Promise((resolve, reject) => {
|
|
608
|
-
this.api
|
|
609
|
-
.get(`${constants_1.Endpoints.Pokemon}?offset=${offset || 0}&limit=${limit || 20}`)
|
|
610
|
-
.then((response) => resolve(response.data))
|
|
611
|
-
.catch((error) => reject(error));
|
|
612
|
-
});
|
|
613
|
-
});
|
|
614
|
-
}
|
|
615
|
-
/**
|
|
616
|
-
* List Pokemon Colors
|
|
617
|
-
* @param offset The first item that you will get
|
|
618
|
-
* @param limit How many Pokemon Colors per page
|
|
619
|
-
* @returns A list of Pokemon Colors
|
|
620
|
-
*/
|
|
621
|
-
listPokemonColors(offset, limit) {
|
|
622
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
623
|
-
return new Promise((resolve, reject) => {
|
|
624
|
-
this.api
|
|
625
|
-
.get(`${constants_1.Endpoints.PokemonColor}?offset=${offset || 0}&limit=${limit || 20}`)
|
|
626
|
-
.then((response) => resolve(response.data))
|
|
627
|
-
.catch((error) => reject(error));
|
|
628
|
-
});
|
|
629
|
-
});
|
|
630
|
-
}
|
|
631
|
-
/**
|
|
632
|
-
* List Pokemon Forms
|
|
633
|
-
* @param offset The first item that you will get
|
|
634
|
-
* @param limit How many Pokemon Forms per page
|
|
635
|
-
* @returns A list of Pokemon Forms
|
|
636
|
-
*/
|
|
637
|
-
listPokemonForms(offset, limit) {
|
|
638
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
639
|
-
return new Promise((resolve, reject) => {
|
|
640
|
-
this.api
|
|
641
|
-
.get(`${constants_1.Endpoints.PokemonForm}?offset=${offset || 0}&limit=${limit || 20}`)
|
|
642
|
-
.then((response) => resolve(response.data))
|
|
643
|
-
.catch((error) => reject(error));
|
|
644
|
-
});
|
|
645
|
-
});
|
|
646
|
-
}
|
|
647
|
-
/**
|
|
648
|
-
* List Pokemon Habitats
|
|
649
|
-
* @param offset The first item that you will get
|
|
650
|
-
* @param limit How many Pokemon Habitats per page
|
|
651
|
-
* @returns A list of Pokemon Habitats
|
|
652
|
-
*/
|
|
653
|
-
listPokemonHabitats(offset, limit) {
|
|
654
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
655
|
-
return new Promise((resolve, reject) => {
|
|
656
|
-
this.api
|
|
657
|
-
.get(`${constants_1.Endpoints.PokemonHabitat}?offset=${offset || 0}&limit=${limit || 20}`)
|
|
658
|
-
.then((response) => resolve(response.data))
|
|
659
|
-
.catch((error) => reject(error));
|
|
660
|
-
});
|
|
661
|
-
});
|
|
662
|
-
}
|
|
663
|
-
/**
|
|
664
|
-
* List Pokemon Shapes
|
|
665
|
-
* @param offset The first item that you will get
|
|
666
|
-
* @param limit How many Pokemon Shapes per page
|
|
667
|
-
* @returns A list of Pokemon Shapes
|
|
668
|
-
*/
|
|
669
|
-
listPokemonShapes(offset, limit) {
|
|
670
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
671
|
-
return new Promise((resolve, reject) => {
|
|
672
|
-
this.api
|
|
673
|
-
.get(`${constants_1.Endpoints.PokemonShape}?offset=${offset || 0}&limit=${limit || 20}`)
|
|
674
|
-
.then((response) => resolve(response.data))
|
|
675
|
-
.catch((error) => reject(error));
|
|
676
|
-
});
|
|
677
|
-
});
|
|
678
|
-
}
|
|
679
|
-
/**
|
|
680
|
-
* List Pokemon Species
|
|
681
|
-
* @param offset The first item that you will get
|
|
682
|
-
* @param limit How many Pokemon Species per page
|
|
683
|
-
* @returns A list of Pokemon Species
|
|
684
|
-
*/
|
|
685
|
-
listPokemonSpecies(offset, limit) {
|
|
686
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
687
|
-
return new Promise((resolve, reject) => {
|
|
688
|
-
this.api
|
|
689
|
-
.get(`${constants_1.Endpoints.PokemonSpecies}?offset=${offset || 0}&limit=${limit || 20}`)
|
|
690
|
-
.then((response) => resolve(response.data))
|
|
691
|
-
.catch((error) => reject(error));
|
|
692
|
-
});
|
|
693
|
-
});
|
|
694
|
-
}
|
|
695
|
-
/**
|
|
696
|
-
* List Stats
|
|
697
|
-
* @param offset The first item that you will get
|
|
698
|
-
* @param limit How many Stats per page
|
|
699
|
-
* @returns A list of Stats
|
|
700
|
-
*/
|
|
701
|
-
listStats(offset, limit) {
|
|
702
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
703
|
-
return new Promise((resolve, reject) => {
|
|
704
|
-
this.api
|
|
705
|
-
.get(`${constants_1.Endpoints.Stat}?offset=${offset || 0}&limit=${limit || 20}`)
|
|
706
|
-
.then((response) => resolve(response.data))
|
|
707
|
-
.catch((error) => reject(error));
|
|
708
|
-
});
|
|
709
|
-
});
|
|
710
|
-
}
|
|
711
|
-
/**
|
|
712
|
-
* List Types
|
|
713
|
-
* @param offset The first item that you will get
|
|
714
|
-
* @param limit How many Types per page
|
|
715
|
-
* @returns A list of Types
|
|
716
|
-
*/
|
|
717
|
-
listTypes(offset, limit) {
|
|
718
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
719
|
-
return new Promise((resolve, reject) => {
|
|
720
|
-
this.api
|
|
721
|
-
.get(`${constants_1.Endpoints.Type}?offset=${offset || 0}&limit=${limit || 20}`)
|
|
722
|
-
.then((response) => resolve(response.data))
|
|
723
|
-
.catch((error) => reject(error));
|
|
724
|
-
});
|
|
725
|
-
});
|
|
726
|
-
}
|
|
727
|
-
}
|
|
728
|
-
exports.PokemonClient = PokemonClient;
|