@agroyaar/sdk 2.4.4 → 2.4.8

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.cjs CHANGED
@@ -215,14 +215,13 @@ var createMechanizationServices = (client) => ({
215
215
  kindName
216
216
  }) => {
217
217
  try {
218
- const { data } = await client.get(
219
- `/statics/mechanizations-varieties?kindName=${kindName}`
220
- );
221
- return import_ts_belt2.R.Ok(
222
- mappers.getMechanizationVarietyList(
223
- data.result.data.mechanizationVarieties
224
- )
218
+ const { result } = await client.typed(
219
+ "get",
220
+ "/statics/mechanizations-varieties",
221
+ { params: { kindName } }
225
222
  );
223
+ const mechanizationVarieties = result.data.mechanizationVarieties;
224
+ return import_ts_belt2.R.Ok(mappers.getMechanizationVarietyList(mechanizationVarieties));
226
225
  } catch (error) {
227
226
  return wrapError(error);
228
227
  }
@@ -232,7 +231,7 @@ var createMechanizationServices = (client) => ({
232
231
  mechanizationId
233
232
  }) => {
234
233
  try {
235
- const result = await client.typed(
234
+ const { result } = await client.typed(
236
235
  "get",
237
236
  "/farmers/{farmerId}/mechanizations/{mechanizationId}/sensors/speed-changes",
238
237
  {
@@ -240,7 +239,7 @@ var createMechanizationServices = (client) => ({
240
239
  }
241
240
  );
242
241
  return import_ts_belt2.R.Ok(
243
- mappers.getSpeedChangesChartPointsList(result.result.data.speedChanges)
242
+ mappers.getSpeedChangesChartPointsList(result.data.speedChanges)
244
243
  );
245
244
  } catch (error) {
246
245
  return wrapError(error);
@@ -451,26 +450,21 @@ var createMechanizationServices = (client) => ({
451
450
  return wrapError(error);
452
451
  }
453
452
  },
454
- // verifyPhoneNumber: async ({
455
- // phoneNumber,
456
- // otpCode,
457
- // }: VerifyPhoneNumberVariables) => {
458
- // try {
459
- // const result = await client.typed(
460
- // "post",
461
- // "/farmers/{farmerId}/cropping-patterns",
462
- // {
463
- // body: {
464
- // otpCode,
465
- // phoneNumber,
466
- // },
467
- // }
468
- // );
469
- // return R.Ok(mappers.verifyPhoneNumber(result));
470
- // } catch (error) {
471
- // return wrapError(error);
472
- // }
473
- // },
453
+ verifyPhoneNumber: async ({
454
+ phoneNumber,
455
+ otpCode
456
+ }) => {
457
+ try {
458
+ const result = await client.typed("post", "/auth/verify-phone-number", {
459
+ body: { otpCode, phoneNumber }
460
+ });
461
+ return import_ts_belt2.R.Ok(
462
+ mappers.verifyPhoneNumber(result.result.data.verifyPhoneNumber)
463
+ );
464
+ } catch (error) {
465
+ return wrapError(error);
466
+ }
467
+ },
474
468
  getMechanizationTemperatureChanges: async ({
475
469
  farmerId,
476
470
  mechanizationId,
package/dist/index.d.ts CHANGED
@@ -3002,7 +3002,7 @@ type QuestionInformation = components["schemas"]["MechanizationInformationInput"
3002
3002
  type CreateMechanizationVariables = {
3003
3003
  farmerId: string;
3004
3004
  body: {
3005
- avatarURL: string;
3005
+ avatarURL: string | null;
3006
3006
  information: QuestionInformation[];
3007
3007
  varietyId: string;
3008
3008
  };
@@ -3099,6 +3099,7 @@ declare const createSDK: (config: ClientConfig, middlewares?: Parameters<typeof
3099
3099
  getMechanizationQuestionList: ({ varietyId, }: GetMechanizationQuestionVariable) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<MechanizationQuestionModel[]>>;
3100
3100
  getMechanizationMovementChanges: ({ farmerId, mechanizationId, fromDate, toDate, }: MechanizationMovementChangesVariable) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<MechanizationMovementChangesModel[]>>;
3101
3101
  DeleteTrackingDeviceCode: ({ farmerId, mechanizationId, verificationToken, }: DeleteTrackingDeviceVariables) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<TrackingDeviceCodeModel>>;
3102
+ verifyPhoneNumber: ({ phoneNumber, otpCode, }: VerifyPhoneNumberVariables) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<VerifyPhoneNumberModel>>;
3102
3103
  getMechanizationTemperatureChanges: ({ farmerId, mechanizationId, fromDate, toDate, }: MechanizationTemperatureChangesVariable) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<MechanizationTemperatureChangesModel[]>>;
3103
3104
  getMechanizationFuelConsumptionChanges: ({ farmerId, mechanizationId, fromDate, toDate, }: MechanizationFuelConsumptionChangesVariable) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<MechanizationFuelConsumptionChangesModel[]>>;
3104
3105
  CreateMechanization: ({ farmerId, body, }: CreateMechanizationVariables) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<unknown>>;
package/dist/index.mjs CHANGED
@@ -179,14 +179,13 @@ var createMechanizationServices = (client) => ({
179
179
  kindName
180
180
  }) => {
181
181
  try {
182
- const { data } = await client.get(
183
- `/statics/mechanizations-varieties?kindName=${kindName}`
184
- );
185
- return R2.Ok(
186
- mappers.getMechanizationVarietyList(
187
- data.result.data.mechanizationVarieties
188
- )
182
+ const { result } = await client.typed(
183
+ "get",
184
+ "/statics/mechanizations-varieties",
185
+ { params: { kindName } }
189
186
  );
187
+ const mechanizationVarieties = result.data.mechanizationVarieties;
188
+ return R2.Ok(mappers.getMechanizationVarietyList(mechanizationVarieties));
190
189
  } catch (error) {
191
190
  return wrapError(error);
192
191
  }
@@ -196,7 +195,7 @@ var createMechanizationServices = (client) => ({
196
195
  mechanizationId
197
196
  }) => {
198
197
  try {
199
- const result = await client.typed(
198
+ const { result } = await client.typed(
200
199
  "get",
201
200
  "/farmers/{farmerId}/mechanizations/{mechanizationId}/sensors/speed-changes",
202
201
  {
@@ -204,7 +203,7 @@ var createMechanizationServices = (client) => ({
204
203
  }
205
204
  );
206
205
  return R2.Ok(
207
- mappers.getSpeedChangesChartPointsList(result.result.data.speedChanges)
206
+ mappers.getSpeedChangesChartPointsList(result.data.speedChanges)
208
207
  );
209
208
  } catch (error) {
210
209
  return wrapError(error);
@@ -415,26 +414,21 @@ var createMechanizationServices = (client) => ({
415
414
  return wrapError(error);
416
415
  }
417
416
  },
418
- // verifyPhoneNumber: async ({
419
- // phoneNumber,
420
- // otpCode,
421
- // }: VerifyPhoneNumberVariables) => {
422
- // try {
423
- // const result = await client.typed(
424
- // "post",
425
- // "/farmers/{farmerId}/cropping-patterns",
426
- // {
427
- // body: {
428
- // otpCode,
429
- // phoneNumber,
430
- // },
431
- // }
432
- // );
433
- // return R.Ok(mappers.verifyPhoneNumber(result));
434
- // } catch (error) {
435
- // return wrapError(error);
436
- // }
437
- // },
417
+ verifyPhoneNumber: async ({
418
+ phoneNumber,
419
+ otpCode
420
+ }) => {
421
+ try {
422
+ const result = await client.typed("post", "/auth/verify-phone-number", {
423
+ body: { otpCode, phoneNumber }
424
+ });
425
+ return R2.Ok(
426
+ mappers.verifyPhoneNumber(result.result.data.verifyPhoneNumber)
427
+ );
428
+ } catch (error) {
429
+ return wrapError(error);
430
+ }
431
+ },
438
432
  getMechanizationTemperatureChanges: async ({
439
433
  farmerId,
440
434
  mechanizationId,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agroyaar/sdk",
3
- "version": "2.4.4",
3
+ "version": "2.4.8",
4
4
  "description": "",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",