@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.
- package/README.md +5 -7
- package/dist/ricado.api.client.js +1 -1
- package/lib/Controllers/Packhouse/Site/BinTipBinController.js +622 -0
- package/lib/Controllers/Packhouse/Site/CompacSizerController.js +3 -3
- package/lib/Controllers/Packhouse/Site/FreshQualityPackrunSummaryController.js +657 -0
- package/lib/Controllers/Packhouse/Site/PackingLineController.js +25 -1
- package/lib/Controllers/Packhouse/Site/PackrunController.js +42 -0
- package/lib/Controllers/Packhouse/Site/RejectBinScaleController.js +24 -2
- package/lib/Controllers/Packhouse/Site/ShiftHourlyEntryController.js +15 -0
- package/lib/Controllers/Packhouse/Site/ShiftQualitySummaryController.js +661 -0
- package/lib/Controllers/Packhouse/Site/ShiftTaskController.js +628 -0
- package/lib/Controllers/Packhouse/Site/SoftSortBeltController.js +453 -0
- package/lib/Controllers/Packhouse/Site/index.js +15 -0
- package/lib/DataItems/PointValueItem.js +3 -3
- package/lib/Models/AccountPolicyModel.js +7 -7
- package/lib/Models/ApiAccountModel.js +7 -7
- package/lib/Models/CompanyModel.js +5 -5
- package/lib/Models/FirebaseTokenModel.js +8 -8
- package/lib/Models/Packhouse/Site/BinTipBinModel.js +367 -0
- package/lib/Models/Packhouse/Site/BinTipWeightModel.js +9 -9
- package/lib/Models/Packhouse/Site/CompacSizerBatchModel.js +8 -8
- package/lib/Models/Packhouse/Site/CompacSizerModel.js +15 -15
- package/lib/Models/Packhouse/Site/CompacSizerOutletProductChangeModel.js +10 -10
- package/lib/Models/Packhouse/Site/CompacSizerOutletTypeChangeModel.js +8 -8
- package/lib/Models/Packhouse/Site/CompacSizerOutletTypeModel.js +6 -6
- package/lib/Models/Packhouse/Site/CompacSizerPackrunSummaryModel.js +12 -12
- package/lib/Models/Packhouse/Site/DowntimeEventModel.js +14 -14
- package/lib/Models/Packhouse/Site/FreshPackPackrunSummaryModel.js +8 -8
- package/lib/Models/Packhouse/Site/FreshQualityPackrunSummaryModel.js +481 -0
- package/lib/Models/Packhouse/Site/GrowingMethodModel.js +6 -6
- package/lib/Models/Packhouse/Site/PackTypeModel.js +8 -8
- package/lib/Models/Packhouse/Site/PackingLineModel.js +539 -16
- package/lib/Models/Packhouse/Site/PackrunModel.js +81 -15
- package/lib/Models/Packhouse/Site/RejectBinModel.js +9 -9
- package/lib/Models/Packhouse/Site/RejectBinScaleModel.js +271 -15
- package/lib/Models/Packhouse/Site/RejectBinWeightModel.js +10 -10
- package/lib/Models/Packhouse/Site/ShiftFocusMeetingModel.js +12 -12
- package/lib/Models/Packhouse/Site/ShiftHourlyEntryModel.js +204 -38
- package/lib/Models/Packhouse/Site/ShiftModel.js +26 -19
- package/lib/Models/Packhouse/Site/ShiftQualitySummaryModel.js +599 -0
- package/lib/Models/Packhouse/Site/ShiftTaskModel.js +373 -0
- package/lib/Models/Packhouse/Site/SoftSortBeltModel.js +235 -0
- package/lib/Models/Packhouse/Site/VarietyModel.js +8 -8
- package/lib/Models/Packhouse/Site/index.js +15 -0
- package/lib/Models/RTUModel.js +6 -6
- package/lib/Models/RTUPluginModel.js +5 -5
- package/lib/Models/Site/AlarmGroupModel.js +7 -7
- package/lib/Models/Site/AlarmModel.js +17 -17
- package/lib/Models/Site/DefinitionModel.js +6 -6
- package/lib/Models/Site/PermanentObjectDataModel.js +8 -8
- package/lib/Models/Site/PermanentObjectModel.js +7 -7
- package/lib/Models/Site/PointModel.js +11 -11
- package/lib/Models/Site/TemporaryObjectModel.js +6 -6
- package/lib/Models/SiteModel.js +6 -6
- package/lib/Models/TokenModel.js +10 -10
- package/lib/Models/UserAccountActionTokenModel.js +11 -11
- package/lib/Models/UserAccountModel.js +10 -10
- package/lib/PackageVersion.js +1 -1
- package/lib/Points.js +22 -12
- package/lib/WebSocketHelper.js +29 -13
- package/lib/index.d.ts +3853 -1290
- package/lib/index.js +3 -3
- package/package.json +1 -1
- package/src/Controllers/Packhouse/Site/BinTipBinController.js +665 -0
- package/src/Controllers/Packhouse/Site/CompacSizerController.js +3 -3
- package/src/Controllers/Packhouse/Site/FreshQualityPackrunSummaryController.js +700 -0
- package/src/Controllers/Packhouse/Site/PackingLineController.js +25 -1
- package/src/Controllers/Packhouse/Site/PackrunController.js +52 -0
- package/src/Controllers/Packhouse/Site/RejectBinScaleController.js +24 -2
- package/src/Controllers/Packhouse/Site/ShiftHourlyEntryController.js +15 -0
- package/src/Controllers/Packhouse/Site/ShiftQualitySummaryController.js +704 -0
- package/src/Controllers/Packhouse/Site/ShiftTaskController.js +671 -0
- package/src/Controllers/Packhouse/Site/SoftSortBeltController.js +474 -0
- package/src/Controllers/Packhouse/Site/index.js +10 -0
- package/src/DataItems/PointValueItem.js +3 -3
- package/src/Models/AccountPolicyModel.js +7 -7
- package/src/Models/ApiAccountModel.js +7 -7
- package/src/Models/CompanyModel.js +5 -5
- package/src/Models/FirebaseTokenModel.js +8 -8
- package/src/Models/Packhouse/Site/BinTipBinModel.js +365 -0
- package/src/Models/Packhouse/Site/BinTipWeightModel.js +9 -9
- package/src/Models/Packhouse/Site/CompacSizerBatchModel.js +8 -8
- package/src/Models/Packhouse/Site/CompacSizerModel.js +15 -15
- package/src/Models/Packhouse/Site/CompacSizerOutletProductChangeModel.js +10 -10
- package/src/Models/Packhouse/Site/CompacSizerOutletTypeChangeModel.js +8 -8
- package/src/Models/Packhouse/Site/CompacSizerOutletTypeModel.js +6 -6
- package/src/Models/Packhouse/Site/CompacSizerPackrunSummaryModel.js +12 -12
- package/src/Models/Packhouse/Site/DowntimeEventModel.js +14 -14
- package/src/Models/Packhouse/Site/FreshPackPackrunSummaryModel.js +8 -8
- package/src/Models/Packhouse/Site/FreshQualityPackrunSummaryModel.js +523 -0
- package/src/Models/Packhouse/Site/GrowingMethodModel.js +6 -6
- package/src/Models/Packhouse/Site/PackTypeModel.js +8 -8
- package/src/Models/Packhouse/Site/PackingLineModel.js +720 -16
- package/src/Models/Packhouse/Site/PackrunModel.js +90 -15
- package/src/Models/Packhouse/Site/RejectBinModel.js +9 -9
- package/src/Models/Packhouse/Site/RejectBinScaleModel.js +308 -15
- package/src/Models/Packhouse/Site/RejectBinWeightModel.js +10 -10
- package/src/Models/Packhouse/Site/ShiftFocusMeetingModel.js +12 -12
- package/src/Models/Packhouse/Site/ShiftHourlyEntryModel.js +229 -38
- package/src/Models/Packhouse/Site/ShiftModel.js +29 -19
- package/src/Models/Packhouse/Site/ShiftQualitySummaryModel.js +664 -0
- package/src/Models/Packhouse/Site/ShiftTaskModel.js +369 -0
- package/src/Models/Packhouse/Site/SoftSortBeltModel.js +215 -0
- package/src/Models/Packhouse/Site/VarietyModel.js +8 -8
- package/src/Models/Packhouse/Site/index.js +10 -0
- package/src/Models/RTUModel.js +6 -6
- package/src/Models/RTUPluginModel.js +5 -5
- package/src/Models/Site/AlarmGroupModel.js +7 -7
- package/src/Models/Site/AlarmModel.js +17 -17
- package/src/Models/Site/DefinitionModel.js +6 -6
- package/src/Models/Site/PermanentObjectDataModel.js +8 -8
- package/src/Models/Site/PermanentObjectModel.js +7 -7
- package/src/Models/Site/PointModel.js +11 -11
- package/src/Models/Site/TemporaryObjectModel.js +6 -6
- package/src/Models/SiteModel.js +6 -6
- package/src/Models/TokenModel.js +10 -10
- package/src/Models/UserAccountActionTokenModel.js +11 -11
- package/src/Models/UserAccountModel.js +10 -10
- package/src/PackageVersion.js +1 -1
- package/src/Points.js +24 -12
- package/src/WebSocketHelper.js +34 -13
- package/src/index.js +3 -3
- package/types/tslint.json +2 -1
package/lib/index.js
CHANGED
|
@@ -111,7 +111,7 @@ function isDefined(variable) {
|
|
|
111
111
|
* The JSON Web Token for all Authenticated API Calls
|
|
112
112
|
*
|
|
113
113
|
* @private
|
|
114
|
-
* @type {string}
|
|
114
|
+
* @type {string|undefined}
|
|
115
115
|
*/
|
|
116
116
|
|
|
117
117
|
|
|
@@ -516,13 +516,13 @@ function ping() {
|
|
|
516
516
|
}
|
|
517
517
|
/**
|
|
518
518
|
*
|
|
519
|
-
* @param {string} jwt The JWT Token
|
|
519
|
+
* @param {string|undefined} jwt The JWT Token
|
|
520
520
|
* @return {boolean}
|
|
521
521
|
*/
|
|
522
522
|
|
|
523
523
|
|
|
524
524
|
function isJwtValid(jwt) {
|
|
525
|
-
if (jwt === null || typeof jwt !== 'string') {
|
|
525
|
+
if (jwt === null || jwt === undefined || typeof jwt !== 'string') {
|
|
526
526
|
return false;
|
|
527
527
|
}
|
|
528
528
|
|
package/package.json
CHANGED
|
@@ -0,0 +1,665 @@
|
|
|
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 BinTipBinModel from '../../../Models/Packhouse/Site/BinTipBinModel';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Controller Class for Bin Tip Bins
|
|
12
|
+
*
|
|
13
|
+
* @class
|
|
14
|
+
*/
|
|
15
|
+
class BinTipBinController
|
|
16
|
+
{
|
|
17
|
+
/**
|
|
18
|
+
* Retrieve a Bin Tip Bin [GET /packhouse/sites/{siteId}/bin-tip-bins/{id}]
|
|
19
|
+
*
|
|
20
|
+
* @static
|
|
21
|
+
* @public
|
|
22
|
+
* @param {number} siteId The Site ID
|
|
23
|
+
* @param {string} id The Bin Tip Bin ID
|
|
24
|
+
* @return {Promise<BinTipBinModel>}
|
|
25
|
+
*/
|
|
26
|
+
static getOne(siteId, id)
|
|
27
|
+
{
|
|
28
|
+
return new Promise((resolve, reject) => {
|
|
29
|
+
RequestHelper.getRequest(`/packhouse/sites/${siteId}/bin-tip-bins/${id}`)
|
|
30
|
+
.then((result) => {
|
|
31
|
+
let resolveValue = (function(){
|
|
32
|
+
return BinTipBinModel.fromJSON(result, siteId);
|
|
33
|
+
}());
|
|
34
|
+
|
|
35
|
+
resolve(resolveValue);
|
|
36
|
+
})
|
|
37
|
+
.catch(error => reject(error));
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Update a Bin Tip Bin [PATCH /packhouse/sites/{siteId}/bin-tip-bins/{id}]
|
|
43
|
+
*
|
|
44
|
+
* @static
|
|
45
|
+
* @public
|
|
46
|
+
* @param {number} siteId The Site ID
|
|
47
|
+
* @param {string} id The Bin Tip Bin ID
|
|
48
|
+
* @param {BinTipBinController.UpdateData} updateData The Bin Tip Bin Update Data
|
|
49
|
+
* @return {Promise<BinTipBinModel>}
|
|
50
|
+
*/
|
|
51
|
+
static update(siteId, id, updateData)
|
|
52
|
+
{
|
|
53
|
+
return new Promise((resolve, reject) => {
|
|
54
|
+
RequestHelper.patchRequest(`/packhouse/sites/${siteId}/bin-tip-bins/${id}`, updateData)
|
|
55
|
+
.then((result) => {
|
|
56
|
+
let resolveValue = (function(){
|
|
57
|
+
return BinTipBinModel.fromJSON(result, siteId);
|
|
58
|
+
}());
|
|
59
|
+
|
|
60
|
+
resolve(resolveValue);
|
|
61
|
+
})
|
|
62
|
+
.catch(error => reject(error));
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Delete a Bin Tip Bin [DELETE /packhouse/sites/{siteId}/bin-tip-bins/{id}]
|
|
68
|
+
*
|
|
69
|
+
* @static
|
|
70
|
+
* @public
|
|
71
|
+
* @param {number} siteId The Site ID
|
|
72
|
+
* @param {string} id The Bin Tip Bin ID
|
|
73
|
+
* @return {Promise<boolean>}
|
|
74
|
+
*/
|
|
75
|
+
static delete(siteId, id)
|
|
76
|
+
{
|
|
77
|
+
return new Promise((resolve, reject) => {
|
|
78
|
+
RequestHelper.deleteRequest(`/packhouse/sites/${siteId}/bin-tip-bins/${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}/bin-tip-bins/{id}/comments]
|
|
88
|
+
*
|
|
89
|
+
* Retrieves Comments for a Bin Tip Bin
|
|
90
|
+
*
|
|
91
|
+
* @static
|
|
92
|
+
* @public
|
|
93
|
+
* @param {number} siteId The Site ID
|
|
94
|
+
* @param {string} id The Bin Tip Bin ID
|
|
95
|
+
* @return {Promise<Array<BinTipBinController.CommentItem>>}
|
|
96
|
+
*/
|
|
97
|
+
static getComments(siteId, id)
|
|
98
|
+
{
|
|
99
|
+
return new Promise((resolve, reject) => {
|
|
100
|
+
RequestHelper.getRequest(`/packhouse/sites/${siteId}/bin-tip-bins/${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}/bin-tip-bins/{id}/comments]
|
|
204
|
+
*
|
|
205
|
+
* Create a Comment for a Bin Tip Bin
|
|
206
|
+
*
|
|
207
|
+
* @static
|
|
208
|
+
* @public
|
|
209
|
+
* @param {number} siteId The Site ID
|
|
210
|
+
* @param {string} id The Bin Tip Bin ID
|
|
211
|
+
* @param {string} content The Content of the New Comment
|
|
212
|
+
* @return {Promise<BinTipBinController.CommentItem>}
|
|
213
|
+
*/
|
|
214
|
+
static createComment(siteId, id, content)
|
|
215
|
+
{
|
|
216
|
+
return new Promise((resolve, reject) => {
|
|
217
|
+
RequestHelper.postRequest(`/packhouse/sites/${siteId}/bin-tip-bins/${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}/bin-tip-bins/{id}/comments/{commentId}]
|
|
312
|
+
*
|
|
313
|
+
* Retrieves Comments for a Bin Tip Bin
|
|
314
|
+
*
|
|
315
|
+
* @static
|
|
316
|
+
* @public
|
|
317
|
+
* @param {number} siteId The Site ID
|
|
318
|
+
* @param {string} id The Bin Tip Bin ID
|
|
319
|
+
* @param {string} commentId The Comment ID
|
|
320
|
+
* @return {Promise<BinTipBinController.CommentItem>}
|
|
321
|
+
*/
|
|
322
|
+
static getOneComment(siteId, id, commentId)
|
|
323
|
+
{
|
|
324
|
+
return new Promise((resolve, reject) => {
|
|
325
|
+
RequestHelper.getRequest(`/packhouse/sites/${siteId}/bin-tip-bins/${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}/bin-tip-bins/{id}/comments/{commentId}]
|
|
420
|
+
*
|
|
421
|
+
* Update a Comment for a Bin Tip Bin
|
|
422
|
+
*
|
|
423
|
+
* @static
|
|
424
|
+
* @public
|
|
425
|
+
* @param {number} siteId The Site ID
|
|
426
|
+
* @param {string} id The Bin Tip Bin ID
|
|
427
|
+
* @param {string} commentId The Comment ID
|
|
428
|
+
* @param {string} content The Updated Content for the Comment
|
|
429
|
+
* @return {Promise<BinTipBinController.CommentItem>}
|
|
430
|
+
*/
|
|
431
|
+
static updateOneComment(siteId, id, commentId, content)
|
|
432
|
+
{
|
|
433
|
+
return new Promise((resolve, reject) => {
|
|
434
|
+
RequestHelper.patchRequest(`/packhouse/sites/${siteId}/bin-tip-bins/${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}/bin-tip-bins/{id}/comments/{commentId}]
|
|
529
|
+
*
|
|
530
|
+
* Delete a Comment for a Bin Tip Bin
|
|
531
|
+
*
|
|
532
|
+
* @static
|
|
533
|
+
* @public
|
|
534
|
+
* @param {number} siteId The Site ID
|
|
535
|
+
* @param {string} id The Bin Tip Bin 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}/bin-tip-bins/${id}/comments/${commentId}`)
|
|
543
|
+
.then((result) => {
|
|
544
|
+
resolve(result ?? true);
|
|
545
|
+
})
|
|
546
|
+
.catch(error => reject(error));
|
|
547
|
+
});
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
/**
|
|
551
|
+
* List all Bin Tip Bins [GET /packhouse/sites/{siteId}/bin-tip-bins]
|
|
552
|
+
*
|
|
553
|
+
* @static
|
|
554
|
+
* @public
|
|
555
|
+
* @param {number} siteId The Site ID
|
|
556
|
+
* @param {BinTipBinController.GetAllQueryParameters} [queryParameters] The Optional Query Parameters
|
|
557
|
+
* @return {Promise<BinTipBinModel[]>}
|
|
558
|
+
*/
|
|
559
|
+
static getAll(siteId, queryParameters = {})
|
|
560
|
+
{
|
|
561
|
+
return new Promise((resolve, reject) => {
|
|
562
|
+
RequestHelper.getRequest(`/packhouse/sites/${siteId}/bin-tip-bins`, 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 BinTipBinModel.fromJSON(resultItem, siteId);
|
|
573
|
+
}());
|
|
574
|
+
});
|
|
575
|
+
}());
|
|
576
|
+
|
|
577
|
+
resolve(resolveValue);
|
|
578
|
+
})
|
|
579
|
+
.catch(error => reject(error));
|
|
580
|
+
});
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
/**
|
|
584
|
+
* Create a Bin Tip Bin [POST /packhouse/sites/{siteId}/bin-tip-bins]
|
|
585
|
+
*
|
|
586
|
+
* @static
|
|
587
|
+
* @public
|
|
588
|
+
* @param {number} siteId The Site ID
|
|
589
|
+
* @param {BinTipBinController.CreateData} createData The Bin Tip Bin Create Data
|
|
590
|
+
* @return {Promise<BinTipBinModel>}
|
|
591
|
+
*/
|
|
592
|
+
static create(siteId, createData)
|
|
593
|
+
{
|
|
594
|
+
return new Promise((resolve, reject) => {
|
|
595
|
+
RequestHelper.postRequest(`/packhouse/sites/${siteId}/bin-tip-bins`, createData)
|
|
596
|
+
.then((result) => {
|
|
597
|
+
let resolveValue = (function(){
|
|
598
|
+
return BinTipBinModel.fromJSON(result, siteId);
|
|
599
|
+
}());
|
|
600
|
+
|
|
601
|
+
resolve(resolveValue);
|
|
602
|
+
})
|
|
603
|
+
.catch(error => reject(error));
|
|
604
|
+
});
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
export default BinTipBinController;
|
|
609
|
+
|
|
610
|
+
/**
|
|
611
|
+
* The Optional Query Parameters for the getAll Function
|
|
612
|
+
*
|
|
613
|
+
* @typedef {Object} BinTipBinController.GetAllQueryParameters
|
|
614
|
+
* @property {string} [binTipId] The Bin Tip ID associated with this Bin
|
|
615
|
+
* @property {string} [packrunId] The Packrun ID associated with this Bin
|
|
616
|
+
* @property {?string} [fullBinWeightId] The `BinTipWeight` ID as the Source for the Full Weight of this Bin
|
|
617
|
+
* @property {?string} [emptyBinWeightId] The `BinTipWeight` ID as the Source for the Empty Weight of this Bin
|
|
618
|
+
* @property {Date} [createdTimestampBegin] Filter by the Timestamp when this Bin was Created. Results Greater than or Equal to Timestamp
|
|
619
|
+
* @property {Date} [createdTimestampEnd] Filter by the Timestamp when this Bin was Created. Results Less than or Equal to Timestamp
|
|
620
|
+
* @memberof Controllers.Packhouse.Site
|
|
621
|
+
*/
|
|
622
|
+
|
|
623
|
+
/**
|
|
624
|
+
* The Create Data for a Bin Tip Bin
|
|
625
|
+
*
|
|
626
|
+
* @typedef {Object} BinTipBinController.CreateData
|
|
627
|
+
* @property {string} binTipId The Bin Tip ID associated with this Bin
|
|
628
|
+
* @property {string} [packrunId] The Packrun ID associated with this Bin
|
|
629
|
+
* @property {Date} [createdTimestamp] When this Bin was Created
|
|
630
|
+
* @property {?string} [binNumber] A 10-Digit Bin Number made up of a Bin Lot (4-Digits) and a Unique Number (6-Digits)
|
|
631
|
+
* @property {?string} [timeBatchId] The Time Batch ID associated with this Bin
|
|
632
|
+
* @property {?number} [fullWeight] The Full Weight for this Bin
|
|
633
|
+
* @property {?number} [emptyWeight] The Empty Weight for this Bin
|
|
634
|
+
* @property {?string} [fullBinWeightId] The `BinTipWeight` ID as the Source for the Full Weight of this Bin
|
|
635
|
+
* @property {?string} [emptyBinWeightId] The `BinTipWeight` ID as the Source for the Empty Weight of this Bin
|
|
636
|
+
* @property {?Object} [freshPackFieldBinWeightApi] The FreshPack Field Bin Weight API Data
|
|
637
|
+
* @memberof Controllers.Packhouse.Site
|
|
638
|
+
*/
|
|
639
|
+
|
|
640
|
+
/**
|
|
641
|
+
* The Update Data for a Bin Tip Bin
|
|
642
|
+
*
|
|
643
|
+
* @typedef {Object} BinTipBinController.UpdateData
|
|
644
|
+
* @property {string} [binTipId] The Bin Tip ID associated with this Bin
|
|
645
|
+
* @property {Date} [createdTimestamp] When this Bin was Created
|
|
646
|
+
* @property {?string} [binNumber] A 10-Digit Bin Number made up of a Bin Lot (4-Digits) and a Unique Number (6-Digits)
|
|
647
|
+
* @property {?string} [timeBatchId] The Time Batch ID associated with this Bin
|
|
648
|
+
* @property {?number} [fullWeight] The Full Weight for this Bin
|
|
649
|
+
* @property {?number} [emptyWeight] The Empty Weight for this Bin
|
|
650
|
+
* @property {?string} [fullBinWeightId] The `BinTipWeight` ID as the Source for the Full Weight of this Bin
|
|
651
|
+
* @property {?string} [emptyBinWeightId] The `BinTipWeight` ID as the Source for the Empty Weight of this Bin
|
|
652
|
+
* @property {?Object} [freshPackFieldBinWeightApi] The FreshPack Field Bin Weight API Data
|
|
653
|
+
* @memberof Controllers.Packhouse.Site
|
|
654
|
+
*/
|
|
655
|
+
|
|
656
|
+
/**
|
|
657
|
+
* A **CommentItem** Type
|
|
658
|
+
*
|
|
659
|
+
* @typedef {Object} BinTipBinController.CommentItem
|
|
660
|
+
* @property {string} id The Comment ID
|
|
661
|
+
* @property {?string} content The Content of the Comment
|
|
662
|
+
* @property {?Date} createdTimestamp When the Comment was Created
|
|
663
|
+
* @property {?Date} updatedTimestamp When the Comment was last Updated
|
|
664
|
+
* @memberof Controllers.Packhouse.Site
|
|
665
|
+
*/
|