pokenode-ts 1.17.0 → 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 -7
- 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,351 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MoveClient = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const constants_1 = require("../constants");
|
|
6
|
-
const base_1 = require("../structures/base");
|
|
7
|
-
/**
|
|
8
|
-
* ### Move Client
|
|
9
|
-
*
|
|
10
|
-
* Client used to access the Move Endpoints:
|
|
11
|
-
* - [Moves](https://pokeapi.co/docs/v2#moves)
|
|
12
|
-
* - [Move Ailments](https://pokeapi.co/docs/v2#move-ailments)
|
|
13
|
-
* - [Move Battle Styles](https://pokeapi.co/docs/v2#move-battle-styles)
|
|
14
|
-
* - [Move Categories](https://pokeapi.co/docs/v2#move-categories)
|
|
15
|
-
* - [Move Damage Classes](https://pokeapi.co/docs/v2#move-damage-classes)
|
|
16
|
-
* - [Move Learn Methods](https://pokeapi.co/docs/v2#move-learn-methods)
|
|
17
|
-
* - [Move Move Targets](https://pokeapi.co/docs/v2#move-targets)
|
|
18
|
-
* ---
|
|
19
|
-
* See [PokéAPI Documentation](https://pokeapi.co/docs/v2#moves-section)
|
|
20
|
-
*/
|
|
21
|
-
class MoveClient extends base_1.BaseClient {
|
|
22
|
-
/**
|
|
23
|
-
* @argument clientOptions Options for the client.
|
|
24
|
-
*/
|
|
25
|
-
constructor(clientOptions) {
|
|
26
|
-
super(clientOptions);
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Get a Move by it's name
|
|
30
|
-
* @param name The move name
|
|
31
|
-
* @returns A Move
|
|
32
|
-
*/
|
|
33
|
-
getMoveByName(name) {
|
|
34
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
35
|
-
return new Promise((resolve, reject) => {
|
|
36
|
-
this.api
|
|
37
|
-
.get(`${constants_1.Endpoints.Move}/${name}`)
|
|
38
|
-
.then((response) => resolve(response.data))
|
|
39
|
-
.catch((error) => reject(error));
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Get a Move by it's ID
|
|
45
|
-
* @param id The Move ID
|
|
46
|
-
* @returns A Move
|
|
47
|
-
*/
|
|
48
|
-
getMoveById(id) {
|
|
49
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
50
|
-
return new Promise((resolve, reject) => {
|
|
51
|
-
this.api
|
|
52
|
-
.get(`${constants_1.Endpoints.Move}/${id}`)
|
|
53
|
-
.then((response) => resolve(response.data))
|
|
54
|
-
.catch((error) => reject(error));
|
|
55
|
-
});
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Get a Move Ailment by it's name
|
|
60
|
-
* @param name The Move Ailment name
|
|
61
|
-
* @returns A Move Ailment
|
|
62
|
-
*/
|
|
63
|
-
getMoveAilmentByName(name) {
|
|
64
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
65
|
-
return new Promise((resolve, reject) => {
|
|
66
|
-
this.api
|
|
67
|
-
.get(`${constants_1.Endpoints.MoveAilment}/${name}`)
|
|
68
|
-
.then((response) => resolve(response.data))
|
|
69
|
-
.catch((error) => reject(error));
|
|
70
|
-
});
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* Get a Move Ailment by it's ID
|
|
75
|
-
* @param id The Move Ailment ID
|
|
76
|
-
* @returns A Move Ailment
|
|
77
|
-
*/
|
|
78
|
-
getMoveAilmentById(id) {
|
|
79
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
80
|
-
return new Promise((resolve, reject) => {
|
|
81
|
-
this.api
|
|
82
|
-
.get(`${constants_1.Endpoints.MoveAilment}/${id}`)
|
|
83
|
-
.then((response) => resolve(response.data))
|
|
84
|
-
.catch((error) => reject(error));
|
|
85
|
-
});
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Get a Move Battle Style by it's name
|
|
90
|
-
* @param name The Move Battle Style name
|
|
91
|
-
* @returns A Move Battle Style
|
|
92
|
-
*/
|
|
93
|
-
getMoveBattleStyleByName(name) {
|
|
94
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
95
|
-
return new Promise((resolve, reject) => {
|
|
96
|
-
this.api
|
|
97
|
-
.get(`${constants_1.Endpoints.MoveBattleStyle}/${name}`)
|
|
98
|
-
.then((response) => resolve(response.data))
|
|
99
|
-
.catch((error) => reject(error));
|
|
100
|
-
});
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Get a Move Battle Style by it's ID
|
|
105
|
-
* @param id The Move Battle Style ID
|
|
106
|
-
* @returns A Move Battle Style
|
|
107
|
-
*/
|
|
108
|
-
getMoveBattleStyleById(id) {
|
|
109
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
110
|
-
return new Promise((resolve, reject) => {
|
|
111
|
-
this.api
|
|
112
|
-
.get(`${constants_1.Endpoints.MoveBattleStyle}/${id}`)
|
|
113
|
-
.then((response) => resolve(response.data))
|
|
114
|
-
.catch((error) => reject(error));
|
|
115
|
-
});
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* Get a Move Battle Category by it's name
|
|
120
|
-
* @param name The Move Category name
|
|
121
|
-
* @returns A Move Category
|
|
122
|
-
*/
|
|
123
|
-
getMoveCategoryByName(name) {
|
|
124
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
125
|
-
return new Promise((resolve, reject) => {
|
|
126
|
-
this.api
|
|
127
|
-
.get(`${constants_1.Endpoints.MoveCategory}/${name}`)
|
|
128
|
-
.then((response) => resolve(response.data))
|
|
129
|
-
.catch((error) => reject(error));
|
|
130
|
-
});
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
/**
|
|
134
|
-
* Get a Move Battle Category by it's ID
|
|
135
|
-
* @param id The Move Category ID
|
|
136
|
-
* @returns A Move Category
|
|
137
|
-
*/
|
|
138
|
-
getMoveCategoryById(id) {
|
|
139
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
140
|
-
return new Promise((resolve, reject) => {
|
|
141
|
-
this.api
|
|
142
|
-
.get(`${constants_1.Endpoints.MoveCategory}/${id}`)
|
|
143
|
-
.then((response) => resolve(response.data))
|
|
144
|
-
.catch((error) => reject(error));
|
|
145
|
-
});
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
/**
|
|
149
|
-
* Get a Move Damage Class by it's name
|
|
150
|
-
* @param name The Move Damage Class name
|
|
151
|
-
* @returns A Move Damage Class
|
|
152
|
-
*/
|
|
153
|
-
getMoveDamageClassByName(name) {
|
|
154
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
155
|
-
return new Promise((resolve, reject) => {
|
|
156
|
-
this.api
|
|
157
|
-
.get(`${constants_1.Endpoints.MoveDamageClass}/${name}`)
|
|
158
|
-
.then((response) => resolve(response.data))
|
|
159
|
-
.catch((error) => reject(error));
|
|
160
|
-
});
|
|
161
|
-
});
|
|
162
|
-
}
|
|
163
|
-
/**
|
|
164
|
-
* Get a Move Damage Class by it's ID
|
|
165
|
-
* @param id The Move Damage Class ID
|
|
166
|
-
* @returns A Move Damage Class
|
|
167
|
-
*/
|
|
168
|
-
getMoveDamageClassById(id) {
|
|
169
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
170
|
-
return new Promise((resolve, reject) => {
|
|
171
|
-
this.api
|
|
172
|
-
.get(`${constants_1.Endpoints.MoveDamageClass}/${id}`)
|
|
173
|
-
.then((response) => resolve(response.data))
|
|
174
|
-
.catch((error) => reject(error));
|
|
175
|
-
});
|
|
176
|
-
});
|
|
177
|
-
}
|
|
178
|
-
/**
|
|
179
|
-
* Get a Move Learn Method by it's name
|
|
180
|
-
* @param name The Move Learn Method name
|
|
181
|
-
* @returns A Move Learn Method
|
|
182
|
-
*/
|
|
183
|
-
getMoveLearnMethodByName(name) {
|
|
184
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
185
|
-
return new Promise((resolve, reject) => {
|
|
186
|
-
this.api
|
|
187
|
-
.get(`${constants_1.Endpoints.MoveLearnMethod}/${name}`)
|
|
188
|
-
.then((response) => resolve(response.data))
|
|
189
|
-
.catch((error) => reject(error));
|
|
190
|
-
});
|
|
191
|
-
});
|
|
192
|
-
}
|
|
193
|
-
/**
|
|
194
|
-
* Get a Move Learn Method by it's ID
|
|
195
|
-
* @param id The Move Learn Method ID
|
|
196
|
-
* @returns A Move Learn Method
|
|
197
|
-
*/
|
|
198
|
-
getMoveLearnMethodById(id) {
|
|
199
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
200
|
-
return new Promise((resolve, reject) => {
|
|
201
|
-
this.api
|
|
202
|
-
.get(`${constants_1.Endpoints.MoveLearnMethod}/${id}`)
|
|
203
|
-
.then((response) => resolve(response.data))
|
|
204
|
-
.catch((error) => reject(error));
|
|
205
|
-
});
|
|
206
|
-
});
|
|
207
|
-
}
|
|
208
|
-
/**
|
|
209
|
-
* Get a Move Target by it's name
|
|
210
|
-
* @param name The Move Target name
|
|
211
|
-
* @returns A Move Target
|
|
212
|
-
*/
|
|
213
|
-
getMoveTargetByName(name) {
|
|
214
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
215
|
-
return new Promise((resolve, reject) => {
|
|
216
|
-
this.api
|
|
217
|
-
.get(`${constants_1.Endpoints.MoveTarget}/${name}`)
|
|
218
|
-
.then((response) => resolve(response.data))
|
|
219
|
-
.catch((error) => reject(error));
|
|
220
|
-
});
|
|
221
|
-
});
|
|
222
|
-
}
|
|
223
|
-
/**
|
|
224
|
-
* Get a Move Target by it's ID
|
|
225
|
-
* @param id The Move Target ID
|
|
226
|
-
* @returns A Move Target
|
|
227
|
-
*/
|
|
228
|
-
getMoveTargetById(id) {
|
|
229
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
230
|
-
return new Promise((resolve, reject) => {
|
|
231
|
-
this.api
|
|
232
|
-
.get(`${constants_1.Endpoints.MoveTarget}/${id}`)
|
|
233
|
-
.then((response) => resolve(response.data))
|
|
234
|
-
.catch((error) => reject(error));
|
|
235
|
-
});
|
|
236
|
-
});
|
|
237
|
-
}
|
|
238
|
-
/**
|
|
239
|
-
* List Moves
|
|
240
|
-
* @param offset The first item that you will get
|
|
241
|
-
* @param limit How many Moves per page
|
|
242
|
-
* @returns A list of Moves
|
|
243
|
-
*/
|
|
244
|
-
listMoves(offset, limit) {
|
|
245
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
246
|
-
return new Promise((resolve, reject) => {
|
|
247
|
-
this.api
|
|
248
|
-
.get(`${constants_1.Endpoints.Move}?offset=${offset || 0}&limit=${limit || 20}`)
|
|
249
|
-
.then((response) => resolve(response.data))
|
|
250
|
-
.catch((error) => reject(error));
|
|
251
|
-
});
|
|
252
|
-
});
|
|
253
|
-
}
|
|
254
|
-
/**
|
|
255
|
-
* List Move Ailments
|
|
256
|
-
* @param offset The first item that you will get
|
|
257
|
-
* @param limit How many Move Ailments per page
|
|
258
|
-
* @returns A list of Move Ailments
|
|
259
|
-
*/
|
|
260
|
-
listMoveAilments(offset, limit) {
|
|
261
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
262
|
-
return new Promise((resolve, reject) => {
|
|
263
|
-
this.api
|
|
264
|
-
.get(`${constants_1.Endpoints.MoveAilment}?offset=${offset || 0}&limit=${limit || 20}`)
|
|
265
|
-
.then((response) => resolve(response.data))
|
|
266
|
-
.catch((error) => reject(error));
|
|
267
|
-
});
|
|
268
|
-
});
|
|
269
|
-
}
|
|
270
|
-
/**
|
|
271
|
-
* List Move Battle Styles
|
|
272
|
-
* @param offset The first item that you will get
|
|
273
|
-
* @param limit How many Move Battle Styles per page
|
|
274
|
-
* @returns A list of Move Battle Styles
|
|
275
|
-
*/
|
|
276
|
-
listMoveBattleStyles(offset, limit) {
|
|
277
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
278
|
-
return new Promise((resolve, reject) => {
|
|
279
|
-
this.api
|
|
280
|
-
.get(`${constants_1.Endpoints.MoveBattleStyle}?offset=${offset || 0}&limit=${limit || 20}`)
|
|
281
|
-
.then((response) => resolve(response.data))
|
|
282
|
-
.catch((error) => reject(error));
|
|
283
|
-
});
|
|
284
|
-
});
|
|
285
|
-
}
|
|
286
|
-
/**
|
|
287
|
-
* List Move Categories
|
|
288
|
-
* @param offset The first item that you will get
|
|
289
|
-
* @param limit How many Move Categories per page
|
|
290
|
-
* @returns A list of Move Categories
|
|
291
|
-
*/
|
|
292
|
-
listMoveCategories(offset, limit) {
|
|
293
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
294
|
-
return new Promise((resolve, reject) => {
|
|
295
|
-
this.api
|
|
296
|
-
.get(`${constants_1.Endpoints.MoveCategory}?offset=${offset || 0}&limit=${limit || 20}`)
|
|
297
|
-
.then((response) => resolve(response.data))
|
|
298
|
-
.catch((error) => reject(error));
|
|
299
|
-
});
|
|
300
|
-
});
|
|
301
|
-
}
|
|
302
|
-
/**
|
|
303
|
-
* List Move Damage Classes
|
|
304
|
-
* @param offset The first item that you will get
|
|
305
|
-
* @param limit How many Move Damage Classes per page
|
|
306
|
-
* @returns A list of Move Damage Classes
|
|
307
|
-
*/
|
|
308
|
-
listMoveDamageClasses(offset, limit) {
|
|
309
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
310
|
-
return new Promise((resolve, reject) => {
|
|
311
|
-
this.api
|
|
312
|
-
.get(`${constants_1.Endpoints.MoveDamageClass}?offset=${offset || 0}&limit=${limit || 20}`)
|
|
313
|
-
.then((response) => resolve(response.data))
|
|
314
|
-
.catch((error) => reject(error));
|
|
315
|
-
});
|
|
316
|
-
});
|
|
317
|
-
}
|
|
318
|
-
/**
|
|
319
|
-
* List Move Learn Methods
|
|
320
|
-
* @param offset The first item that you will get
|
|
321
|
-
* @param limit How many Move Learn Methods per page
|
|
322
|
-
* @returns A list of Move Learn Methods
|
|
323
|
-
*/
|
|
324
|
-
listMoveLearnMethods(offset, limit) {
|
|
325
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
326
|
-
return new Promise((resolve, reject) => {
|
|
327
|
-
this.api
|
|
328
|
-
.get(`${constants_1.Endpoints.MoveLearnMethod}?offset=${offset || 0}&limit=${limit || 20}`)
|
|
329
|
-
.then((response) => resolve(response.data))
|
|
330
|
-
.catch((error) => reject(error));
|
|
331
|
-
});
|
|
332
|
-
});
|
|
333
|
-
}
|
|
334
|
-
/**
|
|
335
|
-
* List Move Targets
|
|
336
|
-
* @param offset The first item that you will get
|
|
337
|
-
* @param limit How many Move Targets per page
|
|
338
|
-
* @returns A list of Move Targets
|
|
339
|
-
*/
|
|
340
|
-
listMoveTargets(offset, limit) {
|
|
341
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
342
|
-
return new Promise((resolve, reject) => {
|
|
343
|
-
this.api
|
|
344
|
-
.get(`${constants_1.Endpoints.MoveTarget}?offset=${offset || 0}&limit=${limit || 20}`)
|
|
345
|
-
.then((response) => resolve(response.data))
|
|
346
|
-
.catch((error) => reject(error));
|
|
347
|
-
});
|
|
348
|
-
});
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
exports.MoveClient = MoveClient;
|