@arekstasko/plantcare-api-client 1.2.5 → 1.2.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 +242 -0
- package/dist/index.d.cts +25 -3
- package/dist/index.d.ts +25 -3
- package/dist/index.js +242 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -241,6 +241,248 @@ var Client = /*#__PURE__*/ function() {
|
|
|
241
241
|
_create_class(Client, [
|
|
242
242
|
{
|
|
243
243
|
/**
|
|
244
|
+
* @return OK
|
|
245
|
+
*/ key: "distributorGET",
|
|
246
|
+
value: function distributorGET(cancelToken) {
|
|
247
|
+
var _this = this;
|
|
248
|
+
var url_ = this.baseUrl + "/api/distributor";
|
|
249
|
+
url_ = url_.replace(/[?&]$/, "");
|
|
250
|
+
var options_ = {
|
|
251
|
+
method: "GET",
|
|
252
|
+
url: url_,
|
|
253
|
+
headers: {
|
|
254
|
+
"Accept": "application/json"
|
|
255
|
+
},
|
|
256
|
+
cancelToken: cancelToken
|
|
257
|
+
};
|
|
258
|
+
return this.instance.request(options_).catch(function(_error) {
|
|
259
|
+
if (isAxiosError(_error) && _error.response) {
|
|
260
|
+
return _error.response;
|
|
261
|
+
} else {
|
|
262
|
+
throw _error;
|
|
263
|
+
}
|
|
264
|
+
}).then(function(_response) {
|
|
265
|
+
return _this.processDistributorGET(_response);
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
key: "processDistributorGET",
|
|
271
|
+
value: function processDistributorGET(response) {
|
|
272
|
+
var status = response.status;
|
|
273
|
+
var _headers = {};
|
|
274
|
+
if (response.headers && _type_of(response.headers) === "object") {
|
|
275
|
+
for(var k in response.headers){
|
|
276
|
+
if (response.headers.hasOwnProperty(k)) {
|
|
277
|
+
_headers[k] = response.headers[k];
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
if (status === 200) {
|
|
282
|
+
var _responseText = response.data;
|
|
283
|
+
var result200 = null;
|
|
284
|
+
var resultData200 = _responseText;
|
|
285
|
+
result200 = JSON.parse(resultData200);
|
|
286
|
+
return Promise.resolve(result200);
|
|
287
|
+
} else if (status === 500) {
|
|
288
|
+
var _responseText1 = response.data;
|
|
289
|
+
var result500 = null;
|
|
290
|
+
var resultData500 = _responseText1;
|
|
291
|
+
result500 = JSON.parse(resultData500);
|
|
292
|
+
return throwException("Internal Server Error", status, _responseText1, _headers, result500);
|
|
293
|
+
} else if (status !== 200 && status !== 204) {
|
|
294
|
+
var _responseText2 = response.data;
|
|
295
|
+
return throwException("An unexpected server error occurred.", status, _responseText2, _headers);
|
|
296
|
+
}
|
|
297
|
+
return Promise.resolve(null);
|
|
298
|
+
}
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
/**
|
|
302
|
+
* @param body (optional)
|
|
303
|
+
* @return OK
|
|
304
|
+
*/ key: "distributorPOST",
|
|
305
|
+
value: function distributorPOST(body, cancelToken) {
|
|
306
|
+
var _this = this;
|
|
307
|
+
var url_ = this.baseUrl + "/api/distributor";
|
|
308
|
+
url_ = url_.replace(/[?&]$/, "");
|
|
309
|
+
var content_ = JSON.stringify(body);
|
|
310
|
+
var options_ = {
|
|
311
|
+
data: content_,
|
|
312
|
+
method: "POST",
|
|
313
|
+
url: url_,
|
|
314
|
+
headers: {
|
|
315
|
+
"Content-Type": "application/json",
|
|
316
|
+
"Accept": "application/json"
|
|
317
|
+
},
|
|
318
|
+
cancelToken: cancelToken
|
|
319
|
+
};
|
|
320
|
+
return this.instance.request(options_).catch(function(_error) {
|
|
321
|
+
if (isAxiosError(_error) && _error.response) {
|
|
322
|
+
return _error.response;
|
|
323
|
+
} else {
|
|
324
|
+
throw _error;
|
|
325
|
+
}
|
|
326
|
+
}).then(function(_response) {
|
|
327
|
+
return _this.processDistributorPOST(_response);
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
},
|
|
331
|
+
{
|
|
332
|
+
key: "processDistributorPOST",
|
|
333
|
+
value: function processDistributorPOST(response) {
|
|
334
|
+
var status = response.status;
|
|
335
|
+
var _headers = {};
|
|
336
|
+
if (response.headers && _type_of(response.headers) === "object") {
|
|
337
|
+
for(var k in response.headers){
|
|
338
|
+
if (response.headers.hasOwnProperty(k)) {
|
|
339
|
+
_headers[k] = response.headers[k];
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
if (status === 200) {
|
|
344
|
+
var _responseText = response.data;
|
|
345
|
+
var result200 = null;
|
|
346
|
+
var resultData200 = _responseText;
|
|
347
|
+
result200 = JSON.parse(resultData200);
|
|
348
|
+
return Promise.resolve(result200);
|
|
349
|
+
} else if (status === 500) {
|
|
350
|
+
var _responseText1 = response.data;
|
|
351
|
+
var result500 = null;
|
|
352
|
+
var resultData500 = _responseText1;
|
|
353
|
+
result500 = JSON.parse(resultData500);
|
|
354
|
+
return throwException("Internal Server Error", status, _responseText1, _headers, result500);
|
|
355
|
+
} else if (status !== 200 && status !== 204) {
|
|
356
|
+
var _responseText2 = response.data;
|
|
357
|
+
return throwException("An unexpected server error occurred.", status, _responseText2, _headers);
|
|
358
|
+
}
|
|
359
|
+
return Promise.resolve(null);
|
|
360
|
+
}
|
|
361
|
+
},
|
|
362
|
+
{
|
|
363
|
+
/**
|
|
364
|
+
* @return OK
|
|
365
|
+
*/ key: "distributorGET2",
|
|
366
|
+
value: function distributorGET2(id, cancelToken) {
|
|
367
|
+
var _this = this;
|
|
368
|
+
var url_ = this.baseUrl + "/api/distributor/{id}";
|
|
369
|
+
if (id === void 0 || id === null) throw new globalThis.Error("The parameter 'id' must be defined.");
|
|
370
|
+
url_ = url_.replace("{id}", encodeURIComponent("" + id));
|
|
371
|
+
url_ = url_.replace(/[?&]$/, "");
|
|
372
|
+
var options_ = {
|
|
373
|
+
method: "GET",
|
|
374
|
+
url: url_,
|
|
375
|
+
headers: {
|
|
376
|
+
"Accept": "application/json"
|
|
377
|
+
},
|
|
378
|
+
cancelToken: cancelToken
|
|
379
|
+
};
|
|
380
|
+
return this.instance.request(options_).catch(function(_error) {
|
|
381
|
+
if (isAxiosError(_error) && _error.response) {
|
|
382
|
+
return _error.response;
|
|
383
|
+
} else {
|
|
384
|
+
throw _error;
|
|
385
|
+
}
|
|
386
|
+
}).then(function(_response) {
|
|
387
|
+
return _this.processDistributorGET2(_response);
|
|
388
|
+
});
|
|
389
|
+
}
|
|
390
|
+
},
|
|
391
|
+
{
|
|
392
|
+
key: "processDistributorGET2",
|
|
393
|
+
value: function processDistributorGET2(response) {
|
|
394
|
+
var status = response.status;
|
|
395
|
+
var _headers = {};
|
|
396
|
+
if (response.headers && _type_of(response.headers) === "object") {
|
|
397
|
+
for(var k in response.headers){
|
|
398
|
+
if (response.headers.hasOwnProperty(k)) {
|
|
399
|
+
_headers[k] = response.headers[k];
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
if (status === 200) {
|
|
404
|
+
var _responseText = response.data;
|
|
405
|
+
var result200 = null;
|
|
406
|
+
var resultData200 = _responseText;
|
|
407
|
+
result200 = JSON.parse(resultData200);
|
|
408
|
+
return Promise.resolve(result200);
|
|
409
|
+
} else if (status === 500) {
|
|
410
|
+
var _responseText1 = response.data;
|
|
411
|
+
var result500 = null;
|
|
412
|
+
var resultData500 = _responseText1;
|
|
413
|
+
result500 = JSON.parse(resultData500);
|
|
414
|
+
return throwException("Internal Server Error", status, _responseText1, _headers, result500);
|
|
415
|
+
} else if (status !== 200 && status !== 204) {
|
|
416
|
+
var _responseText2 = response.data;
|
|
417
|
+
return throwException("An unexpected server error occurred.", status, _responseText2, _headers);
|
|
418
|
+
}
|
|
419
|
+
return Promise.resolve(null);
|
|
420
|
+
}
|
|
421
|
+
},
|
|
422
|
+
{
|
|
423
|
+
/**
|
|
424
|
+
* @return OK
|
|
425
|
+
*/ key: "waterSupply",
|
|
426
|
+
value: function waterSupply(id, plantId, cancelToken) {
|
|
427
|
+
var _this = this;
|
|
428
|
+
var url_ = this.baseUrl + "/api/distributor/{id}/{plantId}/water-supply";
|
|
429
|
+
if (id === void 0 || id === null) throw new globalThis.Error("The parameter 'id' must be defined.");
|
|
430
|
+
url_ = url_.replace("{id}", encodeURIComponent("" + id));
|
|
431
|
+
if (plantId === void 0 || plantId === null) throw new globalThis.Error("The parameter 'plantId' must be defined.");
|
|
432
|
+
url_ = url_.replace("{plantId}", encodeURIComponent("" + plantId));
|
|
433
|
+
url_ = url_.replace(/[?&]$/, "");
|
|
434
|
+
var options_ = {
|
|
435
|
+
method: "POST",
|
|
436
|
+
url: url_,
|
|
437
|
+
headers: {
|
|
438
|
+
"Accept": "application/json"
|
|
439
|
+
},
|
|
440
|
+
cancelToken: cancelToken
|
|
441
|
+
};
|
|
442
|
+
return this.instance.request(options_).catch(function(_error) {
|
|
443
|
+
if (isAxiosError(_error) && _error.response) {
|
|
444
|
+
return _error.response;
|
|
445
|
+
} else {
|
|
446
|
+
throw _error;
|
|
447
|
+
}
|
|
448
|
+
}).then(function(_response) {
|
|
449
|
+
return _this.processWaterSupply(_response);
|
|
450
|
+
});
|
|
451
|
+
}
|
|
452
|
+
},
|
|
453
|
+
{
|
|
454
|
+
key: "processWaterSupply",
|
|
455
|
+
value: function processWaterSupply(response) {
|
|
456
|
+
var status = response.status;
|
|
457
|
+
var _headers = {};
|
|
458
|
+
if (response.headers && _type_of(response.headers) === "object") {
|
|
459
|
+
for(var k in response.headers){
|
|
460
|
+
if (response.headers.hasOwnProperty(k)) {
|
|
461
|
+
_headers[k] = response.headers[k];
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
if (status === 200) {
|
|
466
|
+
var _responseText = response.data;
|
|
467
|
+
var result200 = null;
|
|
468
|
+
var resultData200 = _responseText;
|
|
469
|
+
result200 = JSON.parse(resultData200);
|
|
470
|
+
return Promise.resolve(result200);
|
|
471
|
+
} else if (status === 500) {
|
|
472
|
+
var _responseText1 = response.data;
|
|
473
|
+
var result500 = null;
|
|
474
|
+
var resultData500 = _responseText1;
|
|
475
|
+
result500 = JSON.parse(resultData500);
|
|
476
|
+
return throwException("Internal Server Error", status, _responseText1, _headers, result500);
|
|
477
|
+
} else if (status !== 200 && status !== 204) {
|
|
478
|
+
var _responseText2 = response.data;
|
|
479
|
+
return throwException("An unexpected server error occurred.", status, _responseText2, _headers);
|
|
480
|
+
}
|
|
481
|
+
return Promise.resolve(null);
|
|
482
|
+
}
|
|
483
|
+
},
|
|
484
|
+
{
|
|
485
|
+
/**
|
|
244
486
|
* @param body (optional)
|
|
245
487
|
* @return OK
|
|
246
488
|
*/ key: "humidityMeasurements",
|
package/dist/index.d.cts
CHANGED
|
@@ -5,6 +5,27 @@ declare class Client {
|
|
|
5
5
|
protected baseUrl: string;
|
|
6
6
|
protected jsonParseReviver: ((key: string, value: any) => any) | undefined;
|
|
7
7
|
constructor(baseUrl?: string, instance?: AxiosInstance);
|
|
8
|
+
/**
|
|
9
|
+
* @return OK
|
|
10
|
+
*/
|
|
11
|
+
distributorGET(cancelToken?: CancelToken): Promise<boolean>;
|
|
12
|
+
protected processDistributorGET(response: AxiosResponse): Promise<boolean>;
|
|
13
|
+
/**
|
|
14
|
+
* @param body (optional)
|
|
15
|
+
* @return OK
|
|
16
|
+
*/
|
|
17
|
+
distributorPOST(body: CreateDistributorRequest | undefined, cancelToken?: CancelToken): Promise<boolean>;
|
|
18
|
+
protected processDistributorPOST(response: AxiosResponse): Promise<boolean>;
|
|
19
|
+
/**
|
|
20
|
+
* @return OK
|
|
21
|
+
*/
|
|
22
|
+
distributorGET2(id: number, cancelToken?: CancelToken): Promise<boolean>;
|
|
23
|
+
protected processDistributorGET2(response: AxiosResponse): Promise<boolean>;
|
|
24
|
+
/**
|
|
25
|
+
* @return OK
|
|
26
|
+
*/
|
|
27
|
+
waterSupply(id: string, plantId: string, cancelToken?: CancelToken): Promise<boolean>;
|
|
28
|
+
protected processWaterSupply(response: AxiosResponse): Promise<boolean>;
|
|
8
29
|
/**
|
|
9
30
|
* @param body (optional)
|
|
10
31
|
* @return OK
|
|
@@ -152,6 +173,9 @@ interface AverageHumidity {
|
|
|
152
173
|
date?: string | undefined;
|
|
153
174
|
humidity?: number;
|
|
154
175
|
}
|
|
176
|
+
interface CreateDistributorRequest {
|
|
177
|
+
name?: string | undefined;
|
|
178
|
+
}
|
|
155
179
|
interface CreateModuleRequest {
|
|
156
180
|
name?: string | undefined;
|
|
157
181
|
}
|
|
@@ -178,8 +202,6 @@ interface PlantHumidityStatus {
|
|
|
178
202
|
interface Module {
|
|
179
203
|
id?: number;
|
|
180
204
|
isAvailable?: boolean;
|
|
181
|
-
requiredMoistureLevel?: number | undefined;
|
|
182
|
-
criticalMoistureLevel?: number | undefined;
|
|
183
205
|
name?: string | undefined;
|
|
184
206
|
}
|
|
185
207
|
interface Place {
|
|
@@ -798,4 +820,4 @@ declare class ApiException extends Error {
|
|
|
798
820
|
static isApiException(obj: any): obj is ApiException;
|
|
799
821
|
}
|
|
800
822
|
|
|
801
|
-
export { type AddHumidityMeasurementCommand, ApiException, type Assembly, type AverageHumidity, CallingConventions, Client, type ConstructorInfo, type CreateModuleRequest, type CreatePlaceCommand, type CreatePlantCommand, type CustomAttributeData, type CustomAttributeNamedArgument, type CustomAttributeTypedArgument, EventAttributes, type EventInfo, type Exception, FieldAttributes, type FieldInfo, GenericParameterAttributes, type HumidityMeasurement, HumidityStatus, type ICustomAttributeProvider, type IntPtr, LayoutKind, type MemberInfo, MemberTypes, MethodAttributes, type MethodBase, MethodImplAttributes, type MethodInfo, type Module, type Module2, type ModuleHandle, ParameterAttributes, type ParameterInfo, type Place, type Plant, type PlantHumidityStatus, PlantType, PropertyAttributes, type PropertyInfo, type RuntimeFieldHandle, type RuntimeMethodHandle, type RuntimeTypeHandle, SecurityRuleSet, type StructLayoutAttribute, type Type, TypeAttributes, type TypeInfo, type UpdatePlaceCommand, type UpdatePlantCommand, type UpdatePlantHumidityValues };
|
|
823
|
+
export { type AddHumidityMeasurementCommand, ApiException, type Assembly, type AverageHumidity, CallingConventions, Client, type ConstructorInfo, type CreateDistributorRequest, type CreateModuleRequest, type CreatePlaceCommand, type CreatePlantCommand, type CustomAttributeData, type CustomAttributeNamedArgument, type CustomAttributeTypedArgument, EventAttributes, type EventInfo, type Exception, FieldAttributes, type FieldInfo, GenericParameterAttributes, type HumidityMeasurement, HumidityStatus, type ICustomAttributeProvider, type IntPtr, LayoutKind, type MemberInfo, MemberTypes, MethodAttributes, type MethodBase, MethodImplAttributes, type MethodInfo, type Module, type Module2, type ModuleHandle, ParameterAttributes, type ParameterInfo, type Place, type Plant, type PlantHumidityStatus, PlantType, PropertyAttributes, type PropertyInfo, type RuntimeFieldHandle, type RuntimeMethodHandle, type RuntimeTypeHandle, SecurityRuleSet, type StructLayoutAttribute, type Type, TypeAttributes, type TypeInfo, type UpdatePlaceCommand, type UpdatePlantCommand, type UpdatePlantHumidityValues };
|
package/dist/index.d.ts
CHANGED
|
@@ -5,6 +5,27 @@ declare class Client {
|
|
|
5
5
|
protected baseUrl: string;
|
|
6
6
|
protected jsonParseReviver: ((key: string, value: any) => any) | undefined;
|
|
7
7
|
constructor(baseUrl?: string, instance?: AxiosInstance);
|
|
8
|
+
/**
|
|
9
|
+
* @return OK
|
|
10
|
+
*/
|
|
11
|
+
distributorGET(cancelToken?: CancelToken): Promise<boolean>;
|
|
12
|
+
protected processDistributorGET(response: AxiosResponse): Promise<boolean>;
|
|
13
|
+
/**
|
|
14
|
+
* @param body (optional)
|
|
15
|
+
* @return OK
|
|
16
|
+
*/
|
|
17
|
+
distributorPOST(body: CreateDistributorRequest | undefined, cancelToken?: CancelToken): Promise<boolean>;
|
|
18
|
+
protected processDistributorPOST(response: AxiosResponse): Promise<boolean>;
|
|
19
|
+
/**
|
|
20
|
+
* @return OK
|
|
21
|
+
*/
|
|
22
|
+
distributorGET2(id: number, cancelToken?: CancelToken): Promise<boolean>;
|
|
23
|
+
protected processDistributorGET2(response: AxiosResponse): Promise<boolean>;
|
|
24
|
+
/**
|
|
25
|
+
* @return OK
|
|
26
|
+
*/
|
|
27
|
+
waterSupply(id: string, plantId: string, cancelToken?: CancelToken): Promise<boolean>;
|
|
28
|
+
protected processWaterSupply(response: AxiosResponse): Promise<boolean>;
|
|
8
29
|
/**
|
|
9
30
|
* @param body (optional)
|
|
10
31
|
* @return OK
|
|
@@ -152,6 +173,9 @@ interface AverageHumidity {
|
|
|
152
173
|
date?: string | undefined;
|
|
153
174
|
humidity?: number;
|
|
154
175
|
}
|
|
176
|
+
interface CreateDistributorRequest {
|
|
177
|
+
name?: string | undefined;
|
|
178
|
+
}
|
|
155
179
|
interface CreateModuleRequest {
|
|
156
180
|
name?: string | undefined;
|
|
157
181
|
}
|
|
@@ -178,8 +202,6 @@ interface PlantHumidityStatus {
|
|
|
178
202
|
interface Module {
|
|
179
203
|
id?: number;
|
|
180
204
|
isAvailable?: boolean;
|
|
181
|
-
requiredMoistureLevel?: number | undefined;
|
|
182
|
-
criticalMoistureLevel?: number | undefined;
|
|
183
205
|
name?: string | undefined;
|
|
184
206
|
}
|
|
185
207
|
interface Place {
|
|
@@ -798,4 +820,4 @@ declare class ApiException extends Error {
|
|
|
798
820
|
static isApiException(obj: any): obj is ApiException;
|
|
799
821
|
}
|
|
800
822
|
|
|
801
|
-
export { type AddHumidityMeasurementCommand, ApiException, type Assembly, type AverageHumidity, CallingConventions, Client, type ConstructorInfo, type CreateModuleRequest, type CreatePlaceCommand, type CreatePlantCommand, type CustomAttributeData, type CustomAttributeNamedArgument, type CustomAttributeTypedArgument, EventAttributes, type EventInfo, type Exception, FieldAttributes, type FieldInfo, GenericParameterAttributes, type HumidityMeasurement, HumidityStatus, type ICustomAttributeProvider, type IntPtr, LayoutKind, type MemberInfo, MemberTypes, MethodAttributes, type MethodBase, MethodImplAttributes, type MethodInfo, type Module, type Module2, type ModuleHandle, ParameterAttributes, type ParameterInfo, type Place, type Plant, type PlantHumidityStatus, PlantType, PropertyAttributes, type PropertyInfo, type RuntimeFieldHandle, type RuntimeMethodHandle, type RuntimeTypeHandle, SecurityRuleSet, type StructLayoutAttribute, type Type, TypeAttributes, type TypeInfo, type UpdatePlaceCommand, type UpdatePlantCommand, type UpdatePlantHumidityValues };
|
|
823
|
+
export { type AddHumidityMeasurementCommand, ApiException, type Assembly, type AverageHumidity, CallingConventions, Client, type ConstructorInfo, type CreateDistributorRequest, type CreateModuleRequest, type CreatePlaceCommand, type CreatePlantCommand, type CustomAttributeData, type CustomAttributeNamedArgument, type CustomAttributeTypedArgument, EventAttributes, type EventInfo, type Exception, FieldAttributes, type FieldInfo, GenericParameterAttributes, type HumidityMeasurement, HumidityStatus, type ICustomAttributeProvider, type IntPtr, LayoutKind, type MemberInfo, MemberTypes, MethodAttributes, type MethodBase, MethodImplAttributes, type MethodInfo, type Module, type Module2, type ModuleHandle, ParameterAttributes, type ParameterInfo, type Place, type Plant, type PlantHumidityStatus, PlantType, PropertyAttributes, type PropertyInfo, type RuntimeFieldHandle, type RuntimeMethodHandle, type RuntimeTypeHandle, SecurityRuleSet, type StructLayoutAttribute, type Type, TypeAttributes, type TypeInfo, type UpdatePlaceCommand, type UpdatePlantCommand, type UpdatePlantHumidityValues };
|
package/dist/index.js
CHANGED
|
@@ -130,6 +130,248 @@ var Client = /*#__PURE__*/ function() {
|
|
|
130
130
|
_create_class(Client, [
|
|
131
131
|
{
|
|
132
132
|
/**
|
|
133
|
+
* @return OK
|
|
134
|
+
*/ key: "distributorGET",
|
|
135
|
+
value: function distributorGET(cancelToken) {
|
|
136
|
+
var _this = this;
|
|
137
|
+
var url_ = this.baseUrl + "/api/distributor";
|
|
138
|
+
url_ = url_.replace(/[?&]$/, "");
|
|
139
|
+
var options_ = {
|
|
140
|
+
method: "GET",
|
|
141
|
+
url: url_,
|
|
142
|
+
headers: {
|
|
143
|
+
"Accept": "application/json"
|
|
144
|
+
},
|
|
145
|
+
cancelToken: cancelToken
|
|
146
|
+
};
|
|
147
|
+
return this.instance.request(options_).catch(function(_error) {
|
|
148
|
+
if (isAxiosError(_error) && _error.response) {
|
|
149
|
+
return _error.response;
|
|
150
|
+
} else {
|
|
151
|
+
throw _error;
|
|
152
|
+
}
|
|
153
|
+
}).then(function(_response) {
|
|
154
|
+
return _this.processDistributorGET(_response);
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
key: "processDistributorGET",
|
|
160
|
+
value: function processDistributorGET(response) {
|
|
161
|
+
var status = response.status;
|
|
162
|
+
var _headers = {};
|
|
163
|
+
if (response.headers && _type_of(response.headers) === "object") {
|
|
164
|
+
for(var k in response.headers){
|
|
165
|
+
if (response.headers.hasOwnProperty(k)) {
|
|
166
|
+
_headers[k] = response.headers[k];
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
if (status === 200) {
|
|
171
|
+
var _responseText = response.data;
|
|
172
|
+
var result200 = null;
|
|
173
|
+
var resultData200 = _responseText;
|
|
174
|
+
result200 = JSON.parse(resultData200);
|
|
175
|
+
return Promise.resolve(result200);
|
|
176
|
+
} else if (status === 500) {
|
|
177
|
+
var _responseText1 = response.data;
|
|
178
|
+
var result500 = null;
|
|
179
|
+
var resultData500 = _responseText1;
|
|
180
|
+
result500 = JSON.parse(resultData500);
|
|
181
|
+
return throwException("Internal Server Error", status, _responseText1, _headers, result500);
|
|
182
|
+
} else if (status !== 200 && status !== 204) {
|
|
183
|
+
var _responseText2 = response.data;
|
|
184
|
+
return throwException("An unexpected server error occurred.", status, _responseText2, _headers);
|
|
185
|
+
}
|
|
186
|
+
return Promise.resolve(null);
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
/**
|
|
191
|
+
* @param body (optional)
|
|
192
|
+
* @return OK
|
|
193
|
+
*/ key: "distributorPOST",
|
|
194
|
+
value: function distributorPOST(body, cancelToken) {
|
|
195
|
+
var _this = this;
|
|
196
|
+
var url_ = this.baseUrl + "/api/distributor";
|
|
197
|
+
url_ = url_.replace(/[?&]$/, "");
|
|
198
|
+
var content_ = JSON.stringify(body);
|
|
199
|
+
var options_ = {
|
|
200
|
+
data: content_,
|
|
201
|
+
method: "POST",
|
|
202
|
+
url: url_,
|
|
203
|
+
headers: {
|
|
204
|
+
"Content-Type": "application/json",
|
|
205
|
+
"Accept": "application/json"
|
|
206
|
+
},
|
|
207
|
+
cancelToken: cancelToken
|
|
208
|
+
};
|
|
209
|
+
return this.instance.request(options_).catch(function(_error) {
|
|
210
|
+
if (isAxiosError(_error) && _error.response) {
|
|
211
|
+
return _error.response;
|
|
212
|
+
} else {
|
|
213
|
+
throw _error;
|
|
214
|
+
}
|
|
215
|
+
}).then(function(_response) {
|
|
216
|
+
return _this.processDistributorPOST(_response);
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
key: "processDistributorPOST",
|
|
222
|
+
value: function processDistributorPOST(response) {
|
|
223
|
+
var status = response.status;
|
|
224
|
+
var _headers = {};
|
|
225
|
+
if (response.headers && _type_of(response.headers) === "object") {
|
|
226
|
+
for(var k in response.headers){
|
|
227
|
+
if (response.headers.hasOwnProperty(k)) {
|
|
228
|
+
_headers[k] = response.headers[k];
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
if (status === 200) {
|
|
233
|
+
var _responseText = response.data;
|
|
234
|
+
var result200 = null;
|
|
235
|
+
var resultData200 = _responseText;
|
|
236
|
+
result200 = JSON.parse(resultData200);
|
|
237
|
+
return Promise.resolve(result200);
|
|
238
|
+
} else if (status === 500) {
|
|
239
|
+
var _responseText1 = response.data;
|
|
240
|
+
var result500 = null;
|
|
241
|
+
var resultData500 = _responseText1;
|
|
242
|
+
result500 = JSON.parse(resultData500);
|
|
243
|
+
return throwException("Internal Server Error", status, _responseText1, _headers, result500);
|
|
244
|
+
} else if (status !== 200 && status !== 204) {
|
|
245
|
+
var _responseText2 = response.data;
|
|
246
|
+
return throwException("An unexpected server error occurred.", status, _responseText2, _headers);
|
|
247
|
+
}
|
|
248
|
+
return Promise.resolve(null);
|
|
249
|
+
}
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
/**
|
|
253
|
+
* @return OK
|
|
254
|
+
*/ key: "distributorGET2",
|
|
255
|
+
value: function distributorGET2(id, cancelToken) {
|
|
256
|
+
var _this = this;
|
|
257
|
+
var url_ = this.baseUrl + "/api/distributor/{id}";
|
|
258
|
+
if (id === void 0 || id === null) throw new globalThis.Error("The parameter 'id' must be defined.");
|
|
259
|
+
url_ = url_.replace("{id}", encodeURIComponent("" + id));
|
|
260
|
+
url_ = url_.replace(/[?&]$/, "");
|
|
261
|
+
var options_ = {
|
|
262
|
+
method: "GET",
|
|
263
|
+
url: url_,
|
|
264
|
+
headers: {
|
|
265
|
+
"Accept": "application/json"
|
|
266
|
+
},
|
|
267
|
+
cancelToken: cancelToken
|
|
268
|
+
};
|
|
269
|
+
return this.instance.request(options_).catch(function(_error) {
|
|
270
|
+
if (isAxiosError(_error) && _error.response) {
|
|
271
|
+
return _error.response;
|
|
272
|
+
} else {
|
|
273
|
+
throw _error;
|
|
274
|
+
}
|
|
275
|
+
}).then(function(_response) {
|
|
276
|
+
return _this.processDistributorGET2(_response);
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
key: "processDistributorGET2",
|
|
282
|
+
value: function processDistributorGET2(response) {
|
|
283
|
+
var status = response.status;
|
|
284
|
+
var _headers = {};
|
|
285
|
+
if (response.headers && _type_of(response.headers) === "object") {
|
|
286
|
+
for(var k in response.headers){
|
|
287
|
+
if (response.headers.hasOwnProperty(k)) {
|
|
288
|
+
_headers[k] = response.headers[k];
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
if (status === 200) {
|
|
293
|
+
var _responseText = response.data;
|
|
294
|
+
var result200 = null;
|
|
295
|
+
var resultData200 = _responseText;
|
|
296
|
+
result200 = JSON.parse(resultData200);
|
|
297
|
+
return Promise.resolve(result200);
|
|
298
|
+
} else if (status === 500) {
|
|
299
|
+
var _responseText1 = response.data;
|
|
300
|
+
var result500 = null;
|
|
301
|
+
var resultData500 = _responseText1;
|
|
302
|
+
result500 = JSON.parse(resultData500);
|
|
303
|
+
return throwException("Internal Server Error", status, _responseText1, _headers, result500);
|
|
304
|
+
} else if (status !== 200 && status !== 204) {
|
|
305
|
+
var _responseText2 = response.data;
|
|
306
|
+
return throwException("An unexpected server error occurred.", status, _responseText2, _headers);
|
|
307
|
+
}
|
|
308
|
+
return Promise.resolve(null);
|
|
309
|
+
}
|
|
310
|
+
},
|
|
311
|
+
{
|
|
312
|
+
/**
|
|
313
|
+
* @return OK
|
|
314
|
+
*/ key: "waterSupply",
|
|
315
|
+
value: function waterSupply(id, plantId, cancelToken) {
|
|
316
|
+
var _this = this;
|
|
317
|
+
var url_ = this.baseUrl + "/api/distributor/{id}/{plantId}/water-supply";
|
|
318
|
+
if (id === void 0 || id === null) throw new globalThis.Error("The parameter 'id' must be defined.");
|
|
319
|
+
url_ = url_.replace("{id}", encodeURIComponent("" + id));
|
|
320
|
+
if (plantId === void 0 || plantId === null) throw new globalThis.Error("The parameter 'plantId' must be defined.");
|
|
321
|
+
url_ = url_.replace("{plantId}", encodeURIComponent("" + plantId));
|
|
322
|
+
url_ = url_.replace(/[?&]$/, "");
|
|
323
|
+
var options_ = {
|
|
324
|
+
method: "POST",
|
|
325
|
+
url: url_,
|
|
326
|
+
headers: {
|
|
327
|
+
"Accept": "application/json"
|
|
328
|
+
},
|
|
329
|
+
cancelToken: cancelToken
|
|
330
|
+
};
|
|
331
|
+
return this.instance.request(options_).catch(function(_error) {
|
|
332
|
+
if (isAxiosError(_error) && _error.response) {
|
|
333
|
+
return _error.response;
|
|
334
|
+
} else {
|
|
335
|
+
throw _error;
|
|
336
|
+
}
|
|
337
|
+
}).then(function(_response) {
|
|
338
|
+
return _this.processWaterSupply(_response);
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
},
|
|
342
|
+
{
|
|
343
|
+
key: "processWaterSupply",
|
|
344
|
+
value: function processWaterSupply(response) {
|
|
345
|
+
var status = response.status;
|
|
346
|
+
var _headers = {};
|
|
347
|
+
if (response.headers && _type_of(response.headers) === "object") {
|
|
348
|
+
for(var k in response.headers){
|
|
349
|
+
if (response.headers.hasOwnProperty(k)) {
|
|
350
|
+
_headers[k] = response.headers[k];
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
if (status === 200) {
|
|
355
|
+
var _responseText = response.data;
|
|
356
|
+
var result200 = null;
|
|
357
|
+
var resultData200 = _responseText;
|
|
358
|
+
result200 = JSON.parse(resultData200);
|
|
359
|
+
return Promise.resolve(result200);
|
|
360
|
+
} else if (status === 500) {
|
|
361
|
+
var _responseText1 = response.data;
|
|
362
|
+
var result500 = null;
|
|
363
|
+
var resultData500 = _responseText1;
|
|
364
|
+
result500 = JSON.parse(resultData500);
|
|
365
|
+
return throwException("Internal Server Error", status, _responseText1, _headers, result500);
|
|
366
|
+
} else if (status !== 200 && status !== 204) {
|
|
367
|
+
var _responseText2 = response.data;
|
|
368
|
+
return throwException("An unexpected server error occurred.", status, _responseText2, _headers);
|
|
369
|
+
}
|
|
370
|
+
return Promise.resolve(null);
|
|
371
|
+
}
|
|
372
|
+
},
|
|
373
|
+
{
|
|
374
|
+
/**
|
|
133
375
|
* @param body (optional)
|
|
134
376
|
* @return OK
|
|
135
377
|
*/ key: "humidityMeasurements",
|