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