@agroyaar/sdk 1.5.7 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -29,6 +29,15 @@ var createClient = (config, middlewares = []) => {
29
29
  "Content-Type": "application/json"
30
30
  }
31
31
  });
32
+ client.typed = async function(method, path, config2) {
33
+ const res = await client.request({
34
+ method,
35
+ url: path,
36
+ params: config2?.params,
37
+ data: config2?.body
38
+ });
39
+ return res.data;
40
+ };
32
41
  for (const middleware of middlewares) {
33
42
  client.interceptors.request.use(middleware);
34
43
  }
@@ -225,8 +234,14 @@ var createMechanizationServices = (client) => ({
225
234
  varietyId
226
235
  }) => {
227
236
  try {
228
- const { data } = await client.get(
229
- `/statics/mechanizations-questions?mechanizationVarietyId=${varietyId}`
237
+ const data = await client.typed(
238
+ "get",
239
+ "/statics/mechanizations-questions",
240
+ {
241
+ params: {
242
+ mechanizationVarietyId: varietyId
243
+ }
244
+ }
230
245
  );
231
246
  return R2.Ok(
232
247
  mappers.getQuestions(data.result.data.mechanizationsQuestions)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agroyaar/sdk",
3
- "version": "1.5.7",
3
+ "version": "2.0.0",
4
4
  "description": "",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",
@@ -24,7 +24,7 @@
24
24
  "spell-check": "cspell \"src/**/*.{ts,js,json,md}\"",
25
25
  "check-all": "pnpm type-check && pnpm lint && pnpm spell-check",
26
26
  "release": "release-it",
27
- "gen-schema": "openapi-typescript https://stgapi-automation.agroyaar.com/docs/json -o src/core/schema.ts"
27
+ "gen-schema": "openapi-typescript https://stgapi-automation.agroyaar.com/docs/json -o src/core/paths.ts"
28
28
  },
29
29
  "publishConfig": {
30
30
  "access": "public"