@ricado/api-client 2.3.24 → 2.3.25

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.
@@ -32,6 +32,7 @@ import MAFSizerPackrunSummaryController from './MAFSizerPackrunSummaryController
32
32
  import PackTypeController from './PackTypeController';
33
33
  import PackingLineController from './PackingLineController';
34
34
  import PackrunController from './PackrunController';
35
+ import PrePackSampleController from './PrePackSampleController';
35
36
  import RejectBinController from './RejectBinController';
36
37
  import RejectBinScaleController from './RejectBinScaleController';
37
38
  import RejectBinWeightController from './RejectBinWeightController';
@@ -72,6 +73,7 @@ const Site = {
72
73
  PackTypeController,
73
74
  PackingLineController,
74
75
  PackrunController,
76
+ PrePackSampleController,
75
77
  RejectBinController,
76
78
  RejectBinScaleController,
77
79
  RejectBinWeightController,
@@ -0,0 +1,324 @@
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 BaseModel from '../../../Models/BaseModel';
8
+
9
+ /**
10
+ * Model Class for a Pre-Pack Sample
11
+ *
12
+ * @class
13
+ * @hideconstructor
14
+ * @extends BaseModel
15
+ */
16
+ class PrePackSampleModel extends BaseModel
17
+ {
18
+ /**
19
+ * PrePackSampleModel Constructor
20
+ *
21
+ * @protected
22
+ * @param {number} siteId The Site ID associated with this Pre-Pack Sample
23
+ */
24
+ constructor(siteId)
25
+ {
26
+ super();
27
+
28
+ /**
29
+ * The Pre-Pack Sample ID
30
+ *
31
+ * @type {string}
32
+ * @public
33
+ */
34
+ this.id = "";
35
+
36
+ /**
37
+ * The Packing Line ID this Sample is associated with
38
+ *
39
+ * @type {string}
40
+ * @public
41
+ */
42
+ this.packingLineId = "";
43
+
44
+ /**
45
+ * The Packrun ID this Sample is associated with
46
+ *
47
+ * @type {string}
48
+ * @public
49
+ */
50
+ this.packrunId = "";
51
+
52
+ /**
53
+ * When this Sample was Created
54
+ *
55
+ * @type {Date}
56
+ * @public
57
+ */
58
+ this.createdTimestamp = new Date();
59
+
60
+ /**
61
+ * The ID of the User who created this Pre-Pack Sample
62
+ *
63
+ * @type {string}
64
+ * @public
65
+ */
66
+ this.userId = "";
67
+
68
+ /**
69
+ * The Name of the User who created this Pre-Pack Sample
70
+ *
71
+ * @type {string}
72
+ * @public
73
+ */
74
+ this.userName = "";
75
+
76
+ /**
77
+ * An Array of Defects found in this Pre-Pack Sample
78
+ *
79
+ * @type {Array<{id: string, name: string, fruitCount: number}>}
80
+ * @public
81
+ */
82
+ this.sampleDefects = [];
83
+
84
+ /**
85
+ * The Total Number of Fruit Sampled in this Pre-Pack Sample
86
+ *
87
+ * @type {number}
88
+ * @public
89
+ */
90
+ this.totalFruitSampled = 0;
91
+
92
+ /**
93
+ * Whether the Pre-Pack Sample has been deleted
94
+ *
95
+ * @type {boolean}
96
+ * @public
97
+ */
98
+ this.deleted = false;
99
+
100
+ /**
101
+ * When the Pre-Pack Sample was last updated
102
+ *
103
+ * @type {Date}
104
+ * @public
105
+ */
106
+ this.updateTimestamp = new Date();
107
+
108
+ /**
109
+ * The Site ID associated with this Pre-Pack Sample
110
+ *
111
+ * @type {number}
112
+ * @public
113
+ */
114
+ this.siteId = siteId;
115
+ }
116
+
117
+ /**
118
+ * Create a new **PrePackSampleModel** from a JSON Object or JSON String
119
+ *
120
+ * @static
121
+ * @public
122
+ * @param {Object<string, any>|string} json A JSON Object or JSON String
123
+ * @param {number} siteId The Site ID associated with this Pre-Pack Sample
124
+ * @return {PrePackSampleModel}
125
+ */
126
+ static fromJSON(json, siteId)
127
+ {
128
+ let model = new PrePackSampleModel(siteId);
129
+
130
+ /**
131
+ * The JSON Object
132
+ *
133
+ * @type {Object<string, any>}
134
+ */
135
+ let jsonObject = {};
136
+
137
+ if(typeof json === 'string')
138
+ {
139
+ jsonObject = JSON.parse(json);
140
+ }
141
+ else if(typeof json === 'object')
142
+ {
143
+ jsonObject = json;
144
+ }
145
+
146
+ if('id' in jsonObject)
147
+ {
148
+ model.id = (function(){
149
+ if(typeof jsonObject['id'] !== 'string')
150
+ {
151
+ return String(jsonObject['id']);
152
+ }
153
+
154
+ return jsonObject['id'];
155
+ }());
156
+ }
157
+
158
+ if('packingLineId' in jsonObject)
159
+ {
160
+ model.packingLineId = (function(){
161
+ if(typeof jsonObject['packingLineId'] !== 'string')
162
+ {
163
+ return String(jsonObject['packingLineId']);
164
+ }
165
+
166
+ return jsonObject['packingLineId'];
167
+ }());
168
+ }
169
+
170
+ if('packrunId' in jsonObject)
171
+ {
172
+ model.packrunId = (function(){
173
+ if(typeof jsonObject['packrunId'] !== 'string')
174
+ {
175
+ return String(jsonObject['packrunId']);
176
+ }
177
+
178
+ return jsonObject['packrunId'];
179
+ }());
180
+ }
181
+
182
+ if('createdTimestamp' in jsonObject)
183
+ {
184
+ model.createdTimestamp = (function(){
185
+ if(typeof jsonObject['createdTimestamp'] !== 'string')
186
+ {
187
+ return new Date(String(jsonObject['createdTimestamp']));
188
+ }
189
+
190
+ return new Date(jsonObject['createdTimestamp']);
191
+ }());
192
+ }
193
+
194
+ if('userId' in jsonObject)
195
+ {
196
+ model.userId = (function(){
197
+ if(typeof jsonObject['userId'] !== 'string')
198
+ {
199
+ return String(jsonObject['userId']);
200
+ }
201
+
202
+ return jsonObject['userId'];
203
+ }());
204
+ }
205
+
206
+ if('userName' in jsonObject)
207
+ {
208
+ model.userName = (function(){
209
+ if(typeof jsonObject['userName'] !== 'string')
210
+ {
211
+ return String(jsonObject['userName']);
212
+ }
213
+
214
+ return jsonObject['userName'];
215
+ }());
216
+ }
217
+
218
+ if('sampleDefects' in jsonObject)
219
+ {
220
+ model.sampleDefects = (function(){
221
+ if(Array.isArray(jsonObject['sampleDefects']) !== true)
222
+ {
223
+ return [];
224
+ }
225
+
226
+ return jsonObject['sampleDefects'].map((sampleDefectsItem) => {
227
+ return (function(){
228
+ let sampleDefectsItemObject = {};
229
+
230
+ if(typeof sampleDefectsItem === 'object' && 'id' in sampleDefectsItem)
231
+ {
232
+ sampleDefectsItemObject.id = (function(){
233
+ if(typeof sampleDefectsItem.id !== 'string')
234
+ {
235
+ return String(sampleDefectsItem.id);
236
+ }
237
+
238
+ return sampleDefectsItem.id;
239
+ }());
240
+ }
241
+ else
242
+ {
243
+ sampleDefectsItemObject.id = "";
244
+ }
245
+
246
+ if(typeof sampleDefectsItem === 'object' && 'name' in sampleDefectsItem)
247
+ {
248
+ sampleDefectsItemObject.name = (function(){
249
+ if(typeof sampleDefectsItem.name !== 'string')
250
+ {
251
+ return String(sampleDefectsItem.name);
252
+ }
253
+
254
+ return sampleDefectsItem.name;
255
+ }());
256
+ }
257
+ else
258
+ {
259
+ sampleDefectsItemObject.name = "";
260
+ }
261
+
262
+ if(typeof sampleDefectsItem === 'object' && 'fruitCount' in sampleDefectsItem)
263
+ {
264
+ sampleDefectsItemObject.fruitCount = (function(){
265
+ if(typeof sampleDefectsItem.fruitCount !== 'number')
266
+ {
267
+ return Number.isInteger(Number(sampleDefectsItem.fruitCount)) ? Number(sampleDefectsItem.fruitCount) : Math.floor(Number(sampleDefectsItem.fruitCount));
268
+ }
269
+
270
+ return Number.isInteger(sampleDefectsItem.fruitCount) ? sampleDefectsItem.fruitCount : Math.floor(sampleDefectsItem.fruitCount);
271
+ }());
272
+ }
273
+ else
274
+ {
275
+ sampleDefectsItemObject.fruitCount = 0;
276
+ }
277
+
278
+ return sampleDefectsItemObject;
279
+ }());
280
+ });
281
+ }());
282
+ }
283
+
284
+ if('totalFruitSampled' in jsonObject)
285
+ {
286
+ model.totalFruitSampled = (function(){
287
+ if(typeof jsonObject['totalFruitSampled'] !== 'number')
288
+ {
289
+ return Number.isInteger(Number(jsonObject['totalFruitSampled'])) ? Number(jsonObject['totalFruitSampled']) : Math.floor(Number(jsonObject['totalFruitSampled']));
290
+ }
291
+
292
+ return Number.isInteger(jsonObject['totalFruitSampled']) ? jsonObject['totalFruitSampled'] : Math.floor(jsonObject['totalFruitSampled']);
293
+ }());
294
+ }
295
+
296
+ if('deleted' in jsonObject)
297
+ {
298
+ model.deleted = (function(){
299
+ if(typeof jsonObject['deleted'] !== 'boolean')
300
+ {
301
+ return Boolean(jsonObject['deleted']);
302
+ }
303
+
304
+ return jsonObject['deleted'];
305
+ }());
306
+ }
307
+
308
+ if('updateTimestamp' in jsonObject)
309
+ {
310
+ model.updateTimestamp = (function(){
311
+ if(typeof jsonObject['updateTimestamp'] !== 'string')
312
+ {
313
+ return new Date(String(jsonObject['updateTimestamp']));
314
+ }
315
+
316
+ return new Date(jsonObject['updateTimestamp']);
317
+ }());
318
+ }
319
+
320
+ return model;
321
+ }
322
+ }
323
+
324
+ export default PrePackSampleModel;
@@ -32,6 +32,7 @@ import MAFSizerPackrunSummaryModel from './MAFSizerPackrunSummaryModel';
32
32
  import PackTypeModel from './PackTypeModel';
33
33
  import PackingLineModel from './PackingLineModel';
34
34
  import PackrunModel from './PackrunModel';
35
+ import PrePackSampleModel from './PrePackSampleModel';
35
36
  import RejectBinModel from './RejectBinModel';
36
37
  import RejectBinScaleModel from './RejectBinScaleModel';
37
38
  import RejectBinWeightModel from './RejectBinWeightModel';
@@ -72,6 +73,7 @@ const Site = {
72
73
  PackTypeModel,
73
74
  PackingLineModel,
74
75
  PackrunModel,
76
+ PrePackSampleModel,
75
77
  RejectBinModel,
76
78
  RejectBinScaleModel,
77
79
  RejectBinWeightModel,
@@ -1,2 +1,2 @@
1
1
  // Generated by genversion.
2
- export const version = '2.3.24';
2
+ export const version = '2.3.25';