@ricado/api-client 2.5.14 → 2.5.16

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.
@@ -2299,58 +2299,58 @@ var PackrunController = /*#__PURE__*/function () {
2299
2299
  resultObject.class2TotalTrays = 0;
2300
2300
  }
2301
2301
 
2302
- if (_typeof(result) === 'object' && 'classTypes' in result) {
2303
- resultObject.classTypes = function () {
2304
- if (Array.isArray(result.classTypes) !== true) {
2302
+ if (_typeof(result) === 'object' && 'classTypeTotals' in result) {
2303
+ resultObject.classTypeTotals = function () {
2304
+ if (Array.isArray(result.classTypeTotals) !== true) {
2305
2305
  return [];
2306
2306
  }
2307
2307
 
2308
- return result.classTypes.map(function (classTypesItem) {
2308
+ return result.classTypeTotals.map(function (classTypeTotalsItem) {
2309
2309
  return function () {
2310
- var classTypesItemObject = {};
2310
+ var classTypeTotalsItemObject = {};
2311
2311
 
2312
- if (_typeof(classTypesItem) === 'object' && 'classType' in classTypesItem) {
2313
- classTypesItemObject.classType = function () {
2314
- if (typeof classTypesItem.classType !== 'string') {
2315
- return String(classTypesItem.classType);
2312
+ if (_typeof(classTypeTotalsItem) === 'object' && 'classType' in classTypeTotalsItem) {
2313
+ classTypeTotalsItemObject.classType = function () {
2314
+ if (typeof classTypeTotalsItem.classType !== 'string') {
2315
+ return String(classTypeTotalsItem.classType);
2316
2316
  }
2317
2317
 
2318
- return classTypesItem.classType;
2318
+ return classTypeTotalsItem.classType;
2319
2319
  }();
2320
2320
  } else {
2321
- classTypesItemObject.classType = "";
2321
+ classTypeTotalsItemObject.classType = "";
2322
2322
  }
2323
2323
 
2324
- if (_typeof(classTypesItem) === 'object' && 'name' in classTypesItem) {
2325
- classTypesItemObject.name = function () {
2326
- if (typeof classTypesItem.name !== 'string') {
2327
- return String(classTypesItem.name);
2324
+ if (_typeof(classTypeTotalsItem) === 'object' && 'name' in classTypeTotalsItem) {
2325
+ classTypeTotalsItemObject.name = function () {
2326
+ if (typeof classTypeTotalsItem.name !== 'string') {
2327
+ return String(classTypeTotalsItem.name);
2328
2328
  }
2329
2329
 
2330
- return classTypesItem.name;
2330
+ return classTypeTotalsItem.name;
2331
2331
  }();
2332
2332
  } else {
2333
- classTypesItemObject.name = "";
2333
+ classTypeTotalsItemObject.name = "";
2334
2334
  }
2335
2335
 
2336
- if (_typeof(classTypesItem) === 'object' && 'percentage' in classTypesItem) {
2337
- classTypesItemObject.percentage = function () {
2338
- if (typeof classTypesItem.percentage !== 'number') {
2339
- return Number(classTypesItem.percentage);
2336
+ if (_typeof(classTypeTotalsItem) === 'object' && 'percentage' in classTypeTotalsItem) {
2337
+ classTypeTotalsItemObject.percentage = function () {
2338
+ if (typeof classTypeTotalsItem.percentage !== 'number') {
2339
+ return Number(classTypeTotalsItem.percentage);
2340
2340
  }
2341
2341
 
2342
- return classTypesItem.percentage;
2342
+ return classTypeTotalsItem.percentage;
2343
2343
  }();
2344
2344
  } else {
2345
- classTypesItemObject.percentage = 0;
2345
+ classTypeTotalsItemObject.percentage = 0;
2346
2346
  }
2347
2347
 
2348
- return classTypesItemObject;
2348
+ return classTypeTotalsItemObject;
2349
2349
  }();
2350
2350
  });
2351
2351
  }();
2352
2352
  } else {
2353
- resultObject.classTypes = [];
2353
+ resultObject.classTypeTotals = [];
2354
2354
  }
2355
2355
 
2356
2356
  return resultObject;
@@ -2693,7 +2693,7 @@ var _default = PackrunController;
2693
2693
  * @property {number} class1TraysPerBin The Number of Class 1 Trays per Bin for this Packrun
2694
2694
  * @property {number} class1AverageFruitSize The Average Class 1 Fruit Size for this Packrun
2695
2695
  * @property {number} class2TotalTrays The Total Class 2 Trays for this Packrun
2696
- * @property {Array<PackrunController.ClassTypePercentageItem>} classTypes An Array of Class Types and their Percentages for this Packrun
2696
+ * @property {Array<PackrunController.ClassTypePercentageItem>} classTypeTotals An Array of Class Types and their Percentages for this Packrun
2697
2697
  * @memberof Controllers.Packhouse.Site
2698
2698
  */
2699
2699
 
@@ -11,6 +11,8 @@ var _RTUModel = _interopRequireDefault(require("../Models/RTUModel"));
11
11
 
12
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
13
 
14
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
15
+
14
16
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
15
17
 
16
18
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
@@ -96,6 +98,104 @@ var RTUController = /*#__PURE__*/function () {
96
98
  });
97
99
  });
98
100
  }
101
+ /**
102
+ * Retrieve the Status of an RTU [GET /rtus/{id}/status]
103
+ *
104
+ * @static
105
+ * @public
106
+ * @param {number} id The RTU ID
107
+ * @return {Promise<RTUController.RTUStatusItem>}
108
+ */
109
+
110
+ }, {
111
+ key: "getOneStatus",
112
+ value: function getOneStatus(id) {
113
+ return new Promise(function (resolve, reject) {
114
+ _RequestHelper.default.getRequest("/rtus/".concat(id, "/status")).then(function (result) {
115
+ var resolveValue = function () {
116
+ var resultObject = {};
117
+
118
+ if (_typeof(result) === 'object' && 'id' in result) {
119
+ resultObject.id = function () {
120
+ if (typeof result.id !== 'number') {
121
+ return Number.isInteger(Number(result.id)) ? Number(result.id) : Math.floor(Number(result.id));
122
+ }
123
+
124
+ return Number.isInteger(result.id) ? result.id : Math.floor(result.id);
125
+ }();
126
+ } else {
127
+ resultObject.id = 0;
128
+ }
129
+
130
+ if (_typeof(result) === 'object' && 'latency' in result) {
131
+ resultObject.latency = function () {
132
+ if (result.latency === null) {
133
+ return null;
134
+ }
135
+
136
+ if (typeof result.latency !== 'number') {
137
+ return Number(result.latency);
138
+ }
139
+
140
+ return result.latency;
141
+ }();
142
+ } else {
143
+ resultObject.latency = null;
144
+ }
145
+
146
+ if (_typeof(result) === 'object' && 'latencyTimestamp' in result) {
147
+ resultObject.latencyTimestamp = function () {
148
+ if (result.latencyTimestamp === null) {
149
+ return null;
150
+ }
151
+
152
+ if (typeof result.latencyTimestamp !== 'string') {
153
+ return new Date(String(result.latencyTimestamp));
154
+ }
155
+
156
+ return new Date(result.latencyTimestamp);
157
+ }();
158
+ } else {
159
+ resultObject.latencyTimestamp = null;
160
+ }
161
+
162
+ if (_typeof(result) === 'object' && 'lastSeenTimestamp' in result) {
163
+ resultObject.lastSeenTimestamp = function () {
164
+ if (result.lastSeenTimestamp === null) {
165
+ return null;
166
+ }
167
+
168
+ if (typeof result.lastSeenTimestamp !== 'string') {
169
+ return new Date(String(result.lastSeenTimestamp));
170
+ }
171
+
172
+ return new Date(result.lastSeenTimestamp);
173
+ }();
174
+ } else {
175
+ resultObject.lastSeenTimestamp = null;
176
+ }
177
+
178
+ if (_typeof(result) === 'object' && 'onlineStatus' in result) {
179
+ resultObject.onlineStatus = function () {
180
+ if (typeof result.onlineStatus !== 'boolean') {
181
+ return Boolean(result.onlineStatus);
182
+ }
183
+
184
+ return result.onlineStatus;
185
+ }();
186
+ } else {
187
+ resultObject.onlineStatus = false;
188
+ }
189
+
190
+ return resultObject;
191
+ }();
192
+
193
+ resolve(resolveValue);
194
+ }).catch(function (error) {
195
+ return reject(error);
196
+ });
197
+ });
198
+ }
99
199
  /**
100
200
  * List all RTUs [GET /rtus]
101
201
  *
@@ -147,6 +247,115 @@ var RTUController = /*#__PURE__*/function () {
147
247
  return _RTUModel.default.fromJSON(result);
148
248
  }();
149
249
 
250
+ resolve(resolveValue);
251
+ }).catch(function (error) {
252
+ return reject(error);
253
+ });
254
+ });
255
+ }
256
+ /**
257
+ * Retrieve the Statuses of all RTUs [GET /rtus/statuses]
258
+ *
259
+ * An Array of Statuses for all RTUs
260
+ *
261
+ * @static
262
+ * @public
263
+ * @param {RTUController.GetAllStatusesQueryParameters} [queryParameters] The Optional Query Parameters
264
+ * @return {Promise<Array<RTUController.RTUStatusItem>>}
265
+ */
266
+
267
+ }, {
268
+ key: "getAllStatuses",
269
+ value: function getAllStatuses() {
270
+ var queryParameters = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
271
+ return new Promise(function (resolve, reject) {
272
+ _RequestHelper.default.getRequest("/rtus/statuses", queryParameters).then(function (result) {
273
+ var resolveValue = function () {
274
+ if (Array.isArray(result) !== true) {
275
+ return [];
276
+ }
277
+
278
+ return result.map(function (resultItem) {
279
+ return function () {
280
+ var resultItemObject = {};
281
+
282
+ if (_typeof(resultItem) === 'object' && 'id' in resultItem) {
283
+ resultItemObject.id = function () {
284
+ if (typeof resultItem.id !== 'number') {
285
+ return Number.isInteger(Number(resultItem.id)) ? Number(resultItem.id) : Math.floor(Number(resultItem.id));
286
+ }
287
+
288
+ return Number.isInteger(resultItem.id) ? resultItem.id : Math.floor(resultItem.id);
289
+ }();
290
+ } else {
291
+ resultItemObject.id = 0;
292
+ }
293
+
294
+ if (_typeof(resultItem) === 'object' && 'latency' in resultItem) {
295
+ resultItemObject.latency = function () {
296
+ if (resultItem.latency === null) {
297
+ return null;
298
+ }
299
+
300
+ if (typeof resultItem.latency !== 'number') {
301
+ return Number(resultItem.latency);
302
+ }
303
+
304
+ return resultItem.latency;
305
+ }();
306
+ } else {
307
+ resultItemObject.latency = null;
308
+ }
309
+
310
+ if (_typeof(resultItem) === 'object' && 'latencyTimestamp' in resultItem) {
311
+ resultItemObject.latencyTimestamp = function () {
312
+ if (resultItem.latencyTimestamp === null) {
313
+ return null;
314
+ }
315
+
316
+ if (typeof resultItem.latencyTimestamp !== 'string') {
317
+ return new Date(String(resultItem.latencyTimestamp));
318
+ }
319
+
320
+ return new Date(resultItem.latencyTimestamp);
321
+ }();
322
+ } else {
323
+ resultItemObject.latencyTimestamp = null;
324
+ }
325
+
326
+ if (_typeof(resultItem) === 'object' && 'lastSeenTimestamp' in resultItem) {
327
+ resultItemObject.lastSeenTimestamp = function () {
328
+ if (resultItem.lastSeenTimestamp === null) {
329
+ return null;
330
+ }
331
+
332
+ if (typeof resultItem.lastSeenTimestamp !== 'string') {
333
+ return new Date(String(resultItem.lastSeenTimestamp));
334
+ }
335
+
336
+ return new Date(resultItem.lastSeenTimestamp);
337
+ }();
338
+ } else {
339
+ resultItemObject.lastSeenTimestamp = null;
340
+ }
341
+
342
+ if (_typeof(resultItem) === 'object' && 'onlineStatus' in resultItem) {
343
+ resultItemObject.onlineStatus = function () {
344
+ if (typeof resultItem.onlineStatus !== 'boolean') {
345
+ return Boolean(resultItem.onlineStatus);
346
+ }
347
+
348
+ return resultItem.onlineStatus;
349
+ }();
350
+ } else {
351
+ resultItemObject.onlineStatus = false;
352
+ }
353
+
354
+ return resultItemObject;
355
+ }();
356
+ });
357
+ }();
358
+
150
359
  resolve(resolveValue);
151
360
  }).catch(function (error) {
152
361
  return reject(error);
@@ -169,6 +378,14 @@ var _default = RTUController;
169
378
  * @memberof Controllers
170
379
  */
171
380
 
381
+ /**
382
+ * The Optional Query Parameters for the getAllStatuses Function
383
+ *
384
+ * @typedef {Object} RTUController.GetAllStatusesQueryParameters
385
+ * @property {number[]} [rtuIds] A List of RTU IDs to Filter by
386
+ * @memberof Controllers
387
+ */
388
+
172
389
  /**
173
390
  * The Create Data for a RTU
174
391
  *
@@ -188,4 +405,16 @@ var _default = RTUController;
188
405
  * @memberof Controllers
189
406
  */
190
407
 
408
+ /**
409
+ * A **RTUStatusItem** Type
410
+ *
411
+ * @typedef {Object} RTUController.RTUStatusItem
412
+ * @property {number} id ID of the RTU
413
+ * @property {?number} latency Round-Trip Latency of the RTU represented in milliseconds
414
+ * @property {?Date} latencyTimestamp When the Latency was last Updated
415
+ * @property {?Date} lastSeenTimestamp When the Last Message was Received from the RTU
416
+ * @property {boolean} onlineStatus Whether the RTU is considered as Online
417
+ * @memberof Controllers
418
+ */
419
+
191
420
  exports.default = _default;
@@ -5,5 +5,5 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.version = void 0;
7
7
  // Generated by genversion.
8
- var version = '2.5.14';
8
+ var version = '2.5.16';
9
9
  exports.version = version;
package/lib/index.d.ts CHANGED
@@ -1281,6 +1281,15 @@ declare module '@ricado/api-client/Controllers/RTUController' {
1281
1281
  * @return {Promise<boolean>}
1282
1282
  */
1283
1283
  static delete(id: number): Promise<boolean>;
1284
+ /**
1285
+ * Retrieve the Status of an RTU [GET /rtus/{id}/status]
1286
+ *
1287
+ * @static
1288
+ * @public
1289
+ * @param {number} id The RTU ID
1290
+ * @return {Promise<RTUController.RTUStatusItem>}
1291
+ */
1292
+ static getOneStatus(id: number): Promise<RTUController.RTUStatusItem>;
1284
1293
  /**
1285
1294
  * List all RTUs [GET /rtus]
1286
1295
  *
@@ -1299,6 +1308,17 @@ declare module '@ricado/api-client/Controllers/RTUController' {
1299
1308
  * @return {Promise<RTUModel>}
1300
1309
  */
1301
1310
  static create(createData: RTUController.CreateData): Promise<RTUModel>;
1311
+ /**
1312
+ * Retrieve the Statuses of all RTUs [GET /rtus/statuses]
1313
+ *
1314
+ * An Array of Statuses for all RTUs
1315
+ *
1316
+ * @static
1317
+ * @public
1318
+ * @param {RTUController.GetAllStatusesQueryParameters} [queryParameters] The Optional Query Parameters
1319
+ * @return {Promise<Array<RTUController.RTUStatusItem>>}
1320
+ */
1321
+ static getAllStatuses(queryParameters?: RTUController.GetAllStatusesQueryParameters | undefined): Promise<Array<RTUController.RTUStatusItem>>;
1302
1322
  }
1303
1323
  namespace RTUController {
1304
1324
  /**
@@ -1318,6 +1338,15 @@ declare module '@ricado/api-client/Controllers/RTUController' {
1318
1338
  */
1319
1339
  enabled?: boolean | undefined;
1320
1340
  };
1341
+ /**
1342
+ * The Optional Query Parameters for the getAllStatuses Function
1343
+ */
1344
+ type GetAllStatusesQueryParameters = {
1345
+ /**
1346
+ * A List of RTU IDs to Filter by
1347
+ */
1348
+ rtuIds?: number[] | undefined;
1349
+ };
1321
1350
  /**
1322
1351
  * The Create Data for a RTU
1323
1352
  */
@@ -1348,6 +1377,31 @@ declare module '@ricado/api-client/Controllers/RTUController' {
1348
1377
  */
1349
1378
  enabled?: boolean | undefined;
1350
1379
  };
1380
+ /**
1381
+ * A **RTUStatusItem** Type
1382
+ */
1383
+ type RTUStatusItem = {
1384
+ /**
1385
+ * ID of the RTU
1386
+ */
1387
+ id: number;
1388
+ /**
1389
+ * Round-Trip Latency of the RTU represented in milliseconds
1390
+ */
1391
+ latency: number | null;
1392
+ /**
1393
+ * When the Latency was last Updated
1394
+ */
1395
+ latencyTimestamp: Date | null;
1396
+ /**
1397
+ * When the Last Message was Received from the RTU
1398
+ */
1399
+ lastSeenTimestamp: Date | null;
1400
+ /**
1401
+ * Whether the RTU is considered as Online
1402
+ */
1403
+ onlineStatus: boolean;
1404
+ };
1351
1405
  }
1352
1406
  import RTUModel from "@ricado/api-client/Models/RTUModel";
1353
1407
  }
@@ -17645,7 +17699,7 @@ declare module '@ricado/api-client/Controllers/Packhouse/Site/PackrunController'
17645
17699
  /**
17646
17700
  * An Array of Class Types and their Percentages for this Packrun
17647
17701
  */
17648
- classTypes: ClassTypePercentageItem[];
17702
+ classTypeTotals: ClassTypePercentageItem[];
17649
17703
  };
17650
17704
  /**
17651
17705
  * A **TimeBatch** Type
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ricado/api-client",
3
- "version": "2.5.14",
3
+ "version": "2.5.16",
4
4
  "description": "RICADO Gen 4 API Client Library for NodeJS and Browsers",
5
5
  "author": {
6
6
  "name": "Ash Neilson"
@@ -2908,74 +2908,74 @@ class PackrunController
2908
2908
  resultObject.class2TotalTrays = 0;
2909
2909
  }
2910
2910
 
2911
- if(typeof result === 'object' && 'classTypes' in result)
2911
+ if(typeof result === 'object' && 'classTypeTotals' in result)
2912
2912
  {
2913
- resultObject.classTypes = (function(){
2914
- if(Array.isArray(result.classTypes) !== true)
2913
+ resultObject.classTypeTotals = (function(){
2914
+ if(Array.isArray(result.classTypeTotals) !== true)
2915
2915
  {
2916
2916
  return [];
2917
2917
  }
2918
2918
 
2919
- return result.classTypes.map((classTypesItem) => {
2919
+ return result.classTypeTotals.map((classTypeTotalsItem) => {
2920
2920
  return (function(){
2921
- let classTypesItemObject = {};
2921
+ let classTypeTotalsItemObject = {};
2922
2922
 
2923
- if(typeof classTypesItem === 'object' && 'classType' in classTypesItem)
2923
+ if(typeof classTypeTotalsItem === 'object' && 'classType' in classTypeTotalsItem)
2924
2924
  {
2925
- classTypesItemObject.classType = (function(){
2926
- if(typeof classTypesItem.classType !== 'string')
2925
+ classTypeTotalsItemObject.classType = (function(){
2926
+ if(typeof classTypeTotalsItem.classType !== 'string')
2927
2927
  {
2928
- return String(classTypesItem.classType);
2928
+ return String(classTypeTotalsItem.classType);
2929
2929
  }
2930
2930
 
2931
- return classTypesItem.classType;
2931
+ return classTypeTotalsItem.classType;
2932
2932
  }());
2933
2933
  }
2934
2934
  else
2935
2935
  {
2936
- classTypesItemObject.classType = "";
2936
+ classTypeTotalsItemObject.classType = "";
2937
2937
  }
2938
2938
 
2939
- if(typeof classTypesItem === 'object' && 'name' in classTypesItem)
2939
+ if(typeof classTypeTotalsItem === 'object' && 'name' in classTypeTotalsItem)
2940
2940
  {
2941
- classTypesItemObject.name = (function(){
2942
- if(typeof classTypesItem.name !== 'string')
2941
+ classTypeTotalsItemObject.name = (function(){
2942
+ if(typeof classTypeTotalsItem.name !== 'string')
2943
2943
  {
2944
- return String(classTypesItem.name);
2944
+ return String(classTypeTotalsItem.name);
2945
2945
  }
2946
2946
 
2947
- return classTypesItem.name;
2947
+ return classTypeTotalsItem.name;
2948
2948
  }());
2949
2949
  }
2950
2950
  else
2951
2951
  {
2952
- classTypesItemObject.name = "";
2952
+ classTypeTotalsItemObject.name = "";
2953
2953
  }
2954
2954
 
2955
- if(typeof classTypesItem === 'object' && 'percentage' in classTypesItem)
2955
+ if(typeof classTypeTotalsItem === 'object' && 'percentage' in classTypeTotalsItem)
2956
2956
  {
2957
- classTypesItemObject.percentage = (function(){
2958
- if(typeof classTypesItem.percentage !== 'number')
2957
+ classTypeTotalsItemObject.percentage = (function(){
2958
+ if(typeof classTypeTotalsItem.percentage !== 'number')
2959
2959
  {
2960
- return Number(classTypesItem.percentage);
2960
+ return Number(classTypeTotalsItem.percentage);
2961
2961
  }
2962
2962
 
2963
- return classTypesItem.percentage;
2963
+ return classTypeTotalsItem.percentage;
2964
2964
  }());
2965
2965
  }
2966
2966
  else
2967
2967
  {
2968
- classTypesItemObject.percentage = 0;
2968
+ classTypeTotalsItemObject.percentage = 0;
2969
2969
  }
2970
2970
 
2971
- return classTypesItemObject;
2971
+ return classTypeTotalsItemObject;
2972
2972
  }());
2973
2973
  });
2974
2974
  }());
2975
2975
  }
2976
2976
  else
2977
2977
  {
2978
- resultObject.classTypes = [];
2978
+ resultObject.classTypeTotals = [];
2979
2979
  }
2980
2980
 
2981
2981
  return resultObject;
@@ -3313,7 +3313,7 @@ export default PackrunController;
3313
3313
  * @property {number} class1TraysPerBin The Number of Class 1 Trays per Bin for this Packrun
3314
3314
  * @property {number} class1AverageFruitSize The Average Class 1 Fruit Size for this Packrun
3315
3315
  * @property {number} class2TotalTrays The Total Class 2 Trays for this Packrun
3316
- * @property {Array<PackrunController.ClassTypePercentageItem>} classTypes An Array of Class Types and their Percentages for this Packrun
3316
+ * @property {Array<PackrunController.ClassTypePercentageItem>} classTypeTotals An Array of Class Types and their Percentages for this Packrun
3317
3317
  * @memberof Controllers.Packhouse.Site
3318
3318
  */
3319
3319