@ricado/api-client 2.1.0 → 2.3.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 (123) hide show
  1. package/README.md +5 -7
  2. package/dist/ricado.api.client.js +1 -1
  3. package/lib/Controllers/Packhouse/Site/BinTipBinController.js +622 -0
  4. package/lib/Controllers/Packhouse/Site/CompacSizerController.js +3 -3
  5. package/lib/Controllers/Packhouse/Site/FreshQualityPackrunSummaryController.js +657 -0
  6. package/lib/Controllers/Packhouse/Site/PackingLineController.js +25 -1
  7. package/lib/Controllers/Packhouse/Site/PackrunController.js +42 -0
  8. package/lib/Controllers/Packhouse/Site/RejectBinScaleController.js +24 -2
  9. package/lib/Controllers/Packhouse/Site/ShiftHourlyEntryController.js +15 -0
  10. package/lib/Controllers/Packhouse/Site/ShiftQualitySummaryController.js +661 -0
  11. package/lib/Controllers/Packhouse/Site/ShiftTaskController.js +628 -0
  12. package/lib/Controllers/Packhouse/Site/SoftSortBeltController.js +453 -0
  13. package/lib/Controllers/Packhouse/Site/index.js +15 -0
  14. package/lib/DataItems/PointValueItem.js +3 -3
  15. package/lib/Models/AccountPolicyModel.js +7 -7
  16. package/lib/Models/ApiAccountModel.js +7 -7
  17. package/lib/Models/CompanyModel.js +5 -5
  18. package/lib/Models/FirebaseTokenModel.js +8 -8
  19. package/lib/Models/Packhouse/Site/BinTipBinModel.js +367 -0
  20. package/lib/Models/Packhouse/Site/BinTipWeightModel.js +9 -9
  21. package/lib/Models/Packhouse/Site/CompacSizerBatchModel.js +8 -8
  22. package/lib/Models/Packhouse/Site/CompacSizerModel.js +15 -15
  23. package/lib/Models/Packhouse/Site/CompacSizerOutletProductChangeModel.js +10 -10
  24. package/lib/Models/Packhouse/Site/CompacSizerOutletTypeChangeModel.js +8 -8
  25. package/lib/Models/Packhouse/Site/CompacSizerOutletTypeModel.js +6 -6
  26. package/lib/Models/Packhouse/Site/CompacSizerPackrunSummaryModel.js +12 -12
  27. package/lib/Models/Packhouse/Site/DowntimeEventModel.js +14 -14
  28. package/lib/Models/Packhouse/Site/FreshPackPackrunSummaryModel.js +8 -8
  29. package/lib/Models/Packhouse/Site/FreshQualityPackrunSummaryModel.js +481 -0
  30. package/lib/Models/Packhouse/Site/GrowingMethodModel.js +6 -6
  31. package/lib/Models/Packhouse/Site/PackTypeModel.js +8 -8
  32. package/lib/Models/Packhouse/Site/PackingLineModel.js +539 -16
  33. package/lib/Models/Packhouse/Site/PackrunModel.js +81 -15
  34. package/lib/Models/Packhouse/Site/RejectBinModel.js +9 -9
  35. package/lib/Models/Packhouse/Site/RejectBinScaleModel.js +271 -15
  36. package/lib/Models/Packhouse/Site/RejectBinWeightModel.js +10 -10
  37. package/lib/Models/Packhouse/Site/ShiftFocusMeetingModel.js +12 -12
  38. package/lib/Models/Packhouse/Site/ShiftHourlyEntryModel.js +204 -38
  39. package/lib/Models/Packhouse/Site/ShiftModel.js +26 -19
  40. package/lib/Models/Packhouse/Site/ShiftQualitySummaryModel.js +599 -0
  41. package/lib/Models/Packhouse/Site/ShiftTaskModel.js +373 -0
  42. package/lib/Models/Packhouse/Site/SoftSortBeltModel.js +235 -0
  43. package/lib/Models/Packhouse/Site/VarietyModel.js +8 -8
  44. package/lib/Models/Packhouse/Site/index.js +15 -0
  45. package/lib/Models/RTUModel.js +6 -6
  46. package/lib/Models/RTUPluginModel.js +5 -5
  47. package/lib/Models/Site/AlarmGroupModel.js +7 -7
  48. package/lib/Models/Site/AlarmModel.js +17 -17
  49. package/lib/Models/Site/DefinitionModel.js +6 -6
  50. package/lib/Models/Site/PermanentObjectDataModel.js +8 -8
  51. package/lib/Models/Site/PermanentObjectModel.js +7 -7
  52. package/lib/Models/Site/PointModel.js +11 -11
  53. package/lib/Models/Site/TemporaryObjectModel.js +6 -6
  54. package/lib/Models/SiteModel.js +6 -6
  55. package/lib/Models/TokenModel.js +10 -10
  56. package/lib/Models/UserAccountActionTokenModel.js +11 -11
  57. package/lib/Models/UserAccountModel.js +10 -10
  58. package/lib/PackageVersion.js +1 -1
  59. package/lib/Points.js +22 -12
  60. package/lib/WebSocketHelper.js +29 -13
  61. package/lib/index.d.ts +3853 -1290
  62. package/lib/index.js +3 -3
  63. package/package.json +1 -1
  64. package/src/Controllers/Packhouse/Site/BinTipBinController.js +665 -0
  65. package/src/Controllers/Packhouse/Site/CompacSizerController.js +3 -3
  66. package/src/Controllers/Packhouse/Site/FreshQualityPackrunSummaryController.js +700 -0
  67. package/src/Controllers/Packhouse/Site/PackingLineController.js +25 -1
  68. package/src/Controllers/Packhouse/Site/PackrunController.js +52 -0
  69. package/src/Controllers/Packhouse/Site/RejectBinScaleController.js +24 -2
  70. package/src/Controllers/Packhouse/Site/ShiftHourlyEntryController.js +15 -0
  71. package/src/Controllers/Packhouse/Site/ShiftQualitySummaryController.js +704 -0
  72. package/src/Controllers/Packhouse/Site/ShiftTaskController.js +671 -0
  73. package/src/Controllers/Packhouse/Site/SoftSortBeltController.js +474 -0
  74. package/src/Controllers/Packhouse/Site/index.js +10 -0
  75. package/src/DataItems/PointValueItem.js +3 -3
  76. package/src/Models/AccountPolicyModel.js +7 -7
  77. package/src/Models/ApiAccountModel.js +7 -7
  78. package/src/Models/CompanyModel.js +5 -5
  79. package/src/Models/FirebaseTokenModel.js +8 -8
  80. package/src/Models/Packhouse/Site/BinTipBinModel.js +365 -0
  81. package/src/Models/Packhouse/Site/BinTipWeightModel.js +9 -9
  82. package/src/Models/Packhouse/Site/CompacSizerBatchModel.js +8 -8
  83. package/src/Models/Packhouse/Site/CompacSizerModel.js +15 -15
  84. package/src/Models/Packhouse/Site/CompacSizerOutletProductChangeModel.js +10 -10
  85. package/src/Models/Packhouse/Site/CompacSizerOutletTypeChangeModel.js +8 -8
  86. package/src/Models/Packhouse/Site/CompacSizerOutletTypeModel.js +6 -6
  87. package/src/Models/Packhouse/Site/CompacSizerPackrunSummaryModel.js +12 -12
  88. package/src/Models/Packhouse/Site/DowntimeEventModel.js +14 -14
  89. package/src/Models/Packhouse/Site/FreshPackPackrunSummaryModel.js +8 -8
  90. package/src/Models/Packhouse/Site/FreshQualityPackrunSummaryModel.js +523 -0
  91. package/src/Models/Packhouse/Site/GrowingMethodModel.js +6 -6
  92. package/src/Models/Packhouse/Site/PackTypeModel.js +8 -8
  93. package/src/Models/Packhouse/Site/PackingLineModel.js +720 -16
  94. package/src/Models/Packhouse/Site/PackrunModel.js +90 -15
  95. package/src/Models/Packhouse/Site/RejectBinModel.js +9 -9
  96. package/src/Models/Packhouse/Site/RejectBinScaleModel.js +308 -15
  97. package/src/Models/Packhouse/Site/RejectBinWeightModel.js +10 -10
  98. package/src/Models/Packhouse/Site/ShiftFocusMeetingModel.js +12 -12
  99. package/src/Models/Packhouse/Site/ShiftHourlyEntryModel.js +229 -38
  100. package/src/Models/Packhouse/Site/ShiftModel.js +29 -19
  101. package/src/Models/Packhouse/Site/ShiftQualitySummaryModel.js +664 -0
  102. package/src/Models/Packhouse/Site/ShiftTaskModel.js +369 -0
  103. package/src/Models/Packhouse/Site/SoftSortBeltModel.js +215 -0
  104. package/src/Models/Packhouse/Site/VarietyModel.js +8 -8
  105. package/src/Models/Packhouse/Site/index.js +10 -0
  106. package/src/Models/RTUModel.js +6 -6
  107. package/src/Models/RTUPluginModel.js +5 -5
  108. package/src/Models/Site/AlarmGroupModel.js +7 -7
  109. package/src/Models/Site/AlarmModel.js +17 -17
  110. package/src/Models/Site/DefinitionModel.js +6 -6
  111. package/src/Models/Site/PermanentObjectDataModel.js +8 -8
  112. package/src/Models/Site/PermanentObjectModel.js +7 -7
  113. package/src/Models/Site/PointModel.js +11 -11
  114. package/src/Models/Site/TemporaryObjectModel.js +6 -6
  115. package/src/Models/SiteModel.js +6 -6
  116. package/src/Models/TokenModel.js +10 -10
  117. package/src/Models/UserAccountActionTokenModel.js +11 -11
  118. package/src/Models/UserAccountModel.js +10 -10
  119. package/src/PackageVersion.js +1 -1
  120. package/src/Points.js +24 -12
  121. package/src/WebSocketHelper.js +34 -13
  122. package/src/index.js +3 -3
  123. package/types/tslint.json +2 -1
@@ -0,0 +1,700 @@
1
+ /**
2
+ * File Auto-Generated by the RICADO Gen 4 PHP API Project
3
+ *
4
+ * Do Not Edit this File Manually!
5
+ */
6
+
7
+ import RequestHelper from '../../../RequestHelper';
8
+ import FreshQualityPackrunSummaryModel from '../../../Models/Packhouse/Site/FreshQualityPackrunSummaryModel';
9
+
10
+ /**
11
+ * Controller Class for FreshQuality Packrun Summaries
12
+ *
13
+ * @class
14
+ */
15
+ class FreshQualityPackrunSummaryController
16
+ {
17
+ /**
18
+ * Retrieve a FreshQuality Packrun Summary [GET /packhouse/sites/{siteId}/freshquality-packrun-summaries/{id}]
19
+ *
20
+ * @static
21
+ * @public
22
+ * @param {number} siteId The Site ID
23
+ * @param {string} id The FreshQuality Packrun Summary ID
24
+ * @return {Promise<FreshQualityPackrunSummaryModel>}
25
+ */
26
+ static getOne(siteId, id)
27
+ {
28
+ return new Promise((resolve, reject) => {
29
+ RequestHelper.getRequest(`/packhouse/sites/${siteId}/freshquality-packrun-summaries/${id}`)
30
+ .then((result) => {
31
+ let resolveValue = (function(){
32
+ return FreshQualityPackrunSummaryModel.fromJSON(result, siteId);
33
+ }());
34
+
35
+ resolve(resolveValue);
36
+ })
37
+ .catch(error => reject(error));
38
+ });
39
+ }
40
+
41
+ /**
42
+ * Update a FreshQuality Packrun Summary [PATCH /packhouse/sites/{siteId}/freshquality-packrun-summaries/{id}]
43
+ *
44
+ * @static
45
+ * @public
46
+ * @param {number} siteId The Site ID
47
+ * @param {string} id The FreshQuality Packrun Summary ID
48
+ * @param {FreshQualityPackrunSummaryController.UpdateData} updateData The FreshQuality Packrun Summary Update Data
49
+ * @return {Promise<FreshQualityPackrunSummaryModel>}
50
+ */
51
+ static update(siteId, id, updateData)
52
+ {
53
+ return new Promise((resolve, reject) => {
54
+ RequestHelper.patchRequest(`/packhouse/sites/${siteId}/freshquality-packrun-summaries/${id}`, updateData)
55
+ .then((result) => {
56
+ let resolveValue = (function(){
57
+ return FreshQualityPackrunSummaryModel.fromJSON(result, siteId);
58
+ }());
59
+
60
+ resolve(resolveValue);
61
+ })
62
+ .catch(error => reject(error));
63
+ });
64
+ }
65
+
66
+ /**
67
+ * Delete a FreshQuality Packrun Summary [DELETE /packhouse/sites/{siteId}/freshquality-packrun-summaries/{id}]
68
+ *
69
+ * @static
70
+ * @public
71
+ * @param {number} siteId The Site ID
72
+ * @param {string} id The FreshQuality Packrun Summary ID
73
+ * @return {Promise<boolean>}
74
+ */
75
+ static delete(siteId, id)
76
+ {
77
+ return new Promise((resolve, reject) => {
78
+ RequestHelper.deleteRequest(`/packhouse/sites/${siteId}/freshquality-packrun-summaries/${id}`)
79
+ .then((result) => {
80
+ resolve(result ?? true);
81
+ })
82
+ .catch(error => reject(error));
83
+ });
84
+ }
85
+
86
+ /**
87
+ * Retrieve Comments [GET /packhouse/sites/{siteId}/freshquality-packrun-summaries/{id}/comments]
88
+ *
89
+ * Retrieves Comments for a FreshQuality Packrun Summary
90
+ *
91
+ * @static
92
+ * @public
93
+ * @param {number} siteId The Site ID
94
+ * @param {string} id The FreshQuality Packrun Summary ID
95
+ * @return {Promise<Array<FreshQualityPackrunSummaryController.CommentItem>>}
96
+ */
97
+ static getComments(siteId, id)
98
+ {
99
+ return new Promise((resolve, reject) => {
100
+ RequestHelper.getRequest(`/packhouse/sites/${siteId}/freshquality-packrun-summaries/${id}/comments`)
101
+ .then((result) => {
102
+ let resolveValue = (function(){
103
+ if(Array.isArray(result) !== true)
104
+ {
105
+ return [];
106
+ }
107
+
108
+ return result.map((resultItem) => {
109
+ return (function(){
110
+ let resultItemObject = {};
111
+
112
+ if(typeof resultItem === 'object' && 'id' in resultItem)
113
+ {
114
+ resultItemObject.id = (function(){
115
+ if(typeof resultItem.id !== 'string')
116
+ {
117
+ return String(resultItem.id);
118
+ }
119
+
120
+ return resultItem.id;
121
+ }());
122
+ }
123
+ else
124
+ {
125
+ resultItemObject.id = "";
126
+ }
127
+
128
+ if(typeof resultItem === 'object' && 'content' in resultItem)
129
+ {
130
+ resultItemObject.content = (function(){
131
+ if(resultItem.content === null)
132
+ {
133
+ return null;
134
+ }
135
+
136
+ if(typeof resultItem.content !== 'string')
137
+ {
138
+ return String(resultItem.content);
139
+ }
140
+
141
+ return resultItem.content;
142
+ }());
143
+ }
144
+ else
145
+ {
146
+ resultItemObject.content = null;
147
+ }
148
+
149
+ if(typeof resultItem === 'object' && 'createdTimestamp' in resultItem)
150
+ {
151
+ resultItemObject.createdTimestamp = (function(){
152
+ if(resultItem.createdTimestamp === null)
153
+ {
154
+ return null;
155
+ }
156
+
157
+ if(typeof resultItem.createdTimestamp !== 'string')
158
+ {
159
+ return new Date(String(resultItem.createdTimestamp));
160
+ }
161
+
162
+ return new Date(resultItem.createdTimestamp);
163
+ }());
164
+ }
165
+ else
166
+ {
167
+ resultItemObject.createdTimestamp = null;
168
+ }
169
+
170
+ if(typeof resultItem === 'object' && 'updatedTimestamp' in resultItem)
171
+ {
172
+ resultItemObject.updatedTimestamp = (function(){
173
+ if(resultItem.updatedTimestamp === null)
174
+ {
175
+ return null;
176
+ }
177
+
178
+ if(typeof resultItem.updatedTimestamp !== 'string')
179
+ {
180
+ return new Date(String(resultItem.updatedTimestamp));
181
+ }
182
+
183
+ return new Date(resultItem.updatedTimestamp);
184
+ }());
185
+ }
186
+ else
187
+ {
188
+ resultItemObject.updatedTimestamp = null;
189
+ }
190
+
191
+ return resultItemObject;
192
+ }());
193
+ });
194
+ }());
195
+
196
+ resolve(resolveValue);
197
+ })
198
+ .catch(error => reject(error));
199
+ });
200
+ }
201
+
202
+ /**
203
+ * Create a Comment [POST /packhouse/sites/{siteId}/freshquality-packrun-summaries/{id}/comments]
204
+ *
205
+ * Create a Comment for a FreshQuality Packrun Summary
206
+ *
207
+ * @static
208
+ * @public
209
+ * @param {number} siteId The Site ID
210
+ * @param {string} id The FreshQuality Packrun Summary ID
211
+ * @param {string} content The Content of the New Comment
212
+ * @return {Promise<FreshQualityPackrunSummaryController.CommentItem>}
213
+ */
214
+ static createComment(siteId, id, content)
215
+ {
216
+ return new Promise((resolve, reject) => {
217
+ RequestHelper.postRequest(`/packhouse/sites/${siteId}/freshquality-packrun-summaries/${id}/comments`, {content})
218
+ .then((result) => {
219
+ let resolveValue = (function(){
220
+ let resultObject = {};
221
+
222
+ if(typeof result === 'object' && 'id' in result)
223
+ {
224
+ resultObject.id = (function(){
225
+ if(typeof result.id !== 'string')
226
+ {
227
+ return String(result.id);
228
+ }
229
+
230
+ return result.id;
231
+ }());
232
+ }
233
+ else
234
+ {
235
+ resultObject.id = "";
236
+ }
237
+
238
+ if(typeof result === 'object' && 'content' in result)
239
+ {
240
+ resultObject.content = (function(){
241
+ if(result.content === null)
242
+ {
243
+ return null;
244
+ }
245
+
246
+ if(typeof result.content !== 'string')
247
+ {
248
+ return String(result.content);
249
+ }
250
+
251
+ return result.content;
252
+ }());
253
+ }
254
+ else
255
+ {
256
+ resultObject.content = null;
257
+ }
258
+
259
+ if(typeof result === 'object' && 'createdTimestamp' in result)
260
+ {
261
+ resultObject.createdTimestamp = (function(){
262
+ if(result.createdTimestamp === null)
263
+ {
264
+ return null;
265
+ }
266
+
267
+ if(typeof result.createdTimestamp !== 'string')
268
+ {
269
+ return new Date(String(result.createdTimestamp));
270
+ }
271
+
272
+ return new Date(result.createdTimestamp);
273
+ }());
274
+ }
275
+ else
276
+ {
277
+ resultObject.createdTimestamp = null;
278
+ }
279
+
280
+ if(typeof result === 'object' && 'updatedTimestamp' in result)
281
+ {
282
+ resultObject.updatedTimestamp = (function(){
283
+ if(result.updatedTimestamp === null)
284
+ {
285
+ return null;
286
+ }
287
+
288
+ if(typeof result.updatedTimestamp !== 'string')
289
+ {
290
+ return new Date(String(result.updatedTimestamp));
291
+ }
292
+
293
+ return new Date(result.updatedTimestamp);
294
+ }());
295
+ }
296
+ else
297
+ {
298
+ resultObject.updatedTimestamp = null;
299
+ }
300
+
301
+ return resultObject;
302
+ }());
303
+
304
+ resolve(resolveValue);
305
+ })
306
+ .catch(error => reject(error));
307
+ });
308
+ }
309
+
310
+ /**
311
+ * Retrieve a Comment [GET /packhouse/sites/{siteId}/freshquality-packrun-summaries/{id}/comments/{commentId}]
312
+ *
313
+ * Retrieves Comments for a FreshQuality Packrun Summary
314
+ *
315
+ * @static
316
+ * @public
317
+ * @param {number} siteId The Site ID
318
+ * @param {string} id The FreshQuality Packrun Summary ID
319
+ * @param {string} commentId The Comment ID
320
+ * @return {Promise<FreshQualityPackrunSummaryController.CommentItem>}
321
+ */
322
+ static getOneComment(siteId, id, commentId)
323
+ {
324
+ return new Promise((resolve, reject) => {
325
+ RequestHelper.getRequest(`/packhouse/sites/${siteId}/freshquality-packrun-summaries/${id}/comments/${commentId}`)
326
+ .then((result) => {
327
+ let resolveValue = (function(){
328
+ let resultObject = {};
329
+
330
+ if(typeof result === 'object' && 'id' in result)
331
+ {
332
+ resultObject.id = (function(){
333
+ if(typeof result.id !== 'string')
334
+ {
335
+ return String(result.id);
336
+ }
337
+
338
+ return result.id;
339
+ }());
340
+ }
341
+ else
342
+ {
343
+ resultObject.id = "";
344
+ }
345
+
346
+ if(typeof result === 'object' && 'content' in result)
347
+ {
348
+ resultObject.content = (function(){
349
+ if(result.content === null)
350
+ {
351
+ return null;
352
+ }
353
+
354
+ if(typeof result.content !== 'string')
355
+ {
356
+ return String(result.content);
357
+ }
358
+
359
+ return result.content;
360
+ }());
361
+ }
362
+ else
363
+ {
364
+ resultObject.content = null;
365
+ }
366
+
367
+ if(typeof result === 'object' && 'createdTimestamp' in result)
368
+ {
369
+ resultObject.createdTimestamp = (function(){
370
+ if(result.createdTimestamp === null)
371
+ {
372
+ return null;
373
+ }
374
+
375
+ if(typeof result.createdTimestamp !== 'string')
376
+ {
377
+ return new Date(String(result.createdTimestamp));
378
+ }
379
+
380
+ return new Date(result.createdTimestamp);
381
+ }());
382
+ }
383
+ else
384
+ {
385
+ resultObject.createdTimestamp = null;
386
+ }
387
+
388
+ if(typeof result === 'object' && 'updatedTimestamp' in result)
389
+ {
390
+ resultObject.updatedTimestamp = (function(){
391
+ if(result.updatedTimestamp === null)
392
+ {
393
+ return null;
394
+ }
395
+
396
+ if(typeof result.updatedTimestamp !== 'string')
397
+ {
398
+ return new Date(String(result.updatedTimestamp));
399
+ }
400
+
401
+ return new Date(result.updatedTimestamp);
402
+ }());
403
+ }
404
+ else
405
+ {
406
+ resultObject.updatedTimestamp = null;
407
+ }
408
+
409
+ return resultObject;
410
+ }());
411
+
412
+ resolve(resolveValue);
413
+ })
414
+ .catch(error => reject(error));
415
+ });
416
+ }
417
+
418
+ /**
419
+ * Update a Comment [PATCH /packhouse/sites/{siteId}/freshquality-packrun-summaries/{id}/comments/{commentId}]
420
+ *
421
+ * Update a Comment for a FreshQuality Packrun Summary
422
+ *
423
+ * @static
424
+ * @public
425
+ * @param {number} siteId The Site ID
426
+ * @param {string} id The FreshQuality Packrun Summary ID
427
+ * @param {string} commentId The Comment ID
428
+ * @param {string} content The Updated Content for the Comment
429
+ * @return {Promise<FreshQualityPackrunSummaryController.CommentItem>}
430
+ */
431
+ static updateOneComment(siteId, id, commentId, content)
432
+ {
433
+ return new Promise((resolve, reject) => {
434
+ RequestHelper.patchRequest(`/packhouse/sites/${siteId}/freshquality-packrun-summaries/${id}/comments/${commentId}`, {content})
435
+ .then((result) => {
436
+ let resolveValue = (function(){
437
+ let resultObject = {};
438
+
439
+ if(typeof result === 'object' && 'id' in result)
440
+ {
441
+ resultObject.id = (function(){
442
+ if(typeof result.id !== 'string')
443
+ {
444
+ return String(result.id);
445
+ }
446
+
447
+ return result.id;
448
+ }());
449
+ }
450
+ else
451
+ {
452
+ resultObject.id = "";
453
+ }
454
+
455
+ if(typeof result === 'object' && 'content' in result)
456
+ {
457
+ resultObject.content = (function(){
458
+ if(result.content === null)
459
+ {
460
+ return null;
461
+ }
462
+
463
+ if(typeof result.content !== 'string')
464
+ {
465
+ return String(result.content);
466
+ }
467
+
468
+ return result.content;
469
+ }());
470
+ }
471
+ else
472
+ {
473
+ resultObject.content = null;
474
+ }
475
+
476
+ if(typeof result === 'object' && 'createdTimestamp' in result)
477
+ {
478
+ resultObject.createdTimestamp = (function(){
479
+ if(result.createdTimestamp === null)
480
+ {
481
+ return null;
482
+ }
483
+
484
+ if(typeof result.createdTimestamp !== 'string')
485
+ {
486
+ return new Date(String(result.createdTimestamp));
487
+ }
488
+
489
+ return new Date(result.createdTimestamp);
490
+ }());
491
+ }
492
+ else
493
+ {
494
+ resultObject.createdTimestamp = null;
495
+ }
496
+
497
+ if(typeof result === 'object' && 'updatedTimestamp' in result)
498
+ {
499
+ resultObject.updatedTimestamp = (function(){
500
+ if(result.updatedTimestamp === null)
501
+ {
502
+ return null;
503
+ }
504
+
505
+ if(typeof result.updatedTimestamp !== 'string')
506
+ {
507
+ return new Date(String(result.updatedTimestamp));
508
+ }
509
+
510
+ return new Date(result.updatedTimestamp);
511
+ }());
512
+ }
513
+ else
514
+ {
515
+ resultObject.updatedTimestamp = null;
516
+ }
517
+
518
+ return resultObject;
519
+ }());
520
+
521
+ resolve(resolveValue);
522
+ })
523
+ .catch(error => reject(error));
524
+ });
525
+ }
526
+
527
+ /**
528
+ * Delete a Comment [DELETE /packhouse/sites/{siteId}/freshquality-packrun-summaries/{id}/comments/{commentId}]
529
+ *
530
+ * Delete a Comment for a FreshQuality Packrun Summary
531
+ *
532
+ * @static
533
+ * @public
534
+ * @param {number} siteId The Site ID
535
+ * @param {string} id The FreshQuality Packrun Summary ID
536
+ * @param {string} commentId The Comment ID
537
+ * @return {Promise<boolean>}
538
+ */
539
+ static deleteOneComment(siteId, id, commentId)
540
+ {
541
+ return new Promise((resolve, reject) => {
542
+ RequestHelper.deleteRequest(`/packhouse/sites/${siteId}/freshquality-packrun-summaries/${id}/comments/${commentId}`)
543
+ .then((result) => {
544
+ resolve(result ?? true);
545
+ })
546
+ .catch(error => reject(error));
547
+ });
548
+ }
549
+
550
+ /**
551
+ * List all FreshQuality Packrun Summaries [GET /packhouse/sites/{siteId}/freshquality-packrun-summaries]
552
+ *
553
+ * @static
554
+ * @public
555
+ * @param {number} siteId The Site ID
556
+ * @param {FreshQualityPackrunSummaryController.GetAllQueryParameters} [queryParameters] The Optional Query Parameters
557
+ * @return {Promise<FreshQualityPackrunSummaryModel[]>}
558
+ */
559
+ static getAll(siteId, queryParameters = {})
560
+ {
561
+ return new Promise((resolve, reject) => {
562
+ RequestHelper.getRequest(`/packhouse/sites/${siteId}/freshquality-packrun-summaries`, queryParameters)
563
+ .then((result) => {
564
+ let resolveValue = (function(){
565
+ if(Array.isArray(result) !== true)
566
+ {
567
+ return [];
568
+ }
569
+
570
+ return result.map((resultItem) => {
571
+ return (function(){
572
+ return FreshQualityPackrunSummaryModel.fromJSON(resultItem, siteId);
573
+ }());
574
+ });
575
+ }());
576
+
577
+ resolve(resolveValue);
578
+ })
579
+ .catch(error => reject(error));
580
+ });
581
+ }
582
+
583
+ /**
584
+ * Create a FreshQuality Packrun Summary [POST /packhouse/sites/{siteId}/freshquality-packrun-summaries]
585
+ *
586
+ * @static
587
+ * @public
588
+ * @param {number} siteId The Site ID
589
+ * @param {FreshQualityPackrunSummaryController.CreateData} createData The FreshQuality Packrun Summary Create Data
590
+ * @return {Promise<FreshQualityPackrunSummaryModel>}
591
+ */
592
+ static create(siteId, createData)
593
+ {
594
+ return new Promise((resolve, reject) => {
595
+ RequestHelper.postRequest(`/packhouse/sites/${siteId}/freshquality-packrun-summaries`, createData)
596
+ .then((result) => {
597
+ let resolveValue = (function(){
598
+ return FreshQualityPackrunSummaryModel.fromJSON(result, siteId);
599
+ }());
600
+
601
+ resolve(resolveValue);
602
+ })
603
+ .catch(error => reject(error));
604
+ });
605
+ }
606
+ }
607
+
608
+ export default FreshQualityPackrunSummaryController;
609
+
610
+ /**
611
+ * The Optional Query Parameters for the getAll Function
612
+ *
613
+ * @typedef {Object} FreshQualityPackrunSummaryController.GetAllQueryParameters
614
+ * @property {string} [packingLineId] The Packing Line ID this Summary is associated with
615
+ * @property {string} [packrunId] The Packrun ID this Summary is associated with
616
+ * @property {?string} [timeBatchId] The Time Batch this Summary is associated with
617
+ * @property {Date} [createdTimestampBegin] Filter by the Timestamp when this FreshQuality Packrun Summary was Created. Results Greater than or Equal to Timestamp
618
+ * @property {Date} [createdTimestampEnd] Filter by the Timestamp when this FreshQuality Packrun Summary was Created. Results Less than or Equal to Timestamp
619
+ * @memberof Controllers.Packhouse.Site
620
+ */
621
+
622
+ /**
623
+ * The Create Data for a FreshQuality Packrun Summary
624
+ *
625
+ * @typedef {Object} FreshQualityPackrunSummaryController.CreateData
626
+ * @property {string} packingLineId The Packing Line ID this Summary is associated with
627
+ * @property {string} [packrunId] The Packrun ID this Summary is associated with
628
+ * @property {Date} [createdTimestamp] When this Summary was Created
629
+ * @property {?string} [timeBatchId] The Time Batch this Summary is associated with
630
+ * @property {Array<FreshQualityPackrunSummaryController.Sample>} [class1R600Samples] An Array of Class 1 R600 Samples
631
+ * @property {Array<FreshQualityPackrunSummaryController.CategorySummary>} [categorySummaries] An Array of Defect Category Summaries (e.g. Minor Packing Defects, Softs)
632
+ * @property {number} [totalFruitSampled] The Total Number of Fruit Sampled in this Packrun Summary
633
+ * @memberof Controllers.Packhouse.Site
634
+ */
635
+
636
+ /**
637
+ * The Update Data for a FreshQuality Packrun Summary
638
+ *
639
+ * @typedef {Object} FreshQualityPackrunSummaryController.UpdateData
640
+ * @property {string} [packingLineId] The Packing Line ID this Summary is associated with
641
+ * @property {Date} [createdTimestamp] When this Summary was Created
642
+ * @property {?string} [timeBatchId] The Time Batch this Summary is associated with
643
+ * @property {Array<FreshQualityPackrunSummaryController.Sample>} [class1R600Samples] An Array of Class 1 R600 Samples
644
+ * @property {Array<FreshQualityPackrunSummaryController.CategorySummary>} [categorySummaries] An Array of Defect Category Summaries (e.g. Minor Packing Defects, Softs)
645
+ * @property {number} [totalFruitSampled] The Total Number of Fruit Sampled in this Packrun Summary
646
+ * @memberof Controllers.Packhouse.Site
647
+ */
648
+
649
+ /**
650
+ * A **CommentItem** Type
651
+ *
652
+ * @typedef {Object} FreshQualityPackrunSummaryController.CommentItem
653
+ * @property {string} id The Comment ID
654
+ * @property {?string} content The Content of the Comment
655
+ * @property {?Date} createdTimestamp When the Comment was Created
656
+ * @property {?Date} updatedTimestamp When the Comment was last Updated
657
+ * @memberof Controllers.Packhouse.Site
658
+ */
659
+
660
+ /**
661
+ * A **SampleDefect** Type
662
+ *
663
+ * @typedef {Object} FreshQualityPackrunSummaryController.SampleDefect
664
+ * @property {string} name The Defect Name
665
+ * @property {string} group The Defect Group
666
+ * @property {number} fruitCount The Number of Fruit with this Defect
667
+ * @memberof Controllers.Packhouse.Site
668
+ */
669
+
670
+ /**
671
+ * A **Sample** Type
672
+ *
673
+ * @typedef {Object} FreshQualityPackrunSummaryController.Sample
674
+ * @property {string} fruitSize The Fruit Size for this Sample
675
+ * @property {string} packType The Pack Type for this Sample
676
+ * @property {Date} timestamp When this Sample was taken
677
+ * @property {number} fruitCount The Total Number of Fruit Sampled
678
+ * @property {Array<FreshQualityPackrunSummaryController.SampleDefect>} defects An Array of Defects found in this Sample
679
+ * @memberof Controllers.Packhouse.Site
680
+ */
681
+
682
+ /**
683
+ * A **CategorySummaryDefect** Type
684
+ *
685
+ * @typedef {Object} FreshQualityPackrunSummaryController.CategorySummaryDefect
686
+ * @property {string} name The Defect Name
687
+ * @property {number} fruitCount The Number of Fruit with this Defect
688
+ * @property {number} percentage The Percentage of Fruit with this Defect
689
+ * @memberof Controllers.Packhouse.Site
690
+ */
691
+
692
+ /**
693
+ * A **CategorySummary** Type
694
+ *
695
+ * @typedef {Object} FreshQualityPackrunSummaryController.CategorySummary
696
+ * @property {string} name The Category Name (e.g. Minor Packing Defects, Softs)
697
+ * @property {number} percentage The Percentage of all Fruit Sampled that have Defects in this Category
698
+ * @property {Array<FreshQualityPackrunSummaryController.CategorySummaryDefect>} defects An Array of Defects within this Category Summary
699
+ * @memberof Controllers.Packhouse.Site
700
+ */