@arekstasko/plantcare-api-client 1.1.9 → 1.2.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 +143 -8
- package/dist/index.d.cts +32 -5
- package/dist/index.d.ts +32 -5
- package/dist/index.js +140 -9
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -197,6 +197,9 @@ __export(index_exports, {
|
|
|
197
197
|
GenericParameterAttributes: function() {
|
|
198
198
|
return GenericParameterAttributes;
|
|
199
199
|
},
|
|
200
|
+
HumidityStatus: function() {
|
|
201
|
+
return HumidityStatus;
|
|
202
|
+
},
|
|
200
203
|
LayoutKind: function() {
|
|
201
204
|
return LayoutKind;
|
|
202
205
|
},
|
|
@@ -552,16 +555,13 @@ var Client = /*#__PURE__*/ function() {
|
|
|
552
555
|
},
|
|
553
556
|
{
|
|
554
557
|
/**
|
|
555
|
-
* @param idQuery (optional)
|
|
556
558
|
* @return OK
|
|
557
559
|
*/ key: "batteryLevel",
|
|
558
|
-
value: function batteryLevel(
|
|
560
|
+
value: function batteryLevel(id, cancelToken) {
|
|
559
561
|
var _this = this;
|
|
560
|
-
var url_ = this.baseUrl + "/api/modules/{id}/battery-level
|
|
561
|
-
if (
|
|
562
|
-
url_ = url_.replace("{id}", encodeURIComponent("" +
|
|
563
|
-
if (idQuery === null) throw new globalThis.Error("The parameter 'idQuery' cannot be null.");
|
|
564
|
-
else if (idQuery !== void 0) url_ += "id=" + encodeURIComponent("" + idQuery) + "&";
|
|
562
|
+
var url_ = this.baseUrl + "/api/modules/{id}/battery-level";
|
|
563
|
+
if (id === void 0 || id === null) throw new globalThis.Error("The parameter 'id' must be defined.");
|
|
564
|
+
url_ = url_.replace("{id}", encodeURIComponent("" + id));
|
|
565
565
|
url_ = url_.replace(/[?&]$/, "");
|
|
566
566
|
var options_ = {
|
|
567
567
|
method: "GET",
|
|
@@ -918,6 +918,66 @@ var Client = /*#__PURE__*/ function() {
|
|
|
918
918
|
},
|
|
919
919
|
{
|
|
920
920
|
/**
|
|
921
|
+
* @return OK
|
|
922
|
+
*/ key: "humidityStatus",
|
|
923
|
+
value: function humidityStatus(id, cancelToken) {
|
|
924
|
+
var _this = this;
|
|
925
|
+
var url_ = this.baseUrl + "/api/places/{id}/plants/humidity-status";
|
|
926
|
+
if (id === void 0 || id === null) throw new globalThis.Error("The parameter 'id' must be defined.");
|
|
927
|
+
url_ = url_.replace("{id}", encodeURIComponent("" + id));
|
|
928
|
+
url_ = url_.replace(/[?&]$/, "");
|
|
929
|
+
var options_ = {
|
|
930
|
+
method: "GET",
|
|
931
|
+
url: url_,
|
|
932
|
+
headers: {
|
|
933
|
+
"Accept": "application/json"
|
|
934
|
+
},
|
|
935
|
+
cancelToken: cancelToken
|
|
936
|
+
};
|
|
937
|
+
return this.instance.request(options_).catch(function(_error) {
|
|
938
|
+
if (isAxiosError(_error) && _error.response) {
|
|
939
|
+
return _error.response;
|
|
940
|
+
} else {
|
|
941
|
+
throw _error;
|
|
942
|
+
}
|
|
943
|
+
}).then(function(_response) {
|
|
944
|
+
return _this.processHumidityStatus(_response);
|
|
945
|
+
});
|
|
946
|
+
}
|
|
947
|
+
},
|
|
948
|
+
{
|
|
949
|
+
key: "processHumidityStatus",
|
|
950
|
+
value: function processHumidityStatus(response) {
|
|
951
|
+
var status = response.status;
|
|
952
|
+
var _headers = {};
|
|
953
|
+
if (response.headers && _type_of(response.headers) === "object") {
|
|
954
|
+
for(var k in response.headers){
|
|
955
|
+
if (response.headers.hasOwnProperty(k)) {
|
|
956
|
+
_headers[k] = response.headers[k];
|
|
957
|
+
}
|
|
958
|
+
}
|
|
959
|
+
}
|
|
960
|
+
if (status === 200) {
|
|
961
|
+
var _responseText = response.data;
|
|
962
|
+
var result200 = null;
|
|
963
|
+
var resultData200 = _responseText;
|
|
964
|
+
result200 = JSON.parse(resultData200);
|
|
965
|
+
return Promise.resolve(result200);
|
|
966
|
+
} else if (status === 500) {
|
|
967
|
+
var _responseText1 = response.data;
|
|
968
|
+
var result500 = null;
|
|
969
|
+
var resultData500 = _responseText1;
|
|
970
|
+
result500 = JSON.parse(resultData500);
|
|
971
|
+
return throwException("Internal Server Error", status, _responseText1, _headers, result500);
|
|
972
|
+
} else if (status !== 200 && status !== 204) {
|
|
973
|
+
var _responseText2 = response.data;
|
|
974
|
+
return throwException("An unexpected server error occurred.", status, _responseText2, _headers);
|
|
975
|
+
}
|
|
976
|
+
return Promise.resolve(null);
|
|
977
|
+
}
|
|
978
|
+
},
|
|
979
|
+
{
|
|
980
|
+
/**
|
|
921
981
|
* @param body (optional)
|
|
922
982
|
* @return OK
|
|
923
983
|
*/ key: "plantsPOST",
|
|
@@ -1161,6 +1221,73 @@ var Client = /*#__PURE__*/ function() {
|
|
|
1161
1221
|
},
|
|
1162
1222
|
{
|
|
1163
1223
|
/**
|
|
1224
|
+
* @param idQuery (optional)
|
|
1225
|
+
* @param body (optional)
|
|
1226
|
+
* @return OK
|
|
1227
|
+
*/ key: "setHumidityValues",
|
|
1228
|
+
value: function setHumidityValues(idQuery, idPath, body, cancelToken) {
|
|
1229
|
+
var _this = this;
|
|
1230
|
+
var url_ = this.baseUrl + "/api/plants/{id}/set-humidity-values?";
|
|
1231
|
+
if (idPath === void 0 || idPath === null) throw new globalThis.Error("The parameter 'idPath' must be defined.");
|
|
1232
|
+
url_ = url_.replace("{id}", encodeURIComponent("" + idPath));
|
|
1233
|
+
if (idQuery === null) throw new globalThis.Error("The parameter 'idQuery' cannot be null.");
|
|
1234
|
+
else if (idQuery !== void 0) url_ += "id=" + encodeURIComponent("" + idQuery) + "&";
|
|
1235
|
+
url_ = url_.replace(/[?&]$/, "");
|
|
1236
|
+
var content_ = JSON.stringify(body);
|
|
1237
|
+
var options_ = {
|
|
1238
|
+
data: content_,
|
|
1239
|
+
method: "PUT",
|
|
1240
|
+
url: url_,
|
|
1241
|
+
headers: {
|
|
1242
|
+
"Content-Type": "application/json",
|
|
1243
|
+
"Accept": "application/json"
|
|
1244
|
+
},
|
|
1245
|
+
cancelToken: cancelToken
|
|
1246
|
+
};
|
|
1247
|
+
return this.instance.request(options_).catch(function(_error) {
|
|
1248
|
+
if (isAxiosError(_error) && _error.response) {
|
|
1249
|
+
return _error.response;
|
|
1250
|
+
} else {
|
|
1251
|
+
throw _error;
|
|
1252
|
+
}
|
|
1253
|
+
}).then(function(_response) {
|
|
1254
|
+
return _this.processSetHumidityValues(_response);
|
|
1255
|
+
});
|
|
1256
|
+
}
|
|
1257
|
+
},
|
|
1258
|
+
{
|
|
1259
|
+
key: "processSetHumidityValues",
|
|
1260
|
+
value: function processSetHumidityValues(response) {
|
|
1261
|
+
var status = response.status;
|
|
1262
|
+
var _headers = {};
|
|
1263
|
+
if (response.headers && _type_of(response.headers) === "object") {
|
|
1264
|
+
for(var k in response.headers){
|
|
1265
|
+
if (response.headers.hasOwnProperty(k)) {
|
|
1266
|
+
_headers[k] = response.headers[k];
|
|
1267
|
+
}
|
|
1268
|
+
}
|
|
1269
|
+
}
|
|
1270
|
+
if (status === 200) {
|
|
1271
|
+
var _responseText = response.data;
|
|
1272
|
+
var result200 = null;
|
|
1273
|
+
var resultData200 = _responseText;
|
|
1274
|
+
result200 = JSON.parse(resultData200);
|
|
1275
|
+
return Promise.resolve(result200);
|
|
1276
|
+
} else if (status === 500) {
|
|
1277
|
+
var _responseText1 = response.data;
|
|
1278
|
+
var result500 = null;
|
|
1279
|
+
var resultData500 = _responseText1;
|
|
1280
|
+
result500 = JSON.parse(resultData500);
|
|
1281
|
+
return throwException("Internal Server Error", status, _responseText1, _headers, result500);
|
|
1282
|
+
} else if (status !== 200 && status !== 204) {
|
|
1283
|
+
var _responseText2 = response.data;
|
|
1284
|
+
return throwException("An unexpected server error occurred.", status, _responseText2, _headers);
|
|
1285
|
+
}
|
|
1286
|
+
return Promise.resolve(null);
|
|
1287
|
+
}
|
|
1288
|
+
},
|
|
1289
|
+
{
|
|
1290
|
+
/**
|
|
1164
1291
|
* @return OK
|
|
1165
1292
|
*/ key: "plantsGET",
|
|
1166
1293
|
value: function plantsGET(id, cancelToken) {
|
|
@@ -1222,10 +1349,17 @@ var Client = /*#__PURE__*/ function() {
|
|
|
1222
1349
|
]);
|
|
1223
1350
|
return Client;
|
|
1224
1351
|
}();
|
|
1352
|
+
var HumidityStatus = /* @__PURE__ */ function(HumidityStatus2) {
|
|
1353
|
+
HumidityStatus2[HumidityStatus2["_1"] = 1] = "_1";
|
|
1354
|
+
HumidityStatus2[HumidityStatus2["_2"] = 2] = "_2";
|
|
1355
|
+
HumidityStatus2[HumidityStatus2["_3"] = 3] = "_3";
|
|
1356
|
+
HumidityStatus2[HumidityStatus2["_4"] = 4] = "_4";
|
|
1357
|
+
return HumidityStatus2;
|
|
1358
|
+
}(HumidityStatus || {});
|
|
1225
1359
|
var PlantType = /* @__PURE__ */ function(PlantType2) {
|
|
1226
|
-
PlantType2[PlantType2["_0"] = 0] = "_0";
|
|
1227
1360
|
PlantType2[PlantType2["_1"] = 1] = "_1";
|
|
1228
1361
|
PlantType2[PlantType2["_2"] = 2] = "_2";
|
|
1362
|
+
PlantType2[PlantType2["_3"] = 3] = "_3";
|
|
1229
1363
|
return PlantType2;
|
|
1230
1364
|
}(PlantType || {});
|
|
1231
1365
|
var CallingConventions = /* @__PURE__ */ function(CallingConventions2) {
|
|
@@ -1434,6 +1568,7 @@ function isAxiosError(obj) {
|
|
|
1434
1568
|
EventAttributes: EventAttributes,
|
|
1435
1569
|
FieldAttributes: FieldAttributes,
|
|
1436
1570
|
GenericParameterAttributes: GenericParameterAttributes,
|
|
1571
|
+
HumidityStatus: HumidityStatus,
|
|
1437
1572
|
LayoutKind: LayoutKind,
|
|
1438
1573
|
MemberTypes: MemberTypes,
|
|
1439
1574
|
MethodAttributes: MethodAttributes,
|
package/dist/index.d.cts
CHANGED
|
@@ -37,10 +37,9 @@ declare class Client {
|
|
|
37
37
|
modulesAll(cancelToken?: CancelToken): Promise<Module[]>;
|
|
38
38
|
protected processModulesAll(response: AxiosResponse): Promise<Module[]>;
|
|
39
39
|
/**
|
|
40
|
-
* @param idQuery (optional)
|
|
41
40
|
* @return OK
|
|
42
41
|
*/
|
|
43
|
-
batteryLevel(
|
|
42
|
+
batteryLevel(id: number, cancelToken?: CancelToken): Promise<number>;
|
|
44
43
|
protected processBatteryLevel(response: AxiosResponse): Promise<number>;
|
|
45
44
|
/**
|
|
46
45
|
* @return OK
|
|
@@ -70,6 +69,11 @@ declare class Client {
|
|
|
70
69
|
*/
|
|
71
70
|
placesAll(cancelToken?: CancelToken): Promise<Place[]>;
|
|
72
71
|
protected processPlacesAll(response: AxiosResponse): Promise<Place[]>;
|
|
72
|
+
/**
|
|
73
|
+
* @return OK
|
|
74
|
+
*/
|
|
75
|
+
humidityStatus(id: number, cancelToken?: CancelToken): Promise<PlantHumidityStatus[]>;
|
|
76
|
+
protected processHumidityStatus(response: AxiosResponse): Promise<PlantHumidityStatus[]>;
|
|
73
77
|
/**
|
|
74
78
|
* @param body (optional)
|
|
75
79
|
* @return OK
|
|
@@ -93,6 +97,13 @@ declare class Client {
|
|
|
93
97
|
*/
|
|
94
98
|
plantsAll(cancelToken?: CancelToken): Promise<Plant[]>;
|
|
95
99
|
protected processPlantsAll(response: AxiosResponse): Promise<Plant[]>;
|
|
100
|
+
/**
|
|
101
|
+
* @param idQuery (optional)
|
|
102
|
+
* @param body (optional)
|
|
103
|
+
* @return OK
|
|
104
|
+
*/
|
|
105
|
+
setHumidityValues(idQuery: number | undefined, idPath: string, body: UpdatePlantHumidityValues | undefined, cancelToken?: CancelToken): Promise<boolean>;
|
|
106
|
+
protected processSetHumidityValues(response: AxiosResponse): Promise<boolean>;
|
|
96
107
|
/**
|
|
97
108
|
* @return OK
|
|
98
109
|
*/
|
|
@@ -132,6 +143,12 @@ interface UpdatePlantCommand {
|
|
|
132
143
|
type?: PlantType;
|
|
133
144
|
moduleId?: number | undefined;
|
|
134
145
|
}
|
|
146
|
+
interface UpdatePlantHumidityValues {
|
|
147
|
+
userId?: number;
|
|
148
|
+
plantId?: number;
|
|
149
|
+
minHumidity?: number;
|
|
150
|
+
maxHumidity?: number;
|
|
151
|
+
}
|
|
135
152
|
interface AverageHumidity {
|
|
136
153
|
date?: string | undefined;
|
|
137
154
|
humidity?: number;
|
|
@@ -139,16 +156,26 @@ interface AverageHumidity {
|
|
|
139
156
|
interface CreateModuleRequest {
|
|
140
157
|
name?: string | undefined;
|
|
141
158
|
}
|
|
159
|
+
declare enum HumidityStatus {
|
|
160
|
+
_1 = 1,
|
|
161
|
+
_2 = 2,
|
|
162
|
+
_3 = 3,
|
|
163
|
+
_4 = 4
|
|
164
|
+
}
|
|
142
165
|
declare enum PlantType {
|
|
143
|
-
_0 = 0,
|
|
144
166
|
_1 = 1,
|
|
145
|
-
_2 = 2
|
|
167
|
+
_2 = 2,
|
|
168
|
+
_3 = 3
|
|
146
169
|
}
|
|
147
170
|
interface HumidityMeasurement {
|
|
148
171
|
humidity?: number;
|
|
149
172
|
batteryLevel?: number;
|
|
150
173
|
date?: Date;
|
|
151
174
|
}
|
|
175
|
+
interface PlantHumidityStatus {
|
|
176
|
+
plantId?: number;
|
|
177
|
+
status?: HumidityStatus;
|
|
178
|
+
}
|
|
152
179
|
interface Module {
|
|
153
180
|
id?: number;
|
|
154
181
|
isAvailable?: boolean;
|
|
@@ -770,4 +797,4 @@ declare class ApiException extends Error {
|
|
|
770
797
|
static isApiException(obj: any): obj is ApiException;
|
|
771
798
|
}
|
|
772
799
|
|
|
773
|
-
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, 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, PlantType, PropertyAttributes, type PropertyInfo, type RuntimeFieldHandle, type RuntimeMethodHandle, type RuntimeTypeHandle, SecurityRuleSet, type StructLayoutAttribute, type Type, TypeAttributes, type TypeInfo, type UpdatePlaceCommand, type UpdatePlantCommand };
|
|
800
|
+
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -37,10 +37,9 @@ declare class Client {
|
|
|
37
37
|
modulesAll(cancelToken?: CancelToken): Promise<Module[]>;
|
|
38
38
|
protected processModulesAll(response: AxiosResponse): Promise<Module[]>;
|
|
39
39
|
/**
|
|
40
|
-
* @param idQuery (optional)
|
|
41
40
|
* @return OK
|
|
42
41
|
*/
|
|
43
|
-
batteryLevel(
|
|
42
|
+
batteryLevel(id: number, cancelToken?: CancelToken): Promise<number>;
|
|
44
43
|
protected processBatteryLevel(response: AxiosResponse): Promise<number>;
|
|
45
44
|
/**
|
|
46
45
|
* @return OK
|
|
@@ -70,6 +69,11 @@ declare class Client {
|
|
|
70
69
|
*/
|
|
71
70
|
placesAll(cancelToken?: CancelToken): Promise<Place[]>;
|
|
72
71
|
protected processPlacesAll(response: AxiosResponse): Promise<Place[]>;
|
|
72
|
+
/**
|
|
73
|
+
* @return OK
|
|
74
|
+
*/
|
|
75
|
+
humidityStatus(id: number, cancelToken?: CancelToken): Promise<PlantHumidityStatus[]>;
|
|
76
|
+
protected processHumidityStatus(response: AxiosResponse): Promise<PlantHumidityStatus[]>;
|
|
73
77
|
/**
|
|
74
78
|
* @param body (optional)
|
|
75
79
|
* @return OK
|
|
@@ -93,6 +97,13 @@ declare class Client {
|
|
|
93
97
|
*/
|
|
94
98
|
plantsAll(cancelToken?: CancelToken): Promise<Plant[]>;
|
|
95
99
|
protected processPlantsAll(response: AxiosResponse): Promise<Plant[]>;
|
|
100
|
+
/**
|
|
101
|
+
* @param idQuery (optional)
|
|
102
|
+
* @param body (optional)
|
|
103
|
+
* @return OK
|
|
104
|
+
*/
|
|
105
|
+
setHumidityValues(idQuery: number | undefined, idPath: string, body: UpdatePlantHumidityValues | undefined, cancelToken?: CancelToken): Promise<boolean>;
|
|
106
|
+
protected processSetHumidityValues(response: AxiosResponse): Promise<boolean>;
|
|
96
107
|
/**
|
|
97
108
|
* @return OK
|
|
98
109
|
*/
|
|
@@ -132,6 +143,12 @@ interface UpdatePlantCommand {
|
|
|
132
143
|
type?: PlantType;
|
|
133
144
|
moduleId?: number | undefined;
|
|
134
145
|
}
|
|
146
|
+
interface UpdatePlantHumidityValues {
|
|
147
|
+
userId?: number;
|
|
148
|
+
plantId?: number;
|
|
149
|
+
minHumidity?: number;
|
|
150
|
+
maxHumidity?: number;
|
|
151
|
+
}
|
|
135
152
|
interface AverageHumidity {
|
|
136
153
|
date?: string | undefined;
|
|
137
154
|
humidity?: number;
|
|
@@ -139,16 +156,26 @@ interface AverageHumidity {
|
|
|
139
156
|
interface CreateModuleRequest {
|
|
140
157
|
name?: string | undefined;
|
|
141
158
|
}
|
|
159
|
+
declare enum HumidityStatus {
|
|
160
|
+
_1 = 1,
|
|
161
|
+
_2 = 2,
|
|
162
|
+
_3 = 3,
|
|
163
|
+
_4 = 4
|
|
164
|
+
}
|
|
142
165
|
declare enum PlantType {
|
|
143
|
-
_0 = 0,
|
|
144
166
|
_1 = 1,
|
|
145
|
-
_2 = 2
|
|
167
|
+
_2 = 2,
|
|
168
|
+
_3 = 3
|
|
146
169
|
}
|
|
147
170
|
interface HumidityMeasurement {
|
|
148
171
|
humidity?: number;
|
|
149
172
|
batteryLevel?: number;
|
|
150
173
|
date?: Date;
|
|
151
174
|
}
|
|
175
|
+
interface PlantHumidityStatus {
|
|
176
|
+
plantId?: number;
|
|
177
|
+
status?: HumidityStatus;
|
|
178
|
+
}
|
|
152
179
|
interface Module {
|
|
153
180
|
id?: number;
|
|
154
181
|
isAvailable?: boolean;
|
|
@@ -770,4 +797,4 @@ declare class ApiException extends Error {
|
|
|
770
797
|
static isApiException(obj: any): obj is ApiException;
|
|
771
798
|
}
|
|
772
799
|
|
|
773
|
-
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, 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, PlantType, PropertyAttributes, type PropertyInfo, type RuntimeFieldHandle, type RuntimeMethodHandle, type RuntimeTypeHandle, SecurityRuleSet, type StructLayoutAttribute, type Type, TypeAttributes, type TypeInfo, type UpdatePlaceCommand, type UpdatePlantCommand };
|
|
800
|
+
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 };
|
package/dist/index.js
CHANGED
|
@@ -444,16 +444,13 @@ var Client = /*#__PURE__*/ function() {
|
|
|
444
444
|
},
|
|
445
445
|
{
|
|
446
446
|
/**
|
|
447
|
-
* @param idQuery (optional)
|
|
448
447
|
* @return OK
|
|
449
448
|
*/ key: "batteryLevel",
|
|
450
|
-
value: function batteryLevel(
|
|
449
|
+
value: function batteryLevel(id, cancelToken) {
|
|
451
450
|
var _this = this;
|
|
452
|
-
var url_ = this.baseUrl + "/api/modules/{id}/battery-level
|
|
453
|
-
if (
|
|
454
|
-
url_ = url_.replace("{id}", encodeURIComponent("" +
|
|
455
|
-
if (idQuery === null) throw new globalThis.Error("The parameter 'idQuery' cannot be null.");
|
|
456
|
-
else if (idQuery !== void 0) url_ += "id=" + encodeURIComponent("" + idQuery) + "&";
|
|
451
|
+
var url_ = this.baseUrl + "/api/modules/{id}/battery-level";
|
|
452
|
+
if (id === void 0 || id === null) throw new globalThis.Error("The parameter 'id' must be defined.");
|
|
453
|
+
url_ = url_.replace("{id}", encodeURIComponent("" + id));
|
|
457
454
|
url_ = url_.replace(/[?&]$/, "");
|
|
458
455
|
var options_ = {
|
|
459
456
|
method: "GET",
|
|
@@ -810,6 +807,66 @@ var Client = /*#__PURE__*/ function() {
|
|
|
810
807
|
},
|
|
811
808
|
{
|
|
812
809
|
/**
|
|
810
|
+
* @return OK
|
|
811
|
+
*/ key: "humidityStatus",
|
|
812
|
+
value: function humidityStatus(id, cancelToken) {
|
|
813
|
+
var _this = this;
|
|
814
|
+
var url_ = this.baseUrl + "/api/places/{id}/plants/humidity-status";
|
|
815
|
+
if (id === void 0 || id === null) throw new globalThis.Error("The parameter 'id' must be defined.");
|
|
816
|
+
url_ = url_.replace("{id}", encodeURIComponent("" + id));
|
|
817
|
+
url_ = url_.replace(/[?&]$/, "");
|
|
818
|
+
var options_ = {
|
|
819
|
+
method: "GET",
|
|
820
|
+
url: url_,
|
|
821
|
+
headers: {
|
|
822
|
+
"Accept": "application/json"
|
|
823
|
+
},
|
|
824
|
+
cancelToken: cancelToken
|
|
825
|
+
};
|
|
826
|
+
return this.instance.request(options_).catch(function(_error) {
|
|
827
|
+
if (isAxiosError(_error) && _error.response) {
|
|
828
|
+
return _error.response;
|
|
829
|
+
} else {
|
|
830
|
+
throw _error;
|
|
831
|
+
}
|
|
832
|
+
}).then(function(_response) {
|
|
833
|
+
return _this.processHumidityStatus(_response);
|
|
834
|
+
});
|
|
835
|
+
}
|
|
836
|
+
},
|
|
837
|
+
{
|
|
838
|
+
key: "processHumidityStatus",
|
|
839
|
+
value: function processHumidityStatus(response) {
|
|
840
|
+
var status = response.status;
|
|
841
|
+
var _headers = {};
|
|
842
|
+
if (response.headers && _type_of(response.headers) === "object") {
|
|
843
|
+
for(var k in response.headers){
|
|
844
|
+
if (response.headers.hasOwnProperty(k)) {
|
|
845
|
+
_headers[k] = response.headers[k];
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
if (status === 200) {
|
|
850
|
+
var _responseText = response.data;
|
|
851
|
+
var result200 = null;
|
|
852
|
+
var resultData200 = _responseText;
|
|
853
|
+
result200 = JSON.parse(resultData200);
|
|
854
|
+
return Promise.resolve(result200);
|
|
855
|
+
} else if (status === 500) {
|
|
856
|
+
var _responseText1 = response.data;
|
|
857
|
+
var result500 = null;
|
|
858
|
+
var resultData500 = _responseText1;
|
|
859
|
+
result500 = JSON.parse(resultData500);
|
|
860
|
+
return throwException("Internal Server Error", status, _responseText1, _headers, result500);
|
|
861
|
+
} else if (status !== 200 && status !== 204) {
|
|
862
|
+
var _responseText2 = response.data;
|
|
863
|
+
return throwException("An unexpected server error occurred.", status, _responseText2, _headers);
|
|
864
|
+
}
|
|
865
|
+
return Promise.resolve(null);
|
|
866
|
+
}
|
|
867
|
+
},
|
|
868
|
+
{
|
|
869
|
+
/**
|
|
813
870
|
* @param body (optional)
|
|
814
871
|
* @return OK
|
|
815
872
|
*/ key: "plantsPOST",
|
|
@@ -1053,6 +1110,73 @@ var Client = /*#__PURE__*/ function() {
|
|
|
1053
1110
|
},
|
|
1054
1111
|
{
|
|
1055
1112
|
/**
|
|
1113
|
+
* @param idQuery (optional)
|
|
1114
|
+
* @param body (optional)
|
|
1115
|
+
* @return OK
|
|
1116
|
+
*/ key: "setHumidityValues",
|
|
1117
|
+
value: function setHumidityValues(idQuery, idPath, body, cancelToken) {
|
|
1118
|
+
var _this = this;
|
|
1119
|
+
var url_ = this.baseUrl + "/api/plants/{id}/set-humidity-values?";
|
|
1120
|
+
if (idPath === void 0 || idPath === null) throw new globalThis.Error("The parameter 'idPath' must be defined.");
|
|
1121
|
+
url_ = url_.replace("{id}", encodeURIComponent("" + idPath));
|
|
1122
|
+
if (idQuery === null) throw new globalThis.Error("The parameter 'idQuery' cannot be null.");
|
|
1123
|
+
else if (idQuery !== void 0) url_ += "id=" + encodeURIComponent("" + idQuery) + "&";
|
|
1124
|
+
url_ = url_.replace(/[?&]$/, "");
|
|
1125
|
+
var content_ = JSON.stringify(body);
|
|
1126
|
+
var options_ = {
|
|
1127
|
+
data: content_,
|
|
1128
|
+
method: "PUT",
|
|
1129
|
+
url: url_,
|
|
1130
|
+
headers: {
|
|
1131
|
+
"Content-Type": "application/json",
|
|
1132
|
+
"Accept": "application/json"
|
|
1133
|
+
},
|
|
1134
|
+
cancelToken: cancelToken
|
|
1135
|
+
};
|
|
1136
|
+
return this.instance.request(options_).catch(function(_error) {
|
|
1137
|
+
if (isAxiosError(_error) && _error.response) {
|
|
1138
|
+
return _error.response;
|
|
1139
|
+
} else {
|
|
1140
|
+
throw _error;
|
|
1141
|
+
}
|
|
1142
|
+
}).then(function(_response) {
|
|
1143
|
+
return _this.processSetHumidityValues(_response);
|
|
1144
|
+
});
|
|
1145
|
+
}
|
|
1146
|
+
},
|
|
1147
|
+
{
|
|
1148
|
+
key: "processSetHumidityValues",
|
|
1149
|
+
value: function processSetHumidityValues(response) {
|
|
1150
|
+
var status = response.status;
|
|
1151
|
+
var _headers = {};
|
|
1152
|
+
if (response.headers && _type_of(response.headers) === "object") {
|
|
1153
|
+
for(var k in response.headers){
|
|
1154
|
+
if (response.headers.hasOwnProperty(k)) {
|
|
1155
|
+
_headers[k] = response.headers[k];
|
|
1156
|
+
}
|
|
1157
|
+
}
|
|
1158
|
+
}
|
|
1159
|
+
if (status === 200) {
|
|
1160
|
+
var _responseText = response.data;
|
|
1161
|
+
var result200 = null;
|
|
1162
|
+
var resultData200 = _responseText;
|
|
1163
|
+
result200 = JSON.parse(resultData200);
|
|
1164
|
+
return Promise.resolve(result200);
|
|
1165
|
+
} else if (status === 500) {
|
|
1166
|
+
var _responseText1 = response.data;
|
|
1167
|
+
var result500 = null;
|
|
1168
|
+
var resultData500 = _responseText1;
|
|
1169
|
+
result500 = JSON.parse(resultData500);
|
|
1170
|
+
return throwException("Internal Server Error", status, _responseText1, _headers, result500);
|
|
1171
|
+
} else if (status !== 200 && status !== 204) {
|
|
1172
|
+
var _responseText2 = response.data;
|
|
1173
|
+
return throwException("An unexpected server error occurred.", status, _responseText2, _headers);
|
|
1174
|
+
}
|
|
1175
|
+
return Promise.resolve(null);
|
|
1176
|
+
}
|
|
1177
|
+
},
|
|
1178
|
+
{
|
|
1179
|
+
/**
|
|
1056
1180
|
* @return OK
|
|
1057
1181
|
*/ key: "plantsGET",
|
|
1058
1182
|
value: function plantsGET(id, cancelToken) {
|
|
@@ -1114,10 +1238,17 @@ var Client = /*#__PURE__*/ function() {
|
|
|
1114
1238
|
]);
|
|
1115
1239
|
return Client;
|
|
1116
1240
|
}();
|
|
1241
|
+
var HumidityStatus = /* @__PURE__ */ function(HumidityStatus2) {
|
|
1242
|
+
HumidityStatus2[HumidityStatus2["_1"] = 1] = "_1";
|
|
1243
|
+
HumidityStatus2[HumidityStatus2["_2"] = 2] = "_2";
|
|
1244
|
+
HumidityStatus2[HumidityStatus2["_3"] = 3] = "_3";
|
|
1245
|
+
HumidityStatus2[HumidityStatus2["_4"] = 4] = "_4";
|
|
1246
|
+
return HumidityStatus2;
|
|
1247
|
+
}(HumidityStatus || {});
|
|
1117
1248
|
var PlantType = /* @__PURE__ */ function(PlantType2) {
|
|
1118
|
-
PlantType2[PlantType2["_0"] = 0] = "_0";
|
|
1119
1249
|
PlantType2[PlantType2["_1"] = 1] = "_1";
|
|
1120
1250
|
PlantType2[PlantType2["_2"] = 2] = "_2";
|
|
1251
|
+
PlantType2[PlantType2["_3"] = 3] = "_3";
|
|
1121
1252
|
return PlantType2;
|
|
1122
1253
|
}(PlantType || {});
|
|
1123
1254
|
var CallingConventions = /* @__PURE__ */ function(CallingConventions2) {
|
|
@@ -1319,4 +1450,4 @@ function throwException(message, status, response, headers, result) {
|
|
|
1319
1450
|
function isAxiosError(obj) {
|
|
1320
1451
|
return obj && obj.isAxiosError === true;
|
|
1321
1452
|
}
|
|
1322
|
-
export { ApiException, CallingConventions, Client, EventAttributes, FieldAttributes, GenericParameterAttributes, LayoutKind, MemberTypes, MethodAttributes, MethodImplAttributes, ParameterAttributes, PlantType, PropertyAttributes, SecurityRuleSet, TypeAttributes };
|
|
1453
|
+
export { ApiException, CallingConventions, Client, EventAttributes, FieldAttributes, GenericParameterAttributes, HumidityStatus, LayoutKind, MemberTypes, MethodAttributes, MethodImplAttributes, ParameterAttributes, PlantType, PropertyAttributes, SecurityRuleSet, TypeAttributes };
|