@agroyaar/sdk 2.4.1 → 2.4.2
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 +73 -15
- package/dist/index.d.ts +89 -2
- package/dist/index.mjs +73 -15
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -179,6 +179,10 @@ var mappers = {
|
|
|
179
179
|
heading
|
|
180
180
|
}),
|
|
181
181
|
getMechanizationMovementChanges: (response) => response.map(mappers.getMechanizationMovementChange),
|
|
182
|
+
verifyPhoneNumber: (dto) => ({
|
|
183
|
+
phoneNumber: dto.phoneNumber,
|
|
184
|
+
verificationToken: dto.verificationToken
|
|
185
|
+
}),
|
|
182
186
|
getMechanizationTemperatureChange: ({
|
|
183
187
|
engineWaterTemperature,
|
|
184
188
|
date
|
|
@@ -227,11 +231,15 @@ var createMechanizationServices = (client) => ({
|
|
|
227
231
|
mechanizationId
|
|
228
232
|
}) => {
|
|
229
233
|
try {
|
|
230
|
-
const
|
|
231
|
-
|
|
234
|
+
const result = await client.typed(
|
|
235
|
+
"get",
|
|
236
|
+
"/farmers/{farmerId}/mechanizations/{mechanizationId}/sensors/speed-changes",
|
|
237
|
+
{
|
|
238
|
+
pathParams: { farmerId, mechanizationId }
|
|
239
|
+
}
|
|
232
240
|
);
|
|
233
241
|
return import_ts_belt2.R.Ok(
|
|
234
|
-
mappers.getSpeedChangesChartPointsList(
|
|
242
|
+
mappers.getSpeedChangesChartPointsList(result.result.data.speedChanges)
|
|
235
243
|
);
|
|
236
244
|
} catch (error) {
|
|
237
245
|
return wrapError(error);
|
|
@@ -310,11 +318,20 @@ var createMechanizationServices = (client) => ({
|
|
|
310
318
|
deviceCode
|
|
311
319
|
}) => {
|
|
312
320
|
try {
|
|
313
|
-
const
|
|
314
|
-
|
|
315
|
-
{
|
|
321
|
+
const result = await client.typed(
|
|
322
|
+
"put",
|
|
323
|
+
"/farmers/{farmerId}/mechanizations/{mechanizationId}/submit-device-code",
|
|
324
|
+
{
|
|
325
|
+
body: { deviceCode },
|
|
326
|
+
pathParams: {
|
|
327
|
+
farmerId,
|
|
328
|
+
mechanizationId
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
);
|
|
332
|
+
return import_ts_belt2.R.Ok(
|
|
333
|
+
mappers.SubmitTrackingDeviceData(result.result.data.mechanization)
|
|
316
334
|
);
|
|
317
|
-
return import_ts_belt2.R.Ok(mappers.SubmitTrackingDeviceData(data));
|
|
318
335
|
} catch (error) {
|
|
319
336
|
return wrapError(error);
|
|
320
337
|
}
|
|
@@ -340,11 +357,23 @@ var createMechanizationServices = (client) => ({
|
|
|
340
357
|
verificationToken
|
|
341
358
|
}) => {
|
|
342
359
|
try {
|
|
343
|
-
const
|
|
344
|
-
|
|
345
|
-
{
|
|
360
|
+
const result = await client.typed(
|
|
361
|
+
"put",
|
|
362
|
+
"/farmers/{farmerId}/mechanizations/{mechanizationId}/update-device-code",
|
|
363
|
+
{
|
|
364
|
+
body: {
|
|
365
|
+
deviceCode,
|
|
366
|
+
verificationToken
|
|
367
|
+
},
|
|
368
|
+
pathParams: {
|
|
369
|
+
farmerId,
|
|
370
|
+
mechanizationId
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
);
|
|
374
|
+
return import_ts_belt2.R.Ok(
|
|
375
|
+
mappers.UpdateTrackingDeviceData(result.result.data.mechanization)
|
|
346
376
|
);
|
|
347
|
-
return import_ts_belt2.R.Ok(mappers.UpdateTrackingDeviceData(data));
|
|
348
377
|
} catch (error) {
|
|
349
378
|
return wrapError(error);
|
|
350
379
|
}
|
|
@@ -401,17 +430,46 @@ var createMechanizationServices = (client) => ({
|
|
|
401
430
|
verificationToken
|
|
402
431
|
}) => {
|
|
403
432
|
try {
|
|
404
|
-
const
|
|
405
|
-
|
|
433
|
+
const result = await client.typed(
|
|
434
|
+
"delete",
|
|
435
|
+
"/farmers/{farmerId}/mechanizations/{mechanizationId}/delete-device-code",
|
|
406
436
|
{
|
|
407
|
-
|
|
437
|
+
body: {
|
|
438
|
+
verificationToken
|
|
439
|
+
},
|
|
440
|
+
pathParams: {
|
|
441
|
+
farmerId,
|
|
442
|
+
mechanizationId
|
|
443
|
+
}
|
|
408
444
|
}
|
|
409
445
|
);
|
|
410
|
-
return import_ts_belt2.R.Ok(
|
|
446
|
+
return import_ts_belt2.R.Ok(
|
|
447
|
+
mappers.DeleteTrackingDeviceData(result.result.data.mechanization)
|
|
448
|
+
);
|
|
411
449
|
} catch (error) {
|
|
412
450
|
return wrapError(error);
|
|
413
451
|
}
|
|
414
452
|
},
|
|
453
|
+
// verifyPhoneNumber: async ({
|
|
454
|
+
// phoneNumber,
|
|
455
|
+
// otpCode,
|
|
456
|
+
// }: VerifyPhoneNumberVariables) => {
|
|
457
|
+
// try {
|
|
458
|
+
// const result = await client.typed(
|
|
459
|
+
// "post",
|
|
460
|
+
// "/farmers/{farmerId}/cropping-patterns",
|
|
461
|
+
// {
|
|
462
|
+
// body: {
|
|
463
|
+
// otpCode,
|
|
464
|
+
// phoneNumber,
|
|
465
|
+
// },
|
|
466
|
+
// }
|
|
467
|
+
// );
|
|
468
|
+
// return R.Ok(mappers.verifyPhoneNumber(result));
|
|
469
|
+
// } catch (error) {
|
|
470
|
+
// return wrapError(error);
|
|
471
|
+
// }
|
|
472
|
+
// },
|
|
415
473
|
getMechanizationTemperatureChanges: async ({
|
|
416
474
|
farmerId,
|
|
417
475
|
mechanizationId,
|
package/dist/index.d.ts
CHANGED
|
@@ -156,6 +156,14 @@ type MechanizationMovementChangesVariable = {
|
|
|
156
156
|
fromDate?: string | null | undefined;
|
|
157
157
|
toDate?: string | null | undefined;
|
|
158
158
|
};
|
|
159
|
+
type VerifyPhoneNumberModel = {
|
|
160
|
+
phoneNumber: string;
|
|
161
|
+
verificationToken: string;
|
|
162
|
+
};
|
|
163
|
+
type VerifyPhoneNumberVariables = {
|
|
164
|
+
phoneNumber: string;
|
|
165
|
+
otpCode: string;
|
|
166
|
+
};
|
|
159
167
|
type MechanizationTemperatureChangesModel = {
|
|
160
168
|
engineWaterTemperature: number;
|
|
161
169
|
date: string;
|
|
@@ -484,7 +492,8 @@ interface paths {
|
|
|
484
492
|
/** Get resource list */
|
|
485
493
|
get: operations["MechanizationsController_getMotorizedMechanizationSensors"];
|
|
486
494
|
put?: never;
|
|
487
|
-
|
|
495
|
+
/** Create resource */
|
|
496
|
+
post: operations["MechanizationsController_createMotorizedMechanization"];
|
|
488
497
|
delete?: never;
|
|
489
498
|
options?: never;
|
|
490
499
|
head?: never;
|
|
@@ -950,6 +959,10 @@ interface components {
|
|
|
950
959
|
readonly avatarURL: string;
|
|
951
960
|
/** @example pride */
|
|
952
961
|
readonly model: string;
|
|
962
|
+
/** @example 30 */
|
|
963
|
+
readonly performancePerKilometer: number;
|
|
964
|
+
/** @example 30 */
|
|
965
|
+
readonly timingPerformance: number;
|
|
953
966
|
/** @example shrek */
|
|
954
967
|
readonly commonName: string;
|
|
955
968
|
readonly manufactureYear: string;
|
|
@@ -1007,6 +1020,20 @@ interface components {
|
|
|
1007
1020
|
DeleteMechanizationDeviceCodeInput: {
|
|
1008
1021
|
verificationToken: string;
|
|
1009
1022
|
};
|
|
1023
|
+
CreateMotorizedMechanizationSensorInput: {
|
|
1024
|
+
speed: number;
|
|
1025
|
+
heading: number;
|
|
1026
|
+
latitude: number;
|
|
1027
|
+
longitude: number;
|
|
1028
|
+
fuelLevel: number;
|
|
1029
|
+
engineRpm: number;
|
|
1030
|
+
deviceCode: string;
|
|
1031
|
+
stateEngine: boolean;
|
|
1032
|
+
engineOilPressure: boolean;
|
|
1033
|
+
engineWaterTemperature: number;
|
|
1034
|
+
batteryChargePercentage: number;
|
|
1035
|
+
mechanizationId: string;
|
|
1036
|
+
};
|
|
1010
1037
|
MotorizedMechanizationSensor: {
|
|
1011
1038
|
readonly id: string;
|
|
1012
1039
|
/** Format: date-time */
|
|
@@ -1029,6 +1056,18 @@ interface components {
|
|
|
1029
1056
|
readonly mechanizationId: string;
|
|
1030
1057
|
readonly mechanization: components["schemas"]["Mechanization"];
|
|
1031
1058
|
};
|
|
1059
|
+
MotorizedMechanizationSensorResponseData: {
|
|
1060
|
+
readonly meta: Record<string, never>;
|
|
1061
|
+
readonly motorizedMechanizationSensor: components["schemas"]["MotorizedMechanizationSensor"];
|
|
1062
|
+
};
|
|
1063
|
+
MotorizedMechanizationSensorResponseResult: {
|
|
1064
|
+
readonly message: string;
|
|
1065
|
+
readonly code: string;
|
|
1066
|
+
readonly data: components["schemas"]["MotorizedMechanizationSensorResponseData"];
|
|
1067
|
+
};
|
|
1068
|
+
MotorizedMechanizationSensorResponseDto: {
|
|
1069
|
+
readonly result: components["schemas"]["MotorizedMechanizationSensorResponseResult"];
|
|
1070
|
+
};
|
|
1032
1071
|
Alerts: {
|
|
1033
1072
|
readonly dangerous: boolean;
|
|
1034
1073
|
/** @example hello world */
|
|
@@ -2464,6 +2503,54 @@ interface operations {
|
|
|
2464
2503
|
};
|
|
2465
2504
|
};
|
|
2466
2505
|
};
|
|
2506
|
+
MechanizationsController_createMotorizedMechanization: {
|
|
2507
|
+
parameters: {
|
|
2508
|
+
query?: never;
|
|
2509
|
+
header?: never;
|
|
2510
|
+
path: {
|
|
2511
|
+
mechanizationId: unknown;
|
|
2512
|
+
farmerId: unknown;
|
|
2513
|
+
};
|
|
2514
|
+
cookie?: never;
|
|
2515
|
+
};
|
|
2516
|
+
requestBody: {
|
|
2517
|
+
content: {
|
|
2518
|
+
"application/json": components["schemas"]["CreateMotorizedMechanizationSensorInput"];
|
|
2519
|
+
};
|
|
2520
|
+
};
|
|
2521
|
+
responses: {
|
|
2522
|
+
/** @description عملیات ثبت با موفقیت انجام شد */
|
|
2523
|
+
201: {
|
|
2524
|
+
headers: {
|
|
2525
|
+
[name: string]: unknown;
|
|
2526
|
+
};
|
|
2527
|
+
content: {
|
|
2528
|
+
"application/json": components["schemas"]["MotorizedMechanizationSensorResponseDto"];
|
|
2529
|
+
};
|
|
2530
|
+
};
|
|
2531
|
+
/** @description درخواست نامعتبر است */
|
|
2532
|
+
400: {
|
|
2533
|
+
headers: {
|
|
2534
|
+
[name: string]: unknown;
|
|
2535
|
+
};
|
|
2536
|
+
content?: never;
|
|
2537
|
+
};
|
|
2538
|
+
/** @description دسترسی غیرمجاز است */
|
|
2539
|
+
401: {
|
|
2540
|
+
headers: {
|
|
2541
|
+
[name: string]: unknown;
|
|
2542
|
+
};
|
|
2543
|
+
content?: never;
|
|
2544
|
+
};
|
|
2545
|
+
/** @description خطای غیرمنتظره در سرور رخ داده است */
|
|
2546
|
+
500: {
|
|
2547
|
+
headers: {
|
|
2548
|
+
[name: string]: unknown;
|
|
2549
|
+
};
|
|
2550
|
+
content?: never;
|
|
2551
|
+
};
|
|
2552
|
+
};
|
|
2553
|
+
};
|
|
2467
2554
|
MechanizationsController_getSpeedChanges: {
|
|
2468
2555
|
parameters: {
|
|
2469
2556
|
query?: {
|
|
@@ -3005,4 +3092,4 @@ declare const createSDK: (config: ClientConfig, middlewares?: Parameters<typeof
|
|
|
3005
3092
|
};
|
|
3006
3093
|
};
|
|
3007
3094
|
|
|
3008
|
-
export { type DeleteTrackingDeviceVariables, type GetMechanizationQuestionVariable, Identifiers, type MechanizationFuelConsumptionChangesModel, type MechanizationFuelConsumptionChangesVariable, type MechanizationMachineUsageKind, type MechanizationMachineUsageType, type MechanizationModel, type MechanizationMovementChangesModel, type MechanizationMovementChangesVariable, type MechanizationQuestionModel, type MechanizationSeasonProcessKind, type MechanizationSeasonProcessType, type MechanizationTemperatureChangesModel, type MechanizationTemperatureChangesVariable, type MechanizationType, type MechanizationVariables, type MechanizationVarietyModel, type MechanizationVarietyVariables, type MechanizationsVariables, type MotorizedMechanizationSensorsModel, type MotorizedMechanizationSensorsVariables, type SeasonsProcessModel, type ServiceType, type SpeedChangesChartModel, type SpeedChangesChartVariables, type Status, type StatusType, type SubmitTrackingDeviceVariables, type TaskType, type TrackingDeviceCodeModel, type UpdateTrackingDeviceVariables, type VarietyKind, createSDK };
|
|
3095
|
+
export { type DeleteTrackingDeviceVariables, type GetMechanizationQuestionVariable, Identifiers, type MechanizationFuelConsumptionChangesModel, type MechanizationFuelConsumptionChangesVariable, type MechanizationMachineUsageKind, type MechanizationMachineUsageType, type MechanizationModel, type MechanizationMovementChangesModel, type MechanizationMovementChangesVariable, type MechanizationQuestionModel, type MechanizationSeasonProcessKind, type MechanizationSeasonProcessType, type MechanizationTemperatureChangesModel, type MechanizationTemperatureChangesVariable, type MechanizationType, type MechanizationVariables, type MechanizationVarietyModel, type MechanizationVarietyVariables, type MechanizationsVariables, type MotorizedMechanizationSensorsModel, type MotorizedMechanizationSensorsVariables, type SeasonsProcessModel, type ServiceType, type SpeedChangesChartModel, type SpeedChangesChartVariables, type Status, type StatusType, type SubmitTrackingDeviceVariables, type TaskType, type TrackingDeviceCodeModel, type UpdateTrackingDeviceVariables, type VarietyKind, type VerifyPhoneNumberModel, type VerifyPhoneNumberVariables, createSDK };
|
package/dist/index.mjs
CHANGED
|
@@ -143,6 +143,10 @@ var mappers = {
|
|
|
143
143
|
heading
|
|
144
144
|
}),
|
|
145
145
|
getMechanizationMovementChanges: (response) => response.map(mappers.getMechanizationMovementChange),
|
|
146
|
+
verifyPhoneNumber: (dto) => ({
|
|
147
|
+
phoneNumber: dto.phoneNumber,
|
|
148
|
+
verificationToken: dto.verificationToken
|
|
149
|
+
}),
|
|
146
150
|
getMechanizationTemperatureChange: ({
|
|
147
151
|
engineWaterTemperature,
|
|
148
152
|
date
|
|
@@ -191,11 +195,15 @@ var createMechanizationServices = (client) => ({
|
|
|
191
195
|
mechanizationId
|
|
192
196
|
}) => {
|
|
193
197
|
try {
|
|
194
|
-
const
|
|
195
|
-
|
|
198
|
+
const result = await client.typed(
|
|
199
|
+
"get",
|
|
200
|
+
"/farmers/{farmerId}/mechanizations/{mechanizationId}/sensors/speed-changes",
|
|
201
|
+
{
|
|
202
|
+
pathParams: { farmerId, mechanizationId }
|
|
203
|
+
}
|
|
196
204
|
);
|
|
197
205
|
return R2.Ok(
|
|
198
|
-
mappers.getSpeedChangesChartPointsList(
|
|
206
|
+
mappers.getSpeedChangesChartPointsList(result.result.data.speedChanges)
|
|
199
207
|
);
|
|
200
208
|
} catch (error) {
|
|
201
209
|
return wrapError(error);
|
|
@@ -274,11 +282,20 @@ var createMechanizationServices = (client) => ({
|
|
|
274
282
|
deviceCode
|
|
275
283
|
}) => {
|
|
276
284
|
try {
|
|
277
|
-
const
|
|
278
|
-
|
|
279
|
-
{
|
|
285
|
+
const result = await client.typed(
|
|
286
|
+
"put",
|
|
287
|
+
"/farmers/{farmerId}/mechanizations/{mechanizationId}/submit-device-code",
|
|
288
|
+
{
|
|
289
|
+
body: { deviceCode },
|
|
290
|
+
pathParams: {
|
|
291
|
+
farmerId,
|
|
292
|
+
mechanizationId
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
);
|
|
296
|
+
return R2.Ok(
|
|
297
|
+
mappers.SubmitTrackingDeviceData(result.result.data.mechanization)
|
|
280
298
|
);
|
|
281
|
-
return R2.Ok(mappers.SubmitTrackingDeviceData(data));
|
|
282
299
|
} catch (error) {
|
|
283
300
|
return wrapError(error);
|
|
284
301
|
}
|
|
@@ -304,11 +321,23 @@ var createMechanizationServices = (client) => ({
|
|
|
304
321
|
verificationToken
|
|
305
322
|
}) => {
|
|
306
323
|
try {
|
|
307
|
-
const
|
|
308
|
-
|
|
309
|
-
{
|
|
324
|
+
const result = await client.typed(
|
|
325
|
+
"put",
|
|
326
|
+
"/farmers/{farmerId}/mechanizations/{mechanizationId}/update-device-code",
|
|
327
|
+
{
|
|
328
|
+
body: {
|
|
329
|
+
deviceCode,
|
|
330
|
+
verificationToken
|
|
331
|
+
},
|
|
332
|
+
pathParams: {
|
|
333
|
+
farmerId,
|
|
334
|
+
mechanizationId
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
);
|
|
338
|
+
return R2.Ok(
|
|
339
|
+
mappers.UpdateTrackingDeviceData(result.result.data.mechanization)
|
|
310
340
|
);
|
|
311
|
-
return R2.Ok(mappers.UpdateTrackingDeviceData(data));
|
|
312
341
|
} catch (error) {
|
|
313
342
|
return wrapError(error);
|
|
314
343
|
}
|
|
@@ -365,17 +394,46 @@ var createMechanizationServices = (client) => ({
|
|
|
365
394
|
verificationToken
|
|
366
395
|
}) => {
|
|
367
396
|
try {
|
|
368
|
-
const
|
|
369
|
-
|
|
397
|
+
const result = await client.typed(
|
|
398
|
+
"delete",
|
|
399
|
+
"/farmers/{farmerId}/mechanizations/{mechanizationId}/delete-device-code",
|
|
370
400
|
{
|
|
371
|
-
|
|
401
|
+
body: {
|
|
402
|
+
verificationToken
|
|
403
|
+
},
|
|
404
|
+
pathParams: {
|
|
405
|
+
farmerId,
|
|
406
|
+
mechanizationId
|
|
407
|
+
}
|
|
372
408
|
}
|
|
373
409
|
);
|
|
374
|
-
return R2.Ok(
|
|
410
|
+
return R2.Ok(
|
|
411
|
+
mappers.DeleteTrackingDeviceData(result.result.data.mechanization)
|
|
412
|
+
);
|
|
375
413
|
} catch (error) {
|
|
376
414
|
return wrapError(error);
|
|
377
415
|
}
|
|
378
416
|
},
|
|
417
|
+
// verifyPhoneNumber: async ({
|
|
418
|
+
// phoneNumber,
|
|
419
|
+
// otpCode,
|
|
420
|
+
// }: VerifyPhoneNumberVariables) => {
|
|
421
|
+
// try {
|
|
422
|
+
// const result = await client.typed(
|
|
423
|
+
// "post",
|
|
424
|
+
// "/farmers/{farmerId}/cropping-patterns",
|
|
425
|
+
// {
|
|
426
|
+
// body: {
|
|
427
|
+
// otpCode,
|
|
428
|
+
// phoneNumber,
|
|
429
|
+
// },
|
|
430
|
+
// }
|
|
431
|
+
// );
|
|
432
|
+
// return R.Ok(mappers.verifyPhoneNumber(result));
|
|
433
|
+
// } catch (error) {
|
|
434
|
+
// return wrapError(error);
|
|
435
|
+
// }
|
|
436
|
+
// },
|
|
379
437
|
getMechanizationTemperatureChanges: async ({
|
|
380
438
|
farmerId,
|
|
381
439
|
mechanizationId,
|