@ricado/api-client 2.7.6 → 2.7.8
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/PackingLineController.js +14 -3
- package/lib/Controllers/Packhouse/Site/PackrunController.js +2 -0
- package/lib/Controllers/Packhouse/Site/PackrunGrowerNotificationController.js +940 -0
- package/lib/Controllers/Packhouse/Site/index.js +3 -0
- package/lib/Models/Packhouse/Site/PackingLineModel.js +283 -2
- package/lib/Models/Packhouse/Site/PackrunGrowerNotificationModel.js +669 -0
- package/lib/Models/Packhouse/Site/PackrunModel.js +22 -0
- package/lib/Models/Packhouse/Site/index.js +3 -0
- package/lib/PackageVersion.js +1 -1
- package/lib/index.d.ts +635 -2
- package/package.json +1 -1
- package/src/Controllers/Packhouse/Site/PackingLineController.js +14 -3
- package/src/Controllers/Packhouse/Site/PackrunController.js +2 -0
- package/src/Controllers/Packhouse/Site/PackrunGrowerNotificationController.js +1071 -0
- package/src/Controllers/Packhouse/Site/index.js +2 -0
- package/src/Models/Packhouse/Site/PackingLineModel.js +380 -2
- package/src/Models/Packhouse/Site/PackrunGrowerNotificationModel.js +763 -0
- package/src/Models/Packhouse/Site/PackrunModel.js +25 -0
- package/src/Models/Packhouse/Site/index.js +2 -0
- package/src/PackageVersion.js +1 -1
|
@@ -0,0 +1,763 @@
|
|
|
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 Packrun Grower Notification
|
|
11
|
+
*
|
|
12
|
+
* @class
|
|
13
|
+
* @hideconstructor
|
|
14
|
+
* @extends BaseModel
|
|
15
|
+
*/
|
|
16
|
+
class PackrunGrowerNotificationModel extends BaseModel
|
|
17
|
+
{
|
|
18
|
+
/**
|
|
19
|
+
* PackrunGrowerNotificationModel Constructor
|
|
20
|
+
*
|
|
21
|
+
* @protected
|
|
22
|
+
* @param {number} siteId The Site ID associated with this Packrun Grower Notification
|
|
23
|
+
*/
|
|
24
|
+
constructor(siteId)
|
|
25
|
+
{
|
|
26
|
+
super();
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* The Packrun Grower Notification ID
|
|
30
|
+
*
|
|
31
|
+
* @type {string}
|
|
32
|
+
* @public
|
|
33
|
+
*/
|
|
34
|
+
this.id = "";
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* The Packing Line ID this Grower Notification is associated with
|
|
38
|
+
*
|
|
39
|
+
* @type {string}
|
|
40
|
+
* @public
|
|
41
|
+
*/
|
|
42
|
+
this.packingLineId = "";
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* The Packrun ID this Grower Notification is associated with
|
|
46
|
+
*
|
|
47
|
+
* @type {string}
|
|
48
|
+
* @public
|
|
49
|
+
*/
|
|
50
|
+
this.packrunId = "";
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* When this Grower Notification was Created
|
|
54
|
+
*
|
|
55
|
+
* @type {Date}
|
|
56
|
+
* @public
|
|
57
|
+
*/
|
|
58
|
+
this.createdTimestamp = new Date();
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* The Grower Notification Type
|
|
62
|
+
*
|
|
63
|
+
* @type {string}
|
|
64
|
+
* @public
|
|
65
|
+
*/
|
|
66
|
+
this.notificationType = "";
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* The SMS Request Statuses indicating progress when sending SMS Messages
|
|
70
|
+
*
|
|
71
|
+
* @type {Array<{mobileNumber: string, messageId: ?string, messageStatus: ?string, sendRequestCount: number, sendRequestTimestamp: ?Date, sendResponseCode: ?number, sendResponseMessage: ?string, getStatusRequestCount: number, getStatusRequestTimestamp: ?Date, getStatusResponseCode: ?number, getStatusResponseMessage: ?string, completed: boolean}>}
|
|
72
|
+
* @public
|
|
73
|
+
*/
|
|
74
|
+
this.smsRequests = [];
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* The Email Request Status indicating progress when sending Emails
|
|
78
|
+
*
|
|
79
|
+
* @type {?{requestCount: number, requestTimestamp: ?Date, responseCode: ?number, responseMessage: ?string, completed: boolean}}
|
|
80
|
+
* @public
|
|
81
|
+
*/
|
|
82
|
+
this.emailRequest = null;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Whether the Grower Notification is in the process of being Sent
|
|
86
|
+
*
|
|
87
|
+
* @type {string}
|
|
88
|
+
* @public
|
|
89
|
+
*/
|
|
90
|
+
this.status = "";
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* An Array of SMS Contacts for this Grower Notification
|
|
94
|
+
*
|
|
95
|
+
* @type {Array<{mobileNumber: string, firstName: string, lastName: ?string}>}
|
|
96
|
+
* @public
|
|
97
|
+
*/
|
|
98
|
+
this.smsContacts = [];
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* An Array of Email Contacts for this Grower Notification
|
|
102
|
+
*
|
|
103
|
+
* @type {Array<{email: string, firstName: string, lastName: ?string}>}
|
|
104
|
+
* @public
|
|
105
|
+
*/
|
|
106
|
+
this.emailContacts = [];
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Whether the Packrun Grower Notification has been deleted
|
|
110
|
+
*
|
|
111
|
+
* @type {boolean}
|
|
112
|
+
* @public
|
|
113
|
+
*/
|
|
114
|
+
this.deleted = false;
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* When the Packrun Grower Notification was last updated
|
|
118
|
+
*
|
|
119
|
+
* @type {Date}
|
|
120
|
+
* @public
|
|
121
|
+
*/
|
|
122
|
+
this.updateTimestamp = new Date();
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* The Site ID associated with this Packrun Grower Notification
|
|
126
|
+
*
|
|
127
|
+
* @type {number}
|
|
128
|
+
* @public
|
|
129
|
+
*/
|
|
130
|
+
this.siteId = siteId;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Create a new **PackrunGrowerNotificationModel** from a JSON Object or JSON String
|
|
135
|
+
*
|
|
136
|
+
* @static
|
|
137
|
+
* @public
|
|
138
|
+
* @param {Object<string, any>|string} json A JSON Object or JSON String
|
|
139
|
+
* @param {number} siteId The Site ID associated with this Packrun Grower Notification
|
|
140
|
+
* @return {PackrunGrowerNotificationModel}
|
|
141
|
+
*/
|
|
142
|
+
static fromJSON(json, siteId)
|
|
143
|
+
{
|
|
144
|
+
let model = new PackrunGrowerNotificationModel(siteId);
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* The JSON Object
|
|
148
|
+
*
|
|
149
|
+
* @type {Object<string, any>}
|
|
150
|
+
*/
|
|
151
|
+
let jsonObject = {};
|
|
152
|
+
|
|
153
|
+
if(typeof json === 'string')
|
|
154
|
+
{
|
|
155
|
+
jsonObject = JSON.parse(json);
|
|
156
|
+
}
|
|
157
|
+
else if(typeof json === 'object')
|
|
158
|
+
{
|
|
159
|
+
jsonObject = json;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
if('id' in jsonObject)
|
|
163
|
+
{
|
|
164
|
+
model.id = (function(){
|
|
165
|
+
if(typeof jsonObject['id'] !== 'string')
|
|
166
|
+
{
|
|
167
|
+
return String(jsonObject['id']);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
return jsonObject['id'];
|
|
171
|
+
}());
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
if('packingLineId' in jsonObject)
|
|
175
|
+
{
|
|
176
|
+
model.packingLineId = (function(){
|
|
177
|
+
if(typeof jsonObject['packingLineId'] !== 'string')
|
|
178
|
+
{
|
|
179
|
+
return String(jsonObject['packingLineId']);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
return jsonObject['packingLineId'];
|
|
183
|
+
}());
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
if('packrunId' in jsonObject)
|
|
187
|
+
{
|
|
188
|
+
model.packrunId = (function(){
|
|
189
|
+
if(typeof jsonObject['packrunId'] !== 'string')
|
|
190
|
+
{
|
|
191
|
+
return String(jsonObject['packrunId']);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
return jsonObject['packrunId'];
|
|
195
|
+
}());
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
if('createdTimestamp' in jsonObject)
|
|
199
|
+
{
|
|
200
|
+
model.createdTimestamp = (function(){
|
|
201
|
+
if(typeof jsonObject['createdTimestamp'] !== 'string')
|
|
202
|
+
{
|
|
203
|
+
return new Date(String(jsonObject['createdTimestamp']));
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
return new Date(jsonObject['createdTimestamp']);
|
|
207
|
+
}());
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
if('notificationType' in jsonObject)
|
|
211
|
+
{
|
|
212
|
+
model.notificationType = (function(){
|
|
213
|
+
if(typeof jsonObject['notificationType'] !== 'string')
|
|
214
|
+
{
|
|
215
|
+
return String(jsonObject['notificationType']);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
return jsonObject['notificationType'];
|
|
219
|
+
}());
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
if('smsRequests' in jsonObject)
|
|
223
|
+
{
|
|
224
|
+
model.smsRequests = (function(){
|
|
225
|
+
if(Array.isArray(jsonObject['smsRequests']) !== true)
|
|
226
|
+
{
|
|
227
|
+
return [];
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
return jsonObject['smsRequests'].map((smsRequestsItem) => {
|
|
231
|
+
return (function(){
|
|
232
|
+
let smsRequestsItemObject = {};
|
|
233
|
+
|
|
234
|
+
if(typeof smsRequestsItem === 'object' && 'mobileNumber' in smsRequestsItem)
|
|
235
|
+
{
|
|
236
|
+
smsRequestsItemObject.mobileNumber = (function(){
|
|
237
|
+
if(typeof smsRequestsItem.mobileNumber !== 'string')
|
|
238
|
+
{
|
|
239
|
+
return String(smsRequestsItem.mobileNumber);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
return smsRequestsItem.mobileNumber;
|
|
243
|
+
}());
|
|
244
|
+
}
|
|
245
|
+
else
|
|
246
|
+
{
|
|
247
|
+
smsRequestsItemObject.mobileNumber = "";
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
if(typeof smsRequestsItem === 'object' && 'messageId' in smsRequestsItem)
|
|
251
|
+
{
|
|
252
|
+
smsRequestsItemObject.messageId = (function(){
|
|
253
|
+
if(smsRequestsItem.messageId === null)
|
|
254
|
+
{
|
|
255
|
+
return null;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
if(typeof smsRequestsItem.messageId !== 'string')
|
|
259
|
+
{
|
|
260
|
+
return String(smsRequestsItem.messageId);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
return smsRequestsItem.messageId;
|
|
264
|
+
}());
|
|
265
|
+
}
|
|
266
|
+
else
|
|
267
|
+
{
|
|
268
|
+
smsRequestsItemObject.messageId = null;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
if(typeof smsRequestsItem === 'object' && 'messageStatus' in smsRequestsItem)
|
|
272
|
+
{
|
|
273
|
+
smsRequestsItemObject.messageStatus = (function(){
|
|
274
|
+
if(smsRequestsItem.messageStatus === null)
|
|
275
|
+
{
|
|
276
|
+
return null;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
if(typeof smsRequestsItem.messageStatus !== 'string')
|
|
280
|
+
{
|
|
281
|
+
return String(smsRequestsItem.messageStatus);
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
return smsRequestsItem.messageStatus;
|
|
285
|
+
}());
|
|
286
|
+
}
|
|
287
|
+
else
|
|
288
|
+
{
|
|
289
|
+
smsRequestsItemObject.messageStatus = null;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
if(typeof smsRequestsItem === 'object' && 'sendRequestCount' in smsRequestsItem)
|
|
293
|
+
{
|
|
294
|
+
smsRequestsItemObject.sendRequestCount = (function(){
|
|
295
|
+
if(typeof smsRequestsItem.sendRequestCount !== 'number')
|
|
296
|
+
{
|
|
297
|
+
return Number.isInteger(Number(smsRequestsItem.sendRequestCount)) ? Number(smsRequestsItem.sendRequestCount) : Math.floor(Number(smsRequestsItem.sendRequestCount));
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
return Number.isInteger(smsRequestsItem.sendRequestCount) ? smsRequestsItem.sendRequestCount : Math.floor(smsRequestsItem.sendRequestCount);
|
|
301
|
+
}());
|
|
302
|
+
}
|
|
303
|
+
else
|
|
304
|
+
{
|
|
305
|
+
smsRequestsItemObject.sendRequestCount = 0;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
if(typeof smsRequestsItem === 'object' && 'sendRequestTimestamp' in smsRequestsItem)
|
|
309
|
+
{
|
|
310
|
+
smsRequestsItemObject.sendRequestTimestamp = (function(){
|
|
311
|
+
if(smsRequestsItem.sendRequestTimestamp === null)
|
|
312
|
+
{
|
|
313
|
+
return null;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
if(typeof smsRequestsItem.sendRequestTimestamp !== 'string')
|
|
317
|
+
{
|
|
318
|
+
return new Date(String(smsRequestsItem.sendRequestTimestamp));
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
return new Date(smsRequestsItem.sendRequestTimestamp);
|
|
322
|
+
}());
|
|
323
|
+
}
|
|
324
|
+
else
|
|
325
|
+
{
|
|
326
|
+
smsRequestsItemObject.sendRequestTimestamp = null;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
if(typeof smsRequestsItem === 'object' && 'sendResponseCode' in smsRequestsItem)
|
|
330
|
+
{
|
|
331
|
+
smsRequestsItemObject.sendResponseCode = (function(){
|
|
332
|
+
if(smsRequestsItem.sendResponseCode === null)
|
|
333
|
+
{
|
|
334
|
+
return null;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
if(typeof smsRequestsItem.sendResponseCode !== 'number')
|
|
338
|
+
{
|
|
339
|
+
return Number.isInteger(Number(smsRequestsItem.sendResponseCode)) ? Number(smsRequestsItem.sendResponseCode) : Math.floor(Number(smsRequestsItem.sendResponseCode));
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
return Number.isInteger(smsRequestsItem.sendResponseCode) ? smsRequestsItem.sendResponseCode : Math.floor(smsRequestsItem.sendResponseCode);
|
|
343
|
+
}());
|
|
344
|
+
}
|
|
345
|
+
else
|
|
346
|
+
{
|
|
347
|
+
smsRequestsItemObject.sendResponseCode = null;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
if(typeof smsRequestsItem === 'object' && 'sendResponseMessage' in smsRequestsItem)
|
|
351
|
+
{
|
|
352
|
+
smsRequestsItemObject.sendResponseMessage = (function(){
|
|
353
|
+
if(smsRequestsItem.sendResponseMessage === null)
|
|
354
|
+
{
|
|
355
|
+
return null;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
if(typeof smsRequestsItem.sendResponseMessage !== 'string')
|
|
359
|
+
{
|
|
360
|
+
return String(smsRequestsItem.sendResponseMessage);
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
return smsRequestsItem.sendResponseMessage;
|
|
364
|
+
}());
|
|
365
|
+
}
|
|
366
|
+
else
|
|
367
|
+
{
|
|
368
|
+
smsRequestsItemObject.sendResponseMessage = null;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
if(typeof smsRequestsItem === 'object' && 'getStatusRequestCount' in smsRequestsItem)
|
|
372
|
+
{
|
|
373
|
+
smsRequestsItemObject.getStatusRequestCount = (function(){
|
|
374
|
+
if(typeof smsRequestsItem.getStatusRequestCount !== 'number')
|
|
375
|
+
{
|
|
376
|
+
return Number.isInteger(Number(smsRequestsItem.getStatusRequestCount)) ? Number(smsRequestsItem.getStatusRequestCount) : Math.floor(Number(smsRequestsItem.getStatusRequestCount));
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
return Number.isInteger(smsRequestsItem.getStatusRequestCount) ? smsRequestsItem.getStatusRequestCount : Math.floor(smsRequestsItem.getStatusRequestCount);
|
|
380
|
+
}());
|
|
381
|
+
}
|
|
382
|
+
else
|
|
383
|
+
{
|
|
384
|
+
smsRequestsItemObject.getStatusRequestCount = 0;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
if(typeof smsRequestsItem === 'object' && 'getStatusRequestTimestamp' in smsRequestsItem)
|
|
388
|
+
{
|
|
389
|
+
smsRequestsItemObject.getStatusRequestTimestamp = (function(){
|
|
390
|
+
if(smsRequestsItem.getStatusRequestTimestamp === null)
|
|
391
|
+
{
|
|
392
|
+
return null;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
if(typeof smsRequestsItem.getStatusRequestTimestamp !== 'string')
|
|
396
|
+
{
|
|
397
|
+
return new Date(String(smsRequestsItem.getStatusRequestTimestamp));
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
return new Date(smsRequestsItem.getStatusRequestTimestamp);
|
|
401
|
+
}());
|
|
402
|
+
}
|
|
403
|
+
else
|
|
404
|
+
{
|
|
405
|
+
smsRequestsItemObject.getStatusRequestTimestamp = null;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
if(typeof smsRequestsItem === 'object' && 'getStatusResponseCode' in smsRequestsItem)
|
|
409
|
+
{
|
|
410
|
+
smsRequestsItemObject.getStatusResponseCode = (function(){
|
|
411
|
+
if(smsRequestsItem.getStatusResponseCode === null)
|
|
412
|
+
{
|
|
413
|
+
return null;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
if(typeof smsRequestsItem.getStatusResponseCode !== 'number')
|
|
417
|
+
{
|
|
418
|
+
return Number.isInteger(Number(smsRequestsItem.getStatusResponseCode)) ? Number(smsRequestsItem.getStatusResponseCode) : Math.floor(Number(smsRequestsItem.getStatusResponseCode));
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
return Number.isInteger(smsRequestsItem.getStatusResponseCode) ? smsRequestsItem.getStatusResponseCode : Math.floor(smsRequestsItem.getStatusResponseCode);
|
|
422
|
+
}());
|
|
423
|
+
}
|
|
424
|
+
else
|
|
425
|
+
{
|
|
426
|
+
smsRequestsItemObject.getStatusResponseCode = null;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
if(typeof smsRequestsItem === 'object' && 'getStatusResponseMessage' in smsRequestsItem)
|
|
430
|
+
{
|
|
431
|
+
smsRequestsItemObject.getStatusResponseMessage = (function(){
|
|
432
|
+
if(smsRequestsItem.getStatusResponseMessage === null)
|
|
433
|
+
{
|
|
434
|
+
return null;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
if(typeof smsRequestsItem.getStatusResponseMessage !== 'string')
|
|
438
|
+
{
|
|
439
|
+
return String(smsRequestsItem.getStatusResponseMessage);
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
return smsRequestsItem.getStatusResponseMessage;
|
|
443
|
+
}());
|
|
444
|
+
}
|
|
445
|
+
else
|
|
446
|
+
{
|
|
447
|
+
smsRequestsItemObject.getStatusResponseMessage = null;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
if(typeof smsRequestsItem === 'object' && 'completed' in smsRequestsItem)
|
|
451
|
+
{
|
|
452
|
+
smsRequestsItemObject.completed = (function(){
|
|
453
|
+
if(typeof smsRequestsItem.completed !== 'boolean')
|
|
454
|
+
{
|
|
455
|
+
return Boolean(smsRequestsItem.completed);
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
return smsRequestsItem.completed;
|
|
459
|
+
}());
|
|
460
|
+
}
|
|
461
|
+
else
|
|
462
|
+
{
|
|
463
|
+
smsRequestsItemObject.completed = false;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
return smsRequestsItemObject;
|
|
467
|
+
}());
|
|
468
|
+
});
|
|
469
|
+
}());
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
if('emailRequest' in jsonObject)
|
|
473
|
+
{
|
|
474
|
+
model.emailRequest = (function(){
|
|
475
|
+
if(jsonObject['emailRequest'] === null)
|
|
476
|
+
{
|
|
477
|
+
return null;
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
let emailRequestObject = {};
|
|
481
|
+
|
|
482
|
+
if(typeof jsonObject['emailRequest'] === 'object' && 'requestCount' in jsonObject['emailRequest'])
|
|
483
|
+
{
|
|
484
|
+
emailRequestObject.requestCount = (function(){
|
|
485
|
+
if(typeof jsonObject['emailRequest'].requestCount !== 'number')
|
|
486
|
+
{
|
|
487
|
+
return Number.isInteger(Number(jsonObject['emailRequest'].requestCount)) ? Number(jsonObject['emailRequest'].requestCount) : Math.floor(Number(jsonObject['emailRequest'].requestCount));
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
return Number.isInteger(jsonObject['emailRequest'].requestCount) ? jsonObject['emailRequest'].requestCount : Math.floor(jsonObject['emailRequest'].requestCount);
|
|
491
|
+
}());
|
|
492
|
+
}
|
|
493
|
+
else
|
|
494
|
+
{
|
|
495
|
+
emailRequestObject.requestCount = 0;
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
if(typeof jsonObject['emailRequest'] === 'object' && 'requestTimestamp' in jsonObject['emailRequest'])
|
|
499
|
+
{
|
|
500
|
+
emailRequestObject.requestTimestamp = (function(){
|
|
501
|
+
if(jsonObject['emailRequest'].requestTimestamp === null)
|
|
502
|
+
{
|
|
503
|
+
return null;
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
if(typeof jsonObject['emailRequest'].requestTimestamp !== 'string')
|
|
507
|
+
{
|
|
508
|
+
return new Date(String(jsonObject['emailRequest'].requestTimestamp));
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
return new Date(jsonObject['emailRequest'].requestTimestamp);
|
|
512
|
+
}());
|
|
513
|
+
}
|
|
514
|
+
else
|
|
515
|
+
{
|
|
516
|
+
emailRequestObject.requestTimestamp = null;
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
if(typeof jsonObject['emailRequest'] === 'object' && 'responseCode' in jsonObject['emailRequest'])
|
|
520
|
+
{
|
|
521
|
+
emailRequestObject.responseCode = (function(){
|
|
522
|
+
if(jsonObject['emailRequest'].responseCode === null)
|
|
523
|
+
{
|
|
524
|
+
return null;
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
if(typeof jsonObject['emailRequest'].responseCode !== 'number')
|
|
528
|
+
{
|
|
529
|
+
return Number.isInteger(Number(jsonObject['emailRequest'].responseCode)) ? Number(jsonObject['emailRequest'].responseCode) : Math.floor(Number(jsonObject['emailRequest'].responseCode));
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
return Number.isInteger(jsonObject['emailRequest'].responseCode) ? jsonObject['emailRequest'].responseCode : Math.floor(jsonObject['emailRequest'].responseCode);
|
|
533
|
+
}());
|
|
534
|
+
}
|
|
535
|
+
else
|
|
536
|
+
{
|
|
537
|
+
emailRequestObject.responseCode = null;
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
if(typeof jsonObject['emailRequest'] === 'object' && 'responseMessage' in jsonObject['emailRequest'])
|
|
541
|
+
{
|
|
542
|
+
emailRequestObject.responseMessage = (function(){
|
|
543
|
+
if(jsonObject['emailRequest'].responseMessage === null)
|
|
544
|
+
{
|
|
545
|
+
return null;
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
if(typeof jsonObject['emailRequest'].responseMessage !== 'string')
|
|
549
|
+
{
|
|
550
|
+
return String(jsonObject['emailRequest'].responseMessage);
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
return jsonObject['emailRequest'].responseMessage;
|
|
554
|
+
}());
|
|
555
|
+
}
|
|
556
|
+
else
|
|
557
|
+
{
|
|
558
|
+
emailRequestObject.responseMessage = null;
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
if(typeof jsonObject['emailRequest'] === 'object' && 'completed' in jsonObject['emailRequest'])
|
|
562
|
+
{
|
|
563
|
+
emailRequestObject.completed = (function(){
|
|
564
|
+
if(typeof jsonObject['emailRequest'].completed !== 'boolean')
|
|
565
|
+
{
|
|
566
|
+
return Boolean(jsonObject['emailRequest'].completed);
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
return jsonObject['emailRequest'].completed;
|
|
570
|
+
}());
|
|
571
|
+
}
|
|
572
|
+
else
|
|
573
|
+
{
|
|
574
|
+
emailRequestObject.completed = false;
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
return emailRequestObject;
|
|
578
|
+
}());
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
if('status' in jsonObject)
|
|
582
|
+
{
|
|
583
|
+
model.status = (function(){
|
|
584
|
+
if(typeof jsonObject['status'] !== 'string')
|
|
585
|
+
{
|
|
586
|
+
return String(jsonObject['status']);
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
return jsonObject['status'];
|
|
590
|
+
}());
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
if('smsContacts' in jsonObject)
|
|
594
|
+
{
|
|
595
|
+
model.smsContacts = (function(){
|
|
596
|
+
if(Array.isArray(jsonObject['smsContacts']) !== true)
|
|
597
|
+
{
|
|
598
|
+
return [];
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
return jsonObject['smsContacts'].map((smsContactsItem) => {
|
|
602
|
+
return (function(){
|
|
603
|
+
let smsContactsItemObject = {};
|
|
604
|
+
|
|
605
|
+
if(typeof smsContactsItem === 'object' && 'mobileNumber' in smsContactsItem)
|
|
606
|
+
{
|
|
607
|
+
smsContactsItemObject.mobileNumber = (function(){
|
|
608
|
+
if(typeof smsContactsItem.mobileNumber !== 'string')
|
|
609
|
+
{
|
|
610
|
+
return String(smsContactsItem.mobileNumber);
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
return smsContactsItem.mobileNumber;
|
|
614
|
+
}());
|
|
615
|
+
}
|
|
616
|
+
else
|
|
617
|
+
{
|
|
618
|
+
smsContactsItemObject.mobileNumber = "";
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
if(typeof smsContactsItem === 'object' && 'firstName' in smsContactsItem)
|
|
622
|
+
{
|
|
623
|
+
smsContactsItemObject.firstName = (function(){
|
|
624
|
+
if(typeof smsContactsItem.firstName !== 'string')
|
|
625
|
+
{
|
|
626
|
+
return String(smsContactsItem.firstName);
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
return smsContactsItem.firstName;
|
|
630
|
+
}());
|
|
631
|
+
}
|
|
632
|
+
else
|
|
633
|
+
{
|
|
634
|
+
smsContactsItemObject.firstName = "";
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
if(typeof smsContactsItem === 'object' && 'lastName' in smsContactsItem)
|
|
638
|
+
{
|
|
639
|
+
smsContactsItemObject.lastName = (function(){
|
|
640
|
+
if(smsContactsItem.lastName === null)
|
|
641
|
+
{
|
|
642
|
+
return null;
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
if(typeof smsContactsItem.lastName !== 'string')
|
|
646
|
+
{
|
|
647
|
+
return String(smsContactsItem.lastName);
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
return smsContactsItem.lastName;
|
|
651
|
+
}());
|
|
652
|
+
}
|
|
653
|
+
else
|
|
654
|
+
{
|
|
655
|
+
smsContactsItemObject.lastName = null;
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
return smsContactsItemObject;
|
|
659
|
+
}());
|
|
660
|
+
});
|
|
661
|
+
}());
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
if('emailContacts' in jsonObject)
|
|
665
|
+
{
|
|
666
|
+
model.emailContacts = (function(){
|
|
667
|
+
if(Array.isArray(jsonObject['emailContacts']) !== true)
|
|
668
|
+
{
|
|
669
|
+
return [];
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
return jsonObject['emailContacts'].map((emailContactsItem) => {
|
|
673
|
+
return (function(){
|
|
674
|
+
let emailContactsItemObject = {};
|
|
675
|
+
|
|
676
|
+
if(typeof emailContactsItem === 'object' && 'email' in emailContactsItem)
|
|
677
|
+
{
|
|
678
|
+
emailContactsItemObject.email = (function(){
|
|
679
|
+
if(typeof emailContactsItem.email !== 'string')
|
|
680
|
+
{
|
|
681
|
+
return String(emailContactsItem.email);
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
return emailContactsItem.email;
|
|
685
|
+
}());
|
|
686
|
+
}
|
|
687
|
+
else
|
|
688
|
+
{
|
|
689
|
+
emailContactsItemObject.email = "";
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
if(typeof emailContactsItem === 'object' && 'firstName' in emailContactsItem)
|
|
693
|
+
{
|
|
694
|
+
emailContactsItemObject.firstName = (function(){
|
|
695
|
+
if(typeof emailContactsItem.firstName !== 'string')
|
|
696
|
+
{
|
|
697
|
+
return String(emailContactsItem.firstName);
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
return emailContactsItem.firstName;
|
|
701
|
+
}());
|
|
702
|
+
}
|
|
703
|
+
else
|
|
704
|
+
{
|
|
705
|
+
emailContactsItemObject.firstName = "";
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
if(typeof emailContactsItem === 'object' && 'lastName' in emailContactsItem)
|
|
709
|
+
{
|
|
710
|
+
emailContactsItemObject.lastName = (function(){
|
|
711
|
+
if(emailContactsItem.lastName === null)
|
|
712
|
+
{
|
|
713
|
+
return null;
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
if(typeof emailContactsItem.lastName !== 'string')
|
|
717
|
+
{
|
|
718
|
+
return String(emailContactsItem.lastName);
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
return emailContactsItem.lastName;
|
|
722
|
+
}());
|
|
723
|
+
}
|
|
724
|
+
else
|
|
725
|
+
{
|
|
726
|
+
emailContactsItemObject.lastName = null;
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
return emailContactsItemObject;
|
|
730
|
+
}());
|
|
731
|
+
});
|
|
732
|
+
}());
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
if('deleted' in jsonObject)
|
|
736
|
+
{
|
|
737
|
+
model.deleted = (function(){
|
|
738
|
+
if(typeof jsonObject['deleted'] !== 'boolean')
|
|
739
|
+
{
|
|
740
|
+
return Boolean(jsonObject['deleted']);
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
return jsonObject['deleted'];
|
|
744
|
+
}());
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
if('updateTimestamp' in jsonObject)
|
|
748
|
+
{
|
|
749
|
+
model.updateTimestamp = (function(){
|
|
750
|
+
if(typeof jsonObject['updateTimestamp'] !== 'string')
|
|
751
|
+
{
|
|
752
|
+
return new Date(String(jsonObject['updateTimestamp']));
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
return new Date(jsonObject['updateTimestamp']);
|
|
756
|
+
}());
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
return model;
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
export default PackrunGrowerNotificationModel;
|