@agroyaar/sdk 2.4.5 → 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
@@ -179,6 +179,7 @@ var mappers = {
179
179
  heading
180
180
  }),
181
181
  getMechanizationMovementChanges: (response) => response.map(mappers.getMechanizationMovementChange),
182
+ createMechanization: (_dto) => ({}),
182
183
  verifyPhoneNumber: (dto) => ({
183
184
  phoneNumber: dto.phoneNumber,
184
185
  verificationToken: dto.verificationToken
@@ -214,14 +215,13 @@ var createMechanizationServices = (client) => ({
214
215
  kindName
215
216
  }) => {
216
217
  try {
217
- const { data } = await client.get(
218
- `/statics/mechanizations-varieties?kindName=${kindName}`
219
- );
220
- return import_ts_belt2.R.Ok(
221
- mappers.getMechanizationVarietyList(
222
- data.result.data.mechanizationVarieties
223
- )
218
+ const { result } = await client.typed(
219
+ "get",
220
+ "/statics/mechanizations-varieties",
221
+ { params: { kindName } }
224
222
  );
223
+ const mechanizationVarieties = result.data.mechanizationVarieties;
224
+ return import_ts_belt2.R.Ok(mappers.getMechanizationVarietyList(mechanizationVarieties));
225
225
  } catch (error) {
226
226
  return wrapError(error);
227
227
  }
@@ -231,7 +231,7 @@ var createMechanizationServices = (client) => ({
231
231
  mechanizationId
232
232
  }) => {
233
233
  try {
234
- const result = await client.typed(
234
+ const { result } = await client.typed(
235
235
  "get",
236
236
  "/farmers/{farmerId}/mechanizations/{mechanizationId}/sensors/speed-changes",
237
237
  {
@@ -239,7 +239,7 @@ var createMechanizationServices = (client) => ({
239
239
  }
240
240
  );
241
241
  return import_ts_belt2.R.Ok(
242
- mappers.getSpeedChangesChartPointsList(result.result.data.speedChanges)
242
+ mappers.getSpeedChangesChartPointsList(result.data.speedChanges)
243
243
  );
244
244
  } catch (error) {
245
245
  return wrapError(error);
@@ -450,26 +450,21 @@ var createMechanizationServices = (client) => ({
450
450
  return wrapError(error);
451
451
  }
452
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
- // },
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
+ },
473
468
  getMechanizationTemperatureChanges: async ({
474
469
  farmerId,
475
470
  mechanizationId,
@@ -527,6 +522,32 @@ var createMechanizationServices = (client) => ({
527
522
  } catch (error) {
528
523
  return wrapError(error);
529
524
  }
525
+ },
526
+ CreateMechanization: async ({
527
+ farmerId,
528
+ body
529
+ }) => {
530
+ try {
531
+ const response = await client.typed(
532
+ "post",
533
+ "/farmers/{farmerId}/mechanizations",
534
+ {
535
+ pathParams: {
536
+ farmerId
537
+ },
538
+ body: {
539
+ avatarURL: body.avatarURL,
540
+ information: body.information,
541
+ varietyId: body.varietyId
542
+ }
543
+ }
544
+ );
545
+ return import_ts_belt2.R.Ok(
546
+ mappers.createMechanization(response.result.data.mechanization)
547
+ );
548
+ } catch (error) {
549
+ return wrapError(error);
550
+ }
530
551
  }
531
552
  });
532
553
 
package/dist/index.d.ts CHANGED
@@ -1,190 +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 VerifyPhoneNumberModel = {
160
- phoneNumber: string;
161
- verificationToken: string;
162
- };
163
- type VerifyPhoneNumberVariables = {
164
- phoneNumber: string;
165
- otpCode: string;
166
- };
167
- type MechanizationTemperatureChangesModel = {
168
- engineWaterTemperature: number;
169
- date: string;
170
- };
171
- type MechanizationTemperatureChangesVariable = {
172
- farmerId: string;
173
- mechanizationId: string;
174
- fromDate?: string | null | undefined;
175
- toDate?: string | null | undefined;
176
- };
177
- type MechanizationFuelConsumptionChangesModel = {
178
- fuelConsumption: number;
179
- date: string;
180
- };
181
- type MechanizationFuelConsumptionChangesVariable = {
182
- farmerId: string;
183
- mechanizationId: string;
184
- fromDate?: string | null | undefined;
185
- toDate?: string | null | undefined;
186
- };
187
-
188
4
  /**
189
5
  * This file was auto-generated by openapi-typescript.
190
6
  * Do not make direct changes to the file.
@@ -3027,6 +2843,199 @@ interface operations {
3027
2843
  };
3028
2844
  }
3029
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 | null;
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
+
3030
3039
  type HttpMethod = "get" | "post" | "put" | "delete" | "patch";
3031
3040
  type ExtractPathsByMethod<M extends HttpMethod> = {
3032
3041
  [K in keyof paths]: M extends keyof paths[K] ? K : never;
@@ -3050,14 +3059,18 @@ type PathParams<Op> = Op extends {
3050
3059
  };
3051
3060
  } ? P extends object ? P : never : never;
3052
3061
  type ResponseData<Op> = Op extends {
3053
- responses: {
3054
- 200: {
3055
- content: {
3056
- "application/json": infer R;
3057
- };
3062
+ responses: Record<string, {
3063
+ content?: {
3064
+ "application/json"?: infer _R;
3058
3065
  };
3059
- };
3060
- } ? 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;
3061
3074
 
3062
3075
  type ExtendedClient = AxiosInstance & {
3063
3076
  typed: <M extends HttpMethod, P extends ExtractPathsByMethod<M>, Op extends PathOperation<M, P>>(_method: M, _path: P, _config?: {
@@ -3086,10 +3099,12 @@ declare const createSDK: (config: ClientConfig, middlewares?: Parameters<typeof
3086
3099
  getMechanizationQuestionList: ({ varietyId, }: GetMechanizationQuestionVariable) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<MechanizationQuestionModel[]>>;
3087
3100
  getMechanizationMovementChanges: ({ farmerId, mechanizationId, fromDate, toDate, }: MechanizationMovementChangesVariable) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<MechanizationMovementChangesModel[]>>;
3088
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>>;
3089
3103
  getMechanizationTemperatureChanges: ({ farmerId, mechanizationId, fromDate, toDate, }: MechanizationTemperatureChangesVariable) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<MechanizationTemperatureChangesModel[]>>;
3090
3104
  getMechanizationFuelConsumptionChanges: ({ farmerId, mechanizationId, fromDate, toDate, }: MechanizationFuelConsumptionChangesVariable) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<MechanizationFuelConsumptionChangesModel[]>>;
3105
+ CreateMechanization: ({ farmerId, body, }: CreateMechanizationVariables) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<unknown>>;
3091
3106
  };
3092
3107
  };
3093
3108
  };
3094
3109
 
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 };
3110
+ 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,7 @@ var mappers = {
143
143
  heading
144
144
  }),
145
145
  getMechanizationMovementChanges: (response) => response.map(mappers.getMechanizationMovementChange),
146
+ createMechanization: (_dto) => ({}),
146
147
  verifyPhoneNumber: (dto) => ({
147
148
  phoneNumber: dto.phoneNumber,
148
149
  verificationToken: dto.verificationToken
@@ -178,14 +179,13 @@ var createMechanizationServices = (client) => ({
178
179
  kindName
179
180
  }) => {
180
181
  try {
181
- const { data } = await client.get(
182
- `/statics/mechanizations-varieties?kindName=${kindName}`
183
- );
184
- return R2.Ok(
185
- mappers.getMechanizationVarietyList(
186
- data.result.data.mechanizationVarieties
187
- )
182
+ const { result } = await client.typed(
183
+ "get",
184
+ "/statics/mechanizations-varieties",
185
+ { params: { kindName } }
188
186
  );
187
+ const mechanizationVarieties = result.data.mechanizationVarieties;
188
+ return R2.Ok(mappers.getMechanizationVarietyList(mechanizationVarieties));
189
189
  } catch (error) {
190
190
  return wrapError(error);
191
191
  }
@@ -195,7 +195,7 @@ var createMechanizationServices = (client) => ({
195
195
  mechanizationId
196
196
  }) => {
197
197
  try {
198
- const result = await client.typed(
198
+ const { result } = await client.typed(
199
199
  "get",
200
200
  "/farmers/{farmerId}/mechanizations/{mechanizationId}/sensors/speed-changes",
201
201
  {
@@ -203,7 +203,7 @@ var createMechanizationServices = (client) => ({
203
203
  }
204
204
  );
205
205
  return R2.Ok(
206
- mappers.getSpeedChangesChartPointsList(result.result.data.speedChanges)
206
+ mappers.getSpeedChangesChartPointsList(result.data.speedChanges)
207
207
  );
208
208
  } catch (error) {
209
209
  return wrapError(error);
@@ -414,26 +414,21 @@ var createMechanizationServices = (client) => ({
414
414
  return wrapError(error);
415
415
  }
416
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
- // },
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
+ },
437
432
  getMechanizationTemperatureChanges: async ({
438
433
  farmerId,
439
434
  mechanizationId,
@@ -491,6 +486,32 @@ var createMechanizationServices = (client) => ({
491
486
  } catch (error) {
492
487
  return wrapError(error);
493
488
  }
489
+ },
490
+ CreateMechanization: async ({
491
+ farmerId,
492
+ body
493
+ }) => {
494
+ try {
495
+ const response = await client.typed(
496
+ "post",
497
+ "/farmers/{farmerId}/mechanizations",
498
+ {
499
+ pathParams: {
500
+ farmerId
501
+ },
502
+ body: {
503
+ avatarURL: body.avatarURL,
504
+ information: body.information,
505
+ varietyId: body.varietyId
506
+ }
507
+ }
508
+ );
509
+ return R2.Ok(
510
+ mappers.createMechanization(response.result.data.mechanization)
511
+ );
512
+ } catch (error) {
513
+ return wrapError(error);
514
+ }
494
515
  }
495
516
  });
496
517
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agroyaar/sdk",
3
- "version": "2.4.5",
3
+ "version": "2.4.8",
4
4
  "description": "",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",