@ryyseexvi/temtem-promise-v1 1.0.1 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +18 -1
- package/dist/index.d.mts +16 -34
- package/dist/index.d.ts +16 -34
- package/dist/index.js +38 -64
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +36 -63
- package/dist/index.mjs.map +1 -1
- package/package.json +49 -41
package/README.md
CHANGED
@@ -9,13 +9,14 @@ A modern TypeScript wrapper for the [Temtem API](https://temtem-api.mael.tech),
|
|
9
9
|
|
10
10
|
```sh
|
11
11
|
npm install temtem-promise-v1
|
12
|
+
```
|
12
13
|
|
13
14
|
🚀 Usage
|
14
15
|
|
15
16
|
```ts
|
16
17
|
import { TemtemAPI } from 'temtem-promise';
|
17
18
|
|
18
|
-
const api = new
|
19
|
+
const api = new TemtemDex();
|
19
20
|
|
20
21
|
// Example: Get all Temtems
|
21
22
|
const temtems = await api.getTemtems();
|
@@ -30,6 +31,7 @@ const filteredTemtems = await api.getTemtems({
|
|
30
31
|
expand: "evolution",
|
31
32
|
weaknesses: true
|
32
33
|
});
|
34
|
+
```
|
33
35
|
|
34
36
|
📚 Available Methods
|
35
37
|
- getTemtems(params?: TemtemQueryParams)
|
@@ -62,8 +64,23 @@ All methods that accept parameters support filtering the response using:
|
|
62
64
|
- limit: Limit the number of results
|
63
65
|
Some endpoints support additional parameters like names, expand, and weaknesses.
|
64
66
|
|
67
|
+
🏷️ Used Types/Interfaces
|
68
|
+
- BasicQueryParams { fields?: string, limit?: number }
|
69
|
+
- TemtemQueryParams extends BasicQueryParams { names?: string, expand?: string, weaknesses?: boolean }
|
70
|
+
- TemtemByIdQueryParams { fields?: string, expand?: string, weaknesses?: boolean }
|
71
|
+
- TechniquesQueryParams extends BasicQueryParams { names?: string }
|
72
|
+
- TraitsQueryParams extends BasicQueryParams { names?: string }
|
73
|
+
- TypesQueryParams = BasicQueryParams
|
74
|
+
- ConditionsQueryParams = BasicQueryParams
|
75
|
+
- TrainingCoursesQueryParams = BasicQueryParams
|
76
|
+
- ItemsQueryParams = BasicQueryParams
|
77
|
+
- GearQueryParams = BasicQueryParams
|
78
|
+
- WeaknessCalculateParams { attacking: string, defending: string }
|
79
|
+
|
65
80
|
📄 License
|
66
81
|
MIT
|
67
82
|
|
68
83
|
🤝 Contributing
|
69
84
|
This wrapper uses the Temtem API provided by https://temtem-api.mael.tech
|
85
|
+
|
86
|
+
# Using his typing package is strongly recommended until its included here.
|
package/dist/index.d.mts
CHANGED
@@ -1,6 +1,9 @@
|
|
1
|
-
interface
|
2
|
-
names?: string;
|
1
|
+
interface BasicQueryParams {
|
3
2
|
fields?: string;
|
3
|
+
limit?: number;
|
4
|
+
}
|
5
|
+
interface TemtemQueryParams extends BasicQueryParams {
|
6
|
+
names?: string;
|
4
7
|
expand?: string;
|
5
8
|
weaknesses?: boolean;
|
6
9
|
}
|
@@ -9,48 +12,26 @@ interface TemtemByIdQueryParams {
|
|
9
12
|
expand?: string;
|
10
13
|
weaknesses?: boolean;
|
11
14
|
}
|
12
|
-
interface
|
13
|
-
fields?: string;
|
14
|
-
limit?: number;
|
15
|
-
}
|
16
|
-
interface ConditionsQueryParams {
|
17
|
-
fields?: string;
|
18
|
-
limit?: number;
|
19
|
-
}
|
20
|
-
interface TechniquesQueryParams {
|
15
|
+
interface TechniquesQueryParams extends BasicQueryParams {
|
21
16
|
names?: string;
|
22
|
-
fields?: string;
|
23
|
-
limit?: number;
|
24
|
-
}
|
25
|
-
interface TrainingCoursesQueryParams {
|
26
|
-
fields?: string;
|
27
|
-
limit?: number;
|
28
17
|
}
|
29
|
-
interface TraitsQueryParams {
|
18
|
+
interface TraitsQueryParams extends BasicQueryParams {
|
30
19
|
names?: string;
|
31
|
-
fields?: string;
|
32
|
-
limit?: number;
|
33
|
-
}
|
34
|
-
interface ItemsQueryParams {
|
35
|
-
fields?: string;
|
36
|
-
limit?: number;
|
37
|
-
}
|
38
|
-
interface GearQueryParams {
|
39
|
-
fields?: string;
|
40
|
-
limit?: number;
|
41
|
-
}
|
42
|
-
interface BasicQueryParams {
|
43
|
-
fields?: string;
|
44
|
-
limit?: number;
|
45
20
|
}
|
46
21
|
interface WeaknessCalculateParams {
|
47
22
|
attacking: string;
|
48
23
|
defending: string;
|
49
24
|
}
|
25
|
+
type TypesQueryParams = BasicQueryParams;
|
26
|
+
type ConditionsQueryParams = BasicQueryParams;
|
27
|
+
type TrainingCoursesQueryParams = BasicQueryParams;
|
28
|
+
type ItemsQueryParams = BasicQueryParams;
|
29
|
+
type GearQueryParams = BasicQueryParams;
|
50
30
|
|
51
|
-
declare class
|
31
|
+
declare class TemtemDex {
|
52
32
|
private readonly baseUrl;
|
53
33
|
constructor();
|
34
|
+
private fetchAndParse;
|
54
35
|
getTemtems(params?: TemtemQueryParams): Promise<any>;
|
55
36
|
getTemtemById(id: number, params?: TemtemByIdQueryParams): Promise<any>;
|
56
37
|
getFreetemByTemtemNameAndLevel(name: string, level: number): Promise<any>;
|
@@ -74,5 +55,6 @@ declare class TemtemAPI {
|
|
74
55
|
calculateWeaknesses(params: WeaknessCalculateParams): Promise<any>;
|
75
56
|
getBreeding(): Promise<any>;
|
76
57
|
}
|
58
|
+
declare const TemtemApi: typeof TemtemDex;
|
77
59
|
|
78
|
-
export {
|
60
|
+
export { type BasicQueryParams, type ConditionsQueryParams, type GearQueryParams, type ItemsQueryParams, type TechniquesQueryParams, TemtemApi, type TemtemByIdQueryParams, TemtemDex, type TemtemQueryParams, type TrainingCoursesQueryParams, type TraitsQueryParams, type TypesQueryParams, type WeaknessCalculateParams };
|
package/dist/index.d.ts
CHANGED
@@ -1,6 +1,9 @@
|
|
1
|
-
interface
|
2
|
-
names?: string;
|
1
|
+
interface BasicQueryParams {
|
3
2
|
fields?: string;
|
3
|
+
limit?: number;
|
4
|
+
}
|
5
|
+
interface TemtemQueryParams extends BasicQueryParams {
|
6
|
+
names?: string;
|
4
7
|
expand?: string;
|
5
8
|
weaknesses?: boolean;
|
6
9
|
}
|
@@ -9,48 +12,26 @@ interface TemtemByIdQueryParams {
|
|
9
12
|
expand?: string;
|
10
13
|
weaknesses?: boolean;
|
11
14
|
}
|
12
|
-
interface
|
13
|
-
fields?: string;
|
14
|
-
limit?: number;
|
15
|
-
}
|
16
|
-
interface ConditionsQueryParams {
|
17
|
-
fields?: string;
|
18
|
-
limit?: number;
|
19
|
-
}
|
20
|
-
interface TechniquesQueryParams {
|
15
|
+
interface TechniquesQueryParams extends BasicQueryParams {
|
21
16
|
names?: string;
|
22
|
-
fields?: string;
|
23
|
-
limit?: number;
|
24
|
-
}
|
25
|
-
interface TrainingCoursesQueryParams {
|
26
|
-
fields?: string;
|
27
|
-
limit?: number;
|
28
17
|
}
|
29
|
-
interface TraitsQueryParams {
|
18
|
+
interface TraitsQueryParams extends BasicQueryParams {
|
30
19
|
names?: string;
|
31
|
-
fields?: string;
|
32
|
-
limit?: number;
|
33
|
-
}
|
34
|
-
interface ItemsQueryParams {
|
35
|
-
fields?: string;
|
36
|
-
limit?: number;
|
37
|
-
}
|
38
|
-
interface GearQueryParams {
|
39
|
-
fields?: string;
|
40
|
-
limit?: number;
|
41
|
-
}
|
42
|
-
interface BasicQueryParams {
|
43
|
-
fields?: string;
|
44
|
-
limit?: number;
|
45
20
|
}
|
46
21
|
interface WeaknessCalculateParams {
|
47
22
|
attacking: string;
|
48
23
|
defending: string;
|
49
24
|
}
|
25
|
+
type TypesQueryParams = BasicQueryParams;
|
26
|
+
type ConditionsQueryParams = BasicQueryParams;
|
27
|
+
type TrainingCoursesQueryParams = BasicQueryParams;
|
28
|
+
type ItemsQueryParams = BasicQueryParams;
|
29
|
+
type GearQueryParams = BasicQueryParams;
|
50
30
|
|
51
|
-
declare class
|
31
|
+
declare class TemtemDex {
|
52
32
|
private readonly baseUrl;
|
53
33
|
constructor();
|
34
|
+
private fetchAndParse;
|
54
35
|
getTemtems(params?: TemtemQueryParams): Promise<any>;
|
55
36
|
getTemtemById(id: number, params?: TemtemByIdQueryParams): Promise<any>;
|
56
37
|
getFreetemByTemtemNameAndLevel(name: string, level: number): Promise<any>;
|
@@ -74,5 +55,6 @@ declare class TemtemAPI {
|
|
74
55
|
calculateWeaknesses(params: WeaknessCalculateParams): Promise<any>;
|
75
56
|
getBreeding(): Promise<any>;
|
76
57
|
}
|
58
|
+
declare const TemtemApi: typeof TemtemDex;
|
77
59
|
|
78
|
-
export {
|
60
|
+
export { type BasicQueryParams, type ConditionsQueryParams, type GearQueryParams, type ItemsQueryParams, type TechniquesQueryParams, TemtemApi, type TemtemByIdQueryParams, TemtemDex, type TemtemQueryParams, type TrainingCoursesQueryParams, type TraitsQueryParams, type TypesQueryParams, type WeaknessCalculateParams };
|
package/dist/index.js
CHANGED
@@ -40,13 +40,24 @@ var __async = (__this, __arguments, generator) => {
|
|
40
40
|
// src/index.ts
|
41
41
|
var src_exports = {};
|
42
42
|
__export(src_exports, {
|
43
|
-
|
43
|
+
TemtemApi: () => TemtemApi,
|
44
|
+
TemtemDex: () => TemtemDex
|
44
45
|
});
|
45
46
|
module.exports = __toCommonJS(src_exports);
|
46
|
-
var
|
47
|
+
var TemtemDex = class {
|
47
48
|
constructor() {
|
48
49
|
this.baseUrl = "https://temtem-api.mael.tech/api";
|
49
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
|
+
}
|
50
61
|
getTemtems(params) {
|
51
62
|
return __async(this, null, function* () {
|
52
63
|
const queryParams = new URLSearchParams();
|
@@ -54,9 +65,7 @@ var TemtemAPI = class {
|
|
54
65
|
if (params == null ? void 0 : params.fields) queryParams.append("fields", params.fields);
|
55
66
|
if (params == null ? void 0 : params.expand) queryParams.append("expand", params.expand);
|
56
67
|
if (params == null ? void 0 : params.weaknesses) queryParams.append("weaknesses", params.weaknesses.toString());
|
57
|
-
|
58
|
-
const response = yield fetch(url);
|
59
|
-
return yield response.json();
|
68
|
+
return this.fetchAndParse("temtems", queryParams);
|
60
69
|
});
|
61
70
|
}
|
62
71
|
getTemtemById(id, params) {
|
@@ -65,21 +74,17 @@ var TemtemAPI = class {
|
|
65
74
|
if (params == null ? void 0 : params.fields) queryParams.append("fields", params.fields);
|
66
75
|
if (params == null ? void 0 : params.expand) queryParams.append("expand", params.expand);
|
67
76
|
if (params == null ? void 0 : params.weaknesses) queryParams.append("weaknesses", params.weaknesses.toString());
|
68
|
-
|
69
|
-
const response = yield fetch(url);
|
70
|
-
return yield response.json();
|
77
|
+
return this.fetchAndParse(`temtems/${id}`, queryParams);
|
71
78
|
});
|
72
79
|
}
|
73
80
|
getFreetemByTemtemNameAndLevel(name, level) {
|
74
81
|
return __async(this, null, function* () {
|
75
|
-
|
76
|
-
return yield response.json();
|
82
|
+
return this.fetchAndParse(`freetem/${name}/${level}`);
|
77
83
|
});
|
78
84
|
}
|
79
85
|
getFreetemsRewards() {
|
80
86
|
return __async(this, null, function* () {
|
81
|
-
|
82
|
-
return yield response.json();
|
87
|
+
return this.fetchAndParse("freetem/rewards");
|
83
88
|
});
|
84
89
|
}
|
85
90
|
getTypes(params) {
|
@@ -87,9 +92,7 @@ var TemtemAPI = class {
|
|
87
92
|
const queryParams = new URLSearchParams();
|
88
93
|
if (params == null ? void 0 : params.fields) queryParams.append("fields", params.fields);
|
89
94
|
if (params == null ? void 0 : params.limit) queryParams.append("limit", params.limit.toString());
|
90
|
-
|
91
|
-
const response = yield fetch(url);
|
92
|
-
return yield response.json();
|
95
|
+
return this.fetchAndParse("types", queryParams);
|
93
96
|
});
|
94
97
|
}
|
95
98
|
getConditions(params) {
|
@@ -97,9 +100,7 @@ var TemtemAPI = class {
|
|
97
100
|
const queryParams = new URLSearchParams();
|
98
101
|
if (params == null ? void 0 : params.fields) queryParams.append("fields", params.fields);
|
99
102
|
if (params == null ? void 0 : params.limit) queryParams.append("limit", params.limit.toString());
|
100
|
-
|
101
|
-
const response = yield fetch(url);
|
102
|
-
return yield response.json();
|
103
|
+
return this.fetchAndParse("conditions", queryParams);
|
103
104
|
});
|
104
105
|
}
|
105
106
|
getTechniques(params) {
|
@@ -108,9 +109,7 @@ var TemtemAPI = class {
|
|
108
109
|
if (params == null ? void 0 : params.names) queryParams.append("names", params.names);
|
109
110
|
if (params == null ? void 0 : params.fields) queryParams.append("fields", params.fields);
|
110
111
|
if (params == null ? void 0 : params.limit) queryParams.append("limit", params.limit.toString());
|
111
|
-
|
112
|
-
const response = yield fetch(url);
|
113
|
-
return yield response.json();
|
112
|
+
return this.fetchAndParse("techniques", queryParams);
|
114
113
|
});
|
115
114
|
}
|
116
115
|
getTrainingCourses(params) {
|
@@ -118,9 +117,7 @@ var TemtemAPI = class {
|
|
118
117
|
const queryParams = new URLSearchParams();
|
119
118
|
if (params == null ? void 0 : params.fields) queryParams.append("fields", params.fields);
|
120
119
|
if (params == null ? void 0 : params.limit) queryParams.append("limit", params.limit.toString());
|
121
|
-
|
122
|
-
const response = yield fetch(url);
|
123
|
-
return yield response.json();
|
120
|
+
return this.fetchAndParse("training-courses", queryParams);
|
124
121
|
});
|
125
122
|
}
|
126
123
|
getTraits(params) {
|
@@ -129,9 +126,7 @@ var TemtemAPI = class {
|
|
129
126
|
if (params == null ? void 0 : params.names) queryParams.append("names", params.names);
|
130
127
|
if (params == null ? void 0 : params.fields) queryParams.append("fields", params.fields);
|
131
128
|
if (params == null ? void 0 : params.limit) queryParams.append("limit", params.limit.toString());
|
132
|
-
|
133
|
-
const response = yield fetch(url);
|
134
|
-
return yield response.json();
|
129
|
+
return this.fetchAndParse("traits", queryParams);
|
135
130
|
});
|
136
131
|
}
|
137
132
|
getItems(params) {
|
@@ -139,9 +134,7 @@ var TemtemAPI = class {
|
|
139
134
|
const queryParams = new URLSearchParams();
|
140
135
|
if (params == null ? void 0 : params.fields) queryParams.append("fields", params.fields);
|
141
136
|
if (params == null ? void 0 : params.limit) queryParams.append("limit", params.limit.toString());
|
142
|
-
|
143
|
-
const response = yield fetch(url);
|
144
|
-
return yield response.json();
|
137
|
+
return this.fetchAndParse("items", queryParams);
|
145
138
|
});
|
146
139
|
}
|
147
140
|
getGear(params) {
|
@@ -149,9 +142,7 @@ var TemtemAPI = class {
|
|
149
142
|
const queryParams = new URLSearchParams();
|
150
143
|
if (params == null ? void 0 : params.fields) queryParams.append("fields", params.fields);
|
151
144
|
if (params == null ? void 0 : params.limit) queryParams.append("limit", params.limit.toString());
|
152
|
-
|
153
|
-
const response = yield fetch(url);
|
154
|
-
return yield response.json();
|
145
|
+
return this.fetchAndParse("gear", queryParams);
|
155
146
|
});
|
156
147
|
}
|
157
148
|
getQuests(params) {
|
@@ -159,15 +150,12 @@ var TemtemAPI = class {
|
|
159
150
|
const queryParams = new URLSearchParams();
|
160
151
|
if (params == null ? void 0 : params.fields) queryParams.append("fields", params.fields);
|
161
152
|
if (params == null ? void 0 : params.limit) queryParams.append("limit", params.limit.toString());
|
162
|
-
|
163
|
-
const response = yield fetch(url);
|
164
|
-
return yield response.json();
|
153
|
+
return this.fetchAndParse("quests", queryParams);
|
165
154
|
});
|
166
155
|
}
|
167
156
|
getDojos() {
|
168
157
|
return __async(this, null, function* () {
|
169
|
-
|
170
|
-
return yield response.json();
|
158
|
+
return this.fetchAndParse("dojos");
|
171
159
|
});
|
172
160
|
}
|
173
161
|
getCharacters(params) {
|
@@ -175,9 +163,7 @@ var TemtemAPI = class {
|
|
175
163
|
const queryParams = new URLSearchParams();
|
176
164
|
if (params == null ? void 0 : params.fields) queryParams.append("fields", params.fields);
|
177
165
|
if (params == null ? void 0 : params.limit) queryParams.append("limit", params.limit.toString());
|
178
|
-
|
179
|
-
const response = yield fetch(url);
|
180
|
-
return yield response.json();
|
166
|
+
return this.fetchAndParse("characters", queryParams);
|
181
167
|
});
|
182
168
|
}
|
183
169
|
getSaipark(params) {
|
@@ -185,9 +171,7 @@ var TemtemAPI = class {
|
|
185
171
|
const queryParams = new URLSearchParams();
|
186
172
|
if (params == null ? void 0 : params.fields) queryParams.append("fields", params.fields);
|
187
173
|
if (params == null ? void 0 : params.limit) queryParams.append("limit", params.limit.toString());
|
188
|
-
|
189
|
-
const response = yield fetch(url);
|
190
|
-
return yield response.json();
|
174
|
+
return this.fetchAndParse("saipark", queryParams);
|
191
175
|
});
|
192
176
|
}
|
193
177
|
getLocations(params) {
|
@@ -195,9 +179,7 @@ var TemtemAPI = class {
|
|
195
179
|
const queryParams = new URLSearchParams();
|
196
180
|
if (params == null ? void 0 : params.fields) queryParams.append("fields", params.fields);
|
197
181
|
if (params == null ? void 0 : params.limit) queryParams.append("limit", params.limit.toString());
|
198
|
-
|
199
|
-
const response = yield fetch(url);
|
200
|
-
return yield response.json();
|
182
|
+
return this.fetchAndParse("locations", queryParams);
|
201
183
|
});
|
202
184
|
}
|
203
185
|
getCosmetics(params) {
|
@@ -205,9 +187,7 @@ var TemtemAPI = class {
|
|
205
187
|
const queryParams = new URLSearchParams();
|
206
188
|
if (params == null ? void 0 : params.fields) queryParams.append("fields", params.fields);
|
207
189
|
if (params == null ? void 0 : params.limit) queryParams.append("limit", params.limit.toString());
|
208
|
-
|
209
|
-
const response = yield fetch(url);
|
210
|
-
return yield response.json();
|
190
|
+
return this.fetchAndParse("cosmetics", queryParams);
|
211
191
|
});
|
212
192
|
}
|
213
193
|
getDyes(params) {
|
@@ -215,9 +195,7 @@ var TemtemAPI = class {
|
|
215
195
|
const queryParams = new URLSearchParams();
|
216
196
|
if (params == null ? void 0 : params.fields) queryParams.append("fields", params.fields);
|
217
197
|
if (params == null ? void 0 : params.limit) queryParams.append("limit", params.limit.toString());
|
218
|
-
|
219
|
-
const response = yield fetch(url);
|
220
|
-
return yield response.json();
|
198
|
+
return this.fetchAndParse("dyes", queryParams);
|
221
199
|
});
|
222
200
|
}
|
223
201
|
getPatches(params) {
|
@@ -225,15 +203,12 @@ var TemtemAPI = class {
|
|
225
203
|
const queryParams = new URLSearchParams();
|
226
204
|
if (params == null ? void 0 : params.fields) queryParams.append("fields", params.fields);
|
227
205
|
if (params == null ? void 0 : params.limit) queryParams.append("limit", params.limit.toString());
|
228
|
-
|
229
|
-
const response = yield fetch(url);
|
230
|
-
return yield response.json();
|
206
|
+
return this.fetchAndParse("patches", queryParams);
|
231
207
|
});
|
232
208
|
}
|
233
209
|
getWeaknesses() {
|
234
210
|
return __async(this, null, function* () {
|
235
|
-
|
236
|
-
return yield response.json();
|
211
|
+
return this.fetchAndParse("weaknesses");
|
237
212
|
});
|
238
213
|
}
|
239
214
|
calculateWeaknesses(params) {
|
@@ -241,20 +216,19 @@ var TemtemAPI = class {
|
|
241
216
|
const queryParams = new URLSearchParams();
|
242
217
|
queryParams.append("attacking", params.attacking);
|
243
218
|
queryParams.append("defending", params.defending);
|
244
|
-
|
245
|
-
const response = yield fetch(url);
|
246
|
-
return yield response.json();
|
219
|
+
return this.fetchAndParse("weaknesses/calculate", queryParams);
|
247
220
|
});
|
248
221
|
}
|
249
222
|
getBreeding() {
|
250
223
|
return __async(this, null, function* () {
|
251
|
-
|
252
|
-
return yield response.json();
|
224
|
+
return this.fetchAndParse("breeding");
|
253
225
|
});
|
254
226
|
}
|
255
227
|
};
|
228
|
+
var TemtemApi = TemtemDex;
|
256
229
|
// Annotate the CommonJS export names for ESM import in node:
|
257
230
|
0 && (module.exports = {
|
258
|
-
|
231
|
+
TemtemApi,
|
232
|
+
TemtemDex
|
259
233
|
});
|
260
234
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import * as Types from './types';\n\nexport class TemtemAPI {\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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEO,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;AAChG,YAAM,WAAW,MAAM,MAAM,GAAG;AAChC,aAAO,MAAM,SAAS,KAAK;AAAA,IAC/B;AAAA;AAAA,EAEM,cAAc,IAAY,QAAsC;AAAA;AAClE,YAAM,cAAc,IAAI,gBAAgB;AAExC,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,YAAY,EAAE,GAAG,YAAY,SAAS,IAAI,MAAM,YAAY,SAAS,IAAI,EAAE;A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AW,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;","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,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ACxC,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/dist/index.mjs
CHANGED
@@ -20,10 +20,20 @@ var __async = (__this, __arguments, generator) => {
|
|
20
20
|
};
|
21
21
|
|
22
22
|
// src/index.ts
|
23
|
-
var
|
23
|
+
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 TemtemAPI = 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 TemtemAPI = 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 TemtemAPI = 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 TemtemAPI = 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 TemtemAPI = 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 TemtemAPI = 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 TemtemAPI = 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 TemtemAPI = 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 TemtemAPI = 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 TemtemAPI = 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 TemtemAPI = 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 TemtemAPI = 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 TemtemAPI = 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 TemtemAPI = 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 TemtemAPI = 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 TemtemAPI = 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,19 +192,18 @@ var TemtemAPI = 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
|
};
|
204
|
+
var TemtemApi = TemtemDex;
|
233
205
|
export {
|
234
|
-
|
206
|
+
TemtemApi,
|
207
|
+
TemtemDex
|
235
208
|
};
|
236
209
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import * as Types from './types';\n\nexport class TemtemAPI {\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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAEO,IAAM,YAAN,MAAgB;AAAA,EAGnB,cAAc;AACV,SAAK,UAAU;AAAA,E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SAAS,IAAI,MAAM,YAAY,SAAS,IAAI,EAAE;AAC7F,YAAM,WAAW,MAAM,MAAM,GAAG;AAChC,aAAO,MAAM,SAAS,KAAK;AAAA,IAC/B;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;AAEtE,YAAM,MAAM,GAAG,KAAK,OAAO,WAAW,YAAY,SAAS,IAAI,MAAM,YAAY,SAAS,IAAI,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;","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,MA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
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
"
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
"
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
"
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
2
|
+
"name": "@ryyseexvi/temtem-promise-v1",
|
3
|
+
"version": "1.1.1",
|
4
|
+
"description": "A package that return all of the Temtem API calls as methods in a class",
|
5
|
+
"main": "./dist/index.js",
|
6
|
+
"module": "./dist/index.mjs",
|
7
|
+
"types": "./dist/index.d.ts",
|
8
|
+
"scripts": {
|
9
|
+
"build": "tsup",
|
10
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
11
|
+
"husky": "npm install --save-dev husky && npx husky init",
|
12
|
+
"prepare": "husky"
|
13
|
+
},
|
14
|
+
"repository": {
|
15
|
+
"type": "git",
|
16
|
+
"url": "git+https://github.com/ryyseeXVI/temtem-promise-v1.git"
|
17
|
+
},
|
18
|
+
"keywords": [
|
19
|
+
"Temtem",
|
20
|
+
"API",
|
21
|
+
"Promise",
|
22
|
+
"Class",
|
23
|
+
"Wrapper",
|
24
|
+
"TypeScript",
|
25
|
+
"OpenSource"
|
26
|
+
],
|
27
|
+
"author": "",
|
28
|
+
"license": "ISC",
|
29
|
+
"bugs": {
|
30
|
+
"url": "https://github.com/ryyseeXVI/temtem-promise-v1/issues"
|
31
|
+
},
|
32
|
+
"homepage": "https://github.com/ryyseeXVI/temtem-promise-v1#readme",
|
33
|
+
"devDependencies": {
|
34
|
+
"@types/jest": "^29.5.14",
|
35
|
+
"husky": "^9.1.7",
|
36
|
+
"ts-node": "^10.9.2",
|
37
|
+
"tsup": "^8.3.5",
|
38
|
+
"typescript": "^5.6.3"
|
39
|
+
},
|
40
|
+
"files": [
|
41
|
+
"dist",
|
42
|
+
"README.md"
|
43
|
+
],
|
44
|
+
"publishConfig": {
|
45
|
+
"access": "public"
|
46
|
+
},
|
47
|
+
"dependencies": {
|
48
|
+
"@types/node-fetch": "^2.6.12",
|
49
|
+
"node-fetch": "^3.3.2"
|
50
|
+
}
|
43
51
|
}
|