@ryyseexvi/temtem-promise-v1 1.1.0 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +7 -8
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +32 -61
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +32 -61
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -1
package/README.md
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
# Temtem API Wrapper 🎮
|
2
2
|
|
3
|
-
[![NPM Version](https://img.shields.io/npm/v/temtem-promise-v1)](https://www.npmjs.com/package/temtem-promise-v1)
|
4
|
-
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
|
3
|
+
[![NPM Version](https://img.shields.io/npm/v/temtem-promise-v1)](https://www.npmjs.com/package/@ryyseexvi/temtem-promise-v1)
|
5
4
|
|
6
5
|
A modern TypeScript wrapper for the [Temtem API](https://temtem-api.mael.tech), providing easy access to all Temtem game data.
|
7
6
|
|
@@ -14,19 +13,19 @@ npm install temtem-promise-v1
|
|
14
13
|
🚀 Usage
|
15
14
|
|
16
15
|
```ts
|
17
|
-
import {
|
16
|
+
import { TemtemDex } from '@ryyseexvi/temtem-promise-v1';
|
18
17
|
|
19
|
-
const
|
18
|
+
const TemDex = new TemtemDex();
|
20
19
|
|
21
20
|
// Example: Get all Temtems
|
22
|
-
const temtems = await
|
21
|
+
const temtems = await TemDex.getTemtems();
|
23
22
|
|
24
23
|
// Example: Get a specific Temtem with ID
|
25
|
-
const temtem = await
|
24
|
+
const temtem = await TemDex.getTemtemById(1);
|
26
25
|
|
27
26
|
// Example: Get Temtems with specific parameters
|
28
|
-
const filteredTemtems = await
|
29
|
-
names: "Pigepic
|
27
|
+
const filteredTemtems = await TemDex.getTemtems({
|
28
|
+
names: "Pigepic",
|
30
29
|
fields: "name,type",
|
31
30
|
expand: "evolution",
|
32
31
|
weaknesses: true
|
package/dist/index.d.mts
CHANGED
@@ -31,6 +31,7 @@ type GearQueryParams = BasicQueryParams;
|
|
31
31
|
declare class TemtemDex {
|
32
32
|
private readonly baseUrl;
|
33
33
|
constructor();
|
34
|
+
private fetchAndParse;
|
34
35
|
getTemtems(params?: TemtemQueryParams): Promise<any>;
|
35
36
|
getTemtemById(id: number, params?: TemtemByIdQueryParams): Promise<any>;
|
36
37
|
getFreetemByTemtemNameAndLevel(name: string, level: number): Promise<any>;
|
package/dist/index.d.ts
CHANGED
@@ -31,6 +31,7 @@ type GearQueryParams = BasicQueryParams;
|
|
31
31
|
declare class TemtemDex {
|
32
32
|
private readonly baseUrl;
|
33
33
|
constructor();
|
34
|
+
private fetchAndParse;
|
34
35
|
getTemtems(params?: TemtemQueryParams): Promise<any>;
|
35
36
|
getTemtemById(id: number, params?: TemtemByIdQueryParams): Promise<any>;
|
36
37
|
getFreetemByTemtemNameAndLevel(name: string, level: number): Promise<any>;
|
package/dist/index.js
CHANGED
@@ -48,6 +48,16 @@ var TemtemDex = class {
|
|
48
48
|
constructor() {
|
49
49
|
this.baseUrl = "https://temtem-api.mael.tech/api";
|
50
50
|
}
|
51
|
+
fetchAndParse(endpoint, queryParams) {
|
52
|
+
return __async(this, null, function* () {
|
53
|
+
const url = `${this.baseUrl}/${endpoint}${(queryParams == null ? void 0 : queryParams.toString()) ? "?" + queryParams.toString() : ""}`;
|
54
|
+
const response = yield fetch(url);
|
55
|
+
if (!response.ok) {
|
56
|
+
throw new Error(`HTTP error! status: ${response.status}`);
|
57
|
+
}
|
58
|
+
return yield response.json();
|
59
|
+
});
|
60
|
+
}
|
51
61
|
getTemtems(params) {
|
52
62
|
return __async(this, null, function* () {
|
53
63
|
const queryParams = new URLSearchParams();
|
@@ -55,9 +65,7 @@ var TemtemDex = class {
|
|
55
65
|
if (params == null ? void 0 : params.fields) queryParams.append("fields", params.fields);
|
56
66
|
if (params == null ? void 0 : params.expand) queryParams.append("expand", params.expand);
|
57
67
|
if (params == null ? void 0 : params.weaknesses) queryParams.append("weaknesses", params.weaknesses.toString());
|
58
|
-
|
59
|
-
const response = yield fetch(url);
|
60
|
-
return yield response.json();
|
68
|
+
return this.fetchAndParse("temtems", queryParams);
|
61
69
|
});
|
62
70
|
}
|
63
71
|
getTemtemById(id, params) {
|
@@ -66,21 +74,17 @@ var TemtemDex = class {
|
|
66
74
|
if (params == null ? void 0 : params.fields) queryParams.append("fields", params.fields);
|
67
75
|
if (params == null ? void 0 : params.expand) queryParams.append("expand", params.expand);
|
68
76
|
if (params == null ? void 0 : params.weaknesses) queryParams.append("weaknesses", params.weaknesses.toString());
|
69
|
-
|
70
|
-
const response = yield fetch(url);
|
71
|
-
return yield response.json();
|
77
|
+
return this.fetchAndParse(`temtems/${id}`, queryParams);
|
72
78
|
});
|
73
79
|
}
|
74
80
|
getFreetemByTemtemNameAndLevel(name, level) {
|
75
81
|
return __async(this, null, function* () {
|
76
|
-
|
77
|
-
return yield response.json();
|
82
|
+
return this.fetchAndParse(`freetem/${name}/${level}`);
|
78
83
|
});
|
79
84
|
}
|
80
85
|
getFreetemsRewards() {
|
81
86
|
return __async(this, null, function* () {
|
82
|
-
|
83
|
-
return yield response.json();
|
87
|
+
return this.fetchAndParse("freetem/rewards");
|
84
88
|
});
|
85
89
|
}
|
86
90
|
getTypes(params) {
|
@@ -88,9 +92,7 @@ var TemtemDex = class {
|
|
88
92
|
const queryParams = new URLSearchParams();
|
89
93
|
if (params == null ? void 0 : params.fields) queryParams.append("fields", params.fields);
|
90
94
|
if (params == null ? void 0 : params.limit) queryParams.append("limit", params.limit.toString());
|
91
|
-
|
92
|
-
const response = yield fetch(url);
|
93
|
-
return yield response.json();
|
95
|
+
return this.fetchAndParse("types", queryParams);
|
94
96
|
});
|
95
97
|
}
|
96
98
|
getConditions(params) {
|
@@ -98,9 +100,7 @@ var TemtemDex = class {
|
|
98
100
|
const queryParams = new URLSearchParams();
|
99
101
|
if (params == null ? void 0 : params.fields) queryParams.append("fields", params.fields);
|
100
102
|
if (params == null ? void 0 : params.limit) queryParams.append("limit", params.limit.toString());
|
101
|
-
|
102
|
-
const response = yield fetch(url);
|
103
|
-
return yield response.json();
|
103
|
+
return this.fetchAndParse("conditions", queryParams);
|
104
104
|
});
|
105
105
|
}
|
106
106
|
getTechniques(params) {
|
@@ -109,9 +109,7 @@ var TemtemDex = class {
|
|
109
109
|
if (params == null ? void 0 : params.names) queryParams.append("names", params.names);
|
110
110
|
if (params == null ? void 0 : params.fields) queryParams.append("fields", params.fields);
|
111
111
|
if (params == null ? void 0 : params.limit) queryParams.append("limit", params.limit.toString());
|
112
|
-
|
113
|
-
const response = yield fetch(url);
|
114
|
-
return yield response.json();
|
112
|
+
return this.fetchAndParse("techniques", queryParams);
|
115
113
|
});
|
116
114
|
}
|
117
115
|
getTrainingCourses(params) {
|
@@ -119,9 +117,7 @@ var TemtemDex = class {
|
|
119
117
|
const queryParams = new URLSearchParams();
|
120
118
|
if (params == null ? void 0 : params.fields) queryParams.append("fields", params.fields);
|
121
119
|
if (params == null ? void 0 : params.limit) queryParams.append("limit", params.limit.toString());
|
122
|
-
|
123
|
-
const response = yield fetch(url);
|
124
|
-
return yield response.json();
|
120
|
+
return this.fetchAndParse("training-courses", queryParams);
|
125
121
|
});
|
126
122
|
}
|
127
123
|
getTraits(params) {
|
@@ -130,9 +126,7 @@ var TemtemDex = class {
|
|
130
126
|
if (params == null ? void 0 : params.names) queryParams.append("names", params.names);
|
131
127
|
if (params == null ? void 0 : params.fields) queryParams.append("fields", params.fields);
|
132
128
|
if (params == null ? void 0 : params.limit) queryParams.append("limit", params.limit.toString());
|
133
|
-
|
134
|
-
const response = yield fetch(url);
|
135
|
-
return yield response.json();
|
129
|
+
return this.fetchAndParse("traits", queryParams);
|
136
130
|
});
|
137
131
|
}
|
138
132
|
getItems(params) {
|
@@ -140,9 +134,7 @@ var TemtemDex = class {
|
|
140
134
|
const queryParams = new URLSearchParams();
|
141
135
|
if (params == null ? void 0 : params.fields) queryParams.append("fields", params.fields);
|
142
136
|
if (params == null ? void 0 : params.limit) queryParams.append("limit", params.limit.toString());
|
143
|
-
|
144
|
-
const response = yield fetch(url);
|
145
|
-
return yield response.json();
|
137
|
+
return this.fetchAndParse("items", queryParams);
|
146
138
|
});
|
147
139
|
}
|
148
140
|
getGear(params) {
|
@@ -150,9 +142,7 @@ var TemtemDex = class {
|
|
150
142
|
const queryParams = new URLSearchParams();
|
151
143
|
if (params == null ? void 0 : params.fields) queryParams.append("fields", params.fields);
|
152
144
|
if (params == null ? void 0 : params.limit) queryParams.append("limit", params.limit.toString());
|
153
|
-
|
154
|
-
const response = yield fetch(url);
|
155
|
-
return yield response.json();
|
145
|
+
return this.fetchAndParse("gear", queryParams);
|
156
146
|
});
|
157
147
|
}
|
158
148
|
getQuests(params) {
|
@@ -160,15 +150,12 @@ var TemtemDex = class {
|
|
160
150
|
const queryParams = new URLSearchParams();
|
161
151
|
if (params == null ? void 0 : params.fields) queryParams.append("fields", params.fields);
|
162
152
|
if (params == null ? void 0 : params.limit) queryParams.append("limit", params.limit.toString());
|
163
|
-
|
164
|
-
const response = yield fetch(url);
|
165
|
-
return yield response.json();
|
153
|
+
return this.fetchAndParse("quests", queryParams);
|
166
154
|
});
|
167
155
|
}
|
168
156
|
getDojos() {
|
169
157
|
return __async(this, null, function* () {
|
170
|
-
|
171
|
-
return yield response.json();
|
158
|
+
return this.fetchAndParse("dojos");
|
172
159
|
});
|
173
160
|
}
|
174
161
|
getCharacters(params) {
|
@@ -176,9 +163,7 @@ var TemtemDex = class {
|
|
176
163
|
const queryParams = new URLSearchParams();
|
177
164
|
if (params == null ? void 0 : params.fields) queryParams.append("fields", params.fields);
|
178
165
|
if (params == null ? void 0 : params.limit) queryParams.append("limit", params.limit.toString());
|
179
|
-
|
180
|
-
const response = yield fetch(url);
|
181
|
-
return yield response.json();
|
166
|
+
return this.fetchAndParse("characters", queryParams);
|
182
167
|
});
|
183
168
|
}
|
184
169
|
getSaipark(params) {
|
@@ -186,9 +171,7 @@ var TemtemDex = class {
|
|
186
171
|
const queryParams = new URLSearchParams();
|
187
172
|
if (params == null ? void 0 : params.fields) queryParams.append("fields", params.fields);
|
188
173
|
if (params == null ? void 0 : params.limit) queryParams.append("limit", params.limit.toString());
|
189
|
-
|
190
|
-
const response = yield fetch(url);
|
191
|
-
return yield response.json();
|
174
|
+
return this.fetchAndParse("saipark", queryParams);
|
192
175
|
});
|
193
176
|
}
|
194
177
|
getLocations(params) {
|
@@ -196,9 +179,7 @@ var TemtemDex = class {
|
|
196
179
|
const queryParams = new URLSearchParams();
|
197
180
|
if (params == null ? void 0 : params.fields) queryParams.append("fields", params.fields);
|
198
181
|
if (params == null ? void 0 : params.limit) queryParams.append("limit", params.limit.toString());
|
199
|
-
|
200
|
-
const response = yield fetch(url);
|
201
|
-
return yield response.json();
|
182
|
+
return this.fetchAndParse("locations", queryParams);
|
202
183
|
});
|
203
184
|
}
|
204
185
|
getCosmetics(params) {
|
@@ -206,9 +187,7 @@ var TemtemDex = class {
|
|
206
187
|
const queryParams = new URLSearchParams();
|
207
188
|
if (params == null ? void 0 : params.fields) queryParams.append("fields", params.fields);
|
208
189
|
if (params == null ? void 0 : params.limit) queryParams.append("limit", params.limit.toString());
|
209
|
-
|
210
|
-
const response = yield fetch(url);
|
211
|
-
return yield response.json();
|
190
|
+
return this.fetchAndParse("cosmetics", queryParams);
|
212
191
|
});
|
213
192
|
}
|
214
193
|
getDyes(params) {
|
@@ -216,9 +195,7 @@ var TemtemDex = class {
|
|
216
195
|
const queryParams = new URLSearchParams();
|
217
196
|
if (params == null ? void 0 : params.fields) queryParams.append("fields", params.fields);
|
218
197
|
if (params == null ? void 0 : params.limit) queryParams.append("limit", params.limit.toString());
|
219
|
-
|
220
|
-
const response = yield fetch(url);
|
221
|
-
return yield response.json();
|
198
|
+
return this.fetchAndParse("dyes", queryParams);
|
222
199
|
});
|
223
200
|
}
|
224
201
|
getPatches(params) {
|
@@ -226,15 +203,12 @@ var TemtemDex = class {
|
|
226
203
|
const queryParams = new URLSearchParams();
|
227
204
|
if (params == null ? void 0 : params.fields) queryParams.append("fields", params.fields);
|
228
205
|
if (params == null ? void 0 : params.limit) queryParams.append("limit", params.limit.toString());
|
229
|
-
|
230
|
-
const response = yield fetch(url);
|
231
|
-
return yield response.json();
|
206
|
+
return this.fetchAndParse("patches", queryParams);
|
232
207
|
});
|
233
208
|
}
|
234
209
|
getWeaknesses() {
|
235
210
|
return __async(this, null, function* () {
|
236
|
-
|
237
|
-
return yield response.json();
|
211
|
+
return this.fetchAndParse("weaknesses");
|
238
212
|
});
|
239
213
|
}
|
240
214
|
calculateWeaknesses(params) {
|
@@ -242,15 +216,12 @@ var TemtemDex = class {
|
|
242
216
|
const queryParams = new URLSearchParams();
|
243
217
|
queryParams.append("attacking", params.attacking);
|
244
218
|
queryParams.append("defending", params.defending);
|
245
|
-
|
246
|
-
const response = yield fetch(url);
|
247
|
-
return yield response.json();
|
219
|
+
return this.fetchAndParse("weaknesses/calculate", queryParams);
|
248
220
|
});
|
249
221
|
}
|
250
222
|
getBreeding() {
|
251
223
|
return __async(this, null, function* () {
|
252
|
-
|
253
|
-
return yield response.json();
|
224
|
+
return this.fetchAndParse("breeding");
|
254
225
|
});
|
255
226
|
}
|
256
227
|
};
|
package/dist/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import * as Types from './types';\n\nexport * from './types';\n\nexport class TemtemDex {\n private readonly baseUrl: string;\n\n constructor() {\n this.baseUrl = 'https://temtem-api.mael.tech/api';\n }\n\n async getTemtems(params?: Types.TemtemQueryParams) {\n const queryParams = new URLSearchParams();\n \n if (params?.names) queryParams.append('names', params.names);\n if (params?.fields) queryParams.append('fields', params.fields);\n if (params?.expand) queryParams.append('expand', params.expand);\n if (params?.weaknesses) queryParams.append('weaknesses', params.weaknesses.toString());\n\n const url = `${this.baseUrl}/temtems${queryParams.toString() ? '?' + queryParams.toString() : ''}`;\n const response = await fetch(url);\n return await response.json();\n }\n\n async getTemtemById(id: number, params?: Types.TemtemByIdQueryParams) {\n const queryParams = new URLSearchParams();\n \n if (params?.fields) queryParams.append('fields', params.fields);\n if (params?.expand) queryParams.append('expand', params.expand);\n if (params?.weaknesses) queryParams.append('weaknesses', params.weaknesses.toString());\n\n const url = `${this.baseUrl}/temtems/${id}${queryParams.toString() ? '?' + queryParams.toString() : ''}`;\n const response = await fetch(url);\n return await response.json();\n }\n\n async getFreetemByTemtemNameAndLevel(name: string, level: number) {\n const response = await fetch(`${this.baseUrl}/freetem/${name}/${level}`);\n return await response.json();\n }\n\n async getFreetemsRewards() {\n const response = await fetch(`${this.baseUrl}/freetem/rewards`);\n return await response.json();\n }\n\n async getTypes(params?: Types.TypesQueryParams) {\n const queryParams = new URLSearchParams();\n \n if (params?.fields) queryParams.append('fields', params.fields);\n if (params?.limit) queryParams.append('limit', params.limit.toString());\n\n const url = `${this.baseUrl}/types${queryParams.toString() ? '?' + queryParams.toString() : ''}`;\n const response = await fetch(url);\n return await response.json();\n }\n\n async getConditions(params?: Types.ConditionsQueryParams) {\n const queryParams = new URLSearchParams();\n if (params?.fields) queryParams.append('fields', params.fields);\n if (params?.limit) queryParams.append('limit', params.limit.toString());\n \n const url = `${this.baseUrl}/conditions${queryParams.toString() ? '?' + queryParams.toString() : ''}`;\n const response = await fetch(url);\n return await response.json();\n }\n\n async getTechniques(params?: Types.TechniquesQueryParams) {\n const queryParams = new URLSearchParams();\n if (params?.names) queryParams.append('names', params.names);\n if (params?.fields) queryParams.append('fields', params.fields);\n if (params?.limit) queryParams.append('limit', params.limit.toString());\n \n const url = `${this.baseUrl}/techniques${queryParams.toString() ? '?' + queryParams.toString() : ''}`;\n const response = await fetch(url);\n return await response.json();\n }\n\n async getTrainingCourses(params?: Types.TrainingCoursesQueryParams) {\n const queryParams = new URLSearchParams();\n if (params?.fields) queryParams.append('fields', params.fields);\n if (params?.limit) queryParams.append('limit', params.limit.toString());\n \n const url = `${this.baseUrl}/training-courses${queryParams.toString() ? '?' + queryParams.toString() : ''}`;\n const response = await fetch(url);\n return await response.json();\n }\n\n async getTraits(params?: Types.TraitsQueryParams) {\n const queryParams = new URLSearchParams();\n if (params?.names) queryParams.append('names', params.names);\n if (params?.fields) queryParams.append('fields', params.fields);\n if (params?.limit) queryParams.append('limit', params.limit.toString());\n \n const url = `${this.baseUrl}/traits${queryParams.toString() ? '?' + queryParams.toString() : ''}`;\n const response = await fetch(url);\n return await response.json();\n }\n\n async getItems(params?: Types.ItemsQueryParams) {\n const queryParams = new URLSearchParams();\n if (params?.fields) queryParams.append('fields', params.fields);\n if (params?.limit) queryParams.append('limit', params.limit.toString());\n \n const url = `${this.baseUrl}/items${queryParams.toString() ? '?' + queryParams.toString() : ''}`;\n const response = await fetch(url);\n return await response.json();\n }\n\n async getGear(params?: Types.GearQueryParams) {\n const queryParams = new URLSearchParams();\n if (params?.fields) queryParams.append('fields', params.fields);\n if (params?.limit) queryParams.append('limit', params.limit.toString());\n \n const url = `${this.baseUrl}/gear${queryParams.toString() ? '?' + queryParams.toString() : ''}`;\n const response = await fetch(url);\n return await response.json();\n }\n\n async getQuests(params?: Types.BasicQueryParams) {\n const queryParams = new URLSearchParams();\n if (params?.fields) queryParams.append('fields', params.fields);\n if (params?.limit) queryParams.append('limit', params.limit.toString());\n \n const url = `${this.baseUrl}/quests${queryParams.toString() ? '?' + queryParams.toString() : ''}`;\n const response = await fetch(url);\n return await response.json();\n }\n\n async getDojos() {\n const response = await fetch(`${this.baseUrl}/dojos`);\n return await response.json();\n }\n\n async getCharacters(params?: Types.BasicQueryParams) {\n const queryParams = new URLSearchParams();\n if (params?.fields) queryParams.append('fields', params.fields);\n if (params?.limit) queryParams.append('limit', params.limit.toString());\n \n const url = `${this.baseUrl}/characters${queryParams.toString() ? '?' + queryParams.toString() : ''}`;\n const response = await fetch(url);\n return await response.json();\n }\n\n async getSaipark(params?: Types.BasicQueryParams) {\n const queryParams = new URLSearchParams();\n if (params?.fields) queryParams.append('fields', params.fields);\n if (params?.limit) queryParams.append('limit', params.limit.toString());\n \n const url = `${this.baseUrl}/saipark${queryParams.toString() ? '?' + queryParams.toString() : ''}`;\n const response = await fetch(url);\n return await response.json();\n }\n\n async getLocations(params?: Types.BasicQueryParams) {\n const queryParams = new URLSearchParams();\n if (params?.fields) queryParams.append('fields', params.fields);\n if (params?.limit) queryParams.append('limit', params.limit.toString());\n \n const url = `${this.baseUrl}/locations${queryParams.toString() ? '?' + queryParams.toString() : ''}`;\n const response = await fetch(url);\n return await response.json();\n }\n\n async getCosmetics(params?: Types.BasicQueryParams) {\n const queryParams = new URLSearchParams();\n if (params?.fields) queryParams.append('fields', params.fields);\n if (params?.limit) queryParams.append('limit', params.limit.toString());\n \n const url = `${this.baseUrl}/cosmetics${queryParams.toString() ? '?' + queryParams.toString() : ''}`;\n const response = await fetch(url);\n return await response.json();\n }\n\n async getDyes(params?: Types.BasicQueryParams) {\n const queryParams = new URLSearchParams();\n if (params?.fields) queryParams.append('fields', params.fields);\n if (params?.limit) queryParams.append('limit', params.limit.toString());\n \n const url = `${this.baseUrl}/dyes${queryParams.toString() ? '?' + queryParams.toString() : ''}`;\n const response = await fetch(url);\n return await response.json();\n }\n\n async getPatches(params?: Types.BasicQueryParams) {\n const queryParams = new URLSearchParams();\n if (params?.fields) queryParams.append('fields', params.fields);\n if (params?.limit) queryParams.append('limit', params.limit.toString());\n \n const url = `${this.baseUrl}/patches${queryParams.toString() ? '?' + queryParams.toString() : ''}`;\n const response = await fetch(url);\n return await response.json();\n }\n\n async getWeaknesses() {\n const response = await fetch(`${this.baseUrl}/weaknesses`);\n return await response.json();\n }\n\n async calculateWeaknesses(params: Types.WeaknessCalculateParams) {\n const queryParams = new URLSearchParams();\n queryParams.append('attacking', params.attacking);\n queryParams.append('defending', params.defending);\n \n const url = `${this.baseUrl}/weaknesses/calculate?${queryParams.toString()}`;\n const response = await fetch(url);\n return await response.json();\n }\n\n async getBreeding() {\n const response = await fetch(`${this.baseUrl}/breeding`);\n return await response.json();\n }\n}\n\nexport const TemtemApi = Temt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YAAY;","names":[]}
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import * as Types from './types';\n\nexport * from './types';\n\nexport class TemtemDex {\n private readonly baseUrl: string;\n\n constructor() {\n this.baseUrl = 'https://temtem-api.mael.tech/api';\n }\n\n private async fetchAndParse(endpoint: string, queryParams?: URLSearchParams) {\n const url = `${this.baseUrl}/${endpoint}${queryParams?.toString() ? '?' + queryParams.toString() : ''}`;\n const response = await fetch(url);\n if (!response.ok) {\n throw new Error(`HTTP error! status: ${response.status}`);\n }\n return await response.json();\n }\n\n async getTemtems(params?: Types.TemtemQueryParams) {\n const queryParams = new URLSearchParams();\n if (params?.names) queryParams.append('names', params.names);\n if (params?.fields) queryParams.append('fields', params.fields);\n if (params?.expand) queryParams.append('expand', params.expand);\n if (params?.weaknesses) queryParams.append('weaknesses', params.weaknesses.toString());\n return this.fetchAndParse('temtems', queryParams);\n }\n\n async getTemtemById(id: number, params?: Types.TemtemByIdQueryParams) {\n const queryParams = new URLSearchParams();\n if (params?.fields) queryParams.append('fields', params.fields);\n if (params?.expand) queryParams.append('expand', params.expand);\n if (params?.weaknesses) queryParams.append('weaknesses', params.weaknesses.toString());\n return this.fetchAndParse(`temtems/${id}`, queryParams);\n }\n\n async getFreetemByTemtemNameAndLevel(name: string, level: number) {\n return this.fetchAndParse(`freetem/${name}/${level}`);\n }\n\n async getFreetemsRewards() {\n return this.fetchAndParse('freetem/rewards');\n }\n\n async getTypes(params?: Types.TypesQueryParams) {\n const queryParams = new URLSearchParams();\n if (params?.fields) queryParams.append('fields', params.fields);\n if (params?.limit) queryParams.append('limit', params.limit.toString());\n return this.fetchAndParse('types', queryParams);\n }\n\n async getConditions(params?: Types.ConditionsQueryParams) {\n const queryParams = new URLSearchParams();\n if (params?.fields) queryParams.append('fields', params.fields);\n if (params?.limit) queryParams.append('limit', params.limit.toString());\n return this.fetchAndParse('conditions', queryParams);\n }\n\n async getTechniques(params?: Types.TechniquesQueryParams) {\n const queryParams = new URLSearchParams();\n if (params?.names) queryParams.append('names', params.names);\n if (params?.fields) queryParams.append('fields', params.fields);\n if (params?.limit) queryParams.append('limit', params.limit.toString());\n return this.fetchAndParse('techniques', queryParams);\n }\n\n async getTrainingCourses(params?: Types.TrainingCoursesQueryParams) {\n const queryParams = new URLSearchParams();\n if (params?.fields) queryParams.append('fields', params.fields);\n if (params?.limit) queryParams.append('limit', params.limit.toString());\n return this.fetchAndParse('training-courses', queryParams);\n }\n\n async getTraits(params?: Types.TraitsQueryParams) {\n const queryParams = new URLSearchParams();\n if (params?.names) queryParams.append('names', params.names);\n if (params?.fields) queryParams.append('fields', params.fields);\n if (params?.limit) queryParams.append('limit', params.limit.toString());\n return this.fetchAndParse('traits', queryParams);\n }\n\n async getItems(params?: Types.ItemsQueryParams) {\n const queryParams = new URLSearchParams();\n if (params?.fields) queryParams.append('fields', params.fields);\n if (params?.limit) queryParams.append('limit', params.limit.toString());\n return this.fetchAndParse('items', queryParams);\n }\n\n async getGear(params?: Types.GearQueryParams) {\n const queryParams = new URLSearchParams();\n if (params?.fields) queryParams.append('fields', params.fields);\n if (params?.limit) queryParams.append('limit', params.limit.toString());\n return this.fetchAndParse('gear', queryParams);\n }\n\n async getQuests(params?: Types.BasicQueryParams) {\n const queryParams = new URLSearchParams();\n if (params?.fields) queryParams.append('fields', params.fields);\n if (params?.limit) queryParams.append('limit', params.limit.toString());\n return this.fetchAndParse('quests', queryParams);\n }\n\n async getDojos() {\n return this.fetchAndParse('dojos');\n }\n\n async getCharacters(params?: Types.BasicQueryParams) {\n const queryParams = new URLSearchParams();\n if (params?.fields) queryParams.append('fields', params.fields);\n if (params?.limit) queryParams.append('limit', params.limit.toString());\n return this.fetchAndParse('characters', queryParams);\n }\n\n async getSaipark(params?: Types.BasicQueryParams) {\n const queryParams = new URLSearchParams();\n if (params?.fields) queryParams.append('fields', params.fields);\n if (params?.limit) queryParams.append('limit', params.limit.toString());\n return this.fetchAndParse('saipark', queryParams);\n }\n\n async getLocations(params?: Types.BasicQueryParams) {\n const queryParams = new URLSearchParams();\n if (params?.fields) queryParams.append('fields', params.fields);\n if (params?.limit) queryParams.append('limit', params.limit.toString());\n return this.fetchAndParse('locations', queryParams);\n }\n\n async getCosmetics(params?: Types.BasicQueryParams) {\n const queryParams = new URLSearchParams();\n if (params?.fields) queryParams.append('fields', params.fields);\n if (params?.limit) queryParams.append('limit', params.limit.toString());\n return this.fetchAndParse('cosmetics', queryParams);\n }\n\n async getDyes(params?: Types.BasicQueryParams) {\n const queryParams = new URLSearchParams();\n if (params?.fields) queryParams.append('fields', params.fields);\n if (params?.limit) queryParams.append('limit', params.limit.toString());\n return this.fetchAndParse('dyes', queryParams);\n }\n\n async getPatches(params?: Types.BasicQueryParams) {\n const queryParams = new URLSearchParams();\n if (params?.fields) queryParams.append('fields', params.fields);\n if (params?.limit) queryParams.append('limit', params.limit.toString());\n return this.fetchAndParse('patches', queryParams);\n }\n\n async getWeaknesses() {\n return this.fetchAndParse('weaknesses');\n }\n\n async calculateWeaknesses(params: Types.WeaknessCalculateParams) {\n const queryParams = new URLSearchParams();\n queryParams.append('attacking', params.attacking);\n queryParams.append('defending', params.defending);\n return this.fetchAndParse('weaknesses/calculate', queryParams);\n }\n\n async getBreeding() {\n return this.fetchAndParse('breeding');\n }\n}\n\nexport const TemtemApi = TemtemDex;"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIO,IAAM,YAAN,MAAgB;AAAA,EAGnB,cAAc;AACV,SAAK,UAAU;AAAA,EACnB;AAAA,EAEc,cAAc,UAAkB,aAA+B;AAAA;AACzE,YAAM,MAAM,GAAG,KAAK,OAAO,IAAI,QAAQ,IAAG,2CAAa,cAAa,MAAM,YAAY,SAAS,IAAI,EAAE;AACrG,YAAM,WAAW,MAAM,MAAM,GAAG;AAChC,UAAI,CAAC,SAAS,IAAI;AACd,cAAM,IAAI,MAAM,uBAAuB,SAAS,MAAM,EA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AA;AACJ;AAEO,IAAM,YAAY;","names":[]}
|
package/dist/index.mjs
CHANGED
@@ -24,6 +24,16 @@ var TemtemDex = class {
|
|
24
24
|
constructor() {
|
25
25
|
this.baseUrl = "https://temtem-api.mael.tech/api";
|
26
26
|
}
|
27
|
+
fetchAndParse(endpoint, queryParams) {
|
28
|
+
return __async(this, null, function* () {
|
29
|
+
const url = `${this.baseUrl}/${endpoint}${(queryParams == null ? void 0 : queryParams.toString()) ? "?" + queryParams.toString() : ""}`;
|
30
|
+
const response = yield fetch(url);
|
31
|
+
if (!response.ok) {
|
32
|
+
throw new Error(`HTTP error! status: ${response.status}`);
|
33
|
+
}
|
34
|
+
return yield response.json();
|
35
|
+
});
|
36
|
+
}
|
27
37
|
getTemtems(params) {
|
28
38
|
return __async(this, null, function* () {
|
29
39
|
const queryParams = new URLSearchParams();
|
@@ -31,9 +41,7 @@ var TemtemDex = class {
|
|
31
41
|
if (params == null ? void 0 : params.fields) queryParams.append("fields", params.fields);
|
32
42
|
if (params == null ? void 0 : params.expand) queryParams.append("expand", params.expand);
|
33
43
|
if (params == null ? void 0 : params.weaknesses) queryParams.append("weaknesses", params.weaknesses.toString());
|
34
|
-
|
35
|
-
const response = yield fetch(url);
|
36
|
-
return yield response.json();
|
44
|
+
return this.fetchAndParse("temtems", queryParams);
|
37
45
|
});
|
38
46
|
}
|
39
47
|
getTemtemById(id, params) {
|
@@ -42,21 +50,17 @@ var TemtemDex = class {
|
|
42
50
|
if (params == null ? void 0 : params.fields) queryParams.append("fields", params.fields);
|
43
51
|
if (params == null ? void 0 : params.expand) queryParams.append("expand", params.expand);
|
44
52
|
if (params == null ? void 0 : params.weaknesses) queryParams.append("weaknesses", params.weaknesses.toString());
|
45
|
-
|
46
|
-
const response = yield fetch(url);
|
47
|
-
return yield response.json();
|
53
|
+
return this.fetchAndParse(`temtems/${id}`, queryParams);
|
48
54
|
});
|
49
55
|
}
|
50
56
|
getFreetemByTemtemNameAndLevel(name, level) {
|
51
57
|
return __async(this, null, function* () {
|
52
|
-
|
53
|
-
return yield response.json();
|
58
|
+
return this.fetchAndParse(`freetem/${name}/${level}`);
|
54
59
|
});
|
55
60
|
}
|
56
61
|
getFreetemsRewards() {
|
57
62
|
return __async(this, null, function* () {
|
58
|
-
|
59
|
-
return yield response.json();
|
63
|
+
return this.fetchAndParse("freetem/rewards");
|
60
64
|
});
|
61
65
|
}
|
62
66
|
getTypes(params) {
|
@@ -64,9 +68,7 @@ var TemtemDex = class {
|
|
64
68
|
const queryParams = new URLSearchParams();
|
65
69
|
if (params == null ? void 0 : params.fields) queryParams.append("fields", params.fields);
|
66
70
|
if (params == null ? void 0 : params.limit) queryParams.append("limit", params.limit.toString());
|
67
|
-
|
68
|
-
const response = yield fetch(url);
|
69
|
-
return yield response.json();
|
71
|
+
return this.fetchAndParse("types", queryParams);
|
70
72
|
});
|
71
73
|
}
|
72
74
|
getConditions(params) {
|
@@ -74,9 +76,7 @@ var TemtemDex = class {
|
|
74
76
|
const queryParams = new URLSearchParams();
|
75
77
|
if (params == null ? void 0 : params.fields) queryParams.append("fields", params.fields);
|
76
78
|
if (params == null ? void 0 : params.limit) queryParams.append("limit", params.limit.toString());
|
77
|
-
|
78
|
-
const response = yield fetch(url);
|
79
|
-
return yield response.json();
|
79
|
+
return this.fetchAndParse("conditions", queryParams);
|
80
80
|
});
|
81
81
|
}
|
82
82
|
getTechniques(params) {
|
@@ -85,9 +85,7 @@ var TemtemDex = class {
|
|
85
85
|
if (params == null ? void 0 : params.names) queryParams.append("names", params.names);
|
86
86
|
if (params == null ? void 0 : params.fields) queryParams.append("fields", params.fields);
|
87
87
|
if (params == null ? void 0 : params.limit) queryParams.append("limit", params.limit.toString());
|
88
|
-
|
89
|
-
const response = yield fetch(url);
|
90
|
-
return yield response.json();
|
88
|
+
return this.fetchAndParse("techniques", queryParams);
|
91
89
|
});
|
92
90
|
}
|
93
91
|
getTrainingCourses(params) {
|
@@ -95,9 +93,7 @@ var TemtemDex = class {
|
|
95
93
|
const queryParams = new URLSearchParams();
|
96
94
|
if (params == null ? void 0 : params.fields) queryParams.append("fields", params.fields);
|
97
95
|
if (params == null ? void 0 : params.limit) queryParams.append("limit", params.limit.toString());
|
98
|
-
|
99
|
-
const response = yield fetch(url);
|
100
|
-
return yield response.json();
|
96
|
+
return this.fetchAndParse("training-courses", queryParams);
|
101
97
|
});
|
102
98
|
}
|
103
99
|
getTraits(params) {
|
@@ -106,9 +102,7 @@ var TemtemDex = class {
|
|
106
102
|
if (params == null ? void 0 : params.names) queryParams.append("names", params.names);
|
107
103
|
if (params == null ? void 0 : params.fields) queryParams.append("fields", params.fields);
|
108
104
|
if (params == null ? void 0 : params.limit) queryParams.append("limit", params.limit.toString());
|
109
|
-
|
110
|
-
const response = yield fetch(url);
|
111
|
-
return yield response.json();
|
105
|
+
return this.fetchAndParse("traits", queryParams);
|
112
106
|
});
|
113
107
|
}
|
114
108
|
getItems(params) {
|
@@ -116,9 +110,7 @@ var TemtemDex = class {
|
|
116
110
|
const queryParams = new URLSearchParams();
|
117
111
|
if (params == null ? void 0 : params.fields) queryParams.append("fields", params.fields);
|
118
112
|
if (params == null ? void 0 : params.limit) queryParams.append("limit", params.limit.toString());
|
119
|
-
|
120
|
-
const response = yield fetch(url);
|
121
|
-
return yield response.json();
|
113
|
+
return this.fetchAndParse("items", queryParams);
|
122
114
|
});
|
123
115
|
}
|
124
116
|
getGear(params) {
|
@@ -126,9 +118,7 @@ var TemtemDex = class {
|
|
126
118
|
const queryParams = new URLSearchParams();
|
127
119
|
if (params == null ? void 0 : params.fields) queryParams.append("fields", params.fields);
|
128
120
|
if (params == null ? void 0 : params.limit) queryParams.append("limit", params.limit.toString());
|
129
|
-
|
130
|
-
const response = yield fetch(url);
|
131
|
-
return yield response.json();
|
121
|
+
return this.fetchAndParse("gear", queryParams);
|
132
122
|
});
|
133
123
|
}
|
134
124
|
getQuests(params) {
|
@@ -136,15 +126,12 @@ var TemtemDex = class {
|
|
136
126
|
const queryParams = new URLSearchParams();
|
137
127
|
if (params == null ? void 0 : params.fields) queryParams.append("fields", params.fields);
|
138
128
|
if (params == null ? void 0 : params.limit) queryParams.append("limit", params.limit.toString());
|
139
|
-
|
140
|
-
const response = yield fetch(url);
|
141
|
-
return yield response.json();
|
129
|
+
return this.fetchAndParse("quests", queryParams);
|
142
130
|
});
|
143
131
|
}
|
144
132
|
getDojos() {
|
145
133
|
return __async(this, null, function* () {
|
146
|
-
|
147
|
-
return yield response.json();
|
134
|
+
return this.fetchAndParse("dojos");
|
148
135
|
});
|
149
136
|
}
|
150
137
|
getCharacters(params) {
|
@@ -152,9 +139,7 @@ var TemtemDex = class {
|
|
152
139
|
const queryParams = new URLSearchParams();
|
153
140
|
if (params == null ? void 0 : params.fields) queryParams.append("fields", params.fields);
|
154
141
|
if (params == null ? void 0 : params.limit) queryParams.append("limit", params.limit.toString());
|
155
|
-
|
156
|
-
const response = yield fetch(url);
|
157
|
-
return yield response.json();
|
142
|
+
return this.fetchAndParse("characters", queryParams);
|
158
143
|
});
|
159
144
|
}
|
160
145
|
getSaipark(params) {
|
@@ -162,9 +147,7 @@ var TemtemDex = class {
|
|
162
147
|
const queryParams = new URLSearchParams();
|
163
148
|
if (params == null ? void 0 : params.fields) queryParams.append("fields", params.fields);
|
164
149
|
if (params == null ? void 0 : params.limit) queryParams.append("limit", params.limit.toString());
|
165
|
-
|
166
|
-
const response = yield fetch(url);
|
167
|
-
return yield response.json();
|
150
|
+
return this.fetchAndParse("saipark", queryParams);
|
168
151
|
});
|
169
152
|
}
|
170
153
|
getLocations(params) {
|
@@ -172,9 +155,7 @@ var TemtemDex = class {
|
|
172
155
|
const queryParams = new URLSearchParams();
|
173
156
|
if (params == null ? void 0 : params.fields) queryParams.append("fields", params.fields);
|
174
157
|
if (params == null ? void 0 : params.limit) queryParams.append("limit", params.limit.toString());
|
175
|
-
|
176
|
-
const response = yield fetch(url);
|
177
|
-
return yield response.json();
|
158
|
+
return this.fetchAndParse("locations", queryParams);
|
178
159
|
});
|
179
160
|
}
|
180
161
|
getCosmetics(params) {
|
@@ -182,9 +163,7 @@ var TemtemDex = class {
|
|
182
163
|
const queryParams = new URLSearchParams();
|
183
164
|
if (params == null ? void 0 : params.fields) queryParams.append("fields", params.fields);
|
184
165
|
if (params == null ? void 0 : params.limit) queryParams.append("limit", params.limit.toString());
|
185
|
-
|
186
|
-
const response = yield fetch(url);
|
187
|
-
return yield response.json();
|
166
|
+
return this.fetchAndParse("cosmetics", queryParams);
|
188
167
|
});
|
189
168
|
}
|
190
169
|
getDyes(params) {
|
@@ -192,9 +171,7 @@ var TemtemDex = class {
|
|
192
171
|
const queryParams = new URLSearchParams();
|
193
172
|
if (params == null ? void 0 : params.fields) queryParams.append("fields", params.fields);
|
194
173
|
if (params == null ? void 0 : params.limit) queryParams.append("limit", params.limit.toString());
|
195
|
-
|
196
|
-
const response = yield fetch(url);
|
197
|
-
return yield response.json();
|
174
|
+
return this.fetchAndParse("dyes", queryParams);
|
198
175
|
});
|
199
176
|
}
|
200
177
|
getPatches(params) {
|
@@ -202,15 +179,12 @@ var TemtemDex = class {
|
|
202
179
|
const queryParams = new URLSearchParams();
|
203
180
|
if (params == null ? void 0 : params.fields) queryParams.append("fields", params.fields);
|
204
181
|
if (params == null ? void 0 : params.limit) queryParams.append("limit", params.limit.toString());
|
205
|
-
|
206
|
-
const response = yield fetch(url);
|
207
|
-
return yield response.json();
|
182
|
+
return this.fetchAndParse("patches", queryParams);
|
208
183
|
});
|
209
184
|
}
|
210
185
|
getWeaknesses() {
|
211
186
|
return __async(this, null, function* () {
|
212
|
-
|
213
|
-
return yield response.json();
|
187
|
+
return this.fetchAndParse("weaknesses");
|
214
188
|
});
|
215
189
|
}
|
216
190
|
calculateWeaknesses(params) {
|
@@ -218,15 +192,12 @@ var TemtemDex = class {
|
|
218
192
|
const queryParams = new URLSearchParams();
|
219
193
|
queryParams.append("attacking", params.attacking);
|
220
194
|
queryParams.append("defending", params.defending);
|
221
|
-
|
222
|
-
const response = yield fetch(url);
|
223
|
-
return yield response.json();
|
195
|
+
return this.fetchAndParse("weaknesses/calculate", queryParams);
|
224
196
|
});
|
225
197
|
}
|
226
198
|
getBreeding() {
|
227
199
|
return __async(this, null, function* () {
|
228
|
-
|
229
|
-
return yield response.json();
|
200
|
+
return this.fetchAndParse("breeding");
|
230
201
|
});
|
231
202
|
}
|
232
203
|
};
|
package/dist/index.mjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import * as Types from './types';\n\nexport * from './types';\n\nexport class TemtemDex {\n private readonly baseUrl: string;\n\n constructor() {\n this.baseUrl = 'https://temtem-api.mael.tech/api';\n }\n\n async getTemtems(params?: Types.TemtemQueryParams) {\n const queryParams = new URLSearchParams();\n \n if (params?.names) queryParams.append('names', params.names);\n if (params?.fields) queryParams.append('fields', params.fields);\n if (params?.expand) queryParams.append('expand', params.expand);\n if (params?.weaknesses) queryParams.append('weaknesses', params.weaknesses.toString());\n\n const url = `${this.baseUrl}/temtems${queryParams.toString() ? '?' + queryParams.toString() : ''}`;\n const response = await fetch(url);\n return await response.json();\n }\n\n async getTemtemById(id: number, params?: Types.TemtemByIdQueryParams) {\n const queryParams = new URLSearchParams();\n \n if (params?.fields) queryParams.append('fields', params.fields);\n if (params?.expand) queryParams.append('expand', params.expand);\n if (params?.weaknesses) queryParams.append('weaknesses', params.weaknesses.toString());\n\n const url = `${this.baseUrl}/temtems/${id}${queryParams.toString() ? '?' + queryParams.toString() : ''}`;\n const response = await fetch(url);\n return await response.json();\n }\n\n async getFreetemByTemtemNameAndLevel(name: string, level: number) {\n const response = await fetch(`${this.baseUrl}/freetem/${name}/${level}`);\n return await response.json();\n }\n\n async getFreetemsRewards() {\n const response = await fetch(`${this.baseUrl}/freetem/rewards`);\n return await response.json();\n }\n\n async getTypes(params?: Types.TypesQueryParams) {\n const queryParams = new URLSearchParams();\n \n if (params?.fields) queryParams.append('fields', params.fields);\n if (params?.limit) queryParams.append('limit', params.limit.toString());\n\n const url = `${this.baseUrl}/types${queryParams.toString() ? '?' + queryParams.toString() : ''}`;\n const response = await fetch(url);\n return await response.json();\n }\n\n async getConditions(params?: Types.ConditionsQueryParams) {\n const queryParams = new URLSearchParams();\n if (params?.fields) queryParams.append('fields', params.fields);\n if (params?.limit) queryParams.append('limit', params.limit.toString());\n \n const url = `${this.baseUrl}/conditions${queryParams.toString() ? '?' + queryParams.toString() : ''}`;\n const response = await fetch(url);\n return await response.json();\n }\n\n async getTechniques(params?: Types.TechniquesQueryParams) {\n const queryParams = new URLSearchParams();\n if (params?.names) queryParams.append('names', params.names);\n if (params?.fields) queryParams.append('fields', params.fields);\n if (params?.limit) queryParams.append('limit', params.limit.toString());\n \n const url = `${this.baseUrl}/techniques${queryParams.toString() ? '?' + queryParams.toString() : ''}`;\n const response = await fetch(url);\n return await response.json();\n }\n\n async getTrainingCourses(params?: Types.TrainingCoursesQueryParams) {\n const queryParams = new URLSearchParams();\n if (params?.fields) queryParams.append('fields', params.fields);\n if (params?.limit) queryParams.append('limit', params.limit.toString());\n \n const url = `${this.baseUrl}/training-courses${queryParams.toString() ? '?' + queryParams.toString() : ''}`;\n const response = await fetch(url);\n return await response.json();\n }\n\n async getTraits(params?: Types.TraitsQueryParams) {\n const queryParams = new URLSearchParams();\n if (params?.names) queryParams.append('names', params.names);\n if (params?.fields) queryParams.append('fields', params.fields);\n if (params?.limit) queryParams.append('limit', params.limit.toString());\n \n const url = `${this.baseUrl}/traits${queryParams.toString() ? '?' + queryParams.toString() : ''}`;\n const response = await fetch(url);\n return await response.json();\n }\n\n async getItems(params?: Types.ItemsQueryParams) {\n const queryParams = new URLSearchParams();\n if (params?.fields) queryParams.append('fields', params.fields);\n if (params?.limit) queryParams.append('limit', params.limit.toString());\n \n const url = `${this.baseUrl}/items${queryParams.toString() ? '?' + queryParams.toString() : ''}`;\n const response = await fetch(url);\n return await response.json();\n }\n\n async getGear(params?: Types.GearQueryParams) {\n const queryParams = new URLSearchParams();\n if (params?.fields) queryParams.append('fields', params.fields);\n if (params?.limit) queryParams.append('limit', params.limit.toString());\n \n const url = `${this.baseUrl}/gear${queryParams.toString() ? '?' + queryParams.toString() : ''}`;\n const response = await fetch(url);\n return await response.json();\n }\n\n async getQuests(params?: Types.BasicQueryParams) {\n const queryParams = new URLSearchParams();\n if (params?.fields) queryParams.append('fields', params.fields);\n if (params?.limit) queryParams.append('limit', params.limit.toString());\n \n const url = `${this.baseUrl}/quests${queryParams.toString() ? '?' + queryParams.toString() : ''}`;\n const response = await fetch(url);\n return await response.json();\n }\n\n async getDojos() {\n const response = await fetch(`${this.baseUrl}/dojos`);\n return await response.json();\n }\n\n async getCharacters(params?: Types.BasicQueryParams) {\n const queryParams = new URLSearchParams();\n if (params?.fields) queryParams.append('fields', params.fields);\n if (params?.limit) queryParams.append('limit', params.limit.toString());\n \n const url = `${this.baseUrl}/characters${queryParams.toString() ? '?' + queryParams.toString() : ''}`;\n const response = await fetch(url);\n return await response.json();\n }\n\n async getSaipark(params?: Types.BasicQueryParams) {\n const queryParams = new URLSearchParams();\n if (params?.fields) queryParams.append('fields', params.fields);\n if (params?.limit) queryParams.append('limit', params.limit.toString());\n \n const url = `${this.baseUrl}/saipark${queryParams.toString() ? '?' + queryParams.toString() : ''}`;\n const response = await fetch(url);\n return await response.json();\n }\n\n async getLocations(params?: Types.BasicQueryParams) {\n const queryParams = new URLSearchParams();\n if (params?.fields) queryParams.append('fields', params.fields);\n if (params?.limit) queryParams.append('limit', params.limit.toString());\n \n const url = `${this.baseUrl}/locations${queryParams.toString() ? '?' + queryParams.toString() : ''}`;\n const response = await fetch(url);\n return await response.json();\n }\n\n async getCosmetics(params?: Types.BasicQueryParams) {\n const queryParams = new URLSearchParams();\n if (params?.fields) queryParams.append('fields', params.fields);\n if (params?.limit) queryParams.append('limit', params.limit.toString());\n \n const url = `${this.baseUrl}/cosmetics${queryParams.toString() ? '?' + queryParams.toString() : ''}`;\n const response = await fetch(url);\n return await response.json();\n }\n\n async getDyes(params?: Types.BasicQueryParams) {\n const queryParams = new URLSearchParams();\n if (params?.fields) queryParams.append('fields', params.fields);\n if (params?.limit) queryParams.append('limit', params.limit.toString());\n \n const url = `${this.baseUrl}/dyes${queryParams.toString() ? '?' + queryParams.toString() : ''}`;\n const response = await fetch(url);\n return await response.json();\n }\n\n async getPatches(params?: Types.BasicQueryParams) {\n const queryParams = new URLSearchParams();\n if (params?.fields) queryParams.append('fields', params.fields);\n if (params?.limit) queryParams.append('limit', params.limit.toString());\n \n const url = `${this.baseUrl}/patches${queryParams.toString() ? '?' + queryParams.toString() : ''}`;\n const response = await fetch(url);\n return await response.json();\n }\n\n async getWeaknesses() {\n const response = await fetch(`${this.baseUrl}/weaknesses`);\n return await response.json();\n }\n\n async calculateWeaknesses(params: Types.WeaknessCalculateParams) {\n const queryParams = new URLSearchParams();\n queryParams.append('attacking', params.attacking);\n queryParams.append('defending', params.defending);\n \n const url = `${this.baseUrl}/weaknesses/calculate?${queryParams.toString()}`;\n const response = await fetch(url);\n return await response.json();\n }\n\n async getBreeding() {\n const response = await fetch(`${this.baseUrl}/breeding`);\n return await response.json();\n }\n}\n\nexport const TemtemApi = TemtemDex;"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAIO,IAAM,YAAN,MAAgB;AAAA,EAGnB,cAAc;AACV,SAAK,UAAU;AAAA,EACnB;AAAA,EAEM,WAAW,QAAkC;AAAA;AAC/C,YAAM,cAAc,IAAI,gBAAgB;AAExC,UAAI,iCAAQ,MAAO,aAAY,OAAO,SAAS,OAAO,KAAK;AAC3D,UAAI,iCAAQ,OAAQ,aAAY,OAAO,UAAU,OAAO,MAAM;AAC9D,UAAI,iCAAQ,OAAQ,aAAY,OAAO,UAAU,OAAO,MAAM;AAC9D,UAAI,iCAAQ,WAAY,aAAY,OAAO,cAAc,OAAO,WAAW,SAAS,CAAC;AAErF,YAAM,MAAM,GAAG,KAAK,OAAO,WAAW,YAAY,SAAS,IAAI,MAAM,YAAY,SAAS,IAAI,EAAE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AI,EAAE;AAChG,YAAM,WAAW,MAAM,MAAM,GAAG;AAChC,aAAO,MAAM,SAAS,KAAK;AAAA,IAC/B;AAAA;AAAA,EAEM,gBAAgB;AAAA;AAClB,YAAM,WAAW,MAAM,MAAM,GAAG,KAAK,OAAO,aAAa;AACzD,aAAO,MAAM,SAAS,KAAK;AAAA,IAC/B;AAAA;AAAA,EAEM,oBAAoB,QAAuC;AAAA;AAC7D,YAAM,cAAc,IAAI,gBAAgB;AACxC,kBAAY,OAAO,aAAa,OAAO,SAAS;AAChD,kBAAY,OAAO,aAAa,OAAO,SAAS;AAEhD,YAAM,MAAM,GAAG,KAAK,OAAO,yBAAyB,YAAY,SAAS,CAAC;AAC1E,YAAM,WAAW,MAAM,MAAM,GAAG;AAChC,aAAO,MAAM,SAAS,KAAK;AAAA,IAC/B;AAAA;AAAA,EAEM,cAAc;AAAA;AAChB,YAAM,WAAW,MAAM,MAAM,GAAG,KAAK,OAAO,WAAW;AACvD,aAAO,MAAM,SAAS,KAAK;AAAA,IAC/B;AAAA;AACJ;AAEO,IAAM,YAAY;","names":[]}
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import * as Types from './types';\n\nexport * from './types';\n\nexport class TemtemDex {\n private readonly baseUrl: string;\n\n constructor() {\n this.baseUrl = 'https://temtem-api.mael.tech/api';\n }\n\n private async fetchAndParse(endpoint: string, queryParams?: URLSearchParams) {\n const url = `${this.baseUrl}/${endpoint}${queryParams?.toString() ? '?' + queryParams.toString() : ''}`;\n const response = await fetch(url);\n if (!response.ok) {\n throw new Error(`HTTP error! status: ${response.status}`);\n }\n return await response.json();\n }\n\n async getTemtems(params?: Types.TemtemQueryParams) {\n const queryParams = new URLSearchParams();\n if (params?.names) queryParams.append('names', params.names);\n if (params?.fields) queryParams.append('fields', params.fields);\n if (params?.expand) queryParams.append('expand', params.expand);\n if (params?.weaknesses) queryParams.append('weaknesses', params.weaknesses.toString());\n return this.fetchAndParse('temtems', queryParams);\n }\n\n async getTemtemById(id: number, params?: Types.TemtemByIdQueryParams) {\n const queryParams = new URLSearchParams();\n if (params?.fields) queryParams.append('fields', params.fields);\n if (params?.expand) queryParams.append('expand', params.expand);\n if (params?.weaknesses) queryParams.append('weaknesses', params.weaknesses.toString());\n return this.fetchAndParse(`temtems/${id}`, queryParams);\n }\n\n async getFreetemByTemtemNameAndLevel(name: string, level: number) {\n return this.fetchAndParse(`freetem/${name}/${level}`);\n }\n\n async getFreetemsRewards() {\n return this.fetchAndParse('freetem/rewards');\n }\n\n async getTypes(params?: Types.TypesQueryParams) {\n const queryParams = new URLSearchParams();\n if (params?.fields) queryParams.append('fields', params.fields);\n if (params?.limit) queryParams.append('limit', params.limit.toString());\n return this.fetchAndParse('types', queryParams);\n }\n\n async getConditions(params?: Types.ConditionsQueryParams) {\n const queryParams = new URLSearchParams();\n if (params?.fields) queryParams.append('fields', params.fields);\n if (params?.limit) queryParams.append('limit', params.limit.toString());\n return this.fetchAndParse('conditions', queryParams);\n }\n\n async getTechniques(params?: Types.TechniquesQueryParams) {\n const queryParams = new URLSearchParams();\n if (params?.names) queryParams.append('names', params.names);\n if (params?.fields) queryParams.append('fields', params.fields);\n if (params?.limit) queryParams.append('limit', params.limit.toString());\n return this.fetchAndParse('techniques', queryParams);\n }\n\n async getTrainingCourses(params?: Types.TrainingCoursesQueryParams) {\n const queryParams = new URLSearchParams();\n if (params?.fields) queryParams.append('fields', params.fields);\n if (params?.limit) queryParams.append('limit', params.limit.toString());\n return this.fetchAndParse('training-courses', queryParams);\n }\n\n async getTraits(params?: Types.TraitsQueryParams) {\n const queryParams = new URLSearchParams();\n if (params?.names) queryParams.append('names', params.names);\n if (params?.fields) queryParams.append('fields', params.fields);\n if (params?.limit) queryParams.append('limit', params.limit.toString());\n return this.fetchAndParse('traits', queryParams);\n }\n\n async getItems(params?: Types.ItemsQueryParams) {\n const queryParams = new URLSearchParams();\n if (params?.fields) queryParams.append('fields', params.fields);\n if (params?.limit) queryParams.append('limit', params.limit.toString());\n return this.fetchAndParse('items', queryParams);\n }\n\n async getGear(params?: Types.GearQueryParams) {\n const queryParams = new URLSearchParams();\n if (params?.fields) queryParams.append('fields', params.fields);\n if (params?.limit) queryParams.append('limit', params.limit.toString());\n return this.fetchAndParse('gear', queryParams);\n }\n\n async getQuests(params?: Types.BasicQueryParams) {\n const queryParams = new URLSearchParams();\n if (params?.fields) queryParams.append('fields', params.fields);\n if (params?.limit) queryParams.append('limit', params.limit.toString());\n return this.fetchAndParse('quests', queryParams);\n }\n\n async getDojos() {\n return this.fetchAndParse('dojos');\n }\n\n async getCharacters(params?: Types.BasicQueryParams) {\n const queryParams = new URLSearchParams();\n if (params?.fields) queryParams.append('fields', params.fields);\n if (params?.limit) queryParams.append('limit', params.limit.toString());\n return this.fetchAndParse('characters', queryParams);\n }\n\n async getSaipark(params?: Types.BasicQueryParams) {\n const queryParams = new URLSearchParams();\n if (params?.fields) queryParams.append('fields', params.fields);\n if (params?.limit) queryParams.append('limit', params.limit.toString());\n return this.fetchAndParse('saipark', queryParams);\n }\n\n async getLocations(params?: Types.BasicQueryParams) {\n const queryParams = new URLSearchParams();\n if (params?.fields) queryParams.append('fields', params.fields);\n if (params?.limit) queryParams.append('limit', params.limit.toString());\n return this.fetchAndParse('locations', queryParams);\n }\n\n async getCosmetics(params?: Types.BasicQueryParams) {\n const queryParams = new URLSearchParams();\n if (params?.fields) queryParams.append('fields', params.fields);\n if (params?.limit) queryParams.append('limit', params.limit.toString());\n return this.fetchAndParse('cosmetics', queryParams);\n }\n\n async getDyes(params?: Types.BasicQueryParams) {\n const queryParams = new URLSearchParams();\n if (params?.fields) queryParams.append('fields', params.fields);\n if (params?.limit) queryParams.append('limit', params.limit.toString());\n return this.fetchAndParse('dyes', queryParams);\n }\n\n async getPatches(params?: Types.BasicQueryParams) {\n const queryParams = new URLSearchParams();\n if (params?.fields) queryParams.append('fields', params.fields);\n if (params?.limit) queryParams.append('limit', params.limit.toString());\n return this.fetchAndParse('patches', queryParams);\n }\n\n async getWeaknesses() {\n return this.fetchAndParse('weaknesses');\n }\n\n async calculateWeaknesses(params: Types.WeaknessCalculateParams) {\n const queryParams = new URLSearchParams();\n queryParams.append('attacking', params.attacking);\n queryParams.append('defending', params.defending);\n return this.fetchAndParse('weaknesses/calculate', queryParams);\n }\n\n async getBreeding() {\n return this.fetchAndParse('breeding');\n }\n}\n\nexport const TemtemApi = TemtemDex;"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAIO,IAAM,YAAN,MAAgB;AAAA,EAGnB,cAAc;AACV,SAAK,UAAU;AAAA,EACnB;AAAA,EAEc,cAAc,UAAkB,aAA+B;AAAA;AACzE,YAAM,MAAM,GAAG,KAAK,OAAO,IAAI,QAAQ,IAAG,2CAAa,cAAa,MAAM,YAAY,SAAS,IAAI,EAAE;AACrG,YAAM,WAAW,MAAM,MAAM,GAAG;AAChC,UAAI,CAAC,SAAS,IAAI;AACd,cAAM,IAAI,MAAM,uBAAuB,SAAS,MAAM,EAAE;AAAA,MAC5D;AACA,aAAO,MAAM,SAAS,KAAK;AAAA,IAC/B;AAAA;AAAA,EAEM,WAAW,QAAkC;AAAA;AAC/C,YAAM,cAAc,IAAI,gBAAgB;AACxC,UAAI,iCAAQ,MAAO,aAAY,OAAO,SAAS,OAAO,KAAK;AAC3D,UAAI,iCAAQ,OAAQ,aAAY,OAAO,UAAU,OAAO,MAAM;AAC9D,UAAI,iCAAQ,OAAQ,aAAY,OAAO,UAAU,OAAO,MAAM;AAC9D,UAAI,iCAAQ,WAAY,aAAY,OAAO,cAAc,OAAO,WAAW,SAAS,CAAC;AACrF,aAAO,KAAK,cAAc,WAAW,WAAW;AAAA,IACpD;AAAA;AAAA,EAEM,cAAc,IAAY,QAAsC;AAAA;AAClE,YAAM,cAAc,IAAI,gBAAgB;AACxC,UAAI,iCAAQ,OAAQ,aAAY,OAAO,UAAU,OAAO,MAAM;AAC9D,UAAI,iCAAQ,OAAQ,aAAY,OAAO,UAAU,OAAO,MAAM;AAC9D,UAAI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AA,IACjD;AAAA;AAAA,EAEM,WAAW,QAAiC;AAAA;AAC9C,YAAM,cAAc,IAAI,gBAAgB;AACxC,UAAI,iCAAQ,OAAQ,aAAY,OAAO,UAAU,OAAO,MAAM;AAC9D,UAAI,iCAAQ,MAAO,aAAY,OAAO,SAAS,OAAO,MAAM,SAAS,CAAC;AACtE,aAAO,KAAK,cAAc,WAAW,WAAW;AAAA,IACpD;AAAA;AAAA,EAEM,gBAAgB;AAAA;AAClB,aAAO,KAAK,cAAc,YAAY;AAAA,IAC1C;AAAA;AAAA,EAEM,oBAAoB,QAAuC;AAAA;AAC7D,YAAM,cAAc,IAAI,gBAAgB;AACxC,kBAAY,OAAO,aAAa,OAAO,SAAS;AAChD,kBAAY,OAAO,aAAa,OAAO,SAAS;AAChD,aAAO,KAAK,cAAc,wBAAwB,WAAW;AAAA,IACjE;AAAA;AAAA,EAEM,cAAc;AAAA;AAChB,aAAO,KAAK,cAAc,UAAU;AAAA,IACxC;AAAA;AACJ;AAEO,IAAM,YAAY;","names":[]}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ryyseexvi/temtem-promise-v1",
|
3
|
-
"version": "1.1.
|
3
|
+
"version": "1.1.3",
|
4
4
|
"description": "A package that return all of the Temtem API calls as methods in a class",
|
5
5
|
"main": "./dist/index.js",
|
6
6
|
"module": "./dist/index.mjs",
|
@@ -31,6 +31,7 @@
|
|
31
31
|
},
|
32
32
|
"homepage": "https://github.com/ryyseeXVI/temtem-promise-v1#readme",
|
33
33
|
"devDependencies": {
|
34
|
+
"@types/jest": "^29.5.14",
|
34
35
|
"husky": "^9.1.7",
|
35
36
|
"ts-node": "^10.9.2",
|
36
37
|
"tsup": "^8.3.5",
|
@@ -42,5 +43,9 @@
|
|
42
43
|
],
|
43
44
|
"publishConfig": {
|
44
45
|
"access": "public"
|
46
|
+
},
|
47
|
+
"dependencies": {
|
48
|
+
"@types/node-fetch": "^2.6.12",
|
49
|
+
"node-fetch": "^3.3.2"
|
45
50
|
}
|
46
51
|
}
|