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