@arekstasko/plantcare-api-client 1.0.9 → 1.1.1
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 +59 -0
- package/dist/index.d.cts +18 -1
- package/dist/index.d.ts +18 -1
- package/dist/index.js +59 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -340,6 +340,65 @@ var Client = /*#__PURE__*/ function() {
|
|
|
340
340
|
},
|
|
341
341
|
{
|
|
342
342
|
/**
|
|
343
|
+
* @param fromDate (optional)
|
|
344
|
+
* @param toDate (optional)
|
|
345
|
+
* @return OK
|
|
346
|
+
*/ key: "average",
|
|
347
|
+
value: function average(id, fromDate, toDate) {
|
|
348
|
+
var _this = this;
|
|
349
|
+
var url_ = this.baseUrl + "/api/humidity-measurements/{id}/average?";
|
|
350
|
+
if (id === void 0 || id === null) throw new globalThis.Error("The parameter 'id' must be defined.");
|
|
351
|
+
url_ = url_.replace("{id}", encodeURIComponent("" + id));
|
|
352
|
+
if (fromDate === null) throw new globalThis.Error("The parameter 'fromDate' cannot be null.");
|
|
353
|
+
else if (fromDate !== void 0) url_ += "fromDate=" + encodeURIComponent(fromDate ? "" + fromDate.toISOString() : "") + "&";
|
|
354
|
+
if (toDate === null) throw new globalThis.Error("The parameter 'toDate' cannot be null.");
|
|
355
|
+
else if (toDate !== void 0) url_ += "toDate=" + encodeURIComponent(toDate ? "" + toDate.toISOString() : "") + "&";
|
|
356
|
+
url_ = url_.replace(/[?&]$/, "");
|
|
357
|
+
var options_ = {
|
|
358
|
+
method: "GET",
|
|
359
|
+
headers: {
|
|
360
|
+
"Accept": "application/json"
|
|
361
|
+
}
|
|
362
|
+
};
|
|
363
|
+
return this.http.fetch(url_, options_).then(function(_response) {
|
|
364
|
+
return _this.processAverage(_response);
|
|
365
|
+
});
|
|
366
|
+
}
|
|
367
|
+
},
|
|
368
|
+
{
|
|
369
|
+
key: "processAverage",
|
|
370
|
+
value: function processAverage(response) {
|
|
371
|
+
var _this = this;
|
|
372
|
+
var status = response.status;
|
|
373
|
+
var _headers = {};
|
|
374
|
+
if (response.headers && response.headers.forEach) {
|
|
375
|
+
response.headers.forEach(function(v, k) {
|
|
376
|
+
return _headers[k] = v;
|
|
377
|
+
});
|
|
378
|
+
}
|
|
379
|
+
;
|
|
380
|
+
if (status === 200) {
|
|
381
|
+
return response.text().then(function(_responseText) {
|
|
382
|
+
var result200 = null;
|
|
383
|
+
result200 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
|
|
384
|
+
return result200;
|
|
385
|
+
});
|
|
386
|
+
} else if (status === 500) {
|
|
387
|
+
return response.text().then(function(_responseText) {
|
|
388
|
+
var result500 = null;
|
|
389
|
+
result500 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
|
|
390
|
+
return throwException("Internal Server Error", status, _responseText, _headers, result500);
|
|
391
|
+
});
|
|
392
|
+
} else if (status !== 200 && status !== 204) {
|
|
393
|
+
return response.text().then(function(_responseText) {
|
|
394
|
+
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
|
395
|
+
});
|
|
396
|
+
}
|
|
397
|
+
return Promise.resolve(null);
|
|
398
|
+
}
|
|
399
|
+
},
|
|
400
|
+
{
|
|
401
|
+
/**
|
|
343
402
|
* @param body (optional)
|
|
344
403
|
* @return OK
|
|
345
404
|
*/ key: "modulesPOST",
|
package/dist/index.d.cts
CHANGED
|
@@ -11,6 +11,12 @@ interface IClient {
|
|
|
11
11
|
* @return OK
|
|
12
12
|
*/
|
|
13
13
|
humidityMeasurementsAll(id?: number | undefined, fromDate?: Date | undefined, toDate?: Date | undefined): Promise<IHumidityMeasurement[]>;
|
|
14
|
+
/**
|
|
15
|
+
* @param fromDate (optional)
|
|
16
|
+
* @param toDate (optional)
|
|
17
|
+
* @return OK
|
|
18
|
+
*/
|
|
19
|
+
average(id: number, fromDate?: Date | undefined, toDate?: Date | undefined): Promise<AverageHumidity[]>;
|
|
14
20
|
/**
|
|
15
21
|
* @param body (optional)
|
|
16
22
|
* @return OK
|
|
@@ -88,6 +94,13 @@ declare class Client implements IClient {
|
|
|
88
94
|
*/
|
|
89
95
|
humidityMeasurementsAll(id?: number | undefined, fromDate?: Date | undefined, toDate?: Date | undefined): Promise<IHumidityMeasurement[]>;
|
|
90
96
|
protected processHumidityMeasurementsAll(response: Response): Promise<IHumidityMeasurement[]>;
|
|
97
|
+
/**
|
|
98
|
+
* @param fromDate (optional)
|
|
99
|
+
* @param toDate (optional)
|
|
100
|
+
* @return OK
|
|
101
|
+
*/
|
|
102
|
+
average(id: number, fromDate?: Date | undefined, toDate?: Date | undefined): Promise<AverageHumidity[]>;
|
|
103
|
+
protected processAverage(response: Response): Promise<AverageHumidity[]>;
|
|
91
104
|
/**
|
|
92
105
|
* @param body (optional)
|
|
93
106
|
* @return OK
|
|
@@ -181,6 +194,10 @@ interface Assembly {
|
|
|
181
194
|
readonly hostContext?: number;
|
|
182
195
|
securityRuleSet?: SecurityRuleSet;
|
|
183
196
|
}
|
|
197
|
+
interface AverageHumidity {
|
|
198
|
+
date?: string | undefined;
|
|
199
|
+
humidity?: number;
|
|
200
|
+
}
|
|
184
201
|
declare enum CallingConventions {
|
|
185
202
|
_1 = 1,
|
|
186
203
|
_2 = 2,
|
|
@@ -821,4 +838,4 @@ declare class ApiException extends Error {
|
|
|
821
838
|
static isApiException(obj: any): obj is ApiException;
|
|
822
839
|
}
|
|
823
840
|
|
|
824
|
-
export { type AddHumidityMeasurementCommand, ApiException, type Assembly, 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 GetModuleResponse, type GetPlacesResponse, type GetPlantResponse, type IClient, type ICustomAttributeProvider, type IHumidityMeasurement, type IntPtr, LayoutKind, type MemberInfo, MemberTypes, MethodAttributes, type MethodBase, MethodImplAttributes, type MethodInfo, type Module, type ModuleHandle, ParameterAttributes, type ParameterInfo, PlantType, PropertyAttributes, type PropertyInfo, type RuntimeFieldHandle, type RuntimeMethodHandle, type RuntimeTypeHandle, SecurityRuleSet, type StructLayoutAttribute, type Type, TypeAttributes, type TypeInfo, type UpdatePlaceCommand, type UpdatePlantCommand };
|
|
841
|
+
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 GetModuleResponse, type GetPlacesResponse, type GetPlantResponse, type IClient, type ICustomAttributeProvider, type IHumidityMeasurement, type IntPtr, LayoutKind, type MemberInfo, MemberTypes, MethodAttributes, type MethodBase, MethodImplAttributes, type MethodInfo, type Module, type ModuleHandle, ParameterAttributes, type ParameterInfo, PlantType, PropertyAttributes, type PropertyInfo, type RuntimeFieldHandle, type RuntimeMethodHandle, type RuntimeTypeHandle, SecurityRuleSet, type StructLayoutAttribute, type Type, TypeAttributes, type TypeInfo, type UpdatePlaceCommand, type UpdatePlantCommand };
|
package/dist/index.d.ts
CHANGED
|
@@ -11,6 +11,12 @@ interface IClient {
|
|
|
11
11
|
* @return OK
|
|
12
12
|
*/
|
|
13
13
|
humidityMeasurementsAll(id?: number | undefined, fromDate?: Date | undefined, toDate?: Date | undefined): Promise<IHumidityMeasurement[]>;
|
|
14
|
+
/**
|
|
15
|
+
* @param fromDate (optional)
|
|
16
|
+
* @param toDate (optional)
|
|
17
|
+
* @return OK
|
|
18
|
+
*/
|
|
19
|
+
average(id: number, fromDate?: Date | undefined, toDate?: Date | undefined): Promise<AverageHumidity[]>;
|
|
14
20
|
/**
|
|
15
21
|
* @param body (optional)
|
|
16
22
|
* @return OK
|
|
@@ -88,6 +94,13 @@ declare class Client implements IClient {
|
|
|
88
94
|
*/
|
|
89
95
|
humidityMeasurementsAll(id?: number | undefined, fromDate?: Date | undefined, toDate?: Date | undefined): Promise<IHumidityMeasurement[]>;
|
|
90
96
|
protected processHumidityMeasurementsAll(response: Response): Promise<IHumidityMeasurement[]>;
|
|
97
|
+
/**
|
|
98
|
+
* @param fromDate (optional)
|
|
99
|
+
* @param toDate (optional)
|
|
100
|
+
* @return OK
|
|
101
|
+
*/
|
|
102
|
+
average(id: number, fromDate?: Date | undefined, toDate?: Date | undefined): Promise<AverageHumidity[]>;
|
|
103
|
+
protected processAverage(response: Response): Promise<AverageHumidity[]>;
|
|
91
104
|
/**
|
|
92
105
|
* @param body (optional)
|
|
93
106
|
* @return OK
|
|
@@ -181,6 +194,10 @@ interface Assembly {
|
|
|
181
194
|
readonly hostContext?: number;
|
|
182
195
|
securityRuleSet?: SecurityRuleSet;
|
|
183
196
|
}
|
|
197
|
+
interface AverageHumidity {
|
|
198
|
+
date?: string | undefined;
|
|
199
|
+
humidity?: number;
|
|
200
|
+
}
|
|
184
201
|
declare enum CallingConventions {
|
|
185
202
|
_1 = 1,
|
|
186
203
|
_2 = 2,
|
|
@@ -821,4 +838,4 @@ declare class ApiException extends Error {
|
|
|
821
838
|
static isApiException(obj: any): obj is ApiException;
|
|
822
839
|
}
|
|
823
840
|
|
|
824
|
-
export { type AddHumidityMeasurementCommand, ApiException, type Assembly, 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 GetModuleResponse, type GetPlacesResponse, type GetPlantResponse, type IClient, type ICustomAttributeProvider, type IHumidityMeasurement, type IntPtr, LayoutKind, type MemberInfo, MemberTypes, MethodAttributes, type MethodBase, MethodImplAttributes, type MethodInfo, type Module, type ModuleHandle, ParameterAttributes, type ParameterInfo, PlantType, PropertyAttributes, type PropertyInfo, type RuntimeFieldHandle, type RuntimeMethodHandle, type RuntimeTypeHandle, SecurityRuleSet, type StructLayoutAttribute, type Type, TypeAttributes, type TypeInfo, type UpdatePlaceCommand, type UpdatePlantCommand };
|
|
841
|
+
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 GetModuleResponse, type GetPlacesResponse, type GetPlantResponse, type IClient, type ICustomAttributeProvider, type IHumidityMeasurement, type IntPtr, LayoutKind, type MemberInfo, MemberTypes, MethodAttributes, type MethodBase, MethodImplAttributes, type MethodInfo, type Module, type ModuleHandle, ParameterAttributes, type ParameterInfo, PlantType, PropertyAttributes, type PropertyInfo, type RuntimeFieldHandle, type RuntimeMethodHandle, type RuntimeTypeHandle, SecurityRuleSet, type StructLayoutAttribute, type Type, TypeAttributes, type TypeInfo, type UpdatePlaceCommand, type UpdatePlantCommand };
|
package/dist/index.js
CHANGED
|
@@ -244,6 +244,65 @@ var Client = /*#__PURE__*/ function() {
|
|
|
244
244
|
},
|
|
245
245
|
{
|
|
246
246
|
/**
|
|
247
|
+
* @param fromDate (optional)
|
|
248
|
+
* @param toDate (optional)
|
|
249
|
+
* @return OK
|
|
250
|
+
*/ key: "average",
|
|
251
|
+
value: function average(id, fromDate, toDate) {
|
|
252
|
+
var _this = this;
|
|
253
|
+
var url_ = this.baseUrl + "/api/humidity-measurements/{id}/average?";
|
|
254
|
+
if (id === void 0 || id === null) throw new globalThis.Error("The parameter 'id' must be defined.");
|
|
255
|
+
url_ = url_.replace("{id}", encodeURIComponent("" + id));
|
|
256
|
+
if (fromDate === null) throw new globalThis.Error("The parameter 'fromDate' cannot be null.");
|
|
257
|
+
else if (fromDate !== void 0) url_ += "fromDate=" + encodeURIComponent(fromDate ? "" + fromDate.toISOString() : "") + "&";
|
|
258
|
+
if (toDate === null) throw new globalThis.Error("The parameter 'toDate' cannot be null.");
|
|
259
|
+
else if (toDate !== void 0) url_ += "toDate=" + encodeURIComponent(toDate ? "" + toDate.toISOString() : "") + "&";
|
|
260
|
+
url_ = url_.replace(/[?&]$/, "");
|
|
261
|
+
var options_ = {
|
|
262
|
+
method: "GET",
|
|
263
|
+
headers: {
|
|
264
|
+
"Accept": "application/json"
|
|
265
|
+
}
|
|
266
|
+
};
|
|
267
|
+
return this.http.fetch(url_, options_).then(function(_response) {
|
|
268
|
+
return _this.processAverage(_response);
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
key: "processAverage",
|
|
274
|
+
value: function processAverage(response) {
|
|
275
|
+
var _this = this;
|
|
276
|
+
var status = response.status;
|
|
277
|
+
var _headers = {};
|
|
278
|
+
if (response.headers && response.headers.forEach) {
|
|
279
|
+
response.headers.forEach(function(v, k) {
|
|
280
|
+
return _headers[k] = v;
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
;
|
|
284
|
+
if (status === 200) {
|
|
285
|
+
return response.text().then(function(_responseText) {
|
|
286
|
+
var result200 = null;
|
|
287
|
+
result200 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
|
|
288
|
+
return result200;
|
|
289
|
+
});
|
|
290
|
+
} else if (status === 500) {
|
|
291
|
+
return response.text().then(function(_responseText) {
|
|
292
|
+
var result500 = null;
|
|
293
|
+
result500 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
|
|
294
|
+
return throwException("Internal Server Error", status, _responseText, _headers, result500);
|
|
295
|
+
});
|
|
296
|
+
} else if (status !== 200 && status !== 204) {
|
|
297
|
+
return response.text().then(function(_responseText) {
|
|
298
|
+
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
return Promise.resolve(null);
|
|
302
|
+
}
|
|
303
|
+
},
|
|
304
|
+
{
|
|
305
|
+
/**
|
|
247
306
|
* @param body (optional)
|
|
248
307
|
* @return OK
|
|
249
308
|
*/ key: "modulesPOST",
|