@agroyaar/sdk 2.4.0 → 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 +74 -15
- package/dist/index.d.ts +90 -2
- package/dist/index.mjs +74 -15
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -119,6 +119,7 @@ var mappers = {
|
|
|
119
119
|
code: res.code,
|
|
120
120
|
kind: res.kind,
|
|
121
121
|
kindName: res.kindName,
|
|
122
|
+
deviceCode: res.deviceCode,
|
|
122
123
|
variety: mappers.getMechanizationVariety(res.variety)
|
|
123
124
|
}),
|
|
124
125
|
getMechanizations: (response) => response.map(mappers.getMechanization),
|
|
@@ -178,6 +179,10 @@ var mappers = {
|
|
|
178
179
|
heading
|
|
179
180
|
}),
|
|
180
181
|
getMechanizationMovementChanges: (response) => response.map(mappers.getMechanizationMovementChange),
|
|
182
|
+
verifyPhoneNumber: (dto) => ({
|
|
183
|
+
phoneNumber: dto.phoneNumber,
|
|
184
|
+
verificationToken: dto.verificationToken
|
|
185
|
+
}),
|
|
181
186
|
getMechanizationTemperatureChange: ({
|
|
182
187
|
engineWaterTemperature,
|
|
183
188
|
date
|
|
@@ -226,11 +231,15 @@ var createMechanizationServices = (client) => ({
|
|
|
226
231
|
mechanizationId
|
|
227
232
|
}) => {
|
|
228
233
|
try {
|
|
229
|
-
const
|
|
230
|
-
|
|
234
|
+
const result = await client.typed(
|
|
235
|
+
"get",
|
|
236
|
+
"/farmers/{farmerId}/mechanizations/{mechanizationId}/sensors/speed-changes",
|
|
237
|
+
{
|
|
238
|
+
pathParams: { farmerId, mechanizationId }
|
|
239
|
+
}
|
|
231
240
|
);
|
|
232
241
|
return import_ts_belt2.R.Ok(
|
|
233
|
-
mappers.getSpeedChangesChartPointsList(
|
|
242
|
+
mappers.getSpeedChangesChartPointsList(result.result.data.speedChanges)
|
|
234
243
|
);
|
|
235
244
|
} catch (error) {
|
|
236
245
|
return wrapError(error);
|
|
@@ -309,11 +318,20 @@ var createMechanizationServices = (client) => ({
|
|
|
309
318
|
deviceCode
|
|
310
319
|
}) => {
|
|
311
320
|
try {
|
|
312
|
-
const
|
|
313
|
-
|
|
314
|
-
{
|
|
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)
|
|
315
334
|
);
|
|
316
|
-
return import_ts_belt2.R.Ok(mappers.SubmitTrackingDeviceData(data));
|
|
317
335
|
} catch (error) {
|
|
318
336
|
return wrapError(error);
|
|
319
337
|
}
|
|
@@ -339,11 +357,23 @@ var createMechanizationServices = (client) => ({
|
|
|
339
357
|
verificationToken
|
|
340
358
|
}) => {
|
|
341
359
|
try {
|
|
342
|
-
const
|
|
343
|
-
|
|
344
|
-
{
|
|
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)
|
|
345
376
|
);
|
|
346
|
-
return import_ts_belt2.R.Ok(mappers.UpdateTrackingDeviceData(data));
|
|
347
377
|
} catch (error) {
|
|
348
378
|
return wrapError(error);
|
|
349
379
|
}
|
|
@@ -400,17 +430,46 @@ var createMechanizationServices = (client) => ({
|
|
|
400
430
|
verificationToken
|
|
401
431
|
}) => {
|
|
402
432
|
try {
|
|
403
|
-
const
|
|
404
|
-
|
|
433
|
+
const result = await client.typed(
|
|
434
|
+
"delete",
|
|
435
|
+
"/farmers/{farmerId}/mechanizations/{mechanizationId}/delete-device-code",
|
|
405
436
|
{
|
|
406
|
-
|
|
437
|
+
body: {
|
|
438
|
+
verificationToken
|
|
439
|
+
},
|
|
440
|
+
pathParams: {
|
|
441
|
+
farmerId,
|
|
442
|
+
mechanizationId
|
|
443
|
+
}
|
|
407
444
|
}
|
|
408
445
|
);
|
|
409
|
-
return import_ts_belt2.R.Ok(
|
|
446
|
+
return import_ts_belt2.R.Ok(
|
|
447
|
+
mappers.DeleteTrackingDeviceData(result.result.data.mechanization)
|
|
448
|
+
);
|
|
410
449
|
} catch (error) {
|
|
411
450
|
return wrapError(error);
|
|
412
451
|
}
|
|
413
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
|
+
// },
|
|
414
473
|
getMechanizationTemperatureChanges: async ({
|
|
415
474
|
farmerId,
|
|
416
475
|
mechanizationId,
|
package/dist/index.d.ts
CHANGED
|
@@ -64,6 +64,7 @@ type MechanizationModel = {
|
|
|
64
64
|
avatarURL: string;
|
|
65
65
|
manufactureYear: string;
|
|
66
66
|
code: string;
|
|
67
|
+
deviceCode: string;
|
|
67
68
|
kind: VarietyKind;
|
|
68
69
|
kindName: MechanizationType;
|
|
69
70
|
variety: MechanizationVarietyModel;
|
|
@@ -155,6 +156,14 @@ type MechanizationMovementChangesVariable = {
|
|
|
155
156
|
fromDate?: string | null | undefined;
|
|
156
157
|
toDate?: string | null | undefined;
|
|
157
158
|
};
|
|
159
|
+
type VerifyPhoneNumberModel = {
|
|
160
|
+
phoneNumber: string;
|
|
161
|
+
verificationToken: string;
|
|
162
|
+
};
|
|
163
|
+
type VerifyPhoneNumberVariables = {
|
|
164
|
+
phoneNumber: string;
|
|
165
|
+
otpCode: string;
|
|
166
|
+
};
|
|
158
167
|
type MechanizationTemperatureChangesModel = {
|
|
159
168
|
engineWaterTemperature: number;
|
|
160
169
|
date: string;
|
|
@@ -483,7 +492,8 @@ interface paths {
|
|
|
483
492
|
/** Get resource list */
|
|
484
493
|
get: operations["MechanizationsController_getMotorizedMechanizationSensors"];
|
|
485
494
|
put?: never;
|
|
486
|
-
|
|
495
|
+
/** Create resource */
|
|
496
|
+
post: operations["MechanizationsController_createMotorizedMechanization"];
|
|
487
497
|
delete?: never;
|
|
488
498
|
options?: never;
|
|
489
499
|
head?: never;
|
|
@@ -949,6 +959,10 @@ interface components {
|
|
|
949
959
|
readonly avatarURL: string;
|
|
950
960
|
/** @example pride */
|
|
951
961
|
readonly model: string;
|
|
962
|
+
/** @example 30 */
|
|
963
|
+
readonly performancePerKilometer: number;
|
|
964
|
+
/** @example 30 */
|
|
965
|
+
readonly timingPerformance: number;
|
|
952
966
|
/** @example shrek */
|
|
953
967
|
readonly commonName: string;
|
|
954
968
|
readonly manufactureYear: string;
|
|
@@ -1006,6 +1020,20 @@ interface components {
|
|
|
1006
1020
|
DeleteMechanizationDeviceCodeInput: {
|
|
1007
1021
|
verificationToken: string;
|
|
1008
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
|
+
};
|
|
1009
1037
|
MotorizedMechanizationSensor: {
|
|
1010
1038
|
readonly id: string;
|
|
1011
1039
|
/** Format: date-time */
|
|
@@ -1028,6 +1056,18 @@ interface components {
|
|
|
1028
1056
|
readonly mechanizationId: string;
|
|
1029
1057
|
readonly mechanization: components["schemas"]["Mechanization"];
|
|
1030
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
|
+
};
|
|
1031
1071
|
Alerts: {
|
|
1032
1072
|
readonly dangerous: boolean;
|
|
1033
1073
|
/** @example hello world */
|
|
@@ -2463,6 +2503,54 @@ interface operations {
|
|
|
2463
2503
|
};
|
|
2464
2504
|
};
|
|
2465
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
|
+
};
|
|
2466
2554
|
MechanizationsController_getSpeedChanges: {
|
|
2467
2555
|
parameters: {
|
|
2468
2556
|
query?: {
|
|
@@ -3004,4 +3092,4 @@ declare const createSDK: (config: ClientConfig, middlewares?: Parameters<typeof
|
|
|
3004
3092
|
};
|
|
3005
3093
|
};
|
|
3006
3094
|
|
|
3007
|
-
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
|
@@ -83,6 +83,7 @@ var mappers = {
|
|
|
83
83
|
code: res.code,
|
|
84
84
|
kind: res.kind,
|
|
85
85
|
kindName: res.kindName,
|
|
86
|
+
deviceCode: res.deviceCode,
|
|
86
87
|
variety: mappers.getMechanizationVariety(res.variety)
|
|
87
88
|
}),
|
|
88
89
|
getMechanizations: (response) => response.map(mappers.getMechanization),
|
|
@@ -142,6 +143,10 @@ var mappers = {
|
|
|
142
143
|
heading
|
|
143
144
|
}),
|
|
144
145
|
getMechanizationMovementChanges: (response) => response.map(mappers.getMechanizationMovementChange),
|
|
146
|
+
verifyPhoneNumber: (dto) => ({
|
|
147
|
+
phoneNumber: dto.phoneNumber,
|
|
148
|
+
verificationToken: dto.verificationToken
|
|
149
|
+
}),
|
|
145
150
|
getMechanizationTemperatureChange: ({
|
|
146
151
|
engineWaterTemperature,
|
|
147
152
|
date
|
|
@@ -190,11 +195,15 @@ var createMechanizationServices = (client) => ({
|
|
|
190
195
|
mechanizationId
|
|
191
196
|
}) => {
|
|
192
197
|
try {
|
|
193
|
-
const
|
|
194
|
-
|
|
198
|
+
const result = await client.typed(
|
|
199
|
+
"get",
|
|
200
|
+
"/farmers/{farmerId}/mechanizations/{mechanizationId}/sensors/speed-changes",
|
|
201
|
+
{
|
|
202
|
+
pathParams: { farmerId, mechanizationId }
|
|
203
|
+
}
|
|
195
204
|
);
|
|
196
205
|
return R2.Ok(
|
|
197
|
-
mappers.getSpeedChangesChartPointsList(
|
|
206
|
+
mappers.getSpeedChangesChartPointsList(result.result.data.speedChanges)
|
|
198
207
|
);
|
|
199
208
|
} catch (error) {
|
|
200
209
|
return wrapError(error);
|
|
@@ -273,11 +282,20 @@ var createMechanizationServices = (client) => ({
|
|
|
273
282
|
deviceCode
|
|
274
283
|
}) => {
|
|
275
284
|
try {
|
|
276
|
-
const
|
|
277
|
-
|
|
278
|
-
{
|
|
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)
|
|
279
298
|
);
|
|
280
|
-
return R2.Ok(mappers.SubmitTrackingDeviceData(data));
|
|
281
299
|
} catch (error) {
|
|
282
300
|
return wrapError(error);
|
|
283
301
|
}
|
|
@@ -303,11 +321,23 @@ var createMechanizationServices = (client) => ({
|
|
|
303
321
|
verificationToken
|
|
304
322
|
}) => {
|
|
305
323
|
try {
|
|
306
|
-
const
|
|
307
|
-
|
|
308
|
-
{
|
|
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)
|
|
309
340
|
);
|
|
310
|
-
return R2.Ok(mappers.UpdateTrackingDeviceData(data));
|
|
311
341
|
} catch (error) {
|
|
312
342
|
return wrapError(error);
|
|
313
343
|
}
|
|
@@ -364,17 +394,46 @@ var createMechanizationServices = (client) => ({
|
|
|
364
394
|
verificationToken
|
|
365
395
|
}) => {
|
|
366
396
|
try {
|
|
367
|
-
const
|
|
368
|
-
|
|
397
|
+
const result = await client.typed(
|
|
398
|
+
"delete",
|
|
399
|
+
"/farmers/{farmerId}/mechanizations/{mechanizationId}/delete-device-code",
|
|
369
400
|
{
|
|
370
|
-
|
|
401
|
+
body: {
|
|
402
|
+
verificationToken
|
|
403
|
+
},
|
|
404
|
+
pathParams: {
|
|
405
|
+
farmerId,
|
|
406
|
+
mechanizationId
|
|
407
|
+
}
|
|
371
408
|
}
|
|
372
409
|
);
|
|
373
|
-
return R2.Ok(
|
|
410
|
+
return R2.Ok(
|
|
411
|
+
mappers.DeleteTrackingDeviceData(result.result.data.mechanization)
|
|
412
|
+
);
|
|
374
413
|
} catch (error) {
|
|
375
414
|
return wrapError(error);
|
|
376
415
|
}
|
|
377
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
|
+
// },
|
|
378
437
|
getMechanizationTemperatureChanges: async ({
|
|
379
438
|
farmerId,
|
|
380
439
|
mechanizationId,
|