@agroyaar/sdk 2.4.1 → 2.4.3

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
@@ -179,6 +179,11 @@ var mappers = {
179
179
  heading
180
180
  }),
181
181
  getMechanizationMovementChanges: (response) => response.map(mappers.getMechanizationMovementChange),
182
+ createMechanization: (_dto) => ({}),
183
+ verifyPhoneNumber: (dto) => ({
184
+ phoneNumber: dto.phoneNumber,
185
+ verificationToken: dto.verificationToken
186
+ }),
182
187
  getMechanizationTemperatureChange: ({
183
188
  engineWaterTemperature,
184
189
  date
@@ -227,11 +232,15 @@ var createMechanizationServices = (client) => ({
227
232
  mechanizationId
228
233
  }) => {
229
234
  try {
230
- const { data } = await client.get(
231
- `/farmers/${farmerId}/mechanizations/${mechanizationId}/sensors/speed-changes`
235
+ const result = await client.typed(
236
+ "get",
237
+ "/farmers/{farmerId}/mechanizations/{mechanizationId}/sensors/speed-changes",
238
+ {
239
+ pathParams: { farmerId, mechanizationId }
240
+ }
232
241
  );
233
242
  return import_ts_belt2.R.Ok(
234
- mappers.getSpeedChangesChartPointsList(data.result.data.speedChanges)
243
+ mappers.getSpeedChangesChartPointsList(result.result.data.speedChanges)
235
244
  );
236
245
  } catch (error) {
237
246
  return wrapError(error);
@@ -310,11 +319,20 @@ var createMechanizationServices = (client) => ({
310
319
  deviceCode
311
320
  }) => {
312
321
  try {
313
- const { data } = await client.put(
314
- `/farmers/${farmerId}/mechanizations/${mechanizationId}/submit-device-code`,
315
- { deviceCode }
322
+ const result = await client.typed(
323
+ "put",
324
+ "/farmers/{farmerId}/mechanizations/{mechanizationId}/submit-device-code",
325
+ {
326
+ body: { deviceCode },
327
+ pathParams: {
328
+ farmerId,
329
+ mechanizationId
330
+ }
331
+ }
332
+ );
333
+ return import_ts_belt2.R.Ok(
334
+ mappers.SubmitTrackingDeviceData(result.result.data.mechanization)
316
335
  );
317
- return import_ts_belt2.R.Ok(mappers.SubmitTrackingDeviceData(data));
318
336
  } catch (error) {
319
337
  return wrapError(error);
320
338
  }
@@ -340,11 +358,23 @@ var createMechanizationServices = (client) => ({
340
358
  verificationToken
341
359
  }) => {
342
360
  try {
343
- const { data } = await client.put(
344
- `/farmers/${farmerId}/mechanizations/${mechanizationId}/update-device-code`,
345
- { deviceCode, verificationToken }
361
+ const result = await client.typed(
362
+ "put",
363
+ "/farmers/{farmerId}/mechanizations/{mechanizationId}/update-device-code",
364
+ {
365
+ body: {
366
+ deviceCode,
367
+ verificationToken
368
+ },
369
+ pathParams: {
370
+ farmerId,
371
+ mechanizationId
372
+ }
373
+ }
374
+ );
375
+ return import_ts_belt2.R.Ok(
376
+ mappers.UpdateTrackingDeviceData(result.result.data.mechanization)
346
377
  );
347
- return import_ts_belt2.R.Ok(mappers.UpdateTrackingDeviceData(data));
348
378
  } catch (error) {
349
379
  return wrapError(error);
350
380
  }
@@ -401,17 +431,46 @@ var createMechanizationServices = (client) => ({
401
431
  verificationToken
402
432
  }) => {
403
433
  try {
404
- const { data } = await client.delete(
405
- `/farmers/${farmerId}/mechanizations/${mechanizationId}/delete-device-code`,
434
+ const result = await client.typed(
435
+ "delete",
436
+ "/farmers/{farmerId}/mechanizations/{mechanizationId}/delete-device-code",
406
437
  {
407
- data: { verificationToken }
438
+ body: {
439
+ verificationToken
440
+ },
441
+ pathParams: {
442
+ farmerId,
443
+ mechanizationId
444
+ }
408
445
  }
409
446
  );
410
- return import_ts_belt2.R.Ok(mappers.DeleteTrackingDeviceData(data));
447
+ return import_ts_belt2.R.Ok(
448
+ mappers.DeleteTrackingDeviceData(result.result.data.mechanization)
449
+ );
411
450
  } catch (error) {
412
451
  return wrapError(error);
413
452
  }
414
453
  },
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
+ // },
415
474
  getMechanizationTemperatureChanges: async ({
416
475
  farmerId,
417
476
  mechanizationId,
@@ -469,6 +528,32 @@ var createMechanizationServices = (client) => ({
469
528
  } catch (error) {
470
529
  return wrapError(error);
471
530
  }
531
+ },
532
+ CreateMechanization: async ({
533
+ farmerId,
534
+ body
535
+ }) => {
536
+ try {
537
+ const response = await client.typed(
538
+ "post",
539
+ "/farmers/{farmerId}/mechanizations",
540
+ {
541
+ pathParams: {
542
+ farmerId
543
+ },
544
+ body: {
545
+ avatarURL: body.avatarURL,
546
+ information: body.information,
547
+ varietyId: body.varietyId
548
+ }
549
+ }
550
+ );
551
+ return import_ts_belt2.R.Ok(
552
+ mappers.createMechanization(response.result.data.mechanization)
553
+ );
554
+ } catch (error) {
555
+ return wrapError(error);
556
+ }
472
557
  }
473
558
  });
474
559
 
package/dist/index.d.ts CHANGED
@@ -1,182 +1,6 @@
1
1
  import * as _mobily_ts_belt from '@mobily/ts-belt';
2
2
  import { AxiosInstance, InternalAxiosRequestConfig } from 'axios';
3
3
 
4
- declare const __brand: unique symbol;
5
- type Brand<B> = {
6
- readonly [__brand]: B;
7
- };
8
- type Branded<T, B> = Brand<B> & T;
9
-
10
- declare namespace Identifiers {
11
- type MechanizationVarietyId = Branded<string, "mechanizationVariety-id">;
12
- type MechanizationId = Branded<string, "mechanization-id">;
13
- type SeasonsProcessId = Branded<string, " seasonsProcess-id">;
14
- type MotorizedMechanizationSensorId = Branded<string, "motorized-mechanization-sensorsId-id">;
15
- type FarmerId = Branded<string, "farmer-id">;
16
- type QuestionId = Branded<string, "question-id">;
17
- type MechanizationMovementChangeId = Branded<string, " movement-changes-id">;
18
- }
19
-
20
- type ServiceType = "EXPERIMENT" | "VISIT" | "CHILLING_REQUIREMENT" | "CULTIVAR_RECOMMENDATION" | "FIRST_SAFFRON_IRRIGATION_DATE_RECOMMENDATION" | "HARVEST_DATE_RECOMMENDATION" | "QUESTIONNAIRE" | "SOWING_DATE_RECOMMENDATIONS" | "WEATHER_STATION" | "YIELD_GAP";
21
- type StatusType = "ACTIVE" | "ACTIVE_LEADING_EXPERT" | "APPROVED_EXPERIMENT_ANALYSIS_REQUEST" | "APPROVED_MISSION" | "APPROVED_RESIDENT_LEADING_EXPERT" | "ARCHIVED" | "AWAITING_APPROVAL_EXPERIMENT_ANALYSIS_REQUEST" | "AWAITING_APPROVAL_MISSION" | "AWAITING_APPROVAL_RESIDENT_LEADING_EXPERT" | "AWAITING_COLLEAGUE_APPROVAL_REQUEST" | "AWAITING_MISSION_COMPLETION_REQUEST" | "AWAITING_PAYMENT_REQUEST" | "AWAITING_PURCHASE_REQUEST" | "AWAITING_REVIEW_ACTIVATION" | "AWAITING_REVIEW_DATA_MISSION" | "AWAITING_REVIEW_INQUIRY" | "AWAITING_REVIEW_MISSION_DATA_REQUEST" | "AWAITING_REVIEW_MODIFICATION" | "AWAITING_REVIEW_OFFER" | "AWAITING_REVIEW_REGISTRATION" | "AWAITING_REVIEW_REQUEST" | "AWAITING_SAMPLE_DELIVERY_LABORATORY_MISSION" | "AWAITING_SEND_REQUEST" | "AWAITING_SIGNING_CONTRACT" | "AWAITING_START_EXPERIMENT_ANALYSIS_REQUEST" | "AWAITING_START_MISSION" | "AWAITING_SUBMIT_ACTIVATION" | "AWAITING_VERIFICATION_CHARGE_WALLET_TRANSACTION" | "CANCELED_EXPERIMENT_ANALYSIS_REQUEST" | "CANCELED_MISSION" | "CANCELED_REQUEST" | "COMPLETED" | "COMPLETED_EXPERIMENT_ANALYSIS_REQUEST" | "COMPLETED_MISSION" | "COMPLETED_REGISTRATION" | "COMPLETED_REQUEST" | "CONFIRMED" | "CONFIRMED_ACTIVATION" | "CONFIRMED_REGISTRATION" | "DONE" | "DRAFT" | "DRAFT_EXPERIMENT_ANALYSIS_REQUEST" | "DRAFT_MISSION" | "FAILED" | "FAILED_CHARGE_WALLET_TRANSACTION" | "INACTIVE" | "INVALID" | "INVALID_DEVICE_PUSH_TOKEN" | "IN_PROGRESS_EXPERIMENT_ANALYSIS_REQUEST" | "IN_PROGRESS_MISSION" | "PAID" | "PASS_PAYMENT" | "PENDING" | "PROCESSING" | "REJECTED" | "REJECTED_ACTIVATION" | "REJECTED_EXPERIMENT_ANALYSIS_REQUEST" | "REJECTED_MISSION" | "REJECTED_MODIFICATION" | "REJECTED_REGISTRATION" | "REJECTED_RESIDENT_LEADING_EXPERT" | "SUBMIT" | "SUCCESS" | "SUCCESS_PAYMENT_WALLET_TRANSACTION" | "VALID" | "VALID_DEVICE_PUSH_TOKEN" | "VERIFIED" | "VERIFIED_CHARGE_WALLET_TRANSACTION" | "WRITING" | "AWAITING_APPROVAL_RESIDENT_LEADING_EXPERT" | "APPROVED_RESIDENT_LEADING_EXPERT" | "REJECTED_RESIDENT_LEADING_EXPERT";
22
- type TaskType = "SAMPLING_REQUEST" | "SAMPLING_MISSION" | "ANALYSIS_REQUEST" | "MAP_DRAWING" | "WATER_SAMPLE_CONTROL" | "WATER_ANALYSIS_MEASUREMENT" | "WATER_EXPERIMENT_TECHNICAL_REVIEW" | "PLANT_SAMPLE_CONTROL" | "PLANT_ANALYSIS_MEASUREMENT" | "PLANT_EXPERIMENT_TECHNICAL_REVIEW" | "SOIL_SAMPLE_CONTROL" | "SOIL_ANALYSIS_MEASUREMENT" | "SOIL_EXPERIMENT_TECHNICAL_REVIEW" | "SENDING_REPORTS" | "TECHNICAL_REVIEW" | "EXPERIMENT_ANALYSIS_RESULTS_CONTROL" | "EXPERIMENT_RECOMMENDATION_ANALYSIS_RESULTS" | "SUPPORT_EXPERIMENTS" | "VISIT_REQUEST" | "FOLLOW_UP_VISIT" | "VISIT_MAP_DRAWING" | "VISIT_SENDING_REPORTS" | "SUPPORT_VISITS";
23
- type MechanizationType = "MOTORIZED" | "NON_MOTORIZED";
24
- type MechanizationSeasonProcessType = "GROWING" | "HARVESTING" | "PLANTING" | "TRANSPORTATION";
25
- type MechanizationMachineUsageType = "BALER" | "CRUSHING" | "CRUST_BREAKER" | "FERTILIZER_SPREADER" | "FORAGE_COLLECTOR" | "FURROWER" | "GRASS_CUTTER" | "GRINDING" | "HARVESTING" | "LEVELING" | "LOADER" | "MULTI_PURPOSE" | "SEEDER" | "SPRAYER" | "TILLAGE" | "TRANSPORTATION" | "WEEDER";
26
-
27
- type Status = {
28
- id: string;
29
- label: string;
30
- name: StatusType;
31
- };
32
- type VarietyKind = {
33
- id: string;
34
- label: string;
35
- name: MechanizationType;
36
- };
37
- type MechanizationSeasonProcessKind = {
38
- id: string;
39
- label: string;
40
- name: MechanizationSeasonProcessType;
41
- };
42
- type MechanizationMachineUsageKind = {
43
- id: string;
44
- label: string;
45
- name: MechanizationMachineUsageType;
46
- };
47
-
48
- type MechanizationVarietyModel = {
49
- id: Identifiers.MechanizationVarietyId;
50
- name: string;
51
- iconURL: string;
52
- kind: VarietyKind;
53
- seasonProcessIds: string[];
54
- machineUsageIds: string[];
55
- seasonsProcess: MechanizationSeasonProcessKind[];
56
- };
57
- type MechanizationVarietyVariables = {
58
- kindName: MechanizationType;
59
- };
60
- type MechanizationModel = {
61
- id: Identifiers.MechanizationId;
62
- model: string;
63
- commonName: string;
64
- avatarURL: string;
65
- manufactureYear: string;
66
- code: string;
67
- deviceCode: string;
68
- kind: VarietyKind;
69
- kindName: MechanizationType;
70
- variety: MechanizationVarietyModel;
71
- };
72
- type MechanizationsVariables = {
73
- farmerId: string;
74
- kindName: MechanizationType;
75
- };
76
- type MechanizationVariables = {
77
- farmerId: string;
78
- mechanizationId: string;
79
- };
80
- type SeasonsProcessModel = {
81
- id: Identifiers.SeasonsProcessId;
82
- name: string;
83
- label: string;
84
- mechanizationVarietyIds: string[];
85
- };
86
- type MotorizedMechanizationSensorsModel = {
87
- id: string;
88
- speed: number;
89
- heading: number;
90
- latitude: number;
91
- longitude: number;
92
- fuelLevel: number;
93
- engineRpm: number;
94
- deviceCode: string;
95
- stateEngine: boolean;
96
- engineOilPressure: boolean;
97
- engineWaterTemperature: number;
98
- batteryChargePercentage: number;
99
- mechanizationId: string;
100
- };
101
- type MotorizedMechanizationSensorsVariables = {
102
- farmerId: string;
103
- mechanizationId: string;
104
- };
105
- type TrackingDeviceCodeModel = {
106
- deviceCode: string;
107
- };
108
- type SubmitTrackingDeviceVariables = {
109
- farmerId: string;
110
- mechanizationId: string;
111
- deviceCode: string;
112
- };
113
- type SpeedChangesChartModel = {
114
- speed: number;
115
- date: string;
116
- };
117
- type SpeedChangesChartVariables = {
118
- farmerId: string;
119
- mechanizationId: string;
120
- };
121
- type UpdateTrackingDeviceVariables = {
122
- farmerId: string;
123
- mechanizationId: string;
124
- deviceCode: string;
125
- verificationToken: string;
126
- };
127
- type DeleteTrackingDeviceVariables = {
128
- farmerId: string;
129
- mechanizationId: string;
130
- verificationToken: string;
131
- };
132
- type MechanizationQuestionModel = {
133
- id: Identifiers.QuestionId;
134
- name: string;
135
- label: string;
136
- placeholder: string;
137
- isRequired: boolean;
138
- options?: {
139
- value: string | number;
140
- label: string;
141
- }[];
142
- type: "TEXT" | "FILE" | "DATE" | "RADIO" | "NUMBER" | "SELECT" | "PASSWORD" | "CHECK_BOX" | "MULTI_SELECT" | "RADIO";
143
- };
144
- type GetMechanizationQuestionVariable = {
145
- varietyId: string;
146
- };
147
- type MechanizationMovementChangesModel = {
148
- longitude: number;
149
- latitude: number;
150
- heading: number;
151
- date: string;
152
- };
153
- type MechanizationMovementChangesVariable = {
154
- farmerId: string;
155
- mechanizationId: string;
156
- fromDate?: string | null | undefined;
157
- toDate?: string | null | undefined;
158
- };
159
- type MechanizationTemperatureChangesModel = {
160
- engineWaterTemperature: number;
161
- date: string;
162
- };
163
- type MechanizationTemperatureChangesVariable = {
164
- farmerId: string;
165
- mechanizationId: string;
166
- fromDate?: string | null | undefined;
167
- toDate?: string | null | undefined;
168
- };
169
- type MechanizationFuelConsumptionChangesModel = {
170
- fuelConsumption: number;
171
- date: string;
172
- };
173
- type MechanizationFuelConsumptionChangesVariable = {
174
- farmerId: string;
175
- mechanizationId: string;
176
- fromDate?: string | null | undefined;
177
- toDate?: string | null | undefined;
178
- };
179
-
180
4
  /**
181
5
  * This file was auto-generated by openapi-typescript.
182
6
  * Do not make direct changes to the file.
@@ -484,7 +308,8 @@ interface paths {
484
308
  /** Get resource list */
485
309
  get: operations["MechanizationsController_getMotorizedMechanizationSensors"];
486
310
  put?: never;
487
- post?: never;
311
+ /** Create resource */
312
+ post: operations["MechanizationsController_createMotorizedMechanization"];
488
313
  delete?: never;
489
314
  options?: never;
490
315
  head?: never;
@@ -950,6 +775,10 @@ interface components {
950
775
  readonly avatarURL: string;
951
776
  /** @example pride */
952
777
  readonly model: string;
778
+ /** @example 30 */
779
+ readonly performancePerKilometer: number;
780
+ /** @example 30 */
781
+ readonly timingPerformance: number;
953
782
  /** @example shrek */
954
783
  readonly commonName: string;
955
784
  readonly manufactureYear: string;
@@ -1007,6 +836,20 @@ interface components {
1007
836
  DeleteMechanizationDeviceCodeInput: {
1008
837
  verificationToken: string;
1009
838
  };
839
+ CreateMotorizedMechanizationSensorInput: {
840
+ speed: number;
841
+ heading: number;
842
+ latitude: number;
843
+ longitude: number;
844
+ fuelLevel: number;
845
+ engineRpm: number;
846
+ deviceCode: string;
847
+ stateEngine: boolean;
848
+ engineOilPressure: boolean;
849
+ engineWaterTemperature: number;
850
+ batteryChargePercentage: number;
851
+ mechanizationId: string;
852
+ };
1010
853
  MotorizedMechanizationSensor: {
1011
854
  readonly id: string;
1012
855
  /** Format: date-time */
@@ -1029,6 +872,18 @@ interface components {
1029
872
  readonly mechanizationId: string;
1030
873
  readonly mechanization: components["schemas"]["Mechanization"];
1031
874
  };
875
+ MotorizedMechanizationSensorResponseData: {
876
+ readonly meta: Record<string, never>;
877
+ readonly motorizedMechanizationSensor: components["schemas"]["MotorizedMechanizationSensor"];
878
+ };
879
+ MotorizedMechanizationSensorResponseResult: {
880
+ readonly message: string;
881
+ readonly code: string;
882
+ readonly data: components["schemas"]["MotorizedMechanizationSensorResponseData"];
883
+ };
884
+ MotorizedMechanizationSensorResponseDto: {
885
+ readonly result: components["schemas"]["MotorizedMechanizationSensorResponseResult"];
886
+ };
1032
887
  Alerts: {
1033
888
  readonly dangerous: boolean;
1034
889
  /** @example hello world */
@@ -2464,6 +2319,54 @@ interface operations {
2464
2319
  };
2465
2320
  };
2466
2321
  };
2322
+ MechanizationsController_createMotorizedMechanization: {
2323
+ parameters: {
2324
+ query?: never;
2325
+ header?: never;
2326
+ path: {
2327
+ mechanizationId: unknown;
2328
+ farmerId: unknown;
2329
+ };
2330
+ cookie?: never;
2331
+ };
2332
+ requestBody: {
2333
+ content: {
2334
+ "application/json": components["schemas"]["CreateMotorizedMechanizationSensorInput"];
2335
+ };
2336
+ };
2337
+ responses: {
2338
+ /** @description عملیات ثبت با موفقیت انجام شد */
2339
+ 201: {
2340
+ headers: {
2341
+ [name: string]: unknown;
2342
+ };
2343
+ content: {
2344
+ "application/json": components["schemas"]["MotorizedMechanizationSensorResponseDto"];
2345
+ };
2346
+ };
2347
+ /** @description درخواست نامعتبر است */
2348
+ 400: {
2349
+ headers: {
2350
+ [name: string]: unknown;
2351
+ };
2352
+ content?: never;
2353
+ };
2354
+ /** @description دسترسی غیرمجاز است */
2355
+ 401: {
2356
+ headers: {
2357
+ [name: string]: unknown;
2358
+ };
2359
+ content?: never;
2360
+ };
2361
+ /** @description خطای غیرمنتظره در سرور رخ داده است */
2362
+ 500: {
2363
+ headers: {
2364
+ [name: string]: unknown;
2365
+ };
2366
+ content?: never;
2367
+ };
2368
+ };
2369
+ };
2467
2370
  MechanizationsController_getSpeedChanges: {
2468
2371
  parameters: {
2469
2372
  query?: {
@@ -2940,6 +2843,199 @@ interface operations {
2940
2843
  };
2941
2844
  }
2942
2845
 
2846
+ declare const __brand: unique symbol;
2847
+ type Brand<B> = {
2848
+ readonly [__brand]: B;
2849
+ };
2850
+ type Branded<T, B> = Brand<B> & T;
2851
+
2852
+ declare namespace Identifiers {
2853
+ type MechanizationVarietyId = Branded<string, "mechanizationVariety-id">;
2854
+ type MechanizationId = Branded<string, "mechanization-id">;
2855
+ type SeasonsProcessId = Branded<string, " seasonsProcess-id">;
2856
+ type MotorizedMechanizationSensorId = Branded<string, "motorized-mechanization-sensorsId-id">;
2857
+ type FarmerId = Branded<string, "farmer-id">;
2858
+ type QuestionId = Branded<string, "question-id">;
2859
+ type MechanizationMovementChangeId = Branded<string, " movement-changes-id">;
2860
+ }
2861
+
2862
+ type ServiceType = "EXPERIMENT" | "VISIT" | "CHILLING_REQUIREMENT" | "CULTIVAR_RECOMMENDATION" | "FIRST_SAFFRON_IRRIGATION_DATE_RECOMMENDATION" | "HARVEST_DATE_RECOMMENDATION" | "QUESTIONNAIRE" | "SOWING_DATE_RECOMMENDATIONS" | "WEATHER_STATION" | "YIELD_GAP";
2863
+ type StatusType = "ACTIVE" | "ACTIVE_LEADING_EXPERT" | "APPROVED_EXPERIMENT_ANALYSIS_REQUEST" | "APPROVED_MISSION" | "APPROVED_RESIDENT_LEADING_EXPERT" | "ARCHIVED" | "AWAITING_APPROVAL_EXPERIMENT_ANALYSIS_REQUEST" | "AWAITING_APPROVAL_MISSION" | "AWAITING_APPROVAL_RESIDENT_LEADING_EXPERT" | "AWAITING_COLLEAGUE_APPROVAL_REQUEST" | "AWAITING_MISSION_COMPLETION_REQUEST" | "AWAITING_PAYMENT_REQUEST" | "AWAITING_PURCHASE_REQUEST" | "AWAITING_REVIEW_ACTIVATION" | "AWAITING_REVIEW_DATA_MISSION" | "AWAITING_REVIEW_INQUIRY" | "AWAITING_REVIEW_MISSION_DATA_REQUEST" | "AWAITING_REVIEW_MODIFICATION" | "AWAITING_REVIEW_OFFER" | "AWAITING_REVIEW_REGISTRATION" | "AWAITING_REVIEW_REQUEST" | "AWAITING_SAMPLE_DELIVERY_LABORATORY_MISSION" | "AWAITING_SEND_REQUEST" | "AWAITING_SIGNING_CONTRACT" | "AWAITING_START_EXPERIMENT_ANALYSIS_REQUEST" | "AWAITING_START_MISSION" | "AWAITING_SUBMIT_ACTIVATION" | "AWAITING_VERIFICATION_CHARGE_WALLET_TRANSACTION" | "CANCELED_EXPERIMENT_ANALYSIS_REQUEST" | "CANCELED_MISSION" | "CANCELED_REQUEST" | "COMPLETED" | "COMPLETED_EXPERIMENT_ANALYSIS_REQUEST" | "COMPLETED_MISSION" | "COMPLETED_REGISTRATION" | "COMPLETED_REQUEST" | "CONFIRMED" | "CONFIRMED_ACTIVATION" | "CONFIRMED_REGISTRATION" | "DONE" | "DRAFT" | "DRAFT_EXPERIMENT_ANALYSIS_REQUEST" | "DRAFT_MISSION" | "FAILED" | "FAILED_CHARGE_WALLET_TRANSACTION" | "INACTIVE" | "INVALID" | "INVALID_DEVICE_PUSH_TOKEN" | "IN_PROGRESS_EXPERIMENT_ANALYSIS_REQUEST" | "IN_PROGRESS_MISSION" | "PAID" | "PASS_PAYMENT" | "PENDING" | "PROCESSING" | "REJECTED" | "REJECTED_ACTIVATION" | "REJECTED_EXPERIMENT_ANALYSIS_REQUEST" | "REJECTED_MISSION" | "REJECTED_MODIFICATION" | "REJECTED_REGISTRATION" | "REJECTED_RESIDENT_LEADING_EXPERT" | "SUBMIT" | "SUCCESS" | "SUCCESS_PAYMENT_WALLET_TRANSACTION" | "VALID" | "VALID_DEVICE_PUSH_TOKEN" | "VERIFIED" | "VERIFIED_CHARGE_WALLET_TRANSACTION" | "WRITING" | "AWAITING_APPROVAL_RESIDENT_LEADING_EXPERT" | "APPROVED_RESIDENT_LEADING_EXPERT" | "REJECTED_RESIDENT_LEADING_EXPERT";
2864
+ type TaskType = "SAMPLING_REQUEST" | "SAMPLING_MISSION" | "ANALYSIS_REQUEST" | "MAP_DRAWING" | "WATER_SAMPLE_CONTROL" | "WATER_ANALYSIS_MEASUREMENT" | "WATER_EXPERIMENT_TECHNICAL_REVIEW" | "PLANT_SAMPLE_CONTROL" | "PLANT_ANALYSIS_MEASUREMENT" | "PLANT_EXPERIMENT_TECHNICAL_REVIEW" | "SOIL_SAMPLE_CONTROL" | "SOIL_ANALYSIS_MEASUREMENT" | "SOIL_EXPERIMENT_TECHNICAL_REVIEW" | "SENDING_REPORTS" | "TECHNICAL_REVIEW" | "EXPERIMENT_ANALYSIS_RESULTS_CONTROL" | "EXPERIMENT_RECOMMENDATION_ANALYSIS_RESULTS" | "SUPPORT_EXPERIMENTS" | "VISIT_REQUEST" | "FOLLOW_UP_VISIT" | "VISIT_MAP_DRAWING" | "VISIT_SENDING_REPORTS" | "SUPPORT_VISITS";
2865
+ type MechanizationType = "MOTORIZED" | "NON_MOTORIZED";
2866
+ type MechanizationSeasonProcessType = "GROWING" | "HARVESTING" | "PLANTING" | "TRANSPORTATION";
2867
+ type MechanizationMachineUsageType = "BALER" | "CRUSHING" | "CRUST_BREAKER" | "FERTILIZER_SPREADER" | "FORAGE_COLLECTOR" | "FURROWER" | "GRASS_CUTTER" | "GRINDING" | "HARVESTING" | "LEVELING" | "LOADER" | "MULTI_PURPOSE" | "SEEDER" | "SPRAYER" | "TILLAGE" | "TRANSPORTATION" | "WEEDER";
2868
+
2869
+ type Status = {
2870
+ id: string;
2871
+ label: string;
2872
+ name: StatusType;
2873
+ };
2874
+ type VarietyKind = {
2875
+ id: string;
2876
+ label: string;
2877
+ name: MechanizationType;
2878
+ };
2879
+ type MechanizationSeasonProcessKind = {
2880
+ id: string;
2881
+ label: string;
2882
+ name: MechanizationSeasonProcessType;
2883
+ };
2884
+ type MechanizationMachineUsageKind = {
2885
+ id: string;
2886
+ label: string;
2887
+ name: MechanizationMachineUsageType;
2888
+ };
2889
+
2890
+ type MechanizationVarietyModel = {
2891
+ id: Identifiers.MechanizationVarietyId;
2892
+ name: string;
2893
+ iconURL: string;
2894
+ kind: VarietyKind;
2895
+ seasonProcessIds: string[];
2896
+ machineUsageIds: string[];
2897
+ seasonsProcess: MechanizationSeasonProcessKind[];
2898
+ };
2899
+ type MechanizationVarietyVariables = {
2900
+ kindName: MechanizationType;
2901
+ };
2902
+ type MechanizationModel = {
2903
+ id: Identifiers.MechanizationId;
2904
+ model: string;
2905
+ commonName: string;
2906
+ avatarURL: string;
2907
+ manufactureYear: string;
2908
+ code: string;
2909
+ deviceCode: string;
2910
+ kind: VarietyKind;
2911
+ kindName: MechanizationType;
2912
+ variety: MechanizationVarietyModel;
2913
+ };
2914
+ type MechanizationsVariables = {
2915
+ farmerId: string;
2916
+ kindName: MechanizationType;
2917
+ };
2918
+ type MechanizationVariables = {
2919
+ farmerId: string;
2920
+ mechanizationId: string;
2921
+ };
2922
+ type SeasonsProcessModel = {
2923
+ id: Identifiers.SeasonsProcessId;
2924
+ name: string;
2925
+ label: string;
2926
+ mechanizationVarietyIds: string[];
2927
+ };
2928
+ type MotorizedMechanizationSensorsModel = {
2929
+ id: string;
2930
+ speed: number;
2931
+ heading: number;
2932
+ latitude: number;
2933
+ longitude: number;
2934
+ fuelLevel: number;
2935
+ engineRpm: number;
2936
+ deviceCode: string;
2937
+ stateEngine: boolean;
2938
+ engineOilPressure: boolean;
2939
+ engineWaterTemperature: number;
2940
+ batteryChargePercentage: number;
2941
+ mechanizationId: string;
2942
+ };
2943
+ type MotorizedMechanizationSensorsVariables = {
2944
+ farmerId: string;
2945
+ mechanizationId: string;
2946
+ };
2947
+ type TrackingDeviceCodeModel = {
2948
+ deviceCode: string;
2949
+ };
2950
+ type SubmitTrackingDeviceVariables = {
2951
+ farmerId: string;
2952
+ mechanizationId: string;
2953
+ deviceCode: string;
2954
+ };
2955
+ type SpeedChangesChartModel = {
2956
+ speed: number;
2957
+ date: string;
2958
+ };
2959
+ type SpeedChangesChartVariables = {
2960
+ farmerId: string;
2961
+ mechanizationId: string;
2962
+ };
2963
+ type UpdateTrackingDeviceVariables = {
2964
+ farmerId: string;
2965
+ mechanizationId: string;
2966
+ deviceCode: string;
2967
+ verificationToken: string;
2968
+ };
2969
+ type DeleteTrackingDeviceVariables = {
2970
+ farmerId: string;
2971
+ mechanizationId: string;
2972
+ verificationToken: string;
2973
+ };
2974
+ type MechanizationQuestionModel = {
2975
+ id: Identifiers.QuestionId;
2976
+ name: string;
2977
+ label: string;
2978
+ placeholder: string;
2979
+ isRequired: boolean;
2980
+ options?: {
2981
+ value: string | number;
2982
+ label: string;
2983
+ }[];
2984
+ type: "TEXT" | "FILE" | "DATE" | "RADIO" | "NUMBER" | "SELECT" | "PASSWORD" | "CHECK_BOX" | "MULTI_SELECT" | "RADIO";
2985
+ };
2986
+ type GetMechanizationQuestionVariable = {
2987
+ varietyId: string;
2988
+ };
2989
+ type MechanizationMovementChangesModel = {
2990
+ longitude: number;
2991
+ latitude: number;
2992
+ heading: number;
2993
+ date: string;
2994
+ };
2995
+ type MechanizationMovementChangesVariable = {
2996
+ farmerId: string;
2997
+ mechanizationId: string;
2998
+ fromDate?: string | null | undefined;
2999
+ toDate?: string | null | undefined;
3000
+ };
3001
+ type QuestionInformation = components["schemas"]["MechanizationInformationInput"];
3002
+ type CreateMechanizationVariables = {
3003
+ farmerId: string;
3004
+ body: {
3005
+ avatarURL: string;
3006
+ information: QuestionInformation[];
3007
+ varietyId: string;
3008
+ };
3009
+ };
3010
+ type VerifyPhoneNumberModel = {
3011
+ phoneNumber: string;
3012
+ verificationToken: string;
3013
+ };
3014
+ type VerifyPhoneNumberVariables = {
3015
+ phoneNumber: string;
3016
+ otpCode: string;
3017
+ };
3018
+ type MechanizationTemperatureChangesModel = {
3019
+ engineWaterTemperature: number;
3020
+ date: string;
3021
+ };
3022
+ type MechanizationTemperatureChangesVariable = {
3023
+ farmerId: string;
3024
+ mechanizationId: string;
3025
+ fromDate?: string | null | undefined;
3026
+ toDate?: string | null | undefined;
3027
+ };
3028
+ type MechanizationFuelConsumptionChangesModel = {
3029
+ fuelConsumption: number;
3030
+ date: string;
3031
+ };
3032
+ type MechanizationFuelConsumptionChangesVariable = {
3033
+ farmerId: string;
3034
+ mechanizationId: string;
3035
+ fromDate?: string | null | undefined;
3036
+ toDate?: string | null | undefined;
3037
+ };
3038
+
2943
3039
  type HttpMethod = "get" | "post" | "put" | "delete" | "patch";
2944
3040
  type ExtractPathsByMethod<M extends HttpMethod> = {
2945
3041
  [K in keyof paths]: M extends keyof paths[K] ? K : never;
@@ -2963,14 +3059,18 @@ type PathParams<Op> = Op extends {
2963
3059
  };
2964
3060
  } ? P extends object ? P : never : never;
2965
3061
  type ResponseData<Op> = Op extends {
2966
- responses: {
2967
- 200: {
2968
- content: {
2969
- "application/json": infer R;
2970
- };
3062
+ responses: Record<string, {
3063
+ content?: {
3064
+ "application/json"?: infer _R;
2971
3065
  };
2972
- };
2973
- } ? R : unknown;
3066
+ }>;
3067
+ } ? {
3068
+ [K in keyof Op["responses"]]: Op["responses"][K] extends {
3069
+ content: {
3070
+ "application/json": infer R;
3071
+ };
3072
+ } ? R : never;
3073
+ }[keyof Op["responses"]] : unknown;
2974
3074
 
2975
3075
  type ExtendedClient = AxiosInstance & {
2976
3076
  typed: <M extends HttpMethod, P extends ExtractPathsByMethod<M>, Op extends PathOperation<M, P>>(_method: M, _path: P, _config?: {
@@ -3001,8 +3101,9 @@ declare const createSDK: (config: ClientConfig, middlewares?: Parameters<typeof
3001
3101
  DeleteTrackingDeviceCode: ({ farmerId, mechanizationId, verificationToken, }: DeleteTrackingDeviceVariables) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<TrackingDeviceCodeModel>>;
3002
3102
  getMechanizationTemperatureChanges: ({ farmerId, mechanizationId, fromDate, toDate, }: MechanizationTemperatureChangesVariable) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<MechanizationTemperatureChangesModel[]>>;
3003
3103
  getMechanizationFuelConsumptionChanges: ({ farmerId, mechanizationId, fromDate, toDate, }: MechanizationFuelConsumptionChangesVariable) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<MechanizationFuelConsumptionChangesModel[]>>;
3104
+ CreateMechanization: ({ farmerId, body, }: CreateMechanizationVariables) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<unknown>>;
3004
3105
  };
3005
3106
  };
3006
3107
  };
3007
3108
 
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 };
3109
+ export { type CreateMechanizationVariables, 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 QuestionInformation, 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,11 @@ var mappers = {
143
143
  heading
144
144
  }),
145
145
  getMechanizationMovementChanges: (response) => response.map(mappers.getMechanizationMovementChange),
146
+ createMechanization: (_dto) => ({}),
147
+ verifyPhoneNumber: (dto) => ({
148
+ phoneNumber: dto.phoneNumber,
149
+ verificationToken: dto.verificationToken
150
+ }),
146
151
  getMechanizationTemperatureChange: ({
147
152
  engineWaterTemperature,
148
153
  date
@@ -191,11 +196,15 @@ var createMechanizationServices = (client) => ({
191
196
  mechanizationId
192
197
  }) => {
193
198
  try {
194
- const { data } = await client.get(
195
- `/farmers/${farmerId}/mechanizations/${mechanizationId}/sensors/speed-changes`
199
+ const result = await client.typed(
200
+ "get",
201
+ "/farmers/{farmerId}/mechanizations/{mechanizationId}/sensors/speed-changes",
202
+ {
203
+ pathParams: { farmerId, mechanizationId }
204
+ }
196
205
  );
197
206
  return R2.Ok(
198
- mappers.getSpeedChangesChartPointsList(data.result.data.speedChanges)
207
+ mappers.getSpeedChangesChartPointsList(result.result.data.speedChanges)
199
208
  );
200
209
  } catch (error) {
201
210
  return wrapError(error);
@@ -274,11 +283,20 @@ var createMechanizationServices = (client) => ({
274
283
  deviceCode
275
284
  }) => {
276
285
  try {
277
- const { data } = await client.put(
278
- `/farmers/${farmerId}/mechanizations/${mechanizationId}/submit-device-code`,
279
- { deviceCode }
286
+ const result = await client.typed(
287
+ "put",
288
+ "/farmers/{farmerId}/mechanizations/{mechanizationId}/submit-device-code",
289
+ {
290
+ body: { deviceCode },
291
+ pathParams: {
292
+ farmerId,
293
+ mechanizationId
294
+ }
295
+ }
296
+ );
297
+ return R2.Ok(
298
+ mappers.SubmitTrackingDeviceData(result.result.data.mechanization)
280
299
  );
281
- return R2.Ok(mappers.SubmitTrackingDeviceData(data));
282
300
  } catch (error) {
283
301
  return wrapError(error);
284
302
  }
@@ -304,11 +322,23 @@ var createMechanizationServices = (client) => ({
304
322
  verificationToken
305
323
  }) => {
306
324
  try {
307
- const { data } = await client.put(
308
- `/farmers/${farmerId}/mechanizations/${mechanizationId}/update-device-code`,
309
- { deviceCode, verificationToken }
325
+ const result = await client.typed(
326
+ "put",
327
+ "/farmers/{farmerId}/mechanizations/{mechanizationId}/update-device-code",
328
+ {
329
+ body: {
330
+ deviceCode,
331
+ verificationToken
332
+ },
333
+ pathParams: {
334
+ farmerId,
335
+ mechanizationId
336
+ }
337
+ }
338
+ );
339
+ return R2.Ok(
340
+ mappers.UpdateTrackingDeviceData(result.result.data.mechanization)
310
341
  );
311
- return R2.Ok(mappers.UpdateTrackingDeviceData(data));
312
342
  } catch (error) {
313
343
  return wrapError(error);
314
344
  }
@@ -365,17 +395,46 @@ var createMechanizationServices = (client) => ({
365
395
  verificationToken
366
396
  }) => {
367
397
  try {
368
- const { data } = await client.delete(
369
- `/farmers/${farmerId}/mechanizations/${mechanizationId}/delete-device-code`,
398
+ const result = await client.typed(
399
+ "delete",
400
+ "/farmers/{farmerId}/mechanizations/{mechanizationId}/delete-device-code",
370
401
  {
371
- data: { verificationToken }
402
+ body: {
403
+ verificationToken
404
+ },
405
+ pathParams: {
406
+ farmerId,
407
+ mechanizationId
408
+ }
372
409
  }
373
410
  );
374
- return R2.Ok(mappers.DeleteTrackingDeviceData(data));
411
+ return R2.Ok(
412
+ mappers.DeleteTrackingDeviceData(result.result.data.mechanization)
413
+ );
375
414
  } catch (error) {
376
415
  return wrapError(error);
377
416
  }
378
417
  },
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
+ // },
379
438
  getMechanizationTemperatureChanges: async ({
380
439
  farmerId,
381
440
  mechanizationId,
@@ -433,6 +492,32 @@ var createMechanizationServices = (client) => ({
433
492
  } catch (error) {
434
493
  return wrapError(error);
435
494
  }
495
+ },
496
+ CreateMechanization: async ({
497
+ farmerId,
498
+ body
499
+ }) => {
500
+ try {
501
+ const response = await client.typed(
502
+ "post",
503
+ "/farmers/{farmerId}/mechanizations",
504
+ {
505
+ pathParams: {
506
+ farmerId
507
+ },
508
+ body: {
509
+ avatarURL: body.avatarURL,
510
+ information: body.information,
511
+ varietyId: body.varietyId
512
+ }
513
+ }
514
+ );
515
+ return R2.Ok(
516
+ mappers.createMechanization(response.result.data.mechanization)
517
+ );
518
+ } catch (error) {
519
+ return wrapError(error);
520
+ }
436
521
  }
437
522
  });
438
523
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agroyaar/sdk",
3
- "version": "2.4.1",
3
+ "version": "2.4.3",
4
4
  "description": "",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",