pancake-client-sdk
Version:
Official TypeScript SDK for Pancake POS API
92 lines • 2.87 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MeasurementResource = void 0;
const base_1 = require("./base");
class MeasurementResource extends base_1.BaseResource {
/**
* Get list of measurement groups
*/
async listGroups(params) {
return this.client.get(this.getShopPath('/measurement-groups'), params);
}
/**
* Get measurement group by ID
*/
async getGroup(groupId) {
return this.client.get(this.getShopPath(`/measurement-groups/${groupId}`));
}
/**
* Create new measurement group
*/
async createGroup(data) {
return this.client.post(this.getShopPath('/measurement-groups'), data);
}
/**
* Update measurement group
*/
async updateGroup(groupId, data) {
return this.client.put(this.getShopPath(`/measurement-groups/${groupId}`), data);
}
/**
* Delete measurement group
*/
async deleteGroup(groupId) {
return this.client.delete(this.getShopPath(`/measurement-groups/${groupId}`));
}
/**
* Add unit to group
*/
async addUnit(groupId, data) {
return this.client.post(this.getShopPath(`/measurement-groups/${groupId}/units`), data);
}
/**
* Update unit
*/
async updateUnit(groupId, unitId, data) {
return this.client.put(this.getShopPath(`/measurement-groups/${groupId}/units/${unitId}`), data);
}
/**
* Remove unit from group
*/
async removeUnit(groupId, unitId) {
return this.client.delete(this.getShopPath(`/measurement-groups/${groupId}/units/${unitId}`));
}
/**
* Convert measurement
*/
async convert(data) {
return this.client.post(this.getShopPath('/measurements/convert'), data);
}
/**
* Bulk convert measurements
*/
async bulkConvert(data) {
return this.client.post(this.getShopPath('/measurements/bulk-convert'), data);
}
/**
* Get conversion matrix for a group
*/
async getConversionMatrix(groupId) {
return this.client.get(this.getShopPath(`/measurement-groups/${groupId}/conversion-matrix`));
}
/**
* Update conversion matrix
*/
async updateConversionMatrix(groupId, data) {
return this.client.put(this.getShopPath(`/measurement-groups/${groupId}/conversion-matrix`), data);
}
/**
* Get measurement group statistics
*/
async getStatistics() {
return this.client.get(this.getShopPath('/measurement-groups/statistics'));
}
/**
* Validate conversions in a group
*/
async validateConversions(groupId) {
return this.client.post(this.getShopPath(`/measurement-groups/${groupId}/validate-conversions`), {});
}
}
exports.MeasurementResource = MeasurementResource;
//# sourceMappingURL=measurement.js.map