@arekstasko/plantcare-api-client 1.2.8 → 1.3.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 +78 -10
- package/dist/index.d.cts +16 -5
- package/dist/index.d.ts +16 -5
- package/dist/index.js +78 -10
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -242,8 +242,8 @@ var Client = /*#__PURE__*/ function() {
|
|
|
242
242
|
{
|
|
243
243
|
/**
|
|
244
244
|
* @return OK
|
|
245
|
-
*/ key: "
|
|
246
|
-
value: function
|
|
245
|
+
*/ key: "distributorAll",
|
|
246
|
+
value: function distributorAll(cancelToken) {
|
|
247
247
|
var _this = this;
|
|
248
248
|
var url_ = this.baseUrl + "/api/distributor";
|
|
249
249
|
url_ = url_.replace(/[?&]$/, "");
|
|
@@ -262,13 +262,13 @@ var Client = /*#__PURE__*/ function() {
|
|
|
262
262
|
throw _error;
|
|
263
263
|
}
|
|
264
264
|
}).then(function(_response) {
|
|
265
|
-
return _this.
|
|
265
|
+
return _this.processDistributorAll(_response);
|
|
266
266
|
});
|
|
267
267
|
}
|
|
268
268
|
},
|
|
269
269
|
{
|
|
270
|
-
key: "
|
|
271
|
-
value: function
|
|
270
|
+
key: "processDistributorAll",
|
|
271
|
+
value: function processDistributorAll(response) {
|
|
272
272
|
var status = response.status;
|
|
273
273
|
var _headers = {};
|
|
274
274
|
if (response.headers && _type_of(response.headers) === "object") {
|
|
@@ -362,8 +362,8 @@ var Client = /*#__PURE__*/ function() {
|
|
|
362
362
|
{
|
|
363
363
|
/**
|
|
364
364
|
* @return OK
|
|
365
|
-
*/ key: "
|
|
366
|
-
value: function
|
|
365
|
+
*/ key: "distributorGET",
|
|
366
|
+
value: function distributorGET(id, cancelToken) {
|
|
367
367
|
var _this = this;
|
|
368
368
|
var url_ = this.baseUrl + "/api/distributor/{id}";
|
|
369
369
|
if (id === void 0 || id === null) throw new globalThis.Error("The parameter 'id' must be defined.");
|
|
@@ -384,13 +384,81 @@ var Client = /*#__PURE__*/ function() {
|
|
|
384
384
|
throw _error;
|
|
385
385
|
}
|
|
386
386
|
}).then(function(_response) {
|
|
387
|
-
return _this.
|
|
387
|
+
return _this.processDistributorGET(_response);
|
|
388
|
+
});
|
|
389
|
+
}
|
|
390
|
+
},
|
|
391
|
+
{
|
|
392
|
+
key: "processDistributorGET",
|
|
393
|
+
value: function processDistributorGET(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
|
+
* @param distributorIdQuery (optional)
|
|
425
|
+
* @param plantIdQuery (optional)
|
|
426
|
+
* @return OK
|
|
427
|
+
*/ key: "add",
|
|
428
|
+
value: function add(distributorIdQuery, plantIdQuery, distributorIdPath, plantIdPath, cancelToken) {
|
|
429
|
+
var _this = this;
|
|
430
|
+
var url_ = this.baseUrl + "/api/distributor/{distributorId}/{plantId}/add?";
|
|
431
|
+
if (distributorIdPath === void 0 || distributorIdPath === null) throw new globalThis.Error("The parameter 'distributorIdPath' must be defined.");
|
|
432
|
+
url_ = url_.replace("{distributorId}", encodeURIComponent("" + distributorIdPath));
|
|
433
|
+
if (plantIdPath === void 0 || plantIdPath === null) throw new globalThis.Error("The parameter 'plantIdPath' must be defined.");
|
|
434
|
+
url_ = url_.replace("{plantId}", encodeURIComponent("" + plantIdPath));
|
|
435
|
+
if (distributorIdQuery === null) throw new globalThis.Error("The parameter 'distributorIdQuery' cannot be null.");
|
|
436
|
+
else if (distributorIdQuery !== void 0) url_ += "distributorId=" + encodeURIComponent("" + distributorIdQuery) + "&";
|
|
437
|
+
if (plantIdQuery === null) throw new globalThis.Error("The parameter 'plantIdQuery' cannot be null.");
|
|
438
|
+
else if (plantIdQuery !== void 0) url_ += "plantId=" + encodeURIComponent("" + plantIdQuery) + "&";
|
|
439
|
+
url_ = url_.replace(/[?&]$/, "");
|
|
440
|
+
var options_ = {
|
|
441
|
+
method: "POST",
|
|
442
|
+
url: url_,
|
|
443
|
+
headers: {
|
|
444
|
+
"Accept": "application/json"
|
|
445
|
+
},
|
|
446
|
+
cancelToken: cancelToken
|
|
447
|
+
};
|
|
448
|
+
return this.instance.request(options_).catch(function(_error) {
|
|
449
|
+
if (isAxiosError(_error) && _error.response) {
|
|
450
|
+
return _error.response;
|
|
451
|
+
} else {
|
|
452
|
+
throw _error;
|
|
453
|
+
}
|
|
454
|
+
}).then(function(_response) {
|
|
455
|
+
return _this.processAdd(_response);
|
|
388
456
|
});
|
|
389
457
|
}
|
|
390
458
|
},
|
|
391
459
|
{
|
|
392
|
-
key: "
|
|
393
|
-
value: function
|
|
460
|
+
key: "processAdd",
|
|
461
|
+
value: function processAdd(response) {
|
|
394
462
|
var status = response.status;
|
|
395
463
|
var _headers = {};
|
|
396
464
|
if (response.headers && _type_of(response.headers) === "object") {
|
package/dist/index.d.cts
CHANGED
|
@@ -8,8 +8,8 @@ declare class Client {
|
|
|
8
8
|
/**
|
|
9
9
|
* @return OK
|
|
10
10
|
*/
|
|
11
|
-
|
|
12
|
-
protected
|
|
11
|
+
distributorAll(cancelToken?: CancelToken): Promise<Distributor[]>;
|
|
12
|
+
protected processDistributorAll(response: AxiosResponse): Promise<Distributor[]>;
|
|
13
13
|
/**
|
|
14
14
|
* @param body (optional)
|
|
15
15
|
* @return OK
|
|
@@ -19,8 +19,15 @@ declare class Client {
|
|
|
19
19
|
/**
|
|
20
20
|
* @return OK
|
|
21
21
|
*/
|
|
22
|
-
|
|
23
|
-
protected
|
|
22
|
+
distributorGET(id: number, cancelToken?: CancelToken): Promise<Distributor>;
|
|
23
|
+
protected processDistributorGET(response: AxiosResponse): Promise<Distributor>;
|
|
24
|
+
/**
|
|
25
|
+
* @param distributorIdQuery (optional)
|
|
26
|
+
* @param plantIdQuery (optional)
|
|
27
|
+
* @return OK
|
|
28
|
+
*/
|
|
29
|
+
add(distributorIdQuery: number | undefined, plantIdQuery: number | undefined, distributorIdPath: string, plantIdPath: string, cancelToken?: CancelToken): Promise<boolean>;
|
|
30
|
+
protected processAdd(response: AxiosResponse): Promise<boolean>;
|
|
24
31
|
/**
|
|
25
32
|
* @return OK
|
|
26
33
|
*/
|
|
@@ -190,6 +197,10 @@ declare enum PlantType {
|
|
|
190
197
|
_2 = 2,
|
|
191
198
|
_3 = 3
|
|
192
199
|
}
|
|
200
|
+
interface Distributor {
|
|
201
|
+
readonly id?: number;
|
|
202
|
+
name?: string | undefined;
|
|
203
|
+
}
|
|
193
204
|
interface HumidityMeasurement {
|
|
194
205
|
humidity?: number;
|
|
195
206
|
batteryLevel?: number;
|
|
@@ -820,4 +831,4 @@ declare class ApiException extends Error {
|
|
|
820
831
|
static isApiException(obj: any): obj is ApiException;
|
|
821
832
|
}
|
|
822
833
|
|
|
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 };
|
|
834
|
+
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, type Distributor, 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
|
@@ -8,8 +8,8 @@ declare class Client {
|
|
|
8
8
|
/**
|
|
9
9
|
* @return OK
|
|
10
10
|
*/
|
|
11
|
-
|
|
12
|
-
protected
|
|
11
|
+
distributorAll(cancelToken?: CancelToken): Promise<Distributor[]>;
|
|
12
|
+
protected processDistributorAll(response: AxiosResponse): Promise<Distributor[]>;
|
|
13
13
|
/**
|
|
14
14
|
* @param body (optional)
|
|
15
15
|
* @return OK
|
|
@@ -19,8 +19,15 @@ declare class Client {
|
|
|
19
19
|
/**
|
|
20
20
|
* @return OK
|
|
21
21
|
*/
|
|
22
|
-
|
|
23
|
-
protected
|
|
22
|
+
distributorGET(id: number, cancelToken?: CancelToken): Promise<Distributor>;
|
|
23
|
+
protected processDistributorGET(response: AxiosResponse): Promise<Distributor>;
|
|
24
|
+
/**
|
|
25
|
+
* @param distributorIdQuery (optional)
|
|
26
|
+
* @param plantIdQuery (optional)
|
|
27
|
+
* @return OK
|
|
28
|
+
*/
|
|
29
|
+
add(distributorIdQuery: number | undefined, plantIdQuery: number | undefined, distributorIdPath: string, plantIdPath: string, cancelToken?: CancelToken): Promise<boolean>;
|
|
30
|
+
protected processAdd(response: AxiosResponse): Promise<boolean>;
|
|
24
31
|
/**
|
|
25
32
|
* @return OK
|
|
26
33
|
*/
|
|
@@ -190,6 +197,10 @@ declare enum PlantType {
|
|
|
190
197
|
_2 = 2,
|
|
191
198
|
_3 = 3
|
|
192
199
|
}
|
|
200
|
+
interface Distributor {
|
|
201
|
+
readonly id?: number;
|
|
202
|
+
name?: string | undefined;
|
|
203
|
+
}
|
|
193
204
|
interface HumidityMeasurement {
|
|
194
205
|
humidity?: number;
|
|
195
206
|
batteryLevel?: number;
|
|
@@ -820,4 +831,4 @@ declare class ApiException extends Error {
|
|
|
820
831
|
static isApiException(obj: any): obj is ApiException;
|
|
821
832
|
}
|
|
822
833
|
|
|
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 };
|
|
834
|
+
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, type Distributor, 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
|
@@ -131,8 +131,8 @@ var Client = /*#__PURE__*/ function() {
|
|
|
131
131
|
{
|
|
132
132
|
/**
|
|
133
133
|
* @return OK
|
|
134
|
-
*/ key: "
|
|
135
|
-
value: function
|
|
134
|
+
*/ key: "distributorAll",
|
|
135
|
+
value: function distributorAll(cancelToken) {
|
|
136
136
|
var _this = this;
|
|
137
137
|
var url_ = this.baseUrl + "/api/distributor";
|
|
138
138
|
url_ = url_.replace(/[?&]$/, "");
|
|
@@ -151,13 +151,13 @@ var Client = /*#__PURE__*/ function() {
|
|
|
151
151
|
throw _error;
|
|
152
152
|
}
|
|
153
153
|
}).then(function(_response) {
|
|
154
|
-
return _this.
|
|
154
|
+
return _this.processDistributorAll(_response);
|
|
155
155
|
});
|
|
156
156
|
}
|
|
157
157
|
},
|
|
158
158
|
{
|
|
159
|
-
key: "
|
|
160
|
-
value: function
|
|
159
|
+
key: "processDistributorAll",
|
|
160
|
+
value: function processDistributorAll(response) {
|
|
161
161
|
var status = response.status;
|
|
162
162
|
var _headers = {};
|
|
163
163
|
if (response.headers && _type_of(response.headers) === "object") {
|
|
@@ -251,8 +251,8 @@ var Client = /*#__PURE__*/ function() {
|
|
|
251
251
|
{
|
|
252
252
|
/**
|
|
253
253
|
* @return OK
|
|
254
|
-
*/ key: "
|
|
255
|
-
value: function
|
|
254
|
+
*/ key: "distributorGET",
|
|
255
|
+
value: function distributorGET(id, cancelToken) {
|
|
256
256
|
var _this = this;
|
|
257
257
|
var url_ = this.baseUrl + "/api/distributor/{id}";
|
|
258
258
|
if (id === void 0 || id === null) throw new globalThis.Error("The parameter 'id' must be defined.");
|
|
@@ -273,13 +273,81 @@ var Client = /*#__PURE__*/ function() {
|
|
|
273
273
|
throw _error;
|
|
274
274
|
}
|
|
275
275
|
}).then(function(_response) {
|
|
276
|
-
return _this.
|
|
276
|
+
return _this.processDistributorGET(_response);
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
key: "processDistributorGET",
|
|
282
|
+
value: function processDistributorGET(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
|
+
* @param distributorIdQuery (optional)
|
|
314
|
+
* @param plantIdQuery (optional)
|
|
315
|
+
* @return OK
|
|
316
|
+
*/ key: "add",
|
|
317
|
+
value: function add(distributorIdQuery, plantIdQuery, distributorIdPath, plantIdPath, cancelToken) {
|
|
318
|
+
var _this = this;
|
|
319
|
+
var url_ = this.baseUrl + "/api/distributor/{distributorId}/{plantId}/add?";
|
|
320
|
+
if (distributorIdPath === void 0 || distributorIdPath === null) throw new globalThis.Error("The parameter 'distributorIdPath' must be defined.");
|
|
321
|
+
url_ = url_.replace("{distributorId}", encodeURIComponent("" + distributorIdPath));
|
|
322
|
+
if (plantIdPath === void 0 || plantIdPath === null) throw new globalThis.Error("The parameter 'plantIdPath' must be defined.");
|
|
323
|
+
url_ = url_.replace("{plantId}", encodeURIComponent("" + plantIdPath));
|
|
324
|
+
if (distributorIdQuery === null) throw new globalThis.Error("The parameter 'distributorIdQuery' cannot be null.");
|
|
325
|
+
else if (distributorIdQuery !== void 0) url_ += "distributorId=" + encodeURIComponent("" + distributorIdQuery) + "&";
|
|
326
|
+
if (plantIdQuery === null) throw new globalThis.Error("The parameter 'plantIdQuery' cannot be null.");
|
|
327
|
+
else if (plantIdQuery !== void 0) url_ += "plantId=" + encodeURIComponent("" + plantIdQuery) + "&";
|
|
328
|
+
url_ = url_.replace(/[?&]$/, "");
|
|
329
|
+
var options_ = {
|
|
330
|
+
method: "POST",
|
|
331
|
+
url: url_,
|
|
332
|
+
headers: {
|
|
333
|
+
"Accept": "application/json"
|
|
334
|
+
},
|
|
335
|
+
cancelToken: cancelToken
|
|
336
|
+
};
|
|
337
|
+
return this.instance.request(options_).catch(function(_error) {
|
|
338
|
+
if (isAxiosError(_error) && _error.response) {
|
|
339
|
+
return _error.response;
|
|
340
|
+
} else {
|
|
341
|
+
throw _error;
|
|
342
|
+
}
|
|
343
|
+
}).then(function(_response) {
|
|
344
|
+
return _this.processAdd(_response);
|
|
277
345
|
});
|
|
278
346
|
}
|
|
279
347
|
},
|
|
280
348
|
{
|
|
281
|
-
key: "
|
|
282
|
-
value: function
|
|
349
|
+
key: "processAdd",
|
|
350
|
+
value: function processAdd(response) {
|
|
283
351
|
var status = response.status;
|
|
284
352
|
var _headers = {};
|
|
285
353
|
if (response.headers && _type_of(response.headers) === "object") {
|