@ricado/api-client 2.4.1 → 2.5.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/dist/ricado.api.client.js +1 -1
- package/lib/Controllers/Lab/Site/FruitProfileController.js +12 -9
- package/lib/Controllers/Lab/Site/ProbeCalibrationController.js +921 -0
- package/lib/Controllers/Lab/Site/RackPositionController.js +2 -2
- package/lib/Controllers/Lab/Site/SampleController.js +15 -15
- package/lib/Controllers/Lab/Site/SampleResultController.js +29 -27
- package/lib/Controllers/Lab/Site/index.js +3 -3
- package/lib/Models/Lab/Site/FruitProfileModel.js +22 -4
- package/lib/Models/Lab/Site/{SampleFailureReasonModel.js → ProbeCalibrationModel.js} +141 -33
- package/lib/Models/Lab/Site/RackPositionModel.js +67 -15
- package/lib/Models/Lab/Site/SampleModel.js +51 -73
- package/lib/Models/Lab/Site/SampleResultModel.js +45 -23
- package/lib/Models/Lab/Site/index.js +3 -3
- package/lib/PackageVersion.js +1 -1
- package/lib/index.d.ts +577 -305
- package/package.json +1 -1
- package/src/Controllers/Lab/Site/FruitProfileController.js +12 -9
- package/src/Controllers/Lab/Site/ProbeCalibrationController.js +1052 -0
- package/src/Controllers/Lab/Site/RackPositionController.js +2 -2
- package/src/Controllers/Lab/Site/SampleController.js +15 -15
- package/src/Controllers/Lab/Site/SampleResultController.js +29 -27
- package/src/Controllers/Lab/Site/index.js +2 -2
- package/src/Models/Lab/Site/FruitProfileModel.js +24 -4
- package/src/Models/Lab/Site/ProbeCalibrationModel.js +290 -0
- package/src/Models/Lab/Site/RackPositionModel.js +87 -15
- package/src/Models/Lab/Site/SampleModel.js +57 -82
- package/src/Models/Lab/Site/SampleResultModel.js +48 -23
- package/src/Models/Lab/Site/index.js +2 -2
- package/src/PackageVersion.js +1 -1
- package/lib/Controllers/Lab/Site/SampleFailureReasonController.js +0 -192
- package/src/Controllers/Lab/Site/SampleFailureReasonController.js +0 -169
- package/src/Models/Lab/Site/SampleFailureReasonModel.js +0 -170
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _RequestHelper = _interopRequireDefault(require("../../../RequestHelper"));
|
|
9
|
-
|
|
10
|
-
var _SampleFailureReasonModel = _interopRequireDefault(require("../../../Models/Lab/Site/SampleFailureReasonModel"));
|
|
11
|
-
|
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
|
|
14
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
15
|
-
|
|
16
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
17
|
-
|
|
18
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Controller Class for Sample Failure Reasons
|
|
22
|
-
*
|
|
23
|
-
* @class
|
|
24
|
-
*/
|
|
25
|
-
var SampleFailureReasonController = /*#__PURE__*/function () {
|
|
26
|
-
function SampleFailureReasonController() {
|
|
27
|
-
_classCallCheck(this, SampleFailureReasonController);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
_createClass(SampleFailureReasonController, null, [{
|
|
31
|
-
key: "getOne",
|
|
32
|
-
value:
|
|
33
|
-
/**
|
|
34
|
-
* Retrieve a Sample Failure Reason [GET /lab/sites/{siteId}/sample-failure-reasons/{id}]
|
|
35
|
-
*
|
|
36
|
-
* @static
|
|
37
|
-
* @public
|
|
38
|
-
* @param {number} siteId The Site ID
|
|
39
|
-
* @param {string} id The Sample Failure Reason ID
|
|
40
|
-
* @return {Promise<SampleFailureReasonModel>}
|
|
41
|
-
*/
|
|
42
|
-
function getOne(siteId, id) {
|
|
43
|
-
return new Promise(function (resolve, reject) {
|
|
44
|
-
_RequestHelper.default.getRequest("/lab/sites/".concat(siteId, "/sample-failure-reasons/").concat(id)).then(function (result) {
|
|
45
|
-
var resolveValue = function () {
|
|
46
|
-
return _SampleFailureReasonModel.default.fromJSON(result, siteId);
|
|
47
|
-
}();
|
|
48
|
-
|
|
49
|
-
resolve(resolveValue);
|
|
50
|
-
}).catch(function (error) {
|
|
51
|
-
return reject(error);
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Update a Sample Failure Reason [PATCH /lab/sites/{siteId}/sample-failure-reasons/{id}]
|
|
57
|
-
*
|
|
58
|
-
* @static
|
|
59
|
-
* @public
|
|
60
|
-
* @param {number} siteId The Site ID
|
|
61
|
-
* @param {string} id The Sample Failure Reason ID
|
|
62
|
-
* @param {SampleFailureReasonController.UpdateData} updateData The Sample Failure Reason Update Data
|
|
63
|
-
* @return {Promise<SampleFailureReasonModel>}
|
|
64
|
-
*/
|
|
65
|
-
|
|
66
|
-
}, {
|
|
67
|
-
key: "update",
|
|
68
|
-
value: function update(siteId, id, updateData) {
|
|
69
|
-
return new Promise(function (resolve, reject) {
|
|
70
|
-
_RequestHelper.default.patchRequest("/lab/sites/".concat(siteId, "/sample-failure-reasons/").concat(id), updateData).then(function (result) {
|
|
71
|
-
var resolveValue = function () {
|
|
72
|
-
return _SampleFailureReasonModel.default.fromJSON(result, siteId);
|
|
73
|
-
}();
|
|
74
|
-
|
|
75
|
-
resolve(resolveValue);
|
|
76
|
-
}).catch(function (error) {
|
|
77
|
-
return reject(error);
|
|
78
|
-
});
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Delete a Sample Failure Reason [DELETE /lab/sites/{siteId}/sample-failure-reasons/{id}]
|
|
83
|
-
*
|
|
84
|
-
* @static
|
|
85
|
-
* @public
|
|
86
|
-
* @param {number} siteId The Site ID
|
|
87
|
-
* @param {string} id The Sample Failure Reason ID
|
|
88
|
-
* @return {Promise<boolean>}
|
|
89
|
-
*/
|
|
90
|
-
|
|
91
|
-
}, {
|
|
92
|
-
key: "delete",
|
|
93
|
-
value: function _delete(siteId, id) {
|
|
94
|
-
return new Promise(function (resolve, reject) {
|
|
95
|
-
_RequestHelper.default.deleteRequest("/lab/sites/".concat(siteId, "/sample-failure-reasons/").concat(id)).then(function (result) {
|
|
96
|
-
resolve(result !== null && result !== void 0 ? result : true);
|
|
97
|
-
}).catch(function (error) {
|
|
98
|
-
return reject(error);
|
|
99
|
-
});
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* List all Sample Failure Reasons [GET /lab/sites/{siteId}/sample-failure-reasons]
|
|
104
|
-
*
|
|
105
|
-
* @static
|
|
106
|
-
* @public
|
|
107
|
-
* @param {number} siteId The Site ID
|
|
108
|
-
* @param {SampleFailureReasonController.GetAllQueryParameters} [queryParameters] The Optional Query Parameters
|
|
109
|
-
* @return {Promise<SampleFailureReasonModel[]>}
|
|
110
|
-
*/
|
|
111
|
-
|
|
112
|
-
}, {
|
|
113
|
-
key: "getAll",
|
|
114
|
-
value: function getAll(siteId) {
|
|
115
|
-
var queryParameters = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
116
|
-
return new Promise(function (resolve, reject) {
|
|
117
|
-
_RequestHelper.default.getRequest("/lab/sites/".concat(siteId, "/sample-failure-reasons"), queryParameters).then(function (result) {
|
|
118
|
-
var resolveValue = function () {
|
|
119
|
-
if (Array.isArray(result) !== true) {
|
|
120
|
-
return [];
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
return result.map(function (resultItem) {
|
|
124
|
-
return function () {
|
|
125
|
-
return _SampleFailureReasonModel.default.fromJSON(resultItem, siteId);
|
|
126
|
-
}();
|
|
127
|
-
});
|
|
128
|
-
}();
|
|
129
|
-
|
|
130
|
-
resolve(resolveValue);
|
|
131
|
-
}).catch(function (error) {
|
|
132
|
-
return reject(error);
|
|
133
|
-
});
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* Create a Sample Failure Reason [POST /lab/sites/{siteId}/sample-failure-reasons]
|
|
138
|
-
*
|
|
139
|
-
* @static
|
|
140
|
-
* @public
|
|
141
|
-
* @param {number} siteId The Site ID
|
|
142
|
-
* @param {SampleFailureReasonController.CreateData} createData The Sample Failure Reason Create Data
|
|
143
|
-
* @return {Promise<SampleFailureReasonModel>}
|
|
144
|
-
*/
|
|
145
|
-
|
|
146
|
-
}, {
|
|
147
|
-
key: "create",
|
|
148
|
-
value: function create(siteId, createData) {
|
|
149
|
-
return new Promise(function (resolve, reject) {
|
|
150
|
-
_RequestHelper.default.postRequest("/lab/sites/".concat(siteId, "/sample-failure-reasons"), createData).then(function (result) {
|
|
151
|
-
var resolveValue = function () {
|
|
152
|
-
return _SampleFailureReasonModel.default.fromJSON(result, siteId);
|
|
153
|
-
}();
|
|
154
|
-
|
|
155
|
-
resolve(resolveValue);
|
|
156
|
-
}).catch(function (error) {
|
|
157
|
-
return reject(error);
|
|
158
|
-
});
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
|
-
}]);
|
|
162
|
-
|
|
163
|
-
return SampleFailureReasonController;
|
|
164
|
-
}();
|
|
165
|
-
|
|
166
|
-
var _default = SampleFailureReasonController;
|
|
167
|
-
/**
|
|
168
|
-
* The Optional Query Parameters for the getAll Function
|
|
169
|
-
*
|
|
170
|
-
* @typedef {Object} SampleFailureReasonController.GetAllQueryParameters
|
|
171
|
-
* @property {string} [name] The Sample Failure Reason Name
|
|
172
|
-
* @memberof Controllers.Lab.Site
|
|
173
|
-
*/
|
|
174
|
-
|
|
175
|
-
/**
|
|
176
|
-
* The Create Data for a Sample Failure Reason
|
|
177
|
-
*
|
|
178
|
-
* @typedef {Object} SampleFailureReasonController.CreateData
|
|
179
|
-
* @property {string} [name] The Sample Failure Reason Name
|
|
180
|
-
* @property {string} description The Sample Failure Reason Description
|
|
181
|
-
* @memberof Controllers.Lab.Site
|
|
182
|
-
*/
|
|
183
|
-
|
|
184
|
-
/**
|
|
185
|
-
* The Update Data for a Sample Failure Reason
|
|
186
|
-
*
|
|
187
|
-
* @typedef {Object} SampleFailureReasonController.UpdateData
|
|
188
|
-
* @property {string} [description] The Sample Failure Reason Description
|
|
189
|
-
* @memberof Controllers.Lab.Site
|
|
190
|
-
*/
|
|
191
|
-
|
|
192
|
-
exports.default = _default;
|
|
@@ -1,169 +0,0 @@
|
|
|
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 SampleFailureReasonModel from '../../../Models/Lab/Site/SampleFailureReasonModel';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Controller Class for Sample Failure Reasons
|
|
12
|
-
*
|
|
13
|
-
* @class
|
|
14
|
-
*/
|
|
15
|
-
class SampleFailureReasonController
|
|
16
|
-
{
|
|
17
|
-
/**
|
|
18
|
-
* Retrieve a Sample Failure Reason [GET /lab/sites/{siteId}/sample-failure-reasons/{id}]
|
|
19
|
-
*
|
|
20
|
-
* @static
|
|
21
|
-
* @public
|
|
22
|
-
* @param {number} siteId The Site ID
|
|
23
|
-
* @param {string} id The Sample Failure Reason ID
|
|
24
|
-
* @return {Promise<SampleFailureReasonModel>}
|
|
25
|
-
*/
|
|
26
|
-
static getOne(siteId, id)
|
|
27
|
-
{
|
|
28
|
-
return new Promise((resolve, reject) => {
|
|
29
|
-
RequestHelper.getRequest(`/lab/sites/${siteId}/sample-failure-reasons/${id}`)
|
|
30
|
-
.then((result) => {
|
|
31
|
-
let resolveValue = (function(){
|
|
32
|
-
return SampleFailureReasonModel.fromJSON(result, siteId);
|
|
33
|
-
}());
|
|
34
|
-
|
|
35
|
-
resolve(resolveValue);
|
|
36
|
-
})
|
|
37
|
-
.catch(error => reject(error));
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Update a Sample Failure Reason [PATCH /lab/sites/{siteId}/sample-failure-reasons/{id}]
|
|
43
|
-
*
|
|
44
|
-
* @static
|
|
45
|
-
* @public
|
|
46
|
-
* @param {number} siteId The Site ID
|
|
47
|
-
* @param {string} id The Sample Failure Reason ID
|
|
48
|
-
* @param {SampleFailureReasonController.UpdateData} updateData The Sample Failure Reason Update Data
|
|
49
|
-
* @return {Promise<SampleFailureReasonModel>}
|
|
50
|
-
*/
|
|
51
|
-
static update(siteId, id, updateData)
|
|
52
|
-
{
|
|
53
|
-
return new Promise((resolve, reject) => {
|
|
54
|
-
RequestHelper.patchRequest(`/lab/sites/${siteId}/sample-failure-reasons/${id}`, updateData)
|
|
55
|
-
.then((result) => {
|
|
56
|
-
let resolveValue = (function(){
|
|
57
|
-
return SampleFailureReasonModel.fromJSON(result, siteId);
|
|
58
|
-
}());
|
|
59
|
-
|
|
60
|
-
resolve(resolveValue);
|
|
61
|
-
})
|
|
62
|
-
.catch(error => reject(error));
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Delete a Sample Failure Reason [DELETE /lab/sites/{siteId}/sample-failure-reasons/{id}]
|
|
68
|
-
*
|
|
69
|
-
* @static
|
|
70
|
-
* @public
|
|
71
|
-
* @param {number} siteId The Site ID
|
|
72
|
-
* @param {string} id The Sample Failure Reason ID
|
|
73
|
-
* @return {Promise<boolean>}
|
|
74
|
-
*/
|
|
75
|
-
static delete(siteId, id)
|
|
76
|
-
{
|
|
77
|
-
return new Promise((resolve, reject) => {
|
|
78
|
-
RequestHelper.deleteRequest(`/lab/sites/${siteId}/sample-failure-reasons/${id}`)
|
|
79
|
-
.then((result) => {
|
|
80
|
-
resolve(result ?? true);
|
|
81
|
-
})
|
|
82
|
-
.catch(error => reject(error));
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* List all Sample Failure Reasons [GET /lab/sites/{siteId}/sample-failure-reasons]
|
|
88
|
-
*
|
|
89
|
-
* @static
|
|
90
|
-
* @public
|
|
91
|
-
* @param {number} siteId The Site ID
|
|
92
|
-
* @param {SampleFailureReasonController.GetAllQueryParameters} [queryParameters] The Optional Query Parameters
|
|
93
|
-
* @return {Promise<SampleFailureReasonModel[]>}
|
|
94
|
-
*/
|
|
95
|
-
static getAll(siteId, queryParameters = {})
|
|
96
|
-
{
|
|
97
|
-
return new Promise((resolve, reject) => {
|
|
98
|
-
RequestHelper.getRequest(`/lab/sites/${siteId}/sample-failure-reasons`, queryParameters)
|
|
99
|
-
.then((result) => {
|
|
100
|
-
let resolveValue = (function(){
|
|
101
|
-
if(Array.isArray(result) !== true)
|
|
102
|
-
{
|
|
103
|
-
return [];
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
return result.map((resultItem) => {
|
|
107
|
-
return (function(){
|
|
108
|
-
return SampleFailureReasonModel.fromJSON(resultItem, siteId);
|
|
109
|
-
}());
|
|
110
|
-
});
|
|
111
|
-
}());
|
|
112
|
-
|
|
113
|
-
resolve(resolveValue);
|
|
114
|
-
})
|
|
115
|
-
.catch(error => reject(error));
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* Create a Sample Failure Reason [POST /lab/sites/{siteId}/sample-failure-reasons]
|
|
121
|
-
*
|
|
122
|
-
* @static
|
|
123
|
-
* @public
|
|
124
|
-
* @param {number} siteId The Site ID
|
|
125
|
-
* @param {SampleFailureReasonController.CreateData} createData The Sample Failure Reason Create Data
|
|
126
|
-
* @return {Promise<SampleFailureReasonModel>}
|
|
127
|
-
*/
|
|
128
|
-
static create(siteId, createData)
|
|
129
|
-
{
|
|
130
|
-
return new Promise((resolve, reject) => {
|
|
131
|
-
RequestHelper.postRequest(`/lab/sites/${siteId}/sample-failure-reasons`, createData)
|
|
132
|
-
.then((result) => {
|
|
133
|
-
let resolveValue = (function(){
|
|
134
|
-
return SampleFailureReasonModel.fromJSON(result, siteId);
|
|
135
|
-
}());
|
|
136
|
-
|
|
137
|
-
resolve(resolveValue);
|
|
138
|
-
})
|
|
139
|
-
.catch(error => reject(error));
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
export default SampleFailureReasonController;
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
* The Optional Query Parameters for the getAll Function
|
|
148
|
-
*
|
|
149
|
-
* @typedef {Object} SampleFailureReasonController.GetAllQueryParameters
|
|
150
|
-
* @property {string} [name] The Sample Failure Reason Name
|
|
151
|
-
* @memberof Controllers.Lab.Site
|
|
152
|
-
*/
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
* The Create Data for a Sample Failure Reason
|
|
156
|
-
*
|
|
157
|
-
* @typedef {Object} SampleFailureReasonController.CreateData
|
|
158
|
-
* @property {string} [name] The Sample Failure Reason Name
|
|
159
|
-
* @property {string} description The Sample Failure Reason Description
|
|
160
|
-
* @memberof Controllers.Lab.Site
|
|
161
|
-
*/
|
|
162
|
-
|
|
163
|
-
/**
|
|
164
|
-
* The Update Data for a Sample Failure Reason
|
|
165
|
-
*
|
|
166
|
-
* @typedef {Object} SampleFailureReasonController.UpdateData
|
|
167
|
-
* @property {string} [description] The Sample Failure Reason Description
|
|
168
|
-
* @memberof Controllers.Lab.Site
|
|
169
|
-
*/
|
|
@@ -1,170 +0,0 @@
|
|
|
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 Sample Failure Reason
|
|
11
|
-
*
|
|
12
|
-
* @class
|
|
13
|
-
* @hideconstructor
|
|
14
|
-
* @extends BaseModel
|
|
15
|
-
*/
|
|
16
|
-
class SampleFailureReasonModel extends BaseModel
|
|
17
|
-
{
|
|
18
|
-
/**
|
|
19
|
-
* SampleFailureReasonModel Constructor
|
|
20
|
-
*
|
|
21
|
-
* @protected
|
|
22
|
-
* @param {number} siteId The Site ID associated with this Sample Failure Reason
|
|
23
|
-
*/
|
|
24
|
-
constructor(siteId)
|
|
25
|
-
{
|
|
26
|
-
super();
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* The Sample Failure Reason ID
|
|
30
|
-
*
|
|
31
|
-
* @type {string}
|
|
32
|
-
* @public
|
|
33
|
-
*/
|
|
34
|
-
this.id = "";
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* The Sample Failure Reason Name
|
|
38
|
-
*
|
|
39
|
-
* @type {string}
|
|
40
|
-
* @public
|
|
41
|
-
*/
|
|
42
|
-
this.name = "";
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* The Sample Failure Reason Description
|
|
46
|
-
*
|
|
47
|
-
* @type {string}
|
|
48
|
-
* @public
|
|
49
|
-
*/
|
|
50
|
-
this.description = "";
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Whether the Sample Failure Reason has been deleted
|
|
54
|
-
*
|
|
55
|
-
* @type {boolean}
|
|
56
|
-
* @public
|
|
57
|
-
*/
|
|
58
|
-
this.deleted = false;
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* When the Sample Failure Reason was last updated
|
|
62
|
-
*
|
|
63
|
-
* @type {Date}
|
|
64
|
-
* @public
|
|
65
|
-
*/
|
|
66
|
-
this.updateTimestamp = new Date();
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* The Site ID associated with this Sample Failure Reason
|
|
70
|
-
*
|
|
71
|
-
* @type {number}
|
|
72
|
-
* @public
|
|
73
|
-
*/
|
|
74
|
-
this.siteId = siteId;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Create a new **SampleFailureReasonModel** from a JSON Object or JSON String
|
|
79
|
-
*
|
|
80
|
-
* @static
|
|
81
|
-
* @public
|
|
82
|
-
* @param {Object<string, any>|string} json A JSON Object or JSON String
|
|
83
|
-
* @param {number} siteId The Site ID associated with this Sample Failure Reason
|
|
84
|
-
* @return {SampleFailureReasonModel}
|
|
85
|
-
*/
|
|
86
|
-
static fromJSON(json, siteId)
|
|
87
|
-
{
|
|
88
|
-
let model = new SampleFailureReasonModel(siteId);
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* The JSON Object
|
|
92
|
-
*
|
|
93
|
-
* @type {Object<string, any>}
|
|
94
|
-
*/
|
|
95
|
-
let jsonObject = {};
|
|
96
|
-
|
|
97
|
-
if(typeof json === 'string')
|
|
98
|
-
{
|
|
99
|
-
jsonObject = JSON.parse(json);
|
|
100
|
-
}
|
|
101
|
-
else if(typeof json === 'object')
|
|
102
|
-
{
|
|
103
|
-
jsonObject = json;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
if('id' in jsonObject)
|
|
107
|
-
{
|
|
108
|
-
model.id = (function(){
|
|
109
|
-
if(typeof jsonObject['id'] !== 'string')
|
|
110
|
-
{
|
|
111
|
-
return String(jsonObject['id']);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
return jsonObject['id'];
|
|
115
|
-
}());
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
if('name' in jsonObject)
|
|
119
|
-
{
|
|
120
|
-
model.name = (function(){
|
|
121
|
-
if(typeof jsonObject['name'] !== 'string')
|
|
122
|
-
{
|
|
123
|
-
return String(jsonObject['name']);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
return jsonObject['name'];
|
|
127
|
-
}());
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
if('description' in jsonObject)
|
|
131
|
-
{
|
|
132
|
-
model.description = (function(){
|
|
133
|
-
if(typeof jsonObject['description'] !== 'string')
|
|
134
|
-
{
|
|
135
|
-
return String(jsonObject['description']);
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
return jsonObject['description'];
|
|
139
|
-
}());
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
if('deleted' in jsonObject)
|
|
143
|
-
{
|
|
144
|
-
model.deleted = (function(){
|
|
145
|
-
if(typeof jsonObject['deleted'] !== 'boolean')
|
|
146
|
-
{
|
|
147
|
-
return Boolean(jsonObject['deleted']);
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
return jsonObject['deleted'];
|
|
151
|
-
}());
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
if('updateTimestamp' in jsonObject)
|
|
155
|
-
{
|
|
156
|
-
model.updateTimestamp = (function(){
|
|
157
|
-
if(typeof jsonObject['updateTimestamp'] !== 'string')
|
|
158
|
-
{
|
|
159
|
-
return new Date(String(jsonObject['updateTimestamp']));
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
return new Date(jsonObject['updateTimestamp']);
|
|
163
|
-
}());
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
return model;
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
export default SampleFailureReasonModel;
|