@agroyaar/sdk 2.1.2 → 2.1.4-0
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 +60 -32
- package/dist/index.d.ts +174 -159
- package/dist/index.mjs +60 -32
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -110,18 +110,18 @@ var mappers = {
|
|
|
110
110
|
date: response.date
|
|
111
111
|
}),
|
|
112
112
|
getSpeedChangesChartPointsList: (response) => response.map(mappers.getSpeedChangesChart),
|
|
113
|
-
getMechanization: (
|
|
114
|
-
id:
|
|
115
|
-
commonName:
|
|
116
|
-
model:
|
|
117
|
-
avatarURL:
|
|
118
|
-
manufactureYear:
|
|
119
|
-
code:
|
|
120
|
-
kind:
|
|
121
|
-
kindName:
|
|
122
|
-
variety: mappers.getMechanizationVariety(
|
|
113
|
+
getMechanization: (res) => ({
|
|
114
|
+
id: res.id,
|
|
115
|
+
commonName: res.commonName,
|
|
116
|
+
model: res.model,
|
|
117
|
+
avatarURL: res.avatarURL,
|
|
118
|
+
manufactureYear: res.manufactureYear,
|
|
119
|
+
code: res.code,
|
|
120
|
+
kind: res.kind,
|
|
121
|
+
kindName: res.kindName,
|
|
122
|
+
variety: mappers.getMechanizationVariety(res.variety)
|
|
123
123
|
}),
|
|
124
|
-
|
|
124
|
+
getMechanizations: (response) => response.map(mappers.getMechanization),
|
|
125
125
|
getSeasonsProcess: (response) => ({
|
|
126
126
|
id: response.id,
|
|
127
127
|
label: response.label,
|
|
@@ -150,6 +150,9 @@ var mappers = {
|
|
|
150
150
|
UpdateTrackingDeviceData: (response) => ({
|
|
151
151
|
deviceCode: response.deviceCode
|
|
152
152
|
}),
|
|
153
|
+
DeleteTrackingDeviceData: (response) => ({
|
|
154
|
+
deviceCode: response.deviceCode
|
|
155
|
+
}),
|
|
153
156
|
getQuestion: (dto) => ({
|
|
154
157
|
id: dto.id,
|
|
155
158
|
name: dto.key,
|
|
@@ -175,9 +178,7 @@ var mappers = {
|
|
|
175
178
|
heading
|
|
176
179
|
}),
|
|
177
180
|
getMechanizationMovementChanges: (response) => response.map(mappers.getMechanizationMovementChange),
|
|
178
|
-
|
|
179
|
-
deviceCode: response.deviceCode
|
|
180
|
-
})
|
|
181
|
+
createMechanization: (_dto) => ({})
|
|
181
182
|
};
|
|
182
183
|
|
|
183
184
|
// src/utils/wrapError.ts
|
|
@@ -220,20 +221,22 @@ var createMechanizationServices = (client) => ({
|
|
|
220
221
|
return wrapError(error);
|
|
221
222
|
}
|
|
222
223
|
},
|
|
223
|
-
getMechanizations: async (
|
|
224
|
+
getMechanizations: async ({ farmerId, kindName }) => {
|
|
224
225
|
try {
|
|
225
226
|
const response = await client.typed(
|
|
226
227
|
"get",
|
|
227
228
|
"/farmers/{farmerId}/mechanizations",
|
|
228
229
|
{
|
|
229
230
|
params: {
|
|
230
|
-
kindName
|
|
231
|
+
kindName
|
|
232
|
+
},
|
|
233
|
+
pathParams: {
|
|
234
|
+
farmerId
|
|
231
235
|
}
|
|
232
236
|
}
|
|
233
237
|
);
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
);
|
|
238
|
+
const mechanizations = response.result.data.mechanizations;
|
|
239
|
+
return import_ts_belt2.R.Ok(mappers.getMechanizations(mechanizations));
|
|
237
240
|
} catch (error) {
|
|
238
241
|
return wrapError(error);
|
|
239
242
|
}
|
|
@@ -253,10 +256,9 @@ var createMechanizationServices = (client) => ({
|
|
|
253
256
|
}
|
|
254
257
|
}
|
|
255
258
|
);
|
|
259
|
+
const motorizedMechanizationSensors = response.result.data.motorizedMechanizationSensors;
|
|
256
260
|
return import_ts_belt2.R.Ok(
|
|
257
|
-
mappers.getMotorizedMechanizationSensors(
|
|
258
|
-
response.result.data.motorizedMechanizationSensors
|
|
259
|
-
)
|
|
261
|
+
mappers.getMotorizedMechanizationSensors(motorizedMechanizationSensors)
|
|
260
262
|
);
|
|
261
263
|
} catch (error) {
|
|
262
264
|
return wrapError(error);
|
|
@@ -321,13 +323,14 @@ var createMechanizationServices = (client) => ({
|
|
|
321
323
|
}
|
|
322
324
|
);
|
|
323
325
|
const questions = data?.result?.data.mechanizationsQuestions;
|
|
324
|
-
console.log("in SDK - qustions", questions);
|
|
325
326
|
return import_ts_belt2.R.Ok(mappers.getQuestions(questions));
|
|
326
327
|
} catch (error) {
|
|
327
328
|
return wrapError(error);
|
|
328
329
|
}
|
|
329
330
|
},
|
|
330
331
|
getMechanizationMovementChanges: async ({
|
|
332
|
+
farmerId,
|
|
333
|
+
mechanizationId,
|
|
331
334
|
fromDate,
|
|
332
335
|
toDate
|
|
333
336
|
}) => {
|
|
@@ -339,14 +342,15 @@ var createMechanizationServices = (client) => ({
|
|
|
339
342
|
params: {
|
|
340
343
|
fromDate,
|
|
341
344
|
toDate
|
|
345
|
+
},
|
|
346
|
+
pathParams: {
|
|
347
|
+
farmerId,
|
|
348
|
+
mechanizationId
|
|
342
349
|
}
|
|
343
350
|
}
|
|
344
351
|
);
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
response.result.data.movementChanges
|
|
348
|
-
)
|
|
349
|
-
);
|
|
352
|
+
const movementChanges = response.result.data.movementChanges;
|
|
353
|
+
return import_ts_belt2.R.Ok(mappers.getMechanizationMovementChanges(movementChanges));
|
|
350
354
|
} catch (error) {
|
|
351
355
|
return wrapError(error);
|
|
352
356
|
}
|
|
@@ -360,14 +364,38 @@ var createMechanizationServices = (client) => ({
|
|
|
360
364
|
const { data } = await client.delete(
|
|
361
365
|
`/farmers/${farmerId}/mechanizations/${mechanizationId}/delete-device-code`,
|
|
362
366
|
{
|
|
363
|
-
data: verificationToken
|
|
367
|
+
data: { verificationToken }
|
|
364
368
|
}
|
|
365
369
|
);
|
|
366
370
|
return import_ts_belt2.R.Ok(mappers.DeleteTrackingDeviceData(data));
|
|
367
371
|
} catch (error) {
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
372
|
+
return wrapError(error);
|
|
373
|
+
}
|
|
374
|
+
},
|
|
375
|
+
CreateMechanization: async ({
|
|
376
|
+
farmerId,
|
|
377
|
+
body
|
|
378
|
+
}) => {
|
|
379
|
+
try {
|
|
380
|
+
const response = await client.typed(
|
|
381
|
+
"post",
|
|
382
|
+
"/farmers/{farmerId}/mechanizations",
|
|
383
|
+
{
|
|
384
|
+
pathParams: {
|
|
385
|
+
farmerId
|
|
386
|
+
},
|
|
387
|
+
body: {
|
|
388
|
+
avatarURL: body.avatarURL,
|
|
389
|
+
information: body.information,
|
|
390
|
+
varietyId: body.varietyId
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
);
|
|
394
|
+
return import_ts_belt2.R.Ok(
|
|
395
|
+
mappers.createMechanization(response.result.data.mechanization)
|
|
396
|
+
);
|
|
397
|
+
} catch (error) {
|
|
398
|
+
return wrapError(error);
|
|
371
399
|
}
|
|
372
400
|
}
|
|
373
401
|
});
|
package/dist/index.d.ts
CHANGED
|
@@ -1,155 +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
|
-
kind: VarietyKind;
|
|
68
|
-
kindName: MechanizationType;
|
|
69
|
-
variety: MechanizationVarietyModel;
|
|
70
|
-
};
|
|
71
|
-
type MechanizationVariables = {
|
|
72
|
-
farmerId: string;
|
|
73
|
-
kindName: MechanizationType;
|
|
74
|
-
};
|
|
75
|
-
type SeasonsProcessModel = {
|
|
76
|
-
id: Identifiers.SeasonsProcessId;
|
|
77
|
-
name: string;
|
|
78
|
-
label: string;
|
|
79
|
-
mechanizationVarietyIds: string[];
|
|
80
|
-
};
|
|
81
|
-
type MotorizedMechanizationSensorsModel = {
|
|
82
|
-
id: string;
|
|
83
|
-
speed: number;
|
|
84
|
-
heading: number;
|
|
85
|
-
latitude: number;
|
|
86
|
-
longitude: number;
|
|
87
|
-
fuelLevel: number;
|
|
88
|
-
engineRpm: number;
|
|
89
|
-
deviceCode: string;
|
|
90
|
-
stateEngine: boolean;
|
|
91
|
-
engineOilPressure: boolean;
|
|
92
|
-
engineWaterTemperature: number;
|
|
93
|
-
batteryChargePercentage: number;
|
|
94
|
-
mechanizationId: string;
|
|
95
|
-
};
|
|
96
|
-
type MotorizedMechanizationSensorsVariables = {
|
|
97
|
-
farmerId: string;
|
|
98
|
-
mechanizationId: string;
|
|
99
|
-
};
|
|
100
|
-
type TrackingDeviceCodeModel = {
|
|
101
|
-
deviceCode: string;
|
|
102
|
-
};
|
|
103
|
-
type SubmitTrackingDeviceVariables = {
|
|
104
|
-
farmerId: string;
|
|
105
|
-
mechanizationId: string;
|
|
106
|
-
deviceCode: string;
|
|
107
|
-
};
|
|
108
|
-
type SpeedChangesChartModel = {
|
|
109
|
-
speed: number;
|
|
110
|
-
date: string;
|
|
111
|
-
};
|
|
112
|
-
type SpeedChangesChartVariables = {
|
|
113
|
-
farmerId: string;
|
|
114
|
-
mechanizationId: string;
|
|
115
|
-
};
|
|
116
|
-
type UpdateTrackingDeviceVariables = {
|
|
117
|
-
farmerId: string;
|
|
118
|
-
mechanizationId: string;
|
|
119
|
-
deviceCode: string;
|
|
120
|
-
verificationToken: string;
|
|
121
|
-
};
|
|
122
|
-
type MechanizationQuestionModel = {
|
|
123
|
-
id: Identifiers.QuestionId;
|
|
124
|
-
name: string;
|
|
125
|
-
label: string;
|
|
126
|
-
placeholder: string;
|
|
127
|
-
isRequired: boolean;
|
|
128
|
-
options?: {
|
|
129
|
-
value: string | number;
|
|
130
|
-
label: string;
|
|
131
|
-
}[];
|
|
132
|
-
type: "TEXT" | "FILE" | "DATE" | "RADIO" | "NUMBER" | "SELECT" | "PASSWORD" | "CHECK_BOX" | "MULTI_SELECT" | "RADIO";
|
|
133
|
-
};
|
|
134
|
-
type GetMechanizationQuestionVariable = {
|
|
135
|
-
varietyId: string;
|
|
136
|
-
};
|
|
137
|
-
type MechanizationMovementChangesModel = {
|
|
138
|
-
longitude: number;
|
|
139
|
-
latitude: number;
|
|
140
|
-
heading: number;
|
|
141
|
-
date: string;
|
|
142
|
-
};
|
|
143
|
-
type MechanizationMovementChangesVariable = {
|
|
144
|
-
fromDate?: string | null | undefined;
|
|
145
|
-
toDate?: string | null | undefined;
|
|
146
|
-
};
|
|
147
|
-
type DeleteTrackingDeviceVariables = {
|
|
148
|
-
farmerId: Identifiers.FarmerId;
|
|
149
|
-
mechanizationId: Identifiers.MechanizationId;
|
|
150
|
-
verificationToken: string;
|
|
151
|
-
};
|
|
152
|
-
|
|
153
4
|
/**
|
|
154
5
|
* This file was auto-generated by openapi-typescript.
|
|
155
6
|
* Do not make direct changes to the file.
|
|
@@ -2913,6 +2764,165 @@ interface operations {
|
|
|
2913
2764
|
};
|
|
2914
2765
|
}
|
|
2915
2766
|
|
|
2767
|
+
declare const __brand: unique symbol;
|
|
2768
|
+
type Brand<B> = {
|
|
2769
|
+
readonly [__brand]: B;
|
|
2770
|
+
};
|
|
2771
|
+
type Branded<T, B> = Brand<B> & T;
|
|
2772
|
+
|
|
2773
|
+
declare namespace Identifiers {
|
|
2774
|
+
type MechanizationVarietyId = Branded<string, "mechanizationVariety-id">;
|
|
2775
|
+
type MechanizationId = Branded<string, "mechanization-id">;
|
|
2776
|
+
type SeasonsProcessId = Branded<string, " seasonsProcess-id">;
|
|
2777
|
+
type MotorizedMechanizationSensorId = Branded<string, "motorized-mechanization-sensorsId-id">;
|
|
2778
|
+
type FarmerId = Branded<string, "farmer-id">;
|
|
2779
|
+
type QuestionId = Branded<string, "question-id">;
|
|
2780
|
+
type MechanizationMovementChangeId = Branded<string, " movement-changes-id">;
|
|
2781
|
+
}
|
|
2782
|
+
|
|
2783
|
+
type ServiceType = "EXPERIMENT" | "VISIT" | "CHILLING_REQUIREMENT" | "CULTIVAR_RECOMMENDATION" | "FIRST_SAFFRON_IRRIGATION_DATE_RECOMMENDATION" | "HARVEST_DATE_RECOMMENDATION" | "QUESTIONNAIRE" | "SOWING_DATE_RECOMMENDATIONS" | "WEATHER_STATION" | "YIELD_GAP";
|
|
2784
|
+
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";
|
|
2785
|
+
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";
|
|
2786
|
+
type MechanizationType = "MOTORIZED" | "NON_MOTORIZED";
|
|
2787
|
+
type MechanizationSeasonProcessType = "GROWING" | "HARVESTING" | "PLANTING" | "TRANSPORTATION";
|
|
2788
|
+
type MechanizationMachineUsageType = "BALER" | "CRUSHING" | "CRUST_BREAKER" | "FERTILIZER_SPREADER" | "FORAGE_COLLECTOR" | "FURROWER" | "GRASS_CUTTER" | "GRINDING" | "HARVESTING" | "LEVELING" | "LOADER" | "MULTI_PURPOSE" | "SEEDER" | "SPRAYER" | "TILLAGE" | "TRANSPORTATION" | "WEEDER";
|
|
2789
|
+
|
|
2790
|
+
type Status = {
|
|
2791
|
+
id: string;
|
|
2792
|
+
label: string;
|
|
2793
|
+
name: StatusType;
|
|
2794
|
+
};
|
|
2795
|
+
type VarietyKind = {
|
|
2796
|
+
id: string;
|
|
2797
|
+
label: string;
|
|
2798
|
+
name: MechanizationType;
|
|
2799
|
+
};
|
|
2800
|
+
type MechanizationSeasonProcessKind = {
|
|
2801
|
+
id: string;
|
|
2802
|
+
label: string;
|
|
2803
|
+
name: MechanizationSeasonProcessType;
|
|
2804
|
+
};
|
|
2805
|
+
type MechanizationMachineUsageKind = {
|
|
2806
|
+
id: string;
|
|
2807
|
+
label: string;
|
|
2808
|
+
name: MechanizationMachineUsageType;
|
|
2809
|
+
};
|
|
2810
|
+
|
|
2811
|
+
type MechanizationVarietyModel = {
|
|
2812
|
+
id: Identifiers.MechanizationVarietyId;
|
|
2813
|
+
name: string;
|
|
2814
|
+
iconURL: string;
|
|
2815
|
+
kind: VarietyKind;
|
|
2816
|
+
seasonProcessIds: string[];
|
|
2817
|
+
machineUsageIds: string[];
|
|
2818
|
+
seasonsProcess: MechanizationSeasonProcessKind[];
|
|
2819
|
+
};
|
|
2820
|
+
type MechanizationVarietyVariables = {
|
|
2821
|
+
kindName: MechanizationType;
|
|
2822
|
+
};
|
|
2823
|
+
type MechanizationModel = {
|
|
2824
|
+
id: Identifiers.MechanizationId;
|
|
2825
|
+
model: string;
|
|
2826
|
+
commonName: string;
|
|
2827
|
+
avatarURL: string;
|
|
2828
|
+
manufactureYear: string;
|
|
2829
|
+
code: string;
|
|
2830
|
+
kind: VarietyKind;
|
|
2831
|
+
kindName: MechanizationType;
|
|
2832
|
+
variety: MechanizationVarietyModel;
|
|
2833
|
+
};
|
|
2834
|
+
type MechanizationVariables = {
|
|
2835
|
+
farmerId: string;
|
|
2836
|
+
kindName: MechanizationType;
|
|
2837
|
+
};
|
|
2838
|
+
type SeasonsProcessModel = {
|
|
2839
|
+
id: Identifiers.SeasonsProcessId;
|
|
2840
|
+
name: string;
|
|
2841
|
+
label: string;
|
|
2842
|
+
mechanizationVarietyIds: string[];
|
|
2843
|
+
};
|
|
2844
|
+
type MotorizedMechanizationSensorsModel = {
|
|
2845
|
+
id: string;
|
|
2846
|
+
speed: number;
|
|
2847
|
+
heading: number;
|
|
2848
|
+
latitude: number;
|
|
2849
|
+
longitude: number;
|
|
2850
|
+
fuelLevel: number;
|
|
2851
|
+
engineRpm: number;
|
|
2852
|
+
deviceCode: string;
|
|
2853
|
+
stateEngine: boolean;
|
|
2854
|
+
engineOilPressure: boolean;
|
|
2855
|
+
engineWaterTemperature: number;
|
|
2856
|
+
batteryChargePercentage: number;
|
|
2857
|
+
mechanizationId: string;
|
|
2858
|
+
};
|
|
2859
|
+
type MotorizedMechanizationSensorsVariables = {
|
|
2860
|
+
farmerId: string;
|
|
2861
|
+
mechanizationId: string;
|
|
2862
|
+
};
|
|
2863
|
+
type TrackingDeviceCodeModel = {
|
|
2864
|
+
deviceCode: string;
|
|
2865
|
+
};
|
|
2866
|
+
type SubmitTrackingDeviceVariables = {
|
|
2867
|
+
farmerId: string;
|
|
2868
|
+
mechanizationId: string;
|
|
2869
|
+
deviceCode: string;
|
|
2870
|
+
};
|
|
2871
|
+
type SpeedChangesChartModel = {
|
|
2872
|
+
speed: number;
|
|
2873
|
+
date: string;
|
|
2874
|
+
};
|
|
2875
|
+
type SpeedChangesChartVariables = {
|
|
2876
|
+
farmerId: string;
|
|
2877
|
+
mechanizationId: string;
|
|
2878
|
+
};
|
|
2879
|
+
type UpdateTrackingDeviceVariables = {
|
|
2880
|
+
farmerId: string;
|
|
2881
|
+
mechanizationId: string;
|
|
2882
|
+
deviceCode: string;
|
|
2883
|
+
verificationToken: string;
|
|
2884
|
+
};
|
|
2885
|
+
type DeleteTrackingDeviceVariables = {
|
|
2886
|
+
farmerId: string;
|
|
2887
|
+
mechanizationId: string;
|
|
2888
|
+
verificationToken: string;
|
|
2889
|
+
};
|
|
2890
|
+
type MechanizationQuestionModel = {
|
|
2891
|
+
id: Identifiers.QuestionId;
|
|
2892
|
+
name: string;
|
|
2893
|
+
label: string;
|
|
2894
|
+
placeholder: string;
|
|
2895
|
+
isRequired: boolean;
|
|
2896
|
+
options?: {
|
|
2897
|
+
value: string | number;
|
|
2898
|
+
label: string;
|
|
2899
|
+
}[];
|
|
2900
|
+
type: "TEXT" | "FILE" | "DATE" | "RADIO" | "NUMBER" | "SELECT" | "PASSWORD" | "CHECK_BOX" | "MULTI_SELECT" | "RADIO";
|
|
2901
|
+
};
|
|
2902
|
+
type GetMechanizationQuestionVariable = {
|
|
2903
|
+
varietyId: string;
|
|
2904
|
+
};
|
|
2905
|
+
type MechanizationMovementChangesModel = {
|
|
2906
|
+
longitude: number;
|
|
2907
|
+
latitude: number;
|
|
2908
|
+
heading: number;
|
|
2909
|
+
date: string;
|
|
2910
|
+
};
|
|
2911
|
+
type MechanizationMovementChangesVariable = {
|
|
2912
|
+
farmerId: string;
|
|
2913
|
+
mechanizationId: string;
|
|
2914
|
+
fromDate?: string | null | undefined;
|
|
2915
|
+
toDate?: string | null | undefined;
|
|
2916
|
+
};
|
|
2917
|
+
type CreateMechanizationVariables = {
|
|
2918
|
+
farmerId: string;
|
|
2919
|
+
body: {
|
|
2920
|
+
avatarURL: string;
|
|
2921
|
+
information: components["schemas"]["MechanizationInformationInput"][];
|
|
2922
|
+
varietyId: string;
|
|
2923
|
+
};
|
|
2924
|
+
};
|
|
2925
|
+
|
|
2916
2926
|
type HttpMethod = "get" | "post" | "put" | "delete" | "patch";
|
|
2917
2927
|
type ExtractPathsByMethod<M extends HttpMethod> = {
|
|
2918
2928
|
[K in keyof paths]: M extends keyof paths[K] ? K : never;
|
|
@@ -2936,14 +2946,18 @@ type PathParams<Op> = Op extends {
|
|
|
2936
2946
|
};
|
|
2937
2947
|
} ? P extends object ? P : never : never;
|
|
2938
2948
|
type ResponseData<Op> = Op extends {
|
|
2939
|
-
responses: {
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
"application/json": infer R;
|
|
2943
|
-
};
|
|
2949
|
+
responses: Record<string, {
|
|
2950
|
+
content?: {
|
|
2951
|
+
"application/json"?: infer _R;
|
|
2944
2952
|
};
|
|
2945
|
-
}
|
|
2946
|
-
} ?
|
|
2953
|
+
}>;
|
|
2954
|
+
} ? {
|
|
2955
|
+
[K in keyof Op["responses"]]: Op["responses"][K] extends {
|
|
2956
|
+
content: {
|
|
2957
|
+
"application/json": infer R;
|
|
2958
|
+
};
|
|
2959
|
+
} ? R : never;
|
|
2960
|
+
}[keyof Op["responses"]] : unknown;
|
|
2947
2961
|
|
|
2948
2962
|
type ExtendedClient = AxiosInstance & {
|
|
2949
2963
|
typed: <M extends HttpMethod, P extends ExtractPathsByMethod<M>, Op extends PathOperation<M, P>>(_method: M, _path: P, _config?: {
|
|
@@ -2963,16 +2977,17 @@ declare const createSDK: (config: ClientConfig, middlewares?: Parameters<typeof
|
|
|
2963
2977
|
mechanization: {
|
|
2964
2978
|
getMechanizationVarieties: ({ kindName, }: MechanizationVarietyVariables) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<MechanizationVarietyModel[]>>;
|
|
2965
2979
|
getSpeedChangesChartData: ({ farmerId, mechanizationId, }: SpeedChangesChartVariables) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<SpeedChangesChartModel[]>>;
|
|
2966
|
-
getMechanizations: (
|
|
2980
|
+
getMechanizations: ({ farmerId, kindName }: MechanizationVariables) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<MechanizationModel[]>>;
|
|
2967
2981
|
getMotorizedMechanizationSensors: ({ farmerId, mechanizationId, }: MotorizedMechanizationSensorsVariables) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<MotorizedMechanizationSensorsModel>>;
|
|
2968
2982
|
SubmitTrackingDeviceCode: ({ farmerId, mechanizationId, deviceCode, }: SubmitTrackingDeviceVariables) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<TrackingDeviceCodeModel>>;
|
|
2969
2983
|
getSeasonsProcess: () => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<SeasonsProcessModel[]>>;
|
|
2970
2984
|
UpdateTrackingDeviceCode: ({ farmerId, mechanizationId, deviceCode, verificationToken, }: UpdateTrackingDeviceVariables) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<TrackingDeviceCodeModel>>;
|
|
2971
2985
|
getMechanizationQuestionList: ({ varietyId, }: GetMechanizationQuestionVariable) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<MechanizationQuestionModel[]>>;
|
|
2972
|
-
getMechanizationMovementChanges: ({ fromDate, toDate, }: MechanizationMovementChangesVariable) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<MechanizationMovementChangesModel[]>>;
|
|
2986
|
+
getMechanizationMovementChanges: ({ farmerId, mechanizationId, fromDate, toDate, }: MechanizationMovementChangesVariable) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<MechanizationMovementChangesModel[]>>;
|
|
2973
2987
|
DeleteTrackingDeviceCode: ({ farmerId, mechanizationId, verificationToken, }: DeleteTrackingDeviceVariables) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<TrackingDeviceCodeModel>>;
|
|
2988
|
+
CreateMechanization: ({ farmerId, body, }: CreateMechanizationVariables) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<unknown>>;
|
|
2974
2989
|
};
|
|
2975
2990
|
};
|
|
2976
2991
|
};
|
|
2977
2992
|
|
|
2978
|
-
export { type DeleteTrackingDeviceVariables, type GetMechanizationQuestionVariable, Identifiers, type MechanizationMachineUsageKind, type MechanizationMachineUsageType, type MechanizationModel, type MechanizationMovementChangesModel, type MechanizationMovementChangesVariable, type MechanizationQuestionModel, type MechanizationSeasonProcessKind, type MechanizationSeasonProcessType, type MechanizationType, type MechanizationVariables, type MechanizationVarietyModel, type MechanizationVarietyVariables, 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 };
|
|
2993
|
+
export { type CreateMechanizationVariables, type DeleteTrackingDeviceVariables, type GetMechanizationQuestionVariable, Identifiers, type MechanizationMachineUsageKind, type MechanizationMachineUsageType, type MechanizationModel, type MechanizationMovementChangesModel, type MechanizationMovementChangesVariable, type MechanizationQuestionModel, type MechanizationSeasonProcessKind, type MechanizationSeasonProcessType, type MechanizationType, type MechanizationVariables, type MechanizationVarietyModel, type MechanizationVarietyVariables, 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 };
|
package/dist/index.mjs
CHANGED
|
@@ -74,18 +74,18 @@ var mappers = {
|
|
|
74
74
|
date: response.date
|
|
75
75
|
}),
|
|
76
76
|
getSpeedChangesChartPointsList: (response) => response.map(mappers.getSpeedChangesChart),
|
|
77
|
-
getMechanization: (
|
|
78
|
-
id:
|
|
79
|
-
commonName:
|
|
80
|
-
model:
|
|
81
|
-
avatarURL:
|
|
82
|
-
manufactureYear:
|
|
83
|
-
code:
|
|
84
|
-
kind:
|
|
85
|
-
kindName:
|
|
86
|
-
variety: mappers.getMechanizationVariety(
|
|
77
|
+
getMechanization: (res) => ({
|
|
78
|
+
id: res.id,
|
|
79
|
+
commonName: res.commonName,
|
|
80
|
+
model: res.model,
|
|
81
|
+
avatarURL: res.avatarURL,
|
|
82
|
+
manufactureYear: res.manufactureYear,
|
|
83
|
+
code: res.code,
|
|
84
|
+
kind: res.kind,
|
|
85
|
+
kindName: res.kindName,
|
|
86
|
+
variety: mappers.getMechanizationVariety(res.variety)
|
|
87
87
|
}),
|
|
88
|
-
|
|
88
|
+
getMechanizations: (response) => response.map(mappers.getMechanization),
|
|
89
89
|
getSeasonsProcess: (response) => ({
|
|
90
90
|
id: response.id,
|
|
91
91
|
label: response.label,
|
|
@@ -114,6 +114,9 @@ var mappers = {
|
|
|
114
114
|
UpdateTrackingDeviceData: (response) => ({
|
|
115
115
|
deviceCode: response.deviceCode
|
|
116
116
|
}),
|
|
117
|
+
DeleteTrackingDeviceData: (response) => ({
|
|
118
|
+
deviceCode: response.deviceCode
|
|
119
|
+
}),
|
|
117
120
|
getQuestion: (dto) => ({
|
|
118
121
|
id: dto.id,
|
|
119
122
|
name: dto.key,
|
|
@@ -139,9 +142,7 @@ var mappers = {
|
|
|
139
142
|
heading
|
|
140
143
|
}),
|
|
141
144
|
getMechanizationMovementChanges: (response) => response.map(mappers.getMechanizationMovementChange),
|
|
142
|
-
|
|
143
|
-
deviceCode: response.deviceCode
|
|
144
|
-
})
|
|
145
|
+
createMechanization: (_dto) => ({})
|
|
145
146
|
};
|
|
146
147
|
|
|
147
148
|
// src/utils/wrapError.ts
|
|
@@ -184,20 +185,22 @@ var createMechanizationServices = (client) => ({
|
|
|
184
185
|
return wrapError(error);
|
|
185
186
|
}
|
|
186
187
|
},
|
|
187
|
-
getMechanizations: async (
|
|
188
|
+
getMechanizations: async ({ farmerId, kindName }) => {
|
|
188
189
|
try {
|
|
189
190
|
const response = await client.typed(
|
|
190
191
|
"get",
|
|
191
192
|
"/farmers/{farmerId}/mechanizations",
|
|
192
193
|
{
|
|
193
194
|
params: {
|
|
194
|
-
kindName
|
|
195
|
+
kindName
|
|
196
|
+
},
|
|
197
|
+
pathParams: {
|
|
198
|
+
farmerId
|
|
195
199
|
}
|
|
196
200
|
}
|
|
197
201
|
);
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
);
|
|
202
|
+
const mechanizations = response.result.data.mechanizations;
|
|
203
|
+
return R2.Ok(mappers.getMechanizations(mechanizations));
|
|
201
204
|
} catch (error) {
|
|
202
205
|
return wrapError(error);
|
|
203
206
|
}
|
|
@@ -217,10 +220,9 @@ var createMechanizationServices = (client) => ({
|
|
|
217
220
|
}
|
|
218
221
|
}
|
|
219
222
|
);
|
|
223
|
+
const motorizedMechanizationSensors = response.result.data.motorizedMechanizationSensors;
|
|
220
224
|
return R2.Ok(
|
|
221
|
-
mappers.getMotorizedMechanizationSensors(
|
|
222
|
-
response.result.data.motorizedMechanizationSensors
|
|
223
|
-
)
|
|
225
|
+
mappers.getMotorizedMechanizationSensors(motorizedMechanizationSensors)
|
|
224
226
|
);
|
|
225
227
|
} catch (error) {
|
|
226
228
|
return wrapError(error);
|
|
@@ -285,13 +287,14 @@ var createMechanizationServices = (client) => ({
|
|
|
285
287
|
}
|
|
286
288
|
);
|
|
287
289
|
const questions = data?.result?.data.mechanizationsQuestions;
|
|
288
|
-
console.log("in SDK - qustions", questions);
|
|
289
290
|
return R2.Ok(mappers.getQuestions(questions));
|
|
290
291
|
} catch (error) {
|
|
291
292
|
return wrapError(error);
|
|
292
293
|
}
|
|
293
294
|
},
|
|
294
295
|
getMechanizationMovementChanges: async ({
|
|
296
|
+
farmerId,
|
|
297
|
+
mechanizationId,
|
|
295
298
|
fromDate,
|
|
296
299
|
toDate
|
|
297
300
|
}) => {
|
|
@@ -303,14 +306,15 @@ var createMechanizationServices = (client) => ({
|
|
|
303
306
|
params: {
|
|
304
307
|
fromDate,
|
|
305
308
|
toDate
|
|
309
|
+
},
|
|
310
|
+
pathParams: {
|
|
311
|
+
farmerId,
|
|
312
|
+
mechanizationId
|
|
306
313
|
}
|
|
307
314
|
}
|
|
308
315
|
);
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
response.result.data.movementChanges
|
|
312
|
-
)
|
|
313
|
-
);
|
|
316
|
+
const movementChanges = response.result.data.movementChanges;
|
|
317
|
+
return R2.Ok(mappers.getMechanizationMovementChanges(movementChanges));
|
|
314
318
|
} catch (error) {
|
|
315
319
|
return wrapError(error);
|
|
316
320
|
}
|
|
@@ -324,14 +328,38 @@ var createMechanizationServices = (client) => ({
|
|
|
324
328
|
const { data } = await client.delete(
|
|
325
329
|
`/farmers/${farmerId}/mechanizations/${mechanizationId}/delete-device-code`,
|
|
326
330
|
{
|
|
327
|
-
data: verificationToken
|
|
331
|
+
data: { verificationToken }
|
|
328
332
|
}
|
|
329
333
|
);
|
|
330
334
|
return R2.Ok(mappers.DeleteTrackingDeviceData(data));
|
|
331
335
|
} catch (error) {
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
336
|
+
return wrapError(error);
|
|
337
|
+
}
|
|
338
|
+
},
|
|
339
|
+
CreateMechanization: async ({
|
|
340
|
+
farmerId,
|
|
341
|
+
body
|
|
342
|
+
}) => {
|
|
343
|
+
try {
|
|
344
|
+
const response = await client.typed(
|
|
345
|
+
"post",
|
|
346
|
+
"/farmers/{farmerId}/mechanizations",
|
|
347
|
+
{
|
|
348
|
+
pathParams: {
|
|
349
|
+
farmerId
|
|
350
|
+
},
|
|
351
|
+
body: {
|
|
352
|
+
avatarURL: body.avatarURL,
|
|
353
|
+
information: body.information,
|
|
354
|
+
varietyId: body.varietyId
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
);
|
|
358
|
+
return R2.Ok(
|
|
359
|
+
mappers.createMechanization(response.result.data.mechanization)
|
|
360
|
+
);
|
|
361
|
+
} catch (error) {
|
|
362
|
+
return wrapError(error);
|
|
335
363
|
}
|
|
336
364
|
}
|
|
337
365
|
});
|