@ricado/api-client 2.4.2 → 2.5.1
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 +10 -8
- package/lib/Controllers/Lab/Site/LabController.js +5 -2
- package/lib/Controllers/Lab/Site/RackPositionController.js +2 -2
- package/lib/Controllers/Lab/Site/SampleController.js +7 -15
- package/lib/Controllers/Lab/Site/SampleResultController.js +29 -27
- package/lib/Controllers/Lab/Site/index.js +0 -3
- package/lib/Models/Lab/Site/FruitProfileModel.js +22 -4
- package/lib/Models/Lab/Site/LabModel.js +100 -11
- package/lib/Models/Lab/Site/RackPositionModel.js +67 -15
- package/lib/Models/Lab/Site/SampleModel.js +9 -75
- package/lib/Models/Lab/Site/SampleResultModel.js +45 -23
- package/lib/Models/Lab/Site/index.js +0 -3
- package/lib/PackageVersion.js +1 -1
- package/lib/index.d.ts +150 -315
- package/package.json +1 -1
- package/src/Controllers/Lab/Site/FruitProfileController.js +10 -8
- package/src/Controllers/Lab/Site/LabController.js +5 -2
- package/src/Controllers/Lab/Site/RackPositionController.js +2 -2
- package/src/Controllers/Lab/Site/SampleController.js +7 -15
- package/src/Controllers/Lab/Site/SampleResultController.js +29 -27
- package/src/Controllers/Lab/Site/index.js +0 -2
- package/src/Models/Lab/Site/FruitProfileModel.js +24 -4
- package/src/Models/Lab/Site/LabModel.js +132 -11
- package/src/Models/Lab/Site/RackPositionModel.js +87 -15
- package/src/Models/Lab/Site/SampleModel.js +9 -84
- package/src/Models/Lab/Site/SampleResultModel.js +48 -23
- package/src/Models/Lab/Site/index.js +0 -2
- package/src/PackageVersion.js +1 -1
- package/lib/Controllers/Lab/Site/SampleFailureReasonController.js +0 -193
- package/lib/Models/Lab/Site/SampleFailureReasonModel.js +0 -195
- package/src/Controllers/Lab/Site/SampleFailureReasonController.js +0 -170
- package/src/Models/Lab/Site/SampleFailureReasonModel.js +0 -170
|
@@ -1,193 +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} [name] The Sample Failure Reason Name
|
|
189
|
-
* @property {string} [description] The Sample Failure Reason Description
|
|
190
|
-
* @memberof Controllers.Lab.Site
|
|
191
|
-
*/
|
|
192
|
-
|
|
193
|
-
exports.default = _default;
|
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _BaseModel2 = _interopRequireDefault(require("../../../Models/BaseModel"));
|
|
9
|
-
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
|
|
12
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(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
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
21
|
-
|
|
22
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
23
|
-
|
|
24
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
25
|
-
|
|
26
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
27
|
-
|
|
28
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
29
|
-
|
|
30
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
31
|
-
|
|
32
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Model Class for a Sample Failure Reason
|
|
36
|
-
*
|
|
37
|
-
* @class
|
|
38
|
-
* @hideconstructor
|
|
39
|
-
* @extends BaseModel
|
|
40
|
-
*/
|
|
41
|
-
var SampleFailureReasonModel = /*#__PURE__*/function (_BaseModel) {
|
|
42
|
-
_inherits(SampleFailureReasonModel, _BaseModel);
|
|
43
|
-
|
|
44
|
-
var _super = _createSuper(SampleFailureReasonModel);
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* SampleFailureReasonModel Constructor
|
|
48
|
-
*
|
|
49
|
-
* @protected
|
|
50
|
-
* @param {number} siteId The Site ID associated with this Sample Failure Reason
|
|
51
|
-
*/
|
|
52
|
-
function SampleFailureReasonModel(siteId) {
|
|
53
|
-
var _this;
|
|
54
|
-
|
|
55
|
-
_classCallCheck(this, SampleFailureReasonModel);
|
|
56
|
-
|
|
57
|
-
_this = _super.call(this);
|
|
58
|
-
/**
|
|
59
|
-
* The Sample Failure Reason ID
|
|
60
|
-
*
|
|
61
|
-
* @type {string}
|
|
62
|
-
* @public
|
|
63
|
-
*/
|
|
64
|
-
|
|
65
|
-
_this.id = "";
|
|
66
|
-
/**
|
|
67
|
-
* The Sample Failure Reason Name
|
|
68
|
-
*
|
|
69
|
-
* @type {string}
|
|
70
|
-
* @public
|
|
71
|
-
*/
|
|
72
|
-
|
|
73
|
-
_this.name = "";
|
|
74
|
-
/**
|
|
75
|
-
* The Sample Failure Reason Description
|
|
76
|
-
*
|
|
77
|
-
* @type {string}
|
|
78
|
-
* @public
|
|
79
|
-
*/
|
|
80
|
-
|
|
81
|
-
_this.description = "";
|
|
82
|
-
/**
|
|
83
|
-
* Whether the Sample Failure Reason has been deleted
|
|
84
|
-
*
|
|
85
|
-
* @type {boolean}
|
|
86
|
-
* @public
|
|
87
|
-
*/
|
|
88
|
-
|
|
89
|
-
_this.deleted = false;
|
|
90
|
-
/**
|
|
91
|
-
* When the Sample Failure Reason was last updated
|
|
92
|
-
*
|
|
93
|
-
* @type {Date}
|
|
94
|
-
* @public
|
|
95
|
-
*/
|
|
96
|
-
|
|
97
|
-
_this.updateTimestamp = new Date();
|
|
98
|
-
/**
|
|
99
|
-
* The Site ID associated with this Sample Failure Reason
|
|
100
|
-
*
|
|
101
|
-
* @type {number}
|
|
102
|
-
* @public
|
|
103
|
-
*/
|
|
104
|
-
|
|
105
|
-
_this.siteId = siteId;
|
|
106
|
-
return _this;
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* Create a new **SampleFailureReasonModel** from a JSON Object or JSON String
|
|
110
|
-
*
|
|
111
|
-
* @static
|
|
112
|
-
* @public
|
|
113
|
-
* @param {Object<string, any>|string} json A JSON Object or JSON String
|
|
114
|
-
* @param {number} siteId The Site ID associated with this Sample Failure Reason
|
|
115
|
-
* @return {SampleFailureReasonModel}
|
|
116
|
-
*/
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
_createClass(SampleFailureReasonModel, null, [{
|
|
120
|
-
key: "fromJSON",
|
|
121
|
-
value: function fromJSON(json, siteId) {
|
|
122
|
-
var model = new SampleFailureReasonModel(siteId);
|
|
123
|
-
/**
|
|
124
|
-
* The JSON Object
|
|
125
|
-
*
|
|
126
|
-
* @type {Object<string, any>}
|
|
127
|
-
*/
|
|
128
|
-
|
|
129
|
-
var jsonObject = {};
|
|
130
|
-
|
|
131
|
-
if (typeof json === 'string') {
|
|
132
|
-
jsonObject = JSON.parse(json);
|
|
133
|
-
} else if (_typeof(json) === 'object') {
|
|
134
|
-
jsonObject = json;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
if ('id' in jsonObject) {
|
|
138
|
-
model.id = function () {
|
|
139
|
-
if (typeof jsonObject['id'] !== 'string') {
|
|
140
|
-
return String(jsonObject['id']);
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
return jsonObject['id'];
|
|
144
|
-
}();
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
if ('name' in jsonObject) {
|
|
148
|
-
model.name = function () {
|
|
149
|
-
if (typeof jsonObject['name'] !== 'string') {
|
|
150
|
-
return String(jsonObject['name']);
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
return jsonObject['name'];
|
|
154
|
-
}();
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
if ('description' in jsonObject) {
|
|
158
|
-
model.description = function () {
|
|
159
|
-
if (typeof jsonObject['description'] !== 'string') {
|
|
160
|
-
return String(jsonObject['description']);
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
return jsonObject['description'];
|
|
164
|
-
}();
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
if ('deleted' in jsonObject) {
|
|
168
|
-
model.deleted = function () {
|
|
169
|
-
if (typeof jsonObject['deleted'] !== 'boolean') {
|
|
170
|
-
return Boolean(jsonObject['deleted']);
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
return jsonObject['deleted'];
|
|
174
|
-
}();
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
if ('updateTimestamp' in jsonObject) {
|
|
178
|
-
model.updateTimestamp = function () {
|
|
179
|
-
if (typeof jsonObject['updateTimestamp'] !== 'string') {
|
|
180
|
-
return new Date(String(jsonObject['updateTimestamp']));
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
return new Date(jsonObject['updateTimestamp']);
|
|
184
|
-
}();
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
return model;
|
|
188
|
-
}
|
|
189
|
-
}]);
|
|
190
|
-
|
|
191
|
-
return SampleFailureReasonModel;
|
|
192
|
-
}(_BaseModel2.default);
|
|
193
|
-
|
|
194
|
-
var _default = SampleFailureReasonModel;
|
|
195
|
-
exports.default = _default;
|
|
@@ -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 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} [name] The Sample Failure Reason Name
|
|
168
|
-
* @property {string} [description] The Sample Failure Reason Description
|
|
169
|
-
* @memberof Controllers.Lab.Site
|
|
170
|
-
*/
|