Skip to content

Commit

Permalink
Added support for MAF Sizers
Browse files Browse the repository at this point in the history
  • Loading branch information
ashneilson committed Mar 30, 2022
1 parent f3fa29d commit a685bb2
Show file tree
Hide file tree
Showing 10 changed files with 5,124 additions and 0 deletions.
1,057 changes: 1,057 additions & 0 deletions src/Controllers/Packhouse/Site/MAFSizerBatchController.js

Large diffs are not rendered by default.

194 changes: 194 additions & 0 deletions src/Controllers/Packhouse/Site/MAFSizerController.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,194 @@
/**
* File Auto-Generated by the RICADO Gen 4 PHP API Project
*
* Do Not Edit this File Manually!
*/

import RequestHelper from '../../../RequestHelper';
import MAFSizerModel from '../../../Models/Packhouse/Site/MAFSizerModel';

/**
* Controller Class for MAF Sizers
*
* @class
*/
class MAFSizerController
{
/**
* Retrieve a MAF Sizer [GET /packhouse/sites/{siteId}/maf-sizers/{id}]
*
* @static
* @public
* @param {number} siteId The Site ID
* @param {string} id The MAF Sizer ID
* @return {Promise<MAFSizerModel>}
*/
static getOne(siteId, id)
{
return new Promise((resolve, reject) => {
RequestHelper.getRequest(`/packhouse/sites/${siteId}/maf-sizers/${id}`)
.then((result) => {
let resolveValue = (function(){
return MAFSizerModel.fromJSON(result, siteId);
}());

resolve(resolveValue);
})
.catch(error => reject(error));
});
}

/**
* Update a MAF Sizer [PATCH /packhouse/sites/{siteId}/maf-sizers/{id}]
*
* @static
* @public
* @param {number} siteId The Site ID
* @param {string} id The MAF Sizer ID
* @param {MAFSizerController.UpdateData} updateData The MAF Sizer Update Data
* @return {Promise<MAFSizerModel>}
*/
static update(siteId, id, updateData)
{
return new Promise((resolve, reject) => {
RequestHelper.patchRequest(`/packhouse/sites/${siteId}/maf-sizers/${id}`, updateData)
.then((result) => {
let resolveValue = (function(){
return MAFSizerModel.fromJSON(result, siteId);
}());

resolve(resolveValue);
})
.catch(error => reject(error));
});
}

/**
* Delete a MAF Sizer [DELETE /packhouse/sites/{siteId}/maf-sizers/{id}]
*
* @static
* @public
* @param {number} siteId The Site ID
* @param {string} id The MAF Sizer ID
* @return {Promise<boolean>}
*/
static delete(siteId, id)
{
return new Promise((resolve, reject) => {
RequestHelper.deleteRequest(`/packhouse/sites/${siteId}/maf-sizers/${id}`)
.then((result) => {
resolve(result ?? true);
})
.catch(error => reject(error));
});
}

/**
* List all MAF Sizers [GET /packhouse/sites/{siteId}/maf-sizers]
*
* @static
* @public
* @param {number} siteId The Site ID
* @param {MAFSizerController.GetAllQueryParameters} [queryParameters] The Optional Query Parameters
* @return {Promise<MAFSizerModel[]>}
*/
static getAll(siteId, queryParameters = {})
{
return new Promise((resolve, reject) => {
RequestHelper.getRequest(`/packhouse/sites/${siteId}/maf-sizers`, queryParameters)
.then((result) => {
let resolveValue = (function(){
if(Array.isArray(result) !== true)
{
return [];
}

return result.map((resultItem) => {
return (function(){
return MAFSizerModel.fromJSON(resultItem, siteId);
}());
});
}());

resolve(resolveValue);
})
.catch(error => reject(error));
});
}

/**
* Create a MAF Sizer [POST /packhouse/sites/{siteId}/maf-sizers]
*
* @static
* @public
* @param {number} siteId The Site ID
* @param {MAFSizerController.CreateData} createData The MAF Sizer Create Data
* @return {Promise<MAFSizerModel>}
*/
static create(siteId, createData)
{
return new Promise((resolve, reject) => {
RequestHelper.postRequest(`/packhouse/sites/${siteId}/maf-sizers`, createData)
.then((result) => {
let resolveValue = (function(){
return MAFSizerModel.fromJSON(result, siteId);
}());

resolve(resolveValue);
})
.catch(error => reject(error));
});
}
}

export default MAFSizerController;

/**
* The Optional Query Parameters for the getAll Function
*
* @typedef {Object} MAFSizerController.GetAllQueryParameters
* @property {?number} [rtuId] The RTU this MAF Sizer belongs to
* @property {string} [name] The MAF Sizer Name
* @property {string} [sizerType] The Sizer Type
* @property {string} [packingLineId] The Packing Line ID that manages this MAF Sizer
* @memberof Controllers.Packhouse.Site
*/

/**
* The Create Data for a MAF Sizer
*
* @typedef {Object} MAFSizerController.CreateData
* @property {?number} [rtuId] The RTU this MAF Sizer belongs to
* @property {string} name The MAF Sizer Name
* @property {Object[]} [lanes] The Lanes defined for this MAF Sizer
* @property {Object} points The Points used by this MAF Sizer
* @property {Object[]} [outlets] The Outlets defined for this MAF Sizer
* @property {string} sizerType The Sizer Type
* @property {number} [autoCreateBatchDelay] The Auto Create Batch Delay in Seconds for this MAF Sizer
* @property {Object[]} [fruitSizes] The Fruit Sizes defined and handled by this MAF Sizer
* @property {string} packingLineId The Packing Line ID that manages this MAF Sizer
* @property {?Object} [freshPackIntegration] The FreshPack Integration Configuration for this MAF Sizer
* @property {?Object} [mafIntegration] The MAF Integration Configuration for this MAF Sizer
* @property {Object[]} [sources] An Array of Sources that deliver Fruit to this MAF Sizer
* @property {Object[]} [articleClassTypes] An Array of Article to Class Type Maps for this MAF Sizer
* @memberof Controllers.Packhouse.Site
*/

/**
* The Update Data for a MAF Sizer
*
* @typedef {Object} MAFSizerController.UpdateData
* @property {string} [name] The MAF Sizer Name
* @property {Object[]} [lanes] The Lanes defined for this MAF Sizer
* @property {Object} [points] The Points used by this MAF Sizer
* @property {Object[]} [outlets] The Outlets defined for this MAF Sizer
* @property {string} [sizerType] The Sizer Type
* @property {number} [autoCreateBatchDelay] The Auto Create Batch Delay in Seconds for this MAF Sizer
* @property {Object[]} [fruitSizes] The Fruit Sizes defined and handled by this MAF Sizer
* @property {string} [packingLineId] The Packing Line ID that manages this MAF Sizer
* @property {?Object} [freshPackIntegration] The FreshPack Integration Configuration for this MAF Sizer
* @property {?Object} [mafIntegration] The MAF Integration Configuration for this MAF Sizer
* @property {Object[]} [sources] An Array of Sources that deliver Fruit to this MAF Sizer
* @property {Object[]} [articleClassTypes] An Array of Article to Class Type Maps for this MAF Sizer
* @memberof Controllers.Packhouse.Site
*/
Loading

0 comments on commit a685bb2

Please sign in to comment.