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,257 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ItemClient = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const endpoints_1 = require("../constants/endpoints");
|
|
6
|
-
const base_1 = require("../structures/base");
|
|
7
|
-
/**
|
|
8
|
-
* ### Item Client
|
|
9
|
-
*
|
|
10
|
-
* Client used to access the Item Endpoints:
|
|
11
|
-
* - [Item](https://pokeapi.co/docs/v2#item)
|
|
12
|
-
* - [Item Attributes](https://pokeapi.co/docs/v2#item-attributes)
|
|
13
|
-
* - [Item Categories](https://pokeapi.co/docs/v2#item-categories)
|
|
14
|
-
* - [Item Filing Effects](https://pokeapi.co/docs/v2#item-fling-effects)
|
|
15
|
-
* - [Item Pockets](https://pokeapi.co/docs/v2#item-pockets)
|
|
16
|
-
* ---
|
|
17
|
-
* See [PokéAPI Documentation](https://pokeapi.co/docs/v2#items-section)
|
|
18
|
-
*/
|
|
19
|
-
class ItemClient extends base_1.BaseClient {
|
|
20
|
-
/**
|
|
21
|
-
* @argument clientOptions Options for the client.
|
|
22
|
-
*/
|
|
23
|
-
constructor(clientOptions) {
|
|
24
|
-
super(clientOptions);
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Get an Item by it's name
|
|
28
|
-
* @param name The item name
|
|
29
|
-
* @returns An Item
|
|
30
|
-
*/
|
|
31
|
-
getItemByName(name) {
|
|
32
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
33
|
-
return new Promise((resolve, reject) => {
|
|
34
|
-
this.api
|
|
35
|
-
.get(`${endpoints_1.Endpoints.Item}/${name}`)
|
|
36
|
-
.then((response) => resolve(response.data))
|
|
37
|
-
.catch((error) => reject(error));
|
|
38
|
-
});
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Get an Item by it's ID
|
|
43
|
-
* @param id The item ID
|
|
44
|
-
* @returns An Item
|
|
45
|
-
*/
|
|
46
|
-
getItemById(id) {
|
|
47
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
48
|
-
return new Promise((resolve, reject) => {
|
|
49
|
-
this.api
|
|
50
|
-
.get(`${endpoints_1.Endpoints.Item}/${id}`)
|
|
51
|
-
.then((response) => resolve(response.data))
|
|
52
|
-
.catch((error) => reject(error));
|
|
53
|
-
});
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Get an Item Attribute by it's name
|
|
58
|
-
* @param name The item attribute name
|
|
59
|
-
* @returns An Item Attribute
|
|
60
|
-
*/
|
|
61
|
-
getItemAttributeByName(name) {
|
|
62
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
63
|
-
return new Promise((resolve, reject) => {
|
|
64
|
-
this.api
|
|
65
|
-
.get(`${endpoints_1.Endpoints.ItemAttribute}/${name}`)
|
|
66
|
-
.then((response) => resolve(response.data))
|
|
67
|
-
.catch((error) => reject(error));
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Get an Item Attribute by it's ID
|
|
73
|
-
* @param id The item attribute ID
|
|
74
|
-
* @returns An Item Attribute
|
|
75
|
-
*/
|
|
76
|
-
getItemAttributeById(id) {
|
|
77
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
78
|
-
return new Promise((resolve, reject) => {
|
|
79
|
-
this.api
|
|
80
|
-
.get(`${endpoints_1.Endpoints.ItemAttribute}/${id}`)
|
|
81
|
-
.then((response) => resolve(response.data))
|
|
82
|
-
.catch((error) => reject(error));
|
|
83
|
-
});
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Get an Item Category by it's name
|
|
88
|
-
* @param name The item category name
|
|
89
|
-
* @returns An Item Category
|
|
90
|
-
*/
|
|
91
|
-
getItemCategoryByName(name) {
|
|
92
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
93
|
-
return new Promise((resolve, reject) => {
|
|
94
|
-
this.api
|
|
95
|
-
.get(`${endpoints_1.Endpoints.ItemCategory}/${name}`)
|
|
96
|
-
.then((response) => resolve(response.data))
|
|
97
|
-
.catch((error) => reject(error));
|
|
98
|
-
});
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* Get an Item Category by it's ID
|
|
103
|
-
* @param id The item category ID
|
|
104
|
-
* @returns An Item Category
|
|
105
|
-
*/
|
|
106
|
-
getItemCategoryById(id) {
|
|
107
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
108
|
-
return new Promise((resolve, reject) => {
|
|
109
|
-
this.api
|
|
110
|
-
.get(`${endpoints_1.Endpoints.ItemCategory}/${id}`)
|
|
111
|
-
.then((response) => resolve(response.data))
|
|
112
|
-
.catch((error) => reject(error));
|
|
113
|
-
});
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* Get an Item Filing Effect by it's name
|
|
118
|
-
* @param name The item filing effect name
|
|
119
|
-
* @returns An Item Filing Effect
|
|
120
|
-
*/
|
|
121
|
-
getItemFlingEffectByName(name) {
|
|
122
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
123
|
-
return new Promise((resolve, reject) => {
|
|
124
|
-
this.api
|
|
125
|
-
.get(`${endpoints_1.Endpoints.ItemFlingEffect}/${name}`)
|
|
126
|
-
.then((response) => resolve(response.data))
|
|
127
|
-
.catch((error) => reject(error));
|
|
128
|
-
});
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
* Get an Item Filing Effect by it's ID
|
|
133
|
-
* @param id The item filing effect ID
|
|
134
|
-
* @returns An Item Filing Effect
|
|
135
|
-
*/
|
|
136
|
-
getItemFlingEffectById(id) {
|
|
137
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
138
|
-
return new Promise((resolve, reject) => {
|
|
139
|
-
this.api
|
|
140
|
-
.get(`${endpoints_1.Endpoints.ItemFlingEffect}/${id}`)
|
|
141
|
-
.then((response) => resolve(response.data))
|
|
142
|
-
.catch((error) => reject(error));
|
|
143
|
-
});
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
/**
|
|
147
|
-
* Get an Item Pocket by it's name
|
|
148
|
-
* @param name The item pocket name
|
|
149
|
-
* @returns An Item Pocket
|
|
150
|
-
*/
|
|
151
|
-
getItemPocketByName(name) {
|
|
152
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
153
|
-
return new Promise((resolve, reject) => {
|
|
154
|
-
this.api
|
|
155
|
-
.get(`${endpoints_1.Endpoints.ItemPocket}/${name}`)
|
|
156
|
-
.then((response) => resolve(response.data))
|
|
157
|
-
.catch((error) => reject(error));
|
|
158
|
-
});
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
|
-
/**
|
|
162
|
-
* Get an Item Pocket by it's ID
|
|
163
|
-
* @param id The item pocket ID
|
|
164
|
-
* @returns An Item Pocket
|
|
165
|
-
*/
|
|
166
|
-
getItemPocketById(id) {
|
|
167
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
168
|
-
return new Promise((resolve, reject) => {
|
|
169
|
-
this.api
|
|
170
|
-
.get(`${endpoints_1.Endpoints.ItemPocket}/${id}`)
|
|
171
|
-
.then((response) => resolve(response.data))
|
|
172
|
-
.catch((error) => reject(error));
|
|
173
|
-
});
|
|
174
|
-
});
|
|
175
|
-
}
|
|
176
|
-
/**
|
|
177
|
-
* List Items
|
|
178
|
-
* @param offset The first item that you will get
|
|
179
|
-
* @param limit How many Items per page
|
|
180
|
-
* @returns A list of Items
|
|
181
|
-
*/
|
|
182
|
-
listItems(offset, limit) {
|
|
183
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
184
|
-
return new Promise((resolve, reject) => {
|
|
185
|
-
this.api
|
|
186
|
-
.get(`${endpoints_1.Endpoints.Item}?offset=${offset || 0}&limit=${limit || 20}`)
|
|
187
|
-
.then((response) => resolve(response.data))
|
|
188
|
-
.catch((error) => reject(error));
|
|
189
|
-
});
|
|
190
|
-
});
|
|
191
|
-
}
|
|
192
|
-
/**
|
|
193
|
-
* List Item Attributes
|
|
194
|
-
* @param offset The first item that you will get
|
|
195
|
-
* @param limit How many Item Attributes per page
|
|
196
|
-
* @returns A list of Item Attributes
|
|
197
|
-
*/
|
|
198
|
-
listItemAttributes(offset, limit) {
|
|
199
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
200
|
-
return new Promise((resolve, reject) => {
|
|
201
|
-
this.api
|
|
202
|
-
.get(`${endpoints_1.Endpoints.ItemAttribute}?offset=${offset || 0}&limit=${limit || 20}`)
|
|
203
|
-
.then((response) => resolve(response.data))
|
|
204
|
-
.catch((error) => reject(error));
|
|
205
|
-
});
|
|
206
|
-
});
|
|
207
|
-
}
|
|
208
|
-
/**
|
|
209
|
-
* List Item Categories
|
|
210
|
-
* @param offset The first item that you will get
|
|
211
|
-
* @param limit How many Item Categories per page
|
|
212
|
-
* @returns A list of Item Categories
|
|
213
|
-
*/
|
|
214
|
-
listItemCategories(offset, limit) {
|
|
215
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
216
|
-
return new Promise((resolve, reject) => {
|
|
217
|
-
this.api
|
|
218
|
-
.get(`${endpoints_1.Endpoints.ItemCategory}?offset=${offset || 0}&limit=${limit || 20}`)
|
|
219
|
-
.then((response) => resolve(response.data))
|
|
220
|
-
.catch((error) => reject(error));
|
|
221
|
-
});
|
|
222
|
-
});
|
|
223
|
-
}
|
|
224
|
-
/**
|
|
225
|
-
* List Item Filing Effects
|
|
226
|
-
* @param offset The first item that you will get
|
|
227
|
-
* @param limit How many Item Filing Effects per page
|
|
228
|
-
* @returns A list of Item Filing Effects
|
|
229
|
-
*/
|
|
230
|
-
listItemFilingEffects(offset, limit) {
|
|
231
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
232
|
-
return new Promise((resolve, reject) => {
|
|
233
|
-
this.api
|
|
234
|
-
.get(`${endpoints_1.Endpoints.ItemFlingEffect}?offset=${offset || 0}&limit=${limit || 20}`)
|
|
235
|
-
.then((response) => resolve(response.data))
|
|
236
|
-
.catch((error) => reject(error));
|
|
237
|
-
});
|
|
238
|
-
});
|
|
239
|
-
}
|
|
240
|
-
/**
|
|
241
|
-
* List Item Pockets
|
|
242
|
-
* @param offset The first item that you will get
|
|
243
|
-
* @param limit How many Item Pockets per page
|
|
244
|
-
* @returns A list of Item Pockets
|
|
245
|
-
*/
|
|
246
|
-
listItemPockets(offset, limit) {
|
|
247
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
248
|
-
return new Promise((resolve, reject) => {
|
|
249
|
-
this.api
|
|
250
|
-
.get(`${endpoints_1.Endpoints.ItemPocket}?offset=${offset || 0}&limit=${limit || 20}`)
|
|
251
|
-
.then((response) => resolve(response.data))
|
|
252
|
-
.catch((error) => reject(error));
|
|
253
|
-
});
|
|
254
|
-
});
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
exports.ItemClient = ItemClient;
|
|
@@ -1,210 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LocationClient = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const constants_1 = require("../constants");
|
|
6
|
-
const base_1 = require("../structures/base");
|
|
7
|
-
/**
|
|
8
|
-
* ### Location Client
|
|
9
|
-
*
|
|
10
|
-
* Client used to access the Location Endpoints:
|
|
11
|
-
* - [Locations](https://pokeapi.co/docs/v2#locations)
|
|
12
|
-
* - [Location Areas](https://pokeapi.co/docs/v2#location-areas)
|
|
13
|
-
* - [Pal Park Areas](https://pokeapi.co/docs/v2#pal-park-areas)
|
|
14
|
-
* - [Regions](https://pokeapi.co/docs/v2#regions)
|
|
15
|
-
* ---
|
|
16
|
-
* See [PokéAPI Documentation](https://pokeapi.co/docs/v2#locations-section)
|
|
17
|
-
*/
|
|
18
|
-
class LocationClient extends base_1.BaseClient {
|
|
19
|
-
/**
|
|
20
|
-
* @argument clientOptions Options for the client.
|
|
21
|
-
*/
|
|
22
|
-
constructor(clientOptions) {
|
|
23
|
-
super(clientOptions);
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Get a Location by it's name
|
|
27
|
-
* @param name The Location name
|
|
28
|
-
* @returns A Location
|
|
29
|
-
*/
|
|
30
|
-
getLocationByName(name) {
|
|
31
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
32
|
-
return new Promise((resolve, reject) => {
|
|
33
|
-
this.api
|
|
34
|
-
.get(`${constants_1.Endpoints.Location}/${name}`)
|
|
35
|
-
.then((response) => resolve(response.data))
|
|
36
|
-
.catch((error) => reject(error));
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Get a Location by it's ID
|
|
42
|
-
* @param id The Location ID
|
|
43
|
-
* @returns A location
|
|
44
|
-
*/
|
|
45
|
-
getLocationById(id) {
|
|
46
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
47
|
-
return new Promise((resolve, reject) => {
|
|
48
|
-
this.api
|
|
49
|
-
.get(`${constants_1.Endpoints.Location}/${id}`)
|
|
50
|
-
.then((response) => resolve(response.data))
|
|
51
|
-
.catch((error) => reject(error));
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Get a Location Area by it's name
|
|
57
|
-
* @param name The Location Area name
|
|
58
|
-
* @returns A Location Area
|
|
59
|
-
*/
|
|
60
|
-
getLocationAreaByName(name) {
|
|
61
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
62
|
-
return new Promise((resolve, reject) => {
|
|
63
|
-
this.api
|
|
64
|
-
.get(`${constants_1.Endpoints.LocationArea}/${name}`)
|
|
65
|
-
.then((response) => resolve(response.data))
|
|
66
|
-
.catch((error) => reject(error));
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Get a Location Area by it's ID
|
|
72
|
-
* @param id The Location Area ID
|
|
73
|
-
* @returns A Location Area
|
|
74
|
-
*/
|
|
75
|
-
getLocationAreaById(id) {
|
|
76
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
77
|
-
return new Promise((resolve, reject) => {
|
|
78
|
-
this.api
|
|
79
|
-
.get(`${constants_1.Endpoints.LocationArea}/${id}`)
|
|
80
|
-
.then((response) => resolve(response.data))
|
|
81
|
-
.catch((error) => reject(error));
|
|
82
|
-
});
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Get a Pal Park Area by it's name
|
|
87
|
-
* @param name The Pal Park Area name
|
|
88
|
-
* @returns A Pal Park Area
|
|
89
|
-
*/
|
|
90
|
-
getPalParkAreaByName(name) {
|
|
91
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
92
|
-
return new Promise((resolve, reject) => {
|
|
93
|
-
this.api
|
|
94
|
-
.get(`${constants_1.Endpoints.PalParkArea}/${name}`)
|
|
95
|
-
.then((response) => resolve(response.data))
|
|
96
|
-
.catch((error) => reject(error));
|
|
97
|
-
});
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* Get a Pal Park Area by it's ID
|
|
102
|
-
* @param id The Pal Park Area ID
|
|
103
|
-
* @returns A Pal Park Area
|
|
104
|
-
*/
|
|
105
|
-
getPalParkAreaById(id) {
|
|
106
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
107
|
-
return new Promise((resolve, reject) => {
|
|
108
|
-
this.api
|
|
109
|
-
.get(`${constants_1.Endpoints.PalParkArea}/${id}`)
|
|
110
|
-
.then((response) => resolve(response.data))
|
|
111
|
-
.catch((error) => reject(error));
|
|
112
|
-
});
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* Get a Region by it's name
|
|
117
|
-
* @param name The Region name
|
|
118
|
-
* @returns A Region
|
|
119
|
-
*/
|
|
120
|
-
getRegionByName(name) {
|
|
121
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
122
|
-
return new Promise((resolve, reject) => {
|
|
123
|
-
this.api
|
|
124
|
-
.get(`${constants_1.Endpoints.Region}/${name}`)
|
|
125
|
-
.then((response) => resolve(response.data))
|
|
126
|
-
.catch((error) => reject(error));
|
|
127
|
-
});
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* Get a Region by it's ID
|
|
132
|
-
* @param id The Region ID
|
|
133
|
-
* @returns A Region
|
|
134
|
-
*/
|
|
135
|
-
getRegionById(id) {
|
|
136
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
137
|
-
return new Promise((resolve, reject) => {
|
|
138
|
-
this.api
|
|
139
|
-
.get(`${constants_1.Endpoints.Region}/${id}`)
|
|
140
|
-
.then((response) => resolve(response.data))
|
|
141
|
-
.catch((error) => reject(error));
|
|
142
|
-
});
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
/**
|
|
146
|
-
* List Locations
|
|
147
|
-
* @param offset The first item that you will get
|
|
148
|
-
* @param limit How many Locations per page
|
|
149
|
-
* @returns A list of Locations
|
|
150
|
-
*/
|
|
151
|
-
listLocations(offset, limit) {
|
|
152
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
153
|
-
return new Promise((resolve, reject) => {
|
|
154
|
-
this.api
|
|
155
|
-
.get(`${constants_1.Endpoints.Location}?offset=${offset || 0}&limit=${limit || 20}`)
|
|
156
|
-
.then((response) => resolve(response.data))
|
|
157
|
-
.catch((error) => reject(error));
|
|
158
|
-
});
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
|
-
/**
|
|
162
|
-
* List Location Areas
|
|
163
|
-
* @param offset The first item that you will get
|
|
164
|
-
* @param limit How many Locations per page
|
|
165
|
-
* @returns A list of Location Areas
|
|
166
|
-
*/
|
|
167
|
-
listLocationAreas(offset, limit) {
|
|
168
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
169
|
-
return new Promise((resolve, reject) => {
|
|
170
|
-
this.api
|
|
171
|
-
.get(`${constants_1.Endpoints.LocationArea}?offset=${offset || 0}&limit=${limit || 20}`)
|
|
172
|
-
.then((response) => resolve(response.data))
|
|
173
|
-
.catch((error) => reject(error));
|
|
174
|
-
});
|
|
175
|
-
});
|
|
176
|
-
}
|
|
177
|
-
/**
|
|
178
|
-
* List Pal Park Areas
|
|
179
|
-
* @param offset The first item that you will get
|
|
180
|
-
* @param limit How many Pal Park Areas per page
|
|
181
|
-
* @returns A list of Pal Park Areas
|
|
182
|
-
*/
|
|
183
|
-
listPalParkAreas(offset, limit) {
|
|
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.PalParkArea}?offset=${offset || 0}&limit=${limit || 20}`)
|
|
188
|
-
.then((response) => resolve(response.data))
|
|
189
|
-
.catch((error) => reject(error));
|
|
190
|
-
});
|
|
191
|
-
});
|
|
192
|
-
}
|
|
193
|
-
/**
|
|
194
|
-
* List Regions
|
|
195
|
-
* @param offset The first item that you will get
|
|
196
|
-
* @param limit How many Regions per page
|
|
197
|
-
* @returns A list of Regions
|
|
198
|
-
*/
|
|
199
|
-
listRegions(offset, limit) {
|
|
200
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
201
|
-
return new Promise((resolve, reject) => {
|
|
202
|
-
this.api
|
|
203
|
-
.get(`${constants_1.Endpoints.Region}?offset=${offset || 0}&limit=${limit || 20}`)
|
|
204
|
-
.then((response) => resolve(response.data))
|
|
205
|
-
.catch((error) => reject(error));
|
|
206
|
-
});
|
|
207
|
-
});
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
exports.LocationClient = LocationClient;
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MachineClient = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const constants_1 = require("../constants");
|
|
6
|
-
const base_1 = require("../structures/base");
|
|
7
|
-
/**
|
|
8
|
-
* ### Machine Client
|
|
9
|
-
*
|
|
10
|
-
* Client used to access the Machine Endpoints:
|
|
11
|
-
* - [Machines](https://pokeapi.co/docs/v2#machines)
|
|
12
|
-
*
|
|
13
|
-
* See [PokéAPI Documentation](https://pokeapi.co/docs/v2#machines-section)
|
|
14
|
-
*/
|
|
15
|
-
class MachineClient extends base_1.BaseClient {
|
|
16
|
-
/**
|
|
17
|
-
* @argument clientOptions Options for the client.
|
|
18
|
-
*/
|
|
19
|
-
constructor(clientOptions) {
|
|
20
|
-
super(clientOptions);
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Get a Machine by it's ID
|
|
24
|
-
* @param id The Machine ID
|
|
25
|
-
* @returns A Machine
|
|
26
|
-
*/
|
|
27
|
-
getMachineById(id) {
|
|
28
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
29
|
-
return new Promise((resolve, reject) => {
|
|
30
|
-
this.api
|
|
31
|
-
.get(`${constants_1.Endpoints.Machine}/${id}`)
|
|
32
|
-
.then((response) => resolve(response.data))
|
|
33
|
-
.catch((error) => reject(error));
|
|
34
|
-
});
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* List Machines
|
|
39
|
-
* @param offset The first item that you will get
|
|
40
|
-
* @param limit How many Machines per page
|
|
41
|
-
* @returns A list of Machines
|
|
42
|
-
*/
|
|
43
|
-
listMachines(offset, limit) {
|
|
44
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
45
|
-
return new Promise((resolve, reject) => {
|
|
46
|
-
this.api
|
|
47
|
-
.get(`${constants_1.Endpoints.Machine}?offset=${offset || 0}&limit=${limit || 20}`)
|
|
48
|
-
.then((response) => resolve(response.data))
|
|
49
|
-
.catch((error) => reject(error));
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
exports.MachineClient = MachineClient;
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MainClient = void 0;
|
|
4
|
-
const base_1 = require("../structures/base");
|
|
5
|
-
const berry_client_1 = require("./berry.client");
|
|
6
|
-
const contest_client_1 = require("./contest.client");
|
|
7
|
-
const encounter_client_1 = require("./encounter.client");
|
|
8
|
-
const evolution_client_1 = require("./evolution.client");
|
|
9
|
-
const game_client_1 = require("./game.client");
|
|
10
|
-
const item_client_1 = require("./item.client");
|
|
11
|
-
const location_client_1 = require("./location.client");
|
|
12
|
-
const machine_client_1 = require("./machine.client");
|
|
13
|
-
const move_client_1 = require("./move.client");
|
|
14
|
-
const pokemon_client_1 = require("./pokemon.client");
|
|
15
|
-
/**
|
|
16
|
-
* ### Main Client
|
|
17
|
-
*
|
|
18
|
-
* The main client used to access all the PokéAPI Endpoints:
|
|
19
|
-
* - [Berries](https://pokeapi.co/docs/v2#berries-section)
|
|
20
|
-
* - [Contests](https://pokeapi.co/docs/v2#contests-section)
|
|
21
|
-
* - [Encounters](https://pokeapi.co/docs/v2#encounters-section)
|
|
22
|
-
* - [Evolution](https://pokeapi.co/docs/v2#evolution-section)
|
|
23
|
-
* - [Games](https://pokeapi.co/docs/v2#games-section)
|
|
24
|
-
* - [Items](https://pokeapi.co/docs/v2#items-section)
|
|
25
|
-
* - [Locations](https://pokeapi.co/docs/v2#locations-section)
|
|
26
|
-
* - [Machines](https://pokeapi.co/docs/v2#machines-section)
|
|
27
|
-
* - [Moves](https://pokeapi.co/docs/v2#moves-section)
|
|
28
|
-
* - [Pokémon](https://pokeapi.co/docs/v2#pokemon-section)
|
|
29
|
-
* - [Utility](https://pokeapi.co/docs/v2#utility-section)
|
|
30
|
-
* ---
|
|
31
|
-
* See [PokéAPI Documentation](https://pokeapi.co/docs/v2)
|
|
32
|
-
*/
|
|
33
|
-
class MainClient extends base_1.BaseClient {
|
|
34
|
-
constructor(clientOptions) {
|
|
35
|
-
super(clientOptions);
|
|
36
|
-
this.berry = new berry_client_1.BerryClient(clientOptions);
|
|
37
|
-
this.contest = new contest_client_1.ContestClient(clientOptions);
|
|
38
|
-
this.encounter = new encounter_client_1.EncounterClient(clientOptions);
|
|
39
|
-
this.evolution = new evolution_client_1.EvolutionClient(clientOptions);
|
|
40
|
-
this.game = new game_client_1.GameClient(clientOptions);
|
|
41
|
-
this.item = new item_client_1.ItemClient(clientOptions);
|
|
42
|
-
this.location = new location_client_1.LocationClient(clientOptions);
|
|
43
|
-
this.machine = new machine_client_1.MachineClient(clientOptions);
|
|
44
|
-
this.move = new move_client_1.MoveClient(clientOptions);
|
|
45
|
-
this.pokemon = new pokemon_client_1.PokemonClient(clientOptions);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
exports.MainClient = MainClient;
|