/**
* File Auto-Generated by the RICADO Gen 4 PHP API Project
*
* Do Not Edit this File Manually!
*/
import RequestHelper from '../../../RequestHelper';
import BinTipBarcodeScannerResultModel from '../../../Models/Packhouse/Site/BinTipBarcodeScannerResultModel';
/**
* Controller Class for Bin Tip Barcode Scanner Results
*
* @class
*/
class BinTipBarcodeScannerResultController
{
/**
* Retrieve a Bin Tip Barcode Scanner Result [GET /packhouse/sites/{siteId}/bin-tip-barcode-scanner-results/{id}]
*
* @static
* @public
* @param {number} siteId The Site ID
* @param {string} id The Bin Tip Barcode Scanner Result ID
* @return {Promise<BinTipBarcodeScannerResultModel>}
*/
static getOne(siteId, id)
{
return new Promise((resolve, reject) => {
RequestHelper.getRequest(`/packhouse/sites/${siteId}/bin-tip-barcode-scanner-results/${id}`)
.then((result) => {
let resolveValue = (function(){
return BinTipBarcodeScannerResultModel.fromJSON(result, siteId);
}());
resolve(resolveValue);
})
.catch(error => reject(error));
});
}
/**
* Update a Bin Tip Barcode Scanner Result [PATCH /packhouse/sites/{siteId}/bin-tip-barcode-scanner-results/{id}]
*
* @static
* @public
* @param {number} siteId The Site ID
* @param {string} id The Bin Tip Barcode Scanner Result ID
* @param {BinTipBarcodeScannerResultController.UpdateData} updateData The Bin Tip Barcode Scanner Result Update Data
* @return {Promise<BinTipBarcodeScannerResultModel>}
*/
static update(siteId, id, updateData)
{
return new Promise((resolve, reject) => {
RequestHelper.patchRequest(`/packhouse/sites/${siteId}/bin-tip-barcode-scanner-results/${id}`, updateData)
.then((result) => {
let resolveValue = (function(){
return BinTipBarcodeScannerResultModel.fromJSON(result, siteId);
}());
resolve(resolveValue);
})
.catch(error => reject(error));
});
}
/**
* Delete a Bin Tip Barcode Scanner Result [DELETE /packhouse/sites/{siteId}/bin-tip-barcode-scanner-results/{id}]
*
* @static
* @public
* @param {number} siteId The Site ID
* @param {string} id The Bin Tip Barcode Scanner Result ID
* @return {Promise<boolean>}
*/
static delete(siteId, id)
{
return new Promise((resolve, reject) => {
RequestHelper.deleteRequest(`/packhouse/sites/${siteId}/bin-tip-barcode-scanner-results/${id}`)
.then((result) => {
resolve(result ?? true);
})
.catch(error => reject(error));
});
}
/**
* List all Bin Tip Barcode Scanner Results [GET /packhouse/sites/{siteId}/bin-tip-barcode-scanner-results]
*
* @static
* @public
* @param {number} siteId The Site ID
* @param {BinTipBarcodeScannerResultController.GetAllQueryParameters} [queryParameters] The Optional Query Parameters
* @return {Promise<BinTipBarcodeScannerResultModel[]>}
*/
static getAll(siteId, queryParameters = {})
{
return new Promise((resolve, reject) => {
RequestHelper.getRequest(`/packhouse/sites/${siteId}/bin-tip-barcode-scanner-results`, queryParameters)
.then((result) => {
let resolveValue = (function(){
if(Array.isArray(result) !== true)
{
return [];
}
return result.map((resultItem) => {
return (function(){
return BinTipBarcodeScannerResultModel.fromJSON(resultItem, siteId);
}());
});
}());
resolve(resolveValue);
})
.catch(error => reject(error));
});
}
/**
* Create a Bin Tip Barcode Scanner Result [POST /packhouse/sites/{siteId}/bin-tip-barcode-scanner-results]
*
* @static
* @public
* @param {number} siteId The Site ID
* @param {BinTipBarcodeScannerResultController.CreateData} createData The Bin Tip Barcode Scanner Result Create Data
* @return {Promise<BinTipBarcodeScannerResultModel>}
*/
static create(siteId, createData)
{
return new Promise((resolve, reject) => {
RequestHelper.postRequest(`/packhouse/sites/${siteId}/bin-tip-barcode-scanner-results`, createData)
.then((result) => {
let resolveValue = (function(){
return BinTipBarcodeScannerResultModel.fromJSON(result, siteId);
}());
resolve(resolveValue);
})
.catch(error => reject(error));
});
}
}
export default BinTipBarcodeScannerResultController;
/**
* The Optional Query Parameters for the getAll Function
*
* @typedef {Object} BinTipBarcodeScannerResultController.GetAllQueryParameters
* @property {string} [barcodeScannerId] The Bin Tip Barcode Scanner ID associated with this Result
* @property {string} [binNumber] A 10-Digit Bin Number made up of a Bin Lot (4-Digits) and a Unique Number (6-Digits)
* @property {string} [scanMode] The Mode of the Barcode Scanner when creating this Barcode Scanner Result
* @property {?string} [packrunId] The Packrun ID associated with this Barcode Scanner Result
* @property {Date} [createdTimestampBegin] Filter by the Timestamp when this Barcode Scanner Result was Created. Results Greater than or Equal to Timestamp
* @property {Date} [createdTimestampEnd] Filter by the Timestamp when this Barcode Scanner Result was Created. Results Less than or Equal to Timestamp
* @memberof Controllers.Packhouse.Site
*/
/**
* The Create Data for a Bin Tip Barcode Scanner Result
*
* @typedef {Object} BinTipBarcodeScannerResultController.CreateData
* @property {string} barcodeScannerId The Bin Tip Barcode Scanner ID associated with this Result
* @property {string} [binNumber] A 10-Digit Bin Number made up of a Bin Lot (4-Digits) and a Unique Number (6-Digits)
* @property {Date} [createdTimestamp] When this Barcode Scanner Result was Created
* @property {string} scanMode The Mode of the Barcode Scanner when creating this Barcode Scanner Result
* @property {?string} [packrunId] The Packrun ID associated with this Barcode Scanner Result
* @property {boolean} result Whether the Bin Number was Valid and could be matched with a Current or Scheduled Packrun
* @property {?string} resultMessage An Optional Message to accompany the Result. Typically only present when the Result is **false**
* @memberof Controllers.Packhouse.Site
*/
/**
* The Update Data for a Bin Tip Barcode Scanner Result
*
* @typedef {Object} BinTipBarcodeScannerResultController.UpdateData
* @property {string} [barcodeScannerId] The Bin Tip Barcode Scanner ID associated with this Result
* @property {Date} [createdTimestamp] When this Barcode Scanner Result was Created
* @property {string} [scanMode] The Mode of the Barcode Scanner when creating this Barcode Scanner Result
* @property {?string} [packrunId] The Packrun ID associated with this Barcode Scanner Result
* @property {boolean} [result] Whether the Bin Number was Valid and could be matched with a Current or Scheduled Packrun
* @property {?string} [resultMessage] An Optional Message to accompany the Result. Typically only present when the Result is **false**
* @memberof Controllers.Packhouse.Site
*/
source