@ricado/api-client 2.3.27 → 2.4.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/DehydratorController.js +198 -0
- package/lib/Controllers/Lab/Site/FruitProfileController.js +204 -0
- package/lib/Controllers/Lab/Site/LabController.js +222 -0
- package/lib/Controllers/Lab/Site/RackController.js +222 -0
- package/lib/Controllers/Lab/Site/RackPositionController.js +207 -0
- package/lib/Controllers/Lab/Site/SampleController.js +927 -0
- package/lib/Controllers/Lab/Site/SampleFailureReasonController.js +192 -0
- package/lib/Controllers/Lab/Site/SampleResultController.js +905 -0
- package/lib/Controllers/Lab/Site/index.js +46 -0
- package/lib/Controllers/Lab/index.js +25 -0
- package/lib/Controllers/Packhouse/Site/CompacSizerController.js +2 -2
- package/lib/Controllers/Packhouse/Site/MAFSizerController.js +2 -2
- package/lib/Controllers/Packhouse/Site/ShiftController.js +304 -0
- package/lib/Controllers/index.js +9 -6
- package/lib/Models/Lab/Site/DehydratorModel.js +250 -0
- package/lib/Models/Lab/Site/FruitProfileModel.js +303 -0
- package/lib/Models/Lab/Site/LabModel.js +365 -0
- package/lib/Models/Lab/Site/RackModel.js +358 -0
- package/lib/Models/Lab/Site/RackPositionModel.js +525 -0
- package/lib/Models/Lab/Site/SampleFailureReasonModel.js +195 -0
- package/lib/Models/Lab/Site/SampleModel.js +545 -0
- package/lib/Models/Lab/Site/SampleResultModel.js +545 -0
- package/lib/Models/Lab/Site/index.js +46 -0
- package/lib/Models/Lab/index.js +25 -0
- package/lib/Models/Packhouse/Site/CompacSizerModel.js +18 -1
- package/lib/Models/Packhouse/Site/MAFSizerModel.js +18 -1
- package/lib/Models/index.js +7 -4
- package/lib/PackageVersion.js +1 -1
- package/lib/index.d.ts +10491 -7674
- package/package.json +1 -1
- package/src/Controllers/Lab/Site/DehydratorController.js +175 -0
- package/src/Controllers/Lab/Site/FruitProfileController.js +181 -0
- package/src/Controllers/Lab/Site/LabController.js +199 -0
- package/src/Controllers/Lab/Site/RackController.js +199 -0
- package/src/Controllers/Lab/Site/RackPositionController.js +184 -0
- package/src/Controllers/Lab/Site/SampleController.js +1067 -0
- package/src/Controllers/Lab/Site/SampleFailureReasonController.js +169 -0
- package/src/Controllers/Lab/Site/SampleResultController.js +1036 -0
- package/src/Controllers/Lab/Site/index.js +30 -0
- package/src/Controllers/Lab/index.js +16 -0
- package/src/Controllers/Packhouse/Site/CompacSizerController.js +2 -2
- package/src/Controllers/Packhouse/Site/MAFSizerController.js +2 -2
- package/src/Controllers/Packhouse/Site/ShiftController.js +367 -0
- package/src/Controllers/index.js +2 -0
- package/src/Models/Lab/Site/DehydratorModel.js +234 -0
- package/src/Models/Lab/Site/FruitProfileModel.js +290 -0
- package/src/Models/Lab/Site/LabModel.js +372 -0
- package/src/Models/Lab/Site/RackModel.js +358 -0
- package/src/Models/Lab/Site/RackPositionModel.js +600 -0
- package/src/Models/Lab/Site/SampleFailureReasonModel.js +170 -0
- package/src/Models/Lab/Site/SampleModel.js +565 -0
- package/src/Models/Lab/Site/SampleResultModel.js +565 -0
- package/src/Models/Lab/Site/index.js +30 -0
- package/src/Models/Lab/index.js +16 -0
- package/src/Models/Packhouse/Site/CompacSizerModel.js +24 -1
- package/src/Models/Packhouse/Site/MAFSizerModel.js +24 -1
- package/src/Models/index.js +2 -0
- package/src/PackageVersion.js +1 -1
package/package.json
CHANGED
|
@@ -0,0 +1,175 @@
|
|
|
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 DehydratorModel from '../../../Models/Lab/Site/DehydratorModel';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Controller Class for Dehydrators
|
|
12
|
+
*
|
|
13
|
+
* @class
|
|
14
|
+
*/
|
|
15
|
+
class DehydratorController
|
|
16
|
+
{
|
|
17
|
+
/**
|
|
18
|
+
* Retrieve a Dehydrator [GET /lab/sites/{siteId}/dehydrators/{id}]
|
|
19
|
+
*
|
|
20
|
+
* @static
|
|
21
|
+
* @public
|
|
22
|
+
* @param {number} siteId The Site ID
|
|
23
|
+
* @param {string} id The Dehydrator ID
|
|
24
|
+
* @return {Promise<DehydratorModel>}
|
|
25
|
+
*/
|
|
26
|
+
static getOne(siteId, id)
|
|
27
|
+
{
|
|
28
|
+
return new Promise((resolve, reject) => {
|
|
29
|
+
RequestHelper.getRequest(`/lab/sites/${siteId}/dehydrators/${id}`)
|
|
30
|
+
.then((result) => {
|
|
31
|
+
let resolveValue = (function(){
|
|
32
|
+
return DehydratorModel.fromJSON(result, siteId);
|
|
33
|
+
}());
|
|
34
|
+
|
|
35
|
+
resolve(resolveValue);
|
|
36
|
+
})
|
|
37
|
+
.catch(error => reject(error));
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Update a Dehydrator [PATCH /lab/sites/{siteId}/dehydrators/{id}]
|
|
43
|
+
*
|
|
44
|
+
* @static
|
|
45
|
+
* @public
|
|
46
|
+
* @param {number} siteId The Site ID
|
|
47
|
+
* @param {string} id The Dehydrator ID
|
|
48
|
+
* @param {DehydratorController.UpdateData} updateData The Dehydrator Update Data
|
|
49
|
+
* @return {Promise<DehydratorModel>}
|
|
50
|
+
*/
|
|
51
|
+
static update(siteId, id, updateData)
|
|
52
|
+
{
|
|
53
|
+
return new Promise((resolve, reject) => {
|
|
54
|
+
RequestHelper.patchRequest(`/lab/sites/${siteId}/dehydrators/${id}`, updateData)
|
|
55
|
+
.then((result) => {
|
|
56
|
+
let resolveValue = (function(){
|
|
57
|
+
return DehydratorModel.fromJSON(result, siteId);
|
|
58
|
+
}());
|
|
59
|
+
|
|
60
|
+
resolve(resolveValue);
|
|
61
|
+
})
|
|
62
|
+
.catch(error => reject(error));
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Delete a Dehydrator [DELETE /lab/sites/{siteId}/dehydrators/{id}]
|
|
68
|
+
*
|
|
69
|
+
* @static
|
|
70
|
+
* @public
|
|
71
|
+
* @param {number} siteId The Site ID
|
|
72
|
+
* @param {string} id The Dehydrator ID
|
|
73
|
+
* @return {Promise<boolean>}
|
|
74
|
+
*/
|
|
75
|
+
static delete(siteId, id)
|
|
76
|
+
{
|
|
77
|
+
return new Promise((resolve, reject) => {
|
|
78
|
+
RequestHelper.deleteRequest(`/lab/sites/${siteId}/dehydrators/${id}`)
|
|
79
|
+
.then((result) => {
|
|
80
|
+
resolve(result ?? true);
|
|
81
|
+
})
|
|
82
|
+
.catch(error => reject(error));
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* List all Dehydrators [GET /lab/sites/{siteId}/dehydrators]
|
|
88
|
+
*
|
|
89
|
+
* @static
|
|
90
|
+
* @public
|
|
91
|
+
* @param {number} siteId The Site ID
|
|
92
|
+
* @param {DehydratorController.GetAllQueryParameters} [queryParameters] The Optional Query Parameters
|
|
93
|
+
* @return {Promise<DehydratorModel[]>}
|
|
94
|
+
*/
|
|
95
|
+
static getAll(siteId, queryParameters = {})
|
|
96
|
+
{
|
|
97
|
+
return new Promise((resolve, reject) => {
|
|
98
|
+
RequestHelper.getRequest(`/lab/sites/${siteId}/dehydrators`, 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 DehydratorModel.fromJSON(resultItem, siteId);
|
|
109
|
+
}());
|
|
110
|
+
});
|
|
111
|
+
}());
|
|
112
|
+
|
|
113
|
+
resolve(resolveValue);
|
|
114
|
+
})
|
|
115
|
+
.catch(error => reject(error));
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Create a Dehydrator [POST /lab/sites/{siteId}/dehydrators]
|
|
121
|
+
*
|
|
122
|
+
* @static
|
|
123
|
+
* @public
|
|
124
|
+
* @param {number} siteId The Site ID
|
|
125
|
+
* @param {DehydratorController.CreateData} createData The Dehydrator Create Data
|
|
126
|
+
* @return {Promise<DehydratorModel>}
|
|
127
|
+
*/
|
|
128
|
+
static create(siteId, createData)
|
|
129
|
+
{
|
|
130
|
+
return new Promise((resolve, reject) => {
|
|
131
|
+
RequestHelper.postRequest(`/lab/sites/${siteId}/dehydrators`, createData)
|
|
132
|
+
.then((result) => {
|
|
133
|
+
let resolveValue = (function(){
|
|
134
|
+
return DehydratorModel.fromJSON(result, siteId);
|
|
135
|
+
}());
|
|
136
|
+
|
|
137
|
+
resolve(resolveValue);
|
|
138
|
+
})
|
|
139
|
+
.catch(error => reject(error));
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export default DehydratorController;
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* The Optional Query Parameters for the getAll Function
|
|
148
|
+
*
|
|
149
|
+
* @typedef {Object} DehydratorController.GetAllQueryParameters
|
|
150
|
+
* @property {?number} [rtuId] The RTU this Dehydrator belongs to
|
|
151
|
+
* @property {string} [name] The Name of this Dehydrator
|
|
152
|
+
* @property {string} [labId] The Lab that owns this Dehydrator
|
|
153
|
+
* @memberof Controllers.Lab.Site
|
|
154
|
+
*/
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* The Create Data for a Dehydrator
|
|
158
|
+
*
|
|
159
|
+
* @typedef {Object} DehydratorController.CreateData
|
|
160
|
+
* @property {?number} [rtuId] The RTU this Dehydrator belongs to
|
|
161
|
+
* @property {string} name The Name of this Dehydrator
|
|
162
|
+
* @property {{rackPositionId: number}} points The Points used by this Dehydrator
|
|
163
|
+
* @property {string} labId The Lab that owns this Dehydrator
|
|
164
|
+
* @memberof Controllers.Lab.Site
|
|
165
|
+
*/
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* The Update Data for a Dehydrator
|
|
169
|
+
*
|
|
170
|
+
* @typedef {Object} DehydratorController.UpdateData
|
|
171
|
+
* @property {string} [name] The Name of this Dehydrator
|
|
172
|
+
* @property {{rackPositionId: number}} [points] The Points used by this Dehydrator
|
|
173
|
+
* @property {string} [labId] The Lab that owns this Dehydrator
|
|
174
|
+
* @memberof Controllers.Lab.Site
|
|
175
|
+
*/
|
|
@@ -0,0 +1,181 @@
|
|
|
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 FruitProfileModel from '../../../Models/Lab/Site/FruitProfileModel';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Controller Class for Fruit Profiles
|
|
12
|
+
*
|
|
13
|
+
* @class
|
|
14
|
+
*/
|
|
15
|
+
class FruitProfileController
|
|
16
|
+
{
|
|
17
|
+
/**
|
|
18
|
+
* Retrieve a Fruit Profile [GET /lab/sites/{siteId}/fruit-profiles/{id}]
|
|
19
|
+
*
|
|
20
|
+
* @static
|
|
21
|
+
* @public
|
|
22
|
+
* @param {number} siteId The Site ID
|
|
23
|
+
* @param {string} id The Fruit Profile ID
|
|
24
|
+
* @return {Promise<FruitProfileModel>}
|
|
25
|
+
*/
|
|
26
|
+
static getOne(siteId, id)
|
|
27
|
+
{
|
|
28
|
+
return new Promise((resolve, reject) => {
|
|
29
|
+
RequestHelper.getRequest(`/lab/sites/${siteId}/fruit-profiles/${id}`)
|
|
30
|
+
.then((result) => {
|
|
31
|
+
let resolveValue = (function(){
|
|
32
|
+
return FruitProfileModel.fromJSON(result, siteId);
|
|
33
|
+
}());
|
|
34
|
+
|
|
35
|
+
resolve(resolveValue);
|
|
36
|
+
})
|
|
37
|
+
.catch(error => reject(error));
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Update a Fruit Profile [PATCH /lab/sites/{siteId}/fruit-profiles/{id}]
|
|
43
|
+
*
|
|
44
|
+
* @static
|
|
45
|
+
* @public
|
|
46
|
+
* @param {number} siteId The Site ID
|
|
47
|
+
* @param {string} id The Fruit Profile ID
|
|
48
|
+
* @param {FruitProfileController.UpdateData} updateData The Fruit Profile Update Data
|
|
49
|
+
* @return {Promise<FruitProfileModel>}
|
|
50
|
+
*/
|
|
51
|
+
static update(siteId, id, updateData)
|
|
52
|
+
{
|
|
53
|
+
return new Promise((resolve, reject) => {
|
|
54
|
+
RequestHelper.patchRequest(`/lab/sites/${siteId}/fruit-profiles/${id}`, updateData)
|
|
55
|
+
.then((result) => {
|
|
56
|
+
let resolveValue = (function(){
|
|
57
|
+
return FruitProfileModel.fromJSON(result, siteId);
|
|
58
|
+
}());
|
|
59
|
+
|
|
60
|
+
resolve(resolveValue);
|
|
61
|
+
})
|
|
62
|
+
.catch(error => reject(error));
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Delete a Fruit Profile [DELETE /lab/sites/{siteId}/fruit-profiles/{id}]
|
|
68
|
+
*
|
|
69
|
+
* @static
|
|
70
|
+
* @public
|
|
71
|
+
* @param {number} siteId The Site ID
|
|
72
|
+
* @param {string} id The Fruit Profile ID
|
|
73
|
+
* @return {Promise<boolean>}
|
|
74
|
+
*/
|
|
75
|
+
static delete(siteId, id)
|
|
76
|
+
{
|
|
77
|
+
return new Promise((resolve, reject) => {
|
|
78
|
+
RequestHelper.deleteRequest(`/lab/sites/${siteId}/fruit-profiles/${id}`)
|
|
79
|
+
.then((result) => {
|
|
80
|
+
resolve(result ?? true);
|
|
81
|
+
})
|
|
82
|
+
.catch(error => reject(error));
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* List all Fruit Profiles [GET /lab/sites/{siteId}/fruit-profiles]
|
|
88
|
+
*
|
|
89
|
+
* @static
|
|
90
|
+
* @public
|
|
91
|
+
* @param {number} siteId The Site ID
|
|
92
|
+
* @param {FruitProfileController.GetAllQueryParameters} [queryParameters] The Optional Query Parameters
|
|
93
|
+
* @return {Promise<FruitProfileModel[]>}
|
|
94
|
+
*/
|
|
95
|
+
static getAll(siteId, queryParameters = {})
|
|
96
|
+
{
|
|
97
|
+
return new Promise((resolve, reject) => {
|
|
98
|
+
RequestHelper.getRequest(`/lab/sites/${siteId}/fruit-profiles`, 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 FruitProfileModel.fromJSON(resultItem, siteId);
|
|
109
|
+
}());
|
|
110
|
+
});
|
|
111
|
+
}());
|
|
112
|
+
|
|
113
|
+
resolve(resolveValue);
|
|
114
|
+
})
|
|
115
|
+
.catch(error => reject(error));
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Create a Fruit Profile [POST /lab/sites/{siteId}/fruit-profiles]
|
|
121
|
+
*
|
|
122
|
+
* @static
|
|
123
|
+
* @public
|
|
124
|
+
* @param {number} siteId The Site ID
|
|
125
|
+
* @param {FruitProfileController.CreateData} createData The Fruit Profile Create Data
|
|
126
|
+
* @return {Promise<FruitProfileModel>}
|
|
127
|
+
*/
|
|
128
|
+
static create(siteId, createData)
|
|
129
|
+
{
|
|
130
|
+
return new Promise((resolve, reject) => {
|
|
131
|
+
RequestHelper.postRequest(`/lab/sites/${siteId}/fruit-profiles`, createData)
|
|
132
|
+
.then((result) => {
|
|
133
|
+
let resolveValue = (function(){
|
|
134
|
+
return FruitProfileModel.fromJSON(result, siteId);
|
|
135
|
+
}());
|
|
136
|
+
|
|
137
|
+
resolve(resolveValue);
|
|
138
|
+
})
|
|
139
|
+
.catch(error => reject(error));
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export default FruitProfileController;
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* The Optional Query Parameters for the getAll Function
|
|
148
|
+
*
|
|
149
|
+
* @typedef {Object} FruitProfileController.GetAllQueryParameters
|
|
150
|
+
* @property {string} [name] The Fruit Profile Name
|
|
151
|
+
* @memberof Controllers.Lab.Site
|
|
152
|
+
*/
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* The Create Data for a Fruit Profile
|
|
156
|
+
*
|
|
157
|
+
* @typedef {Object} FruitProfileController.CreateData
|
|
158
|
+
* @property {string} [name] The Fruit Profile Name
|
|
159
|
+
* @property {string} description The Fruit Profile Description
|
|
160
|
+
* @property {string} image The Fruit Profile Image Source
|
|
161
|
+
* @property {number} nominalWarmUpDuration The Typical Warm Up Duration (in seconds) for a Sample to reach the Minimum Target Temperature
|
|
162
|
+
* @property {number} minimumWithinTargetDuration The Minimum Duration (in seconds) that a Sample should be within the Min and Max Target Temperatures be Successful
|
|
163
|
+
* @property {number} maximumTotalDuration The Maximum Duration (in seconds) that a Sample should be Dehydrated for before it Fails
|
|
164
|
+
* @property {number} minimumTargetTemperature The Minimum Target Temperature for a Sample to be Successful
|
|
165
|
+
* @property {number} maximumTargetTemperature The Maximum Target Temperature for a Sample to be Successful
|
|
166
|
+
* @memberof Controllers.Lab.Site
|
|
167
|
+
*/
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* The Update Data for a Fruit Profile
|
|
171
|
+
*
|
|
172
|
+
* @typedef {Object} FruitProfileController.UpdateData
|
|
173
|
+
* @property {string} [description] The Fruit Profile Description
|
|
174
|
+
* @property {string} [image] The Fruit Profile Image Source
|
|
175
|
+
* @property {number} [nominalWarmUpDuration] The Typical Warm Up Duration (in seconds) for a Sample to reach the Minimum Target Temperature
|
|
176
|
+
* @property {number} [minimumWithinTargetDuration] The Minimum Duration (in seconds) that a Sample should be within the Min and Max Target Temperatures be Successful
|
|
177
|
+
* @property {number} [maximumTotalDuration] The Maximum Duration (in seconds) that a Sample should be Dehydrated for before it Fails
|
|
178
|
+
* @property {number} [minimumTargetTemperature] The Minimum Target Temperature for a Sample to be Successful
|
|
179
|
+
* @property {number} [maximumTargetTemperature] The Maximum Target Temperature for a Sample to be Successful
|
|
180
|
+
* @memberof Controllers.Lab.Site
|
|
181
|
+
*/
|
|
@@ -0,0 +1,199 @@
|
|
|
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 LabModel from '../../../Models/Lab/Site/LabModel';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Controller Class for Labs
|
|
12
|
+
*
|
|
13
|
+
* @class
|
|
14
|
+
*/
|
|
15
|
+
class LabController
|
|
16
|
+
{
|
|
17
|
+
/**
|
|
18
|
+
* Retrieve a Lab [GET /lab/sites/{siteId}/labs/{id}]
|
|
19
|
+
*
|
|
20
|
+
* @static
|
|
21
|
+
* @public
|
|
22
|
+
* @param {number} siteId The Site ID
|
|
23
|
+
* @param {string} id The Lab ID
|
|
24
|
+
* @return {Promise<LabModel>}
|
|
25
|
+
*/
|
|
26
|
+
static getOne(siteId, id)
|
|
27
|
+
{
|
|
28
|
+
return new Promise((resolve, reject) => {
|
|
29
|
+
RequestHelper.getRequest(`/lab/sites/${siteId}/labs/${id}`)
|
|
30
|
+
.then((result) => {
|
|
31
|
+
let resolveValue = (function(){
|
|
32
|
+
return LabModel.fromJSON(result, siteId);
|
|
33
|
+
}());
|
|
34
|
+
|
|
35
|
+
resolve(resolveValue);
|
|
36
|
+
})
|
|
37
|
+
.catch(error => reject(error));
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Update a Lab [PATCH /lab/sites/{siteId}/labs/{id}]
|
|
43
|
+
*
|
|
44
|
+
* @static
|
|
45
|
+
* @public
|
|
46
|
+
* @param {number} siteId The Site ID
|
|
47
|
+
* @param {string} id The Lab ID
|
|
48
|
+
* @param {LabController.UpdateData} updateData The Lab Update Data
|
|
49
|
+
* @return {Promise<LabModel>}
|
|
50
|
+
*/
|
|
51
|
+
static update(siteId, id, updateData)
|
|
52
|
+
{
|
|
53
|
+
return new Promise((resolve, reject) => {
|
|
54
|
+
RequestHelper.patchRequest(`/lab/sites/${siteId}/labs/${id}`, updateData)
|
|
55
|
+
.then((result) => {
|
|
56
|
+
let resolveValue = (function(){
|
|
57
|
+
return LabModel.fromJSON(result, siteId);
|
|
58
|
+
}());
|
|
59
|
+
|
|
60
|
+
resolve(resolveValue);
|
|
61
|
+
})
|
|
62
|
+
.catch(error => reject(error));
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Delete a Lab [DELETE /lab/sites/{siteId}/labs/{id}]
|
|
68
|
+
*
|
|
69
|
+
* @static
|
|
70
|
+
* @public
|
|
71
|
+
* @param {number} siteId The Site ID
|
|
72
|
+
* @param {string} id The Lab ID
|
|
73
|
+
* @return {Promise<boolean>}
|
|
74
|
+
*/
|
|
75
|
+
static delete(siteId, id)
|
|
76
|
+
{
|
|
77
|
+
return new Promise((resolve, reject) => {
|
|
78
|
+
RequestHelper.deleteRequest(`/lab/sites/${siteId}/labs/${id}`)
|
|
79
|
+
.then((result) => {
|
|
80
|
+
resolve(result ?? true);
|
|
81
|
+
})
|
|
82
|
+
.catch(error => reject(error));
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* List all Labs [GET /lab/sites/{siteId}/labs]
|
|
88
|
+
*
|
|
89
|
+
* @static
|
|
90
|
+
* @public
|
|
91
|
+
* @param {number} siteId The Site ID
|
|
92
|
+
* @param {LabController.GetAllQueryParameters} [queryParameters] The Optional Query Parameters
|
|
93
|
+
* @return {Promise<LabModel[]>}
|
|
94
|
+
*/
|
|
95
|
+
static getAll(siteId, queryParameters = {})
|
|
96
|
+
{
|
|
97
|
+
return new Promise((resolve, reject) => {
|
|
98
|
+
RequestHelper.getRequest(`/lab/sites/${siteId}/labs`, 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 LabModel.fromJSON(resultItem, siteId);
|
|
109
|
+
}());
|
|
110
|
+
});
|
|
111
|
+
}());
|
|
112
|
+
|
|
113
|
+
resolve(resolveValue);
|
|
114
|
+
})
|
|
115
|
+
.catch(error => reject(error));
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Create a Lab [POST /lab/sites/{siteId}/labs]
|
|
121
|
+
*
|
|
122
|
+
* @static
|
|
123
|
+
* @public
|
|
124
|
+
* @param {number} siteId The Site ID
|
|
125
|
+
* @param {LabController.CreateData} createData The Lab Create Data
|
|
126
|
+
* @return {Promise<LabModel>}
|
|
127
|
+
*/
|
|
128
|
+
static create(siteId, createData)
|
|
129
|
+
{
|
|
130
|
+
return new Promise((resolve, reject) => {
|
|
131
|
+
RequestHelper.postRequest(`/lab/sites/${siteId}/labs`, createData)
|
|
132
|
+
.then((result) => {
|
|
133
|
+
let resolveValue = (function(){
|
|
134
|
+
return LabModel.fromJSON(result, siteId);
|
|
135
|
+
}());
|
|
136
|
+
|
|
137
|
+
resolve(resolveValue);
|
|
138
|
+
})
|
|
139
|
+
.catch(error => reject(error));
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export default LabController;
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* The Optional Query Parameters for the getAll Function
|
|
148
|
+
*
|
|
149
|
+
* @typedef {Object} LabController.GetAllQueryParameters
|
|
150
|
+
* @property {?number} [rtuId] The RTU this Lab belongs to
|
|
151
|
+
* @property {string} [name] The Lab Name
|
|
152
|
+
* @memberof Controllers.Lab.Site
|
|
153
|
+
*/
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* The Create Data for a Lab
|
|
157
|
+
*
|
|
158
|
+
* @typedef {Object} LabController.CreateData
|
|
159
|
+
* @property {?number} [rtuId] The RTU this Lab belongs to
|
|
160
|
+
* @property {string} name The Lab Name
|
|
161
|
+
* @property {string} [shortName] A Short Name for the Lab Name. Typically used in Reports and Tables showing multiple Labs
|
|
162
|
+
* @property {Object} points The Points used by this Lab
|
|
163
|
+
* @property {Array<LabController.RackReference>} [racks] The Rack Objects that belong to this Lab
|
|
164
|
+
* @property {string[]} [alarmGroups] The Alarm Groups that are used by this Lab
|
|
165
|
+
* @property {?LabController.InspectIntegration} [inspectIntegration] The Inspect Integration Configuration for this Lab
|
|
166
|
+
* @memberof Controllers.Lab.Site
|
|
167
|
+
*/
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* The Update Data for a Lab
|
|
171
|
+
*
|
|
172
|
+
* @typedef {Object} LabController.UpdateData
|
|
173
|
+
* @property {string} [name] The Lab Name
|
|
174
|
+
* @property {string} [shortName] A Short Name for the Lab Name. Typically used in Reports and Tables showing multiple Labs
|
|
175
|
+
* @property {Object} [points] The Points used by this Lab
|
|
176
|
+
* @property {Array<LabController.RackReference>} [racks] The Rack Objects that belong to this Lab
|
|
177
|
+
* @property {string[]} [alarmGroups] The Alarm Groups that are used by this Lab
|
|
178
|
+
* @property {?LabController.InspectIntegration} [inspectIntegration] The Inspect Integration Configuration for this Lab
|
|
179
|
+
* @memberof Controllers.Lab.Site
|
|
180
|
+
*/
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* A **RackReference** Type
|
|
184
|
+
*
|
|
185
|
+
* @typedef {Object} LabController.RackReference
|
|
186
|
+
* @property {string} id ID of a Rack Object
|
|
187
|
+
* @property {number} displayOrder Display Order of the Rack
|
|
188
|
+
* @memberof Controllers.Lab.Site
|
|
189
|
+
*/
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* A **InspectIntegration** Type
|
|
193
|
+
*
|
|
194
|
+
* @typedef {Object} LabController.InspectIntegration
|
|
195
|
+
* @property {Object} points The Points used for this Inspect Integration
|
|
196
|
+
* @property {boolean} enabled Whether the Inspect Integration is Enabled on this Lab
|
|
197
|
+
* @property {string} apiBaseUrl Base URL of the Inspect API
|
|
198
|
+
* @memberof Controllers.Lab.Site
|
|
199
|
+
*/
|