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