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,133 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ContestClient = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const constants_1 = require("../constants");
|
|
6
|
-
const base_1 = require("../structures/base");
|
|
7
|
-
/**
|
|
8
|
-
* ### Contest Client
|
|
9
|
-
*
|
|
10
|
-
* Client used to access the Contest Endpoints:
|
|
11
|
-
* - [Contest Types](https://pokeapi.co/docs/v2#contest-types)
|
|
12
|
-
* - [Contest Effects](https://pokeapi.co/docs/v2#contest-effects)
|
|
13
|
-
* - [Super Contest Effects](https://pokeapi.co/docs/v2#super-contest-effects)
|
|
14
|
-
* ---
|
|
15
|
-
* See [PokéAPI Documentation](https://pokeapi.co/docs/v2#contests-section)
|
|
16
|
-
*/
|
|
17
|
-
class ContestClient extends base_1.BaseClient {
|
|
18
|
-
/**
|
|
19
|
-
* @argument clientOptions Options for the client.
|
|
20
|
-
*/
|
|
21
|
-
constructor(clientOptions) {
|
|
22
|
-
super(clientOptions);
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Get a Contest Type by it's name
|
|
26
|
-
* @param name The contest type name
|
|
27
|
-
* @returns A Contest Type
|
|
28
|
-
*/
|
|
29
|
-
getContestTypeByName(name) {
|
|
30
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
31
|
-
return new Promise((resolve, reject) => {
|
|
32
|
-
this.api
|
|
33
|
-
.get(`${constants_1.Endpoints.ContestType}/${name}`)
|
|
34
|
-
.then((response) => resolve(response.data))
|
|
35
|
-
.catch((error) => reject(error));
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Get a Contest Type by it's ID
|
|
41
|
-
* @param id The Contest Type ID
|
|
42
|
-
* @returns A Contest Type
|
|
43
|
-
*/
|
|
44
|
-
getContestTypeById(id) {
|
|
45
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
46
|
-
return new Promise((resolve, reject) => {
|
|
47
|
-
this.api
|
|
48
|
-
.get(`${constants_1.Endpoints.ContestType}/${id}`)
|
|
49
|
-
.then((response) => resolve(response.data))
|
|
50
|
-
.catch((error) => reject(error));
|
|
51
|
-
});
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Get a Contest Effect by it's ID
|
|
56
|
-
* @param id The Contest Effect ID
|
|
57
|
-
* @returns Contest Effect
|
|
58
|
-
*/
|
|
59
|
-
getContestEffectById(id) {
|
|
60
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
61
|
-
return new Promise((resolve, reject) => {
|
|
62
|
-
this.api
|
|
63
|
-
.get(`${constants_1.Endpoints.ContestEffect}/${id}`)
|
|
64
|
-
.then((response) => resolve(response.data))
|
|
65
|
-
.catch((error) => reject(error));
|
|
66
|
-
});
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Get a Super Contest Effect by it's ID
|
|
71
|
-
* @param id The Super Contest Effect ID
|
|
72
|
-
* @returns Super Contest Effect
|
|
73
|
-
*/
|
|
74
|
-
getSuperContestEffectById(id) {
|
|
75
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
76
|
-
return new Promise((resolve, reject) => {
|
|
77
|
-
this.api
|
|
78
|
-
.get(`${constants_1.Endpoints.SuperContestEffect}/${id}`)
|
|
79
|
-
.then((response) => resolve(response.data))
|
|
80
|
-
.catch((error) => reject(error));
|
|
81
|
-
});
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* List Contest Types
|
|
86
|
-
* @param offset The first item that you will get
|
|
87
|
-
* @param limit How many contest types per page
|
|
88
|
-
* @returns A list of contest types
|
|
89
|
-
*/
|
|
90
|
-
listContestTypes(offset, limit) {
|
|
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.ContestType}?offset=${offset || 0}&limit=${limit || 20}`)
|
|
95
|
-
.then((response) => resolve(response.data))
|
|
96
|
-
.catch((error) => reject(error));
|
|
97
|
-
});
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* List Contest Effects
|
|
102
|
-
* @param offset The first item that you will get
|
|
103
|
-
* @param limit How many contest effects per page
|
|
104
|
-
* @returns A list of contest effects
|
|
105
|
-
*/
|
|
106
|
-
listContestEffects(offset, limit) {
|
|
107
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
108
|
-
return new Promise((resolve, reject) => {
|
|
109
|
-
this.api
|
|
110
|
-
.get(`${constants_1.Endpoints.ContestEffect}?offset=${offset || 0}&limit=${limit || 20}`)
|
|
111
|
-
.then((response) => resolve(response.data))
|
|
112
|
-
.catch((error) => reject(error));
|
|
113
|
-
});
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* List Super Contest Effects
|
|
118
|
-
* @param offset The first item that you will get
|
|
119
|
-
* @param limit How many Super Contest Effect per page
|
|
120
|
-
* @returns A list of Super Contest Effect
|
|
121
|
-
*/
|
|
122
|
-
listSuperContestEffects(offset, limit) {
|
|
123
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
124
|
-
return new Promise((resolve, reject) => {
|
|
125
|
-
this.api
|
|
126
|
-
.get(`${constants_1.Endpoints.SuperContestEffect}?offset=${offset || 0}&limit=${limit || 20}`)
|
|
127
|
-
.then((response) => resolve(response.data))
|
|
128
|
-
.catch((error) => reject(error));
|
|
129
|
-
});
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
exports.ContestClient = ContestClient;
|
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EncounterClient = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const constants_1 = require("../constants");
|
|
6
|
-
const base_1 = require("../structures/base");
|
|
7
|
-
/**
|
|
8
|
-
* ### Encounter Client
|
|
9
|
-
*
|
|
10
|
-
* Client used to access the Encounter Endpoints:
|
|
11
|
-
* - [Encounter Methods](https://pokeapi.co/docs/v2#encounter-methods)
|
|
12
|
-
* - [Encounter Conditions](https://pokeapi.co/docs/v2#encounter-conditions)
|
|
13
|
-
* - [Encounter Condition Values](https://pokeapi.co/docs/v2#encounter-condition-values)
|
|
14
|
-
* ---
|
|
15
|
-
* See [PokéAPI Documentation](https://pokeapi.co/docs/v2#encounters-section)
|
|
16
|
-
*/
|
|
17
|
-
class EncounterClient extends base_1.BaseClient {
|
|
18
|
-
/**
|
|
19
|
-
* @argument clientOptions Options for the client.
|
|
20
|
-
*/
|
|
21
|
-
constructor(clientOptions) {
|
|
22
|
-
super(clientOptions);
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Get an Encounter Method by it's name
|
|
26
|
-
* @param name The Encounter Method name
|
|
27
|
-
* @returns An Encounter Method
|
|
28
|
-
*/
|
|
29
|
-
getEncounterMethodByName(name) {
|
|
30
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
31
|
-
return new Promise((resolve, reject) => {
|
|
32
|
-
this.api
|
|
33
|
-
.get(`${constants_1.Endpoints.EncouterMethod}/${name}`)
|
|
34
|
-
.then((response) => resolve(response.data))
|
|
35
|
-
.catch((error) => reject(error));
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Get an Encounter Method by it's ID
|
|
41
|
-
* @param id The Encounter Method ID
|
|
42
|
-
* @returns An Encounter Method
|
|
43
|
-
*/
|
|
44
|
-
getEncounterMethodById(id) {
|
|
45
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
46
|
-
return new Promise((resolve, reject) => {
|
|
47
|
-
this.api
|
|
48
|
-
.get(`${constants_1.Endpoints.EncouterMethod}/${id}`)
|
|
49
|
-
.then((response) => resolve(response.data))
|
|
50
|
-
.catch((error) => reject(error));
|
|
51
|
-
});
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Get an Encounter Condition by it's ID
|
|
56
|
-
* @param id The Encounter Condition ID
|
|
57
|
-
* @returns An Encounter Condition
|
|
58
|
-
*/
|
|
59
|
-
getEncounterConditionById(id) {
|
|
60
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
61
|
-
return new Promise((resolve, reject) => {
|
|
62
|
-
this.api
|
|
63
|
-
.get(`${constants_1.Endpoints.EncounterCondition}/${id}`)
|
|
64
|
-
.then((response) => resolve(response.data))
|
|
65
|
-
.catch((error) => reject(error));
|
|
66
|
-
});
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Get an Encounter Condition by it's name
|
|
71
|
-
* @param name The Encounter Condition name
|
|
72
|
-
* @returns An Encounter Condition
|
|
73
|
-
*/
|
|
74
|
-
getEncounterConditionByName(name) {
|
|
75
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
76
|
-
return new Promise((resolve, reject) => {
|
|
77
|
-
this.api
|
|
78
|
-
.get(`${constants_1.Endpoints.EncounterCondition}/${name}`)
|
|
79
|
-
.then((response) => resolve(response.data))
|
|
80
|
-
.catch((error) => reject(error));
|
|
81
|
-
});
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Get an Encounter Condition Value by it's name
|
|
86
|
-
* @param name The Encounter Condition Value name
|
|
87
|
-
* @returns An Encounter Condition Value
|
|
88
|
-
*/
|
|
89
|
-
getEncounterConditionValueByName(name) {
|
|
90
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
91
|
-
return new Promise((resolve, reject) => {
|
|
92
|
-
this.api
|
|
93
|
-
.get(`${constants_1.Endpoints.EncouterConditionValue}/${name}`)
|
|
94
|
-
.then((response) => resolve(response.data))
|
|
95
|
-
.catch((error) => reject(error));
|
|
96
|
-
});
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* Get an Encounter Condition Value by it's ID
|
|
101
|
-
* @param id The Encounter Condition Value ID
|
|
102
|
-
* @returns An Encounter Condition Value
|
|
103
|
-
*/
|
|
104
|
-
getEncounterConditionValueById(id) {
|
|
105
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
106
|
-
return new Promise((resolve, reject) => {
|
|
107
|
-
this.api
|
|
108
|
-
.get(`${constants_1.Endpoints.EncouterConditionValue}/${id}`)
|
|
109
|
-
.then((response) => resolve(response.data))
|
|
110
|
-
.catch((error) => reject(error));
|
|
111
|
-
});
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* List Encounter Methods
|
|
116
|
-
* @param offset The first item that you will get
|
|
117
|
-
* @param limit How many Encounter Methods per page
|
|
118
|
-
* @returns A list of Encounter Methods
|
|
119
|
-
*/
|
|
120
|
-
listEncounterMethods(offset, limit) {
|
|
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.EncouterMethod}?offset=${offset || 0}&limit=${limit || 20}`)
|
|
125
|
-
.then((response) => resolve(response.data))
|
|
126
|
-
.catch((error) => reject(error));
|
|
127
|
-
});
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* List Encounter Conditions
|
|
132
|
-
* @param offset The first item that you will get
|
|
133
|
-
* @param limit How many Encounter Conditions per page
|
|
134
|
-
* @returns A list of Encounter Methods
|
|
135
|
-
*/
|
|
136
|
-
listEncounterConditions(offset, limit) {
|
|
137
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
138
|
-
return new Promise((resolve, reject) => {
|
|
139
|
-
this.api
|
|
140
|
-
.get(`${constants_1.Endpoints.EncounterCondition}?offset=${offset || 0}&limit=${limit || 20}`)
|
|
141
|
-
.then((response) => resolve(response.data))
|
|
142
|
-
.catch((error) => reject(error));
|
|
143
|
-
});
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
/**
|
|
147
|
-
* List Encounter Condition Values
|
|
148
|
-
* @param offset The first item that you will get
|
|
149
|
-
* @param limit How many Encounter Condition Values per page
|
|
150
|
-
* @returns A list of Encounter Condition Values
|
|
151
|
-
*/
|
|
152
|
-
listEncounterConditionValues(offset, limit) {
|
|
153
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
154
|
-
return new Promise((resolve, reject) => {
|
|
155
|
-
this.api
|
|
156
|
-
.get(`${constants_1.Endpoints.EncouterConditionValue}?offset=${offset || 0}&limit=${limit || 20}`)
|
|
157
|
-
.then((response) => resolve(response.data))
|
|
158
|
-
.catch((error) => reject(error));
|
|
159
|
-
});
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
exports.EncounterClient = EncounterClient;
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EvolutionClient = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const constants_1 = require("../constants");
|
|
6
|
-
const base_1 = require("../structures/base");
|
|
7
|
-
/**
|
|
8
|
-
* ### Evolution Client
|
|
9
|
-
*
|
|
10
|
-
* Client used to access the Berry Endpoints:
|
|
11
|
-
* - [Evolution Chains](https://pokeapi.co/docs/v2#evolution-chains)
|
|
12
|
-
* - [Evolution Triggers](https://pokeapi.co/docs/v2#evolution-triggers)
|
|
13
|
-
* ---
|
|
14
|
-
* See [PokéAPI Documentation](https://pokeapi.co/docs/v2#evolution-section)
|
|
15
|
-
*/
|
|
16
|
-
class EvolutionClient extends base_1.BaseClient {
|
|
17
|
-
/**
|
|
18
|
-
* @argument clientOptions Options for the client.
|
|
19
|
-
*/
|
|
20
|
-
constructor(clientOptions) {
|
|
21
|
-
super(clientOptions);
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Get an Evolution Chain by it's ID
|
|
25
|
-
* @param id The Evolution Chain ID
|
|
26
|
-
* @returns An Evolution Chain
|
|
27
|
-
*/
|
|
28
|
-
getEvolutionChainById(id) {
|
|
29
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
30
|
-
return new Promise((resolve, reject) => {
|
|
31
|
-
this.api
|
|
32
|
-
.get(`${constants_1.Endpoints.EvolutionChain}/${id}`)
|
|
33
|
-
.then((response) => resolve(response.data))
|
|
34
|
-
.catch((error) => reject(error));
|
|
35
|
-
});
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Get an Evolution Trigger by it's ID
|
|
40
|
-
* @param id The Evolution Trigger ID
|
|
41
|
-
* @returns An Evolution Trigger
|
|
42
|
-
*/
|
|
43
|
-
getEvolutionTriggerById(id) {
|
|
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.EvolutionTrigger}/${id}`)
|
|
48
|
-
.then((response) => resolve(response.data))
|
|
49
|
-
.catch((error) => {
|
|
50
|
-
reject(error);
|
|
51
|
-
});
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Get an Evolution Trigger by it's name
|
|
57
|
-
* @param name The Evolution Trigger name
|
|
58
|
-
* @returns An Evolution Trigger
|
|
59
|
-
*/
|
|
60
|
-
getEvolutionTriggerByName(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.EvolutionTrigger}/${name}`)
|
|
65
|
-
.then((response) => resolve(response.data))
|
|
66
|
-
.catch((error) => reject(error));
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* List Evolution Chains
|
|
72
|
-
* @param offset The first item that you will get
|
|
73
|
-
* @param limit How many Evolution Chains per page
|
|
74
|
-
* @returns A list of Evolution Chains
|
|
75
|
-
*/
|
|
76
|
-
listEvolutionChains(offset, limit) {
|
|
77
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
78
|
-
return new Promise((resolve, reject) => {
|
|
79
|
-
this.api
|
|
80
|
-
.get(`${constants_1.Endpoints.EvolutionChain}?offset=${offset || 0}&limit=${limit || 20}`)
|
|
81
|
-
.then((response) => resolve(response.data))
|
|
82
|
-
.catch((error) => reject(error));
|
|
83
|
-
});
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* List Evolution Triggers
|
|
88
|
-
* @param offset The first item that you will get
|
|
89
|
-
* @param limit How many Evolution Triggers per page
|
|
90
|
-
* @returns A list of Evolution Triggers
|
|
91
|
-
*/
|
|
92
|
-
listEvolutionTriggers(offset, limit) {
|
|
93
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
94
|
-
return new Promise((resolve, reject) => {
|
|
95
|
-
this.api
|
|
96
|
-
.get(`${constants_1.Endpoints.EvolutionTrigger}?offset=${offset || 0}&limit=${limit || 20}`)
|
|
97
|
-
.then((response) => resolve(response.data))
|
|
98
|
-
.catch((error) => reject(error));
|
|
99
|
-
});
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
exports.EvolutionClient = EvolutionClient;
|
|
@@ -1,210 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GameClient = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const constants_1 = require("../constants");
|
|
6
|
-
const base_1 = require("../structures/base");
|
|
7
|
-
/**
|
|
8
|
-
* ### Game Client
|
|
9
|
-
*
|
|
10
|
-
* Client used to access the Game Endpoints:
|
|
11
|
-
* - [Generations](https://pokeapi.co/docs/v2#generations)
|
|
12
|
-
* - [Pokedexes](https://pokeapi.co/docs/v2#pokedexes)
|
|
13
|
-
* - [Versions](https://pokeapi.co/docs/v2#version)
|
|
14
|
-
* - [Version Groups](https://pokeapi.co/docs/v2#version-groups)
|
|
15
|
-
* ---
|
|
16
|
-
* See [PokéAPI Documentation](https://pokeapi.co/docs/v2#games-section)
|
|
17
|
-
*/
|
|
18
|
-
class GameClient extends base_1.BaseClient {
|
|
19
|
-
/**
|
|
20
|
-
* @argument clientOptions Options for the client.
|
|
21
|
-
*/
|
|
22
|
-
constructor(clientOptions) {
|
|
23
|
-
super(clientOptions);
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Get a Generation by it's name
|
|
27
|
-
* @param name The generation name
|
|
28
|
-
* @returns A Generation
|
|
29
|
-
*/
|
|
30
|
-
getGenerationByName(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.Generation}/${name}`)
|
|
35
|
-
.then((response) => resolve(response.data))
|
|
36
|
-
.catch((error) => reject(error));
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Get a Generation by it's ID
|
|
42
|
-
* @param id The generation ID
|
|
43
|
-
* @returns A Generation
|
|
44
|
-
*/
|
|
45
|
-
getGenerationById(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.Generation}/${id}`)
|
|
50
|
-
.then((response) => resolve(response.data))
|
|
51
|
-
.catch((error) => reject(error));
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Get a Pokedex by it's name
|
|
57
|
-
* @param name The pokedex name
|
|
58
|
-
* @returns A Pokedex
|
|
59
|
-
*/
|
|
60
|
-
getPokedexByName(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.Pokedex}/${name}`)
|
|
65
|
-
.then((response) => resolve(response.data))
|
|
66
|
-
.catch((error) => reject(error));
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Get a Pokedex by it's ID
|
|
72
|
-
* @param id The pokedex ID
|
|
73
|
-
* @returns A Pokedex
|
|
74
|
-
*/
|
|
75
|
-
getPokedexById(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.Pokedex}/${id}`)
|
|
80
|
-
.then((response) => resolve(response.data))
|
|
81
|
-
.catch((error) => reject(error));
|
|
82
|
-
});
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Get a Version by it's name
|
|
87
|
-
* @param name The version name
|
|
88
|
-
* @returns A Version
|
|
89
|
-
*/
|
|
90
|
-
getVersionByName(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.Version}/${name}`)
|
|
95
|
-
.then((response) => resolve(response.data))
|
|
96
|
-
.catch((error) => reject(error));
|
|
97
|
-
});
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* Get a Version by it's ID
|
|
102
|
-
* @param id The version ID
|
|
103
|
-
* @returns A Version
|
|
104
|
-
*/
|
|
105
|
-
getVersionById(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.Version}/${id}`)
|
|
110
|
-
.then((response) => resolve(response.data))
|
|
111
|
-
.catch((error) => reject(error));
|
|
112
|
-
});
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* Get a Version Group by it's name
|
|
117
|
-
* @param name The version group name
|
|
118
|
-
* @returns A Version Group
|
|
119
|
-
*/
|
|
120
|
-
getVersionGroupByName(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.VersionGroup}/${name}`)
|
|
125
|
-
.then((response) => resolve(response.data))
|
|
126
|
-
.catch((error) => reject(error));
|
|
127
|
-
});
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* Get a Version Group by it's ID
|
|
132
|
-
* @param id The version group ID
|
|
133
|
-
* @returns A Version Group
|
|
134
|
-
*/
|
|
135
|
-
getVersionGroupById(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.VersionGroup}/${id}`)
|
|
140
|
-
.then((response) => resolve(response.data))
|
|
141
|
-
.catch((error) => reject(error));
|
|
142
|
-
});
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
/**
|
|
146
|
-
* List Generations
|
|
147
|
-
* @param offset The first item that you will get
|
|
148
|
-
* @param limit How many Generations per page
|
|
149
|
-
* @returns A list of Generations
|
|
150
|
-
*/
|
|
151
|
-
listGenerations(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.Generation}?offset=${offset || 0}&limit=${limit || 20}`)
|
|
156
|
-
.then((response) => resolve(response.data))
|
|
157
|
-
.catch((error) => reject(error));
|
|
158
|
-
});
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
|
-
/**
|
|
162
|
-
* List Pokedexes
|
|
163
|
-
* @param offset The first item that you will get
|
|
164
|
-
* @param limit How many Pokedexes per page
|
|
165
|
-
* @returns A list of Pokedexes
|
|
166
|
-
*/
|
|
167
|
-
listPokedexes(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.Pokedex}?offset=${offset || 0}&limit=${limit || 20}`)
|
|
172
|
-
.then((response) => resolve(response.data))
|
|
173
|
-
.catch((error) => reject(error));
|
|
174
|
-
});
|
|
175
|
-
});
|
|
176
|
-
}
|
|
177
|
-
/**
|
|
178
|
-
* List Versions
|
|
179
|
-
* @param offset The first item that you will get
|
|
180
|
-
* @param limit How many Versions per page
|
|
181
|
-
* @returns A list of Versions
|
|
182
|
-
*/
|
|
183
|
-
listVersions(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.Version}?offset=${offset || 0}&limit=${limit || 20}`)
|
|
188
|
-
.then((response) => resolve(response.data))
|
|
189
|
-
.catch((error) => reject(error));
|
|
190
|
-
});
|
|
191
|
-
});
|
|
192
|
-
}
|
|
193
|
-
/**
|
|
194
|
-
* List Version Groups
|
|
195
|
-
* @param offset The first item that you will get
|
|
196
|
-
* @param limit How many Version Groups per page
|
|
197
|
-
* @returns A list of Version Groups
|
|
198
|
-
*/
|
|
199
|
-
listVersionGroups(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.VersionGroup}?offset=${offset || 0}&limit=${limit || 20}`)
|
|
204
|
-
.then((response) => resolve(response.data))
|
|
205
|
-
.catch((error) => reject(error));
|
|
206
|
-
});
|
|
207
|
-
});
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
exports.GameClient = GameClient;
|
package/dist/clients/index.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
tslib_1.__exportStar(require("./berry.client"), exports);
|
|
5
|
-
tslib_1.__exportStar(require("./contest.client"), exports);
|
|
6
|
-
tslib_1.__exportStar(require("./encounter.client"), exports);
|
|
7
|
-
tslib_1.__exportStar(require("./evolution.client"), exports);
|
|
8
|
-
tslib_1.__exportStar(require("./game.client"), exports);
|
|
9
|
-
tslib_1.__exportStar(require("./item.client"), exports);
|
|
10
|
-
tslib_1.__exportStar(require("./location.client"), exports);
|
|
11
|
-
tslib_1.__exportStar(require("./machine.client"), exports);
|
|
12
|
-
tslib_1.__exportStar(require("./move.client"), exports);
|
|
13
|
-
tslib_1.__exportStar(require("./pokemon.client"), exports);
|
|
14
|
-
tslib_1.__exportStar(require("./utility.client"), exports);
|
|
15
|
-
tslib_1.__exportStar(require("./main.client"), exports);
|