@ricado/api-client 2.3.27 → 2.4.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.
Files changed (59) hide show
  1. package/dist/ricado.api.client.js +1 -1
  2. package/lib/Controllers/Lab/Site/DehydratorController.js +198 -0
  3. package/lib/Controllers/Lab/Site/FruitProfileController.js +204 -0
  4. package/lib/Controllers/Lab/Site/LabController.js +222 -0
  5. package/lib/Controllers/Lab/Site/RackController.js +222 -0
  6. package/lib/Controllers/Lab/Site/RackPositionController.js +207 -0
  7. package/lib/Controllers/Lab/Site/SampleController.js +927 -0
  8. package/lib/Controllers/Lab/Site/SampleFailureReasonController.js +192 -0
  9. package/lib/Controllers/Lab/Site/SampleResultController.js +905 -0
  10. package/lib/Controllers/Lab/Site/index.js +46 -0
  11. package/lib/Controllers/Lab/index.js +25 -0
  12. package/lib/Controllers/Packhouse/Site/CompacSizerController.js +2 -2
  13. package/lib/Controllers/Packhouse/Site/MAFSizerController.js +2 -2
  14. package/lib/Controllers/Packhouse/Site/ShiftController.js +304 -0
  15. package/lib/Controllers/index.js +9 -6
  16. package/lib/Models/Lab/Site/DehydratorModel.js +250 -0
  17. package/lib/Models/Lab/Site/FruitProfileModel.js +303 -0
  18. package/lib/Models/Lab/Site/LabModel.js +365 -0
  19. package/lib/Models/Lab/Site/RackModel.js +358 -0
  20. package/lib/Models/Lab/Site/RackPositionModel.js +525 -0
  21. package/lib/Models/Lab/Site/SampleFailureReasonModel.js +195 -0
  22. package/lib/Models/Lab/Site/SampleModel.js +545 -0
  23. package/lib/Models/Lab/Site/SampleResultModel.js +545 -0
  24. package/lib/Models/Lab/Site/index.js +46 -0
  25. package/lib/Models/Lab/index.js +25 -0
  26. package/lib/Models/Packhouse/Site/CompacSizerModel.js +18 -1
  27. package/lib/Models/Packhouse/Site/MAFSizerModel.js +18 -1
  28. package/lib/Models/index.js +7 -4
  29. package/lib/PackageVersion.js +1 -1
  30. package/lib/index.d.ts +10491 -7674
  31. package/package.json +1 -1
  32. package/src/Controllers/Lab/Site/DehydratorController.js +175 -0
  33. package/src/Controllers/Lab/Site/FruitProfileController.js +181 -0
  34. package/src/Controllers/Lab/Site/LabController.js +199 -0
  35. package/src/Controllers/Lab/Site/RackController.js +199 -0
  36. package/src/Controllers/Lab/Site/RackPositionController.js +184 -0
  37. package/src/Controllers/Lab/Site/SampleController.js +1067 -0
  38. package/src/Controllers/Lab/Site/SampleFailureReasonController.js +169 -0
  39. package/src/Controllers/Lab/Site/SampleResultController.js +1036 -0
  40. package/src/Controllers/Lab/Site/index.js +30 -0
  41. package/src/Controllers/Lab/index.js +16 -0
  42. package/src/Controllers/Packhouse/Site/CompacSizerController.js +2 -2
  43. package/src/Controllers/Packhouse/Site/MAFSizerController.js +2 -2
  44. package/src/Controllers/Packhouse/Site/ShiftController.js +367 -0
  45. package/src/Controllers/index.js +2 -0
  46. package/src/Models/Lab/Site/DehydratorModel.js +234 -0
  47. package/src/Models/Lab/Site/FruitProfileModel.js +290 -0
  48. package/src/Models/Lab/Site/LabModel.js +372 -0
  49. package/src/Models/Lab/Site/RackModel.js +358 -0
  50. package/src/Models/Lab/Site/RackPositionModel.js +600 -0
  51. package/src/Models/Lab/Site/SampleFailureReasonModel.js +170 -0
  52. package/src/Models/Lab/Site/SampleModel.js +565 -0
  53. package/src/Models/Lab/Site/SampleResultModel.js +565 -0
  54. package/src/Models/Lab/Site/index.js +30 -0
  55. package/src/Models/Lab/index.js +16 -0
  56. package/src/Models/Packhouse/Site/CompacSizerModel.js +24 -1
  57. package/src/Models/Packhouse/Site/MAFSizerModel.js +24 -1
  58. package/src/Models/index.js +2 -0
  59. package/src/PackageVersion.js +1 -1
@@ -0,0 +1,927 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _RequestHelper = _interopRequireDefault(require("../../../RequestHelper"));
9
+
10
+ var _SampleModel = _interopRequireDefault(require("../../../Models/Lab/Site/SampleModel"));
11
+
12
+ var _SampleResultModel = _interopRequireDefault(require("../../../Models/Lab/Site/SampleResultModel"));
13
+
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
+
16
+ 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); }
17
+
18
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
19
+
20
+ 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); } }
21
+
22
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
23
+
24
+ /**
25
+ * Controller Class for Samples
26
+ *
27
+ * @class
28
+ */
29
+ var SampleController = /*#__PURE__*/function () {
30
+ function SampleController() {
31
+ _classCallCheck(this, SampleController);
32
+ }
33
+
34
+ _createClass(SampleController, null, [{
35
+ key: "getTemperatureData",
36
+ value:
37
+ /**
38
+ * Retrieve Temperature Data [GET /lab/sites/{siteId}/samples/{id}]
39
+ *
40
+ * Retrieves Temperature Data for a Sample
41
+ *
42
+ * @static
43
+ * @public
44
+ * @param {number} siteId The Site ID
45
+ * @param {string} id The Sample ID
46
+ * @return {Promise<Array<SampleController.TemperatureDataItem>>}
47
+ */
48
+ function getTemperatureData(siteId, id) {
49
+ return new Promise(function (resolve, reject) {
50
+ _RequestHelper.default.getRequest("/lab/sites/".concat(siteId, "/samples/").concat(id)).then(function (result) {
51
+ var resolveValue = function () {
52
+ if (Array.isArray(result) !== true) {
53
+ return [];
54
+ }
55
+
56
+ return result.map(function (resultItem) {
57
+ return function () {
58
+ var resultItemObject = {};
59
+
60
+ if (_typeof(resultItem) === 'object' && 'timestamp' in resultItem) {
61
+ resultItemObject.timestamp = function () {
62
+ if (typeof resultItem.timestamp !== 'string') {
63
+ return new Date(String(resultItem.timestamp));
64
+ }
65
+
66
+ return new Date(resultItem.timestamp);
67
+ }();
68
+ } else {
69
+ resultItemObject.timestamp = new Date();
70
+ }
71
+
72
+ if (_typeof(resultItem) === 'object' && 'temperature' in resultItem) {
73
+ resultItemObject.temperature = function () {
74
+ if (typeof resultItem.temperature !== 'number') {
75
+ return Number(resultItem.temperature);
76
+ }
77
+
78
+ return resultItem.temperature;
79
+ }();
80
+ } else {
81
+ resultItemObject.temperature = 0;
82
+ }
83
+
84
+ return resultItemObject;
85
+ }();
86
+ });
87
+ }();
88
+
89
+ resolve(resolveValue);
90
+ }).catch(function (error) {
91
+ return reject(error);
92
+ });
93
+ });
94
+ }
95
+ /**
96
+ * Retrieve Comments [GET /lab/sites/{siteId}/samples/{id}/comments]
97
+ *
98
+ * Retrieves Comments for a Sample
99
+ *
100
+ * @static
101
+ * @public
102
+ * @param {number} siteId The Site ID
103
+ * @param {string} id The Sample ID
104
+ * @return {Promise<Array<SampleController.CommentItem>>}
105
+ */
106
+
107
+ }, {
108
+ key: "getComments",
109
+ value: function getComments(siteId, id) {
110
+ return new Promise(function (resolve, reject) {
111
+ _RequestHelper.default.getRequest("/lab/sites/".concat(siteId, "/samples/").concat(id, "/comments")).then(function (result) {
112
+ var resolveValue = function () {
113
+ if (Array.isArray(result) !== true) {
114
+ return [];
115
+ }
116
+
117
+ return result.map(function (resultItem) {
118
+ return function () {
119
+ var resultItemObject = {};
120
+
121
+ if (_typeof(resultItem) === 'object' && 'id' in resultItem) {
122
+ resultItemObject.id = function () {
123
+ if (typeof resultItem.id !== 'string') {
124
+ return String(resultItem.id);
125
+ }
126
+
127
+ return resultItem.id;
128
+ }();
129
+ } else {
130
+ resultItemObject.id = "";
131
+ }
132
+
133
+ if (_typeof(resultItem) === 'object' && 'userAccount' in resultItem) {
134
+ resultItemObject.userAccount = function () {
135
+ var userAccountObject = {};
136
+
137
+ if (_typeof(resultItem.userAccount) === 'object' && 'id' in resultItem.userAccount) {
138
+ userAccountObject.id = function () {
139
+ if (resultItem.userAccount.id === null) {
140
+ return null;
141
+ }
142
+
143
+ if (typeof resultItem.userAccount.id !== 'string') {
144
+ return String(resultItem.userAccount.id);
145
+ }
146
+
147
+ return resultItem.userAccount.id;
148
+ }();
149
+ } else {
150
+ userAccountObject.id = null;
151
+ }
152
+
153
+ if (_typeof(resultItem.userAccount) === 'object' && 'firstName' in resultItem.userAccount) {
154
+ userAccountObject.firstName = function () {
155
+ if (resultItem.userAccount.firstName === null) {
156
+ return null;
157
+ }
158
+
159
+ if (typeof resultItem.userAccount.firstName !== 'string') {
160
+ return String(resultItem.userAccount.firstName);
161
+ }
162
+
163
+ return resultItem.userAccount.firstName;
164
+ }();
165
+ } else {
166
+ userAccountObject.firstName = null;
167
+ }
168
+
169
+ if (_typeof(resultItem.userAccount) === 'object' && 'lastName' in resultItem.userAccount) {
170
+ userAccountObject.lastName = function () {
171
+ if (resultItem.userAccount.lastName === null) {
172
+ return null;
173
+ }
174
+
175
+ if (typeof resultItem.userAccount.lastName !== 'string') {
176
+ return String(resultItem.userAccount.lastName);
177
+ }
178
+
179
+ return resultItem.userAccount.lastName;
180
+ }();
181
+ } else {
182
+ userAccountObject.lastName = null;
183
+ }
184
+
185
+ return userAccountObject;
186
+ }();
187
+ } else {
188
+ resultItemObject.userAccount = function () {
189
+ var userAccountDefaultValue = {};
190
+ userAccountDefaultValue.id = null;
191
+ userAccountDefaultValue.firstName = null;
192
+ userAccountDefaultValue.lastName = null;
193
+ return userAccountDefaultValue;
194
+ }();
195
+ }
196
+
197
+ if (_typeof(resultItem) === 'object' && 'content' in resultItem) {
198
+ resultItemObject.content = function () {
199
+ if (resultItem.content === null) {
200
+ return null;
201
+ }
202
+
203
+ if (typeof resultItem.content !== 'string') {
204
+ return String(resultItem.content);
205
+ }
206
+
207
+ return resultItem.content;
208
+ }();
209
+ } else {
210
+ resultItemObject.content = null;
211
+ }
212
+
213
+ if (_typeof(resultItem) === 'object' && 'createdTimestamp' in resultItem) {
214
+ resultItemObject.createdTimestamp = function () {
215
+ if (resultItem.createdTimestamp === null) {
216
+ return null;
217
+ }
218
+
219
+ if (typeof resultItem.createdTimestamp !== 'string') {
220
+ return new Date(String(resultItem.createdTimestamp));
221
+ }
222
+
223
+ return new Date(resultItem.createdTimestamp);
224
+ }();
225
+ } else {
226
+ resultItemObject.createdTimestamp = null;
227
+ }
228
+
229
+ if (_typeof(resultItem) === 'object' && 'updatedTimestamp' in resultItem) {
230
+ resultItemObject.updatedTimestamp = function () {
231
+ if (resultItem.updatedTimestamp === null) {
232
+ return null;
233
+ }
234
+
235
+ if (typeof resultItem.updatedTimestamp !== 'string') {
236
+ return new Date(String(resultItem.updatedTimestamp));
237
+ }
238
+
239
+ return new Date(resultItem.updatedTimestamp);
240
+ }();
241
+ } else {
242
+ resultItemObject.updatedTimestamp = null;
243
+ }
244
+
245
+ return resultItemObject;
246
+ }();
247
+ });
248
+ }();
249
+
250
+ resolve(resolveValue);
251
+ }).catch(function (error) {
252
+ return reject(error);
253
+ });
254
+ });
255
+ }
256
+ /**
257
+ * Create a Comment [POST /lab/sites/{siteId}/samples/{id}/comments]
258
+ *
259
+ * Create a Comment for a Sample
260
+ *
261
+ * @static
262
+ * @public
263
+ * @param {number} siteId The Site ID
264
+ * @param {string} id The Sample ID
265
+ * @param {string} content The Content of the New Comment
266
+ * @return {Promise<SampleController.CommentItem>}
267
+ */
268
+
269
+ }, {
270
+ key: "createComment",
271
+ value: function createComment(siteId, id, content) {
272
+ return new Promise(function (resolve, reject) {
273
+ _RequestHelper.default.postRequest("/lab/sites/".concat(siteId, "/samples/").concat(id, "/comments"), {
274
+ content: content
275
+ }).then(function (result) {
276
+ var resolveValue = function () {
277
+ var resultObject = {};
278
+
279
+ if (_typeof(result) === 'object' && 'id' in result) {
280
+ resultObject.id = function () {
281
+ if (typeof result.id !== 'string') {
282
+ return String(result.id);
283
+ }
284
+
285
+ return result.id;
286
+ }();
287
+ } else {
288
+ resultObject.id = "";
289
+ }
290
+
291
+ if (_typeof(result) === 'object' && 'userAccount' in result) {
292
+ resultObject.userAccount = function () {
293
+ var userAccountObject = {};
294
+
295
+ if (_typeof(result.userAccount) === 'object' && 'id' in result.userAccount) {
296
+ userAccountObject.id = function () {
297
+ if (result.userAccount.id === null) {
298
+ return null;
299
+ }
300
+
301
+ if (typeof result.userAccount.id !== 'string') {
302
+ return String(result.userAccount.id);
303
+ }
304
+
305
+ return result.userAccount.id;
306
+ }();
307
+ } else {
308
+ userAccountObject.id = null;
309
+ }
310
+
311
+ if (_typeof(result.userAccount) === 'object' && 'firstName' in result.userAccount) {
312
+ userAccountObject.firstName = function () {
313
+ if (result.userAccount.firstName === null) {
314
+ return null;
315
+ }
316
+
317
+ if (typeof result.userAccount.firstName !== 'string') {
318
+ return String(result.userAccount.firstName);
319
+ }
320
+
321
+ return result.userAccount.firstName;
322
+ }();
323
+ } else {
324
+ userAccountObject.firstName = null;
325
+ }
326
+
327
+ if (_typeof(result.userAccount) === 'object' && 'lastName' in result.userAccount) {
328
+ userAccountObject.lastName = function () {
329
+ if (result.userAccount.lastName === null) {
330
+ return null;
331
+ }
332
+
333
+ if (typeof result.userAccount.lastName !== 'string') {
334
+ return String(result.userAccount.lastName);
335
+ }
336
+
337
+ return result.userAccount.lastName;
338
+ }();
339
+ } else {
340
+ userAccountObject.lastName = null;
341
+ }
342
+
343
+ return userAccountObject;
344
+ }();
345
+ } else {
346
+ resultObject.userAccount = function () {
347
+ var userAccountDefaultValue = {};
348
+ userAccountDefaultValue.id = null;
349
+ userAccountDefaultValue.firstName = null;
350
+ userAccountDefaultValue.lastName = null;
351
+ return userAccountDefaultValue;
352
+ }();
353
+ }
354
+
355
+ if (_typeof(result) === 'object' && 'content' in result) {
356
+ resultObject.content = function () {
357
+ if (result.content === null) {
358
+ return null;
359
+ }
360
+
361
+ if (typeof result.content !== 'string') {
362
+ return String(result.content);
363
+ }
364
+
365
+ return result.content;
366
+ }();
367
+ } else {
368
+ resultObject.content = null;
369
+ }
370
+
371
+ if (_typeof(result) === 'object' && 'createdTimestamp' in result) {
372
+ resultObject.createdTimestamp = function () {
373
+ if (result.createdTimestamp === null) {
374
+ return null;
375
+ }
376
+
377
+ if (typeof result.createdTimestamp !== 'string') {
378
+ return new Date(String(result.createdTimestamp));
379
+ }
380
+
381
+ return new Date(result.createdTimestamp);
382
+ }();
383
+ } else {
384
+ resultObject.createdTimestamp = null;
385
+ }
386
+
387
+ if (_typeof(result) === 'object' && 'updatedTimestamp' in result) {
388
+ resultObject.updatedTimestamp = function () {
389
+ if (result.updatedTimestamp === null) {
390
+ return null;
391
+ }
392
+
393
+ if (typeof result.updatedTimestamp !== 'string') {
394
+ return new Date(String(result.updatedTimestamp));
395
+ }
396
+
397
+ return new Date(result.updatedTimestamp);
398
+ }();
399
+ } else {
400
+ resultObject.updatedTimestamp = null;
401
+ }
402
+
403
+ return resultObject;
404
+ }();
405
+
406
+ resolve(resolveValue);
407
+ }).catch(function (error) {
408
+ return reject(error);
409
+ });
410
+ });
411
+ }
412
+ /**
413
+ * Retrieve a Comment [GET /lab/sites/{siteId}/samples/{id}/comments/{commentId}]
414
+ *
415
+ * Retrieves Comments for a Sample
416
+ *
417
+ * @static
418
+ * @public
419
+ * @param {number} siteId The Site ID
420
+ * @param {string} id The Sample ID
421
+ * @param {string} commentId The Comment ID
422
+ * @return {Promise<SampleController.CommentItem>}
423
+ */
424
+
425
+ }, {
426
+ key: "getOneComment",
427
+ value: function getOneComment(siteId, id, commentId) {
428
+ return new Promise(function (resolve, reject) {
429
+ _RequestHelper.default.getRequest("/lab/sites/".concat(siteId, "/samples/").concat(id, "/comments/").concat(commentId)).then(function (result) {
430
+ var resolveValue = function () {
431
+ var resultObject = {};
432
+
433
+ if (_typeof(result) === 'object' && 'id' in result) {
434
+ resultObject.id = function () {
435
+ if (typeof result.id !== 'string') {
436
+ return String(result.id);
437
+ }
438
+
439
+ return result.id;
440
+ }();
441
+ } else {
442
+ resultObject.id = "";
443
+ }
444
+
445
+ if (_typeof(result) === 'object' && 'userAccount' in result) {
446
+ resultObject.userAccount = function () {
447
+ var userAccountObject = {};
448
+
449
+ if (_typeof(result.userAccount) === 'object' && 'id' in result.userAccount) {
450
+ userAccountObject.id = function () {
451
+ if (result.userAccount.id === null) {
452
+ return null;
453
+ }
454
+
455
+ if (typeof result.userAccount.id !== 'string') {
456
+ return String(result.userAccount.id);
457
+ }
458
+
459
+ return result.userAccount.id;
460
+ }();
461
+ } else {
462
+ userAccountObject.id = null;
463
+ }
464
+
465
+ if (_typeof(result.userAccount) === 'object' && 'firstName' in result.userAccount) {
466
+ userAccountObject.firstName = function () {
467
+ if (result.userAccount.firstName === null) {
468
+ return null;
469
+ }
470
+
471
+ if (typeof result.userAccount.firstName !== 'string') {
472
+ return String(result.userAccount.firstName);
473
+ }
474
+
475
+ return result.userAccount.firstName;
476
+ }();
477
+ } else {
478
+ userAccountObject.firstName = null;
479
+ }
480
+
481
+ if (_typeof(result.userAccount) === 'object' && 'lastName' in result.userAccount) {
482
+ userAccountObject.lastName = function () {
483
+ if (result.userAccount.lastName === null) {
484
+ return null;
485
+ }
486
+
487
+ if (typeof result.userAccount.lastName !== 'string') {
488
+ return String(result.userAccount.lastName);
489
+ }
490
+
491
+ return result.userAccount.lastName;
492
+ }();
493
+ } else {
494
+ userAccountObject.lastName = null;
495
+ }
496
+
497
+ return userAccountObject;
498
+ }();
499
+ } else {
500
+ resultObject.userAccount = function () {
501
+ var userAccountDefaultValue = {};
502
+ userAccountDefaultValue.id = null;
503
+ userAccountDefaultValue.firstName = null;
504
+ userAccountDefaultValue.lastName = null;
505
+ return userAccountDefaultValue;
506
+ }();
507
+ }
508
+
509
+ if (_typeof(result) === 'object' && 'content' in result) {
510
+ resultObject.content = function () {
511
+ if (result.content === null) {
512
+ return null;
513
+ }
514
+
515
+ if (typeof result.content !== 'string') {
516
+ return String(result.content);
517
+ }
518
+
519
+ return result.content;
520
+ }();
521
+ } else {
522
+ resultObject.content = null;
523
+ }
524
+
525
+ if (_typeof(result) === 'object' && 'createdTimestamp' in result) {
526
+ resultObject.createdTimestamp = function () {
527
+ if (result.createdTimestamp === null) {
528
+ return null;
529
+ }
530
+
531
+ if (typeof result.createdTimestamp !== 'string') {
532
+ return new Date(String(result.createdTimestamp));
533
+ }
534
+
535
+ return new Date(result.createdTimestamp);
536
+ }();
537
+ } else {
538
+ resultObject.createdTimestamp = null;
539
+ }
540
+
541
+ if (_typeof(result) === 'object' && 'updatedTimestamp' in result) {
542
+ resultObject.updatedTimestamp = function () {
543
+ if (result.updatedTimestamp === null) {
544
+ return null;
545
+ }
546
+
547
+ if (typeof result.updatedTimestamp !== 'string') {
548
+ return new Date(String(result.updatedTimestamp));
549
+ }
550
+
551
+ return new Date(result.updatedTimestamp);
552
+ }();
553
+ } else {
554
+ resultObject.updatedTimestamp = null;
555
+ }
556
+
557
+ return resultObject;
558
+ }();
559
+
560
+ resolve(resolveValue);
561
+ }).catch(function (error) {
562
+ return reject(error);
563
+ });
564
+ });
565
+ }
566
+ /**
567
+ * Update a Comment [PATCH /lab/sites/{siteId}/samples/{id}/comments/{commentId}]
568
+ *
569
+ * Update a Comment for a Sample
570
+ *
571
+ * @static
572
+ * @public
573
+ * @param {number} siteId The Site ID
574
+ * @param {string} id The Sample ID
575
+ * @param {string} commentId The Comment ID
576
+ * @param {string} content The Updated Content for the Comment
577
+ * @return {Promise<SampleController.CommentItem>}
578
+ */
579
+
580
+ }, {
581
+ key: "updateOneComment",
582
+ value: function updateOneComment(siteId, id, commentId, content) {
583
+ return new Promise(function (resolve, reject) {
584
+ _RequestHelper.default.patchRequest("/lab/sites/".concat(siteId, "/samples/").concat(id, "/comments/").concat(commentId), {
585
+ content: content
586
+ }).then(function (result) {
587
+ var resolveValue = function () {
588
+ var resultObject = {};
589
+
590
+ if (_typeof(result) === 'object' && 'id' in result) {
591
+ resultObject.id = function () {
592
+ if (typeof result.id !== 'string') {
593
+ return String(result.id);
594
+ }
595
+
596
+ return result.id;
597
+ }();
598
+ } else {
599
+ resultObject.id = "";
600
+ }
601
+
602
+ if (_typeof(result) === 'object' && 'userAccount' in result) {
603
+ resultObject.userAccount = function () {
604
+ var userAccountObject = {};
605
+
606
+ if (_typeof(result.userAccount) === 'object' && 'id' in result.userAccount) {
607
+ userAccountObject.id = function () {
608
+ if (result.userAccount.id === null) {
609
+ return null;
610
+ }
611
+
612
+ if (typeof result.userAccount.id !== 'string') {
613
+ return String(result.userAccount.id);
614
+ }
615
+
616
+ return result.userAccount.id;
617
+ }();
618
+ } else {
619
+ userAccountObject.id = null;
620
+ }
621
+
622
+ if (_typeof(result.userAccount) === 'object' && 'firstName' in result.userAccount) {
623
+ userAccountObject.firstName = function () {
624
+ if (result.userAccount.firstName === null) {
625
+ return null;
626
+ }
627
+
628
+ if (typeof result.userAccount.firstName !== 'string') {
629
+ return String(result.userAccount.firstName);
630
+ }
631
+
632
+ return result.userAccount.firstName;
633
+ }();
634
+ } else {
635
+ userAccountObject.firstName = null;
636
+ }
637
+
638
+ if (_typeof(result.userAccount) === 'object' && 'lastName' in result.userAccount) {
639
+ userAccountObject.lastName = function () {
640
+ if (result.userAccount.lastName === null) {
641
+ return null;
642
+ }
643
+
644
+ if (typeof result.userAccount.lastName !== 'string') {
645
+ return String(result.userAccount.lastName);
646
+ }
647
+
648
+ return result.userAccount.lastName;
649
+ }();
650
+ } else {
651
+ userAccountObject.lastName = null;
652
+ }
653
+
654
+ return userAccountObject;
655
+ }();
656
+ } else {
657
+ resultObject.userAccount = function () {
658
+ var userAccountDefaultValue = {};
659
+ userAccountDefaultValue.id = null;
660
+ userAccountDefaultValue.firstName = null;
661
+ userAccountDefaultValue.lastName = null;
662
+ return userAccountDefaultValue;
663
+ }();
664
+ }
665
+
666
+ if (_typeof(result) === 'object' && 'content' in result) {
667
+ resultObject.content = function () {
668
+ if (result.content === null) {
669
+ return null;
670
+ }
671
+
672
+ if (typeof result.content !== 'string') {
673
+ return String(result.content);
674
+ }
675
+
676
+ return result.content;
677
+ }();
678
+ } else {
679
+ resultObject.content = null;
680
+ }
681
+
682
+ if (_typeof(result) === 'object' && 'createdTimestamp' in result) {
683
+ resultObject.createdTimestamp = function () {
684
+ if (result.createdTimestamp === null) {
685
+ return null;
686
+ }
687
+
688
+ if (typeof result.createdTimestamp !== 'string') {
689
+ return new Date(String(result.createdTimestamp));
690
+ }
691
+
692
+ return new Date(result.createdTimestamp);
693
+ }();
694
+ } else {
695
+ resultObject.createdTimestamp = null;
696
+ }
697
+
698
+ if (_typeof(result) === 'object' && 'updatedTimestamp' in result) {
699
+ resultObject.updatedTimestamp = function () {
700
+ if (result.updatedTimestamp === null) {
701
+ return null;
702
+ }
703
+
704
+ if (typeof result.updatedTimestamp !== 'string') {
705
+ return new Date(String(result.updatedTimestamp));
706
+ }
707
+
708
+ return new Date(result.updatedTimestamp);
709
+ }();
710
+ } else {
711
+ resultObject.updatedTimestamp = null;
712
+ }
713
+
714
+ return resultObject;
715
+ }();
716
+
717
+ resolve(resolveValue);
718
+ }).catch(function (error) {
719
+ return reject(error);
720
+ });
721
+ });
722
+ }
723
+ /**
724
+ * Delete a Comment [DELETE /lab/sites/{siteId}/samples/{id}/comments/{commentId}]
725
+ *
726
+ * Delete a Comment for a Sample
727
+ *
728
+ * @static
729
+ * @public
730
+ * @param {number} siteId The Site ID
731
+ * @param {string} id The Sample ID
732
+ * @param {string} commentId The Comment ID
733
+ * @return {Promise<boolean>}
734
+ */
735
+
736
+ }, {
737
+ key: "deleteOneComment",
738
+ value: function deleteOneComment(siteId, id, commentId) {
739
+ return new Promise(function (resolve, reject) {
740
+ _RequestHelper.default.deleteRequest("/lab/sites/".concat(siteId, "/samples/").concat(id, "/comments/").concat(commentId)).then(function (result) {
741
+ resolve(result !== null && result !== void 0 ? result : true);
742
+ }).catch(function (error) {
743
+ return reject(error);
744
+ });
745
+ });
746
+ }
747
+ /**
748
+ * Retrieve a Sample Result [GET /lab/sites/{siteId}/samples/{id}/result]
749
+ *
750
+ * Retrieves a Sample Result for a Sample
751
+ *
752
+ * @static
753
+ * @public
754
+ * @param {number} siteId The Site ID
755
+ * @param {string} id The Sample ID
756
+ * @return {Promise<SampleResultModel>}
757
+ */
758
+
759
+ }, {
760
+ key: "getSampleResult",
761
+ value: function getSampleResult(siteId, id) {
762
+ return new Promise(function (resolve, reject) {
763
+ _RequestHelper.default.getRequest("/lab/sites/".concat(siteId, "/samples/").concat(id, "/result")).then(function (result) {
764
+ var resolveValue = function () {
765
+ return _SampleResultModel.default.fromJSON(result, siteId);
766
+ }();
767
+
768
+ resolve(resolveValue);
769
+ }).catch(function (error) {
770
+ return reject(error);
771
+ });
772
+ });
773
+ }
774
+ /**
775
+ * List all Samples [GET /lab/sites/{siteId}/samples]
776
+ *
777
+ * @static
778
+ * @public
779
+ * @param {number} siteId The Site ID
780
+ * @param {SampleController.GetAllQueryParameters} [queryParameters] The Optional Query Parameters
781
+ * @return {Promise<SampleModel[]>}
782
+ */
783
+
784
+ }, {
785
+ key: "getAll",
786
+ value: function getAll(siteId) {
787
+ var queryParameters = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
788
+ return new Promise(function (resolve, reject) {
789
+ _RequestHelper.default.getRequest("/lab/sites/".concat(siteId, "/samples"), queryParameters).then(function (result) {
790
+ var resolveValue = function () {
791
+ if (Array.isArray(result) !== true) {
792
+ return [];
793
+ }
794
+
795
+ return result.map(function (resultItem) {
796
+ return function () {
797
+ return _SampleModel.default.fromJSON(resultItem, siteId);
798
+ }();
799
+ });
800
+ }();
801
+
802
+ resolve(resolveValue);
803
+ }).catch(function (error) {
804
+ return reject(error);
805
+ });
806
+ });
807
+ }
808
+ /**
809
+ * Create a Sample [POST /lab/sites/{siteId}/samples]
810
+ *
811
+ * @static
812
+ * @public
813
+ * @param {number} siteId The Site ID
814
+ * @param {SampleController.CreateData} createData The Sample Create Data
815
+ * @return {Promise<SampleModel>}
816
+ */
817
+
818
+ }, {
819
+ key: "create",
820
+ value: function create(siteId, createData) {
821
+ return new Promise(function (resolve, reject) {
822
+ _RequestHelper.default.postRequest("/lab/sites/".concat(siteId, "/samples"), createData).then(function (result) {
823
+ var resolveValue = function () {
824
+ return _SampleModel.default.fromJSON(result, siteId);
825
+ }();
826
+
827
+ resolve(resolveValue);
828
+ }).catch(function (error) {
829
+ return reject(error);
830
+ });
831
+ });
832
+ }
833
+ }]);
834
+
835
+ return SampleController;
836
+ }();
837
+
838
+ var _default = SampleController;
839
+ /**
840
+ * The Optional Query Parameters for the getAll Function
841
+ *
842
+ * @typedef {Object} SampleController.GetAllQueryParameters
843
+ * @property {string} [labId] The Lab ID this Sample is associated with
844
+ * @property {string} [sampleNumber] The Numeric Sample Number
845
+ * @property {string} [createdSource] The Source that Created this Sample
846
+ * @property {?string} [createdUserId] ID of the User who Created this Sample. Only applies if the `createdSource` is 'System'
847
+ * @property {?string} [createdUserName] Name of the User who Created this Sample. Only applies if the `createdSource` is 'System'
848
+ * @property {?string} [publishUserId] ID of the User who Published this Sample
849
+ * @property {?string} [publishUserName] Name of the User who Published this Sample
850
+ * @property {string} [fruitProfileId] The Fruit Profile for this Sample
851
+ * @property {string} [rackPositionId] The Rack Position used for this Sample
852
+ * @property {string} [dehydratorId] The Dehydrator used for this Sample
853
+ * @property {?string} [outcome] The Outcome of this Sample
854
+ * @property {?string} [failureReasonId] A Sample Failure Reason ID if this Sample Failed
855
+ * @property {?string} [resultId] The Sample Result ID asociated with this Sample
856
+ * @property {Date} [createdTimestampBegin] Filter by the Timestamp when Samples were Created. Results Greater than or Equal to Timestamp
857
+ * @property {Date} [createdTimestampEnd] Filter by the Timestamp when Samples were Created. Results Less than or Equal to Timestamp
858
+ * @property {Date} [scheduledTimestampBegin] Filter by the Timestamp when Samples were Scheduled to Begin. Results Greater than or Equal to Timestamp
859
+ * @property {Date} [scheduledTimestampEnd] Filter by the Timestamp when Samples were Scheduled to Begin. Results Less than or Equal to Timestamp
860
+ * @property {Date} [startTimestampBegin] Filter by the Timestamp when Samples were Started. Results Greater than or Equal to Timestamp
861
+ * @property {Date} [startTimestampEnd] Filter by the Timestamp when Samples were Started. Results Less than or Equal to Timestamp
862
+ * @property {Date} [finishTimestampBegin] Filter by the Timestamp when Samples were Finished. Results Greater than or Equal to Timestamp
863
+ * @property {Date} [finishTimestampEnd] Filter by the Timestamp when Samples were Finished. Results Less than or Equal to Timestamp
864
+ * @property {Date} [publishTimestampBegin] Filter by the Timestamp when Samples were Published. Results Greater than or Equal to Timestamp
865
+ * @property {Date} [publishTimestampEnd] Filter by the Timestamp when Samples were Published. Results Less than or Equal to Timestamp
866
+ * @property {Date} [updateTimestampBegin] Filter by the Timestamp when Samples were last Updated. Results Greater than or Equal to Timestamp
867
+ * @property {Date} [updateTimestampEnd] Filter by the Timestamp when Samples were last Updated. Results Less than or Equal to Timestamp
868
+ * @memberof Controllers.Lab.Site
869
+ */
870
+
871
+ /**
872
+ * The Create Data for a Sample
873
+ *
874
+ * @typedef {Object} SampleController.CreateData
875
+ * @property {string} labId The Lab ID this Sample is associated with
876
+ * @property {string} [sampleNumber] The Numeric Sample Number
877
+ * @property {Date} [createdTimestamp] When this Sample was Created
878
+ * @property {string} createdSource The Source that Created this Sample
879
+ * @property {?string} [createdUserId] ID of the User who Created this Sample. Only applies if the `createdSource` is 'System'
880
+ * @property {?string} [createdUserName] Name of the User who Created this Sample. Only applies if the `createdSource` is 'System'
881
+ * @property {?Date} [scheduledTimestamp] Optional Scheduled Timestamp when this Sample should Begin
882
+ * @property {?Date} [startTimestamp] When this Sample was Started
883
+ * @property {?Date} [finishTimestamp] When this Sample was Finished
884
+ * @property {?Date} [publishTimestamp] When this Sample was Published
885
+ * @property {?string} [publishUserId] ID of the User who Published this Sample
886
+ * @property {?string} [publishUserName] Name of the User who Published this Sample
887
+ * @property {string} fruitProfileId The Fruit Profile for this Sample
888
+ * @property {string} rackPositionId The Rack Position used for this Sample
889
+ * @property {string} dehydratorId The Dehydrator used for this Sample
890
+ * @property {?string} [outcome] The Outcome of this Sample
891
+ * @property {?string} [failureReasonId] A Sample Failure Reason ID if this Sample Failed
892
+ * @property {?string} [resultId] The Sample Result ID asociated with this Sample
893
+ * @memberof Controllers.Lab.Site
894
+ */
895
+
896
+ /**
897
+ * A **TemperatureDataItem** Type
898
+ *
899
+ * @typedef {Object} SampleController.TemperatureDataItem
900
+ * @property {Date} timestamp The Timestamp for the Temperature Value
901
+ * @property {number} temperature The Temperature Value
902
+ * @memberof Controllers.Lab.Site
903
+ */
904
+
905
+ /**
906
+ * A **UserAccount** Type
907
+ *
908
+ * @typedef {Object} SampleController.UserAccount
909
+ * @property {?string} id The User Account ID
910
+ * @property {?string} firstName The User's First Name
911
+ * @property {?string} lastName The User's Last Name
912
+ * @memberof Controllers.Lab.Site
913
+ */
914
+
915
+ /**
916
+ * A **CommentItem** Type
917
+ *
918
+ * @typedef {Object} SampleController.CommentItem
919
+ * @property {string} id The Comment ID
920
+ * @property {SampleController.UserAccount} userAccount
921
+ * @property {?string} content The Content of the Comment
922
+ * @property {?Date} createdTimestamp When the Comment was Created
923
+ * @property {?Date} updatedTimestamp When the Comment was last Updated
924
+ * @memberof Controllers.Lab.Site
925
+ */
926
+
927
+ exports.default = _default;