@simpleapps-com/augur-api
Version:
TypeScript client library for Augur microservices API endpoints
114 lines • 4.58 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createRestockHdrResource = createRestockHdrResource;
exports.createRestockHdrDataResource = createRestockHdrDataResource;
const zod_1 = require("zod");
const schemas_1 = require("../schemas");
/**
* Creates the restockHdr resource methods
* OpenAPI Path: /restock-hdr → restockHdr.*
* @description Methods for managing restock headers and replenishment operations
*/
function createRestockHdrResource(executeRequest) {
return {
/**
* List restock headers with filtering
* @description Returns restock headers with optional filtering by warehouse and distributor
* @param params Optional filtering and pagination parameters
* @returns Array of restock header objects
* @throws ValidationError When parameters are invalid or response is malformed
*/
list: async (params) => {
return executeRequest({
method: 'GET',
path: '/restock-hdr',
paramsSchema: schemas_1.RestockHdrListParamsSchema,
responseSchema: schemas_1.RestockHdrListResponseSchema,
}, params);
},
/**
* Get restock header details
* @description Returns detailed information for a specific restock header
* @param restockHdrUid Restock header unique identifier
* @returns Restock header details
* @throws ValidationError When response is malformed
*/
get: async (restockHdrUid) => {
return executeRequest({
method: 'GET',
path: `/restock-hdr/${restockHdrUid}`,
responseSchema: schemas_1.RestockHdrResponseSchema,
}, undefined);
},
/**
* Create restock header
* @description Creates a new restock header for warehouse and distributor combination
* @param request Restock header creation data
* @returns Created restock header information
* @throws ValidationError When request is invalid or response is malformed
*/
create: async (request) => {
return executeRequest({
method: 'POST',
path: '/restock-hdr',
paramsSchema: schemas_1.CreateRestockHdrRequestSchema,
responseSchema: schemas_1.RestockHdrResponseSchema,
}, request);
},
/**
* Update restock header
* @description Updates restock header configuration
* @param restockHdrUid Restock header unique identifier
* @param request Restock header update data
* @returns Updated restock header information
* @throws ValidationError When request is invalid or response is malformed
*/
update: async (restockHdrUid, request) => {
return executeRequest({
method: 'PUT',
path: `/restock-hdr/${restockHdrUid}`,
paramsSchema: schemas_1.UpdateRestockHdrRequestSchema,
responseSchema: schemas_1.RestockHdrResponseSchema,
}, request);
},
/**
* Delete restock header
* @description Removes restock header and associated data
* @param restockHdrUid Restock header unique identifier
* @returns Boolean indicating successful deletion
* @throws ValidationError When response is malformed
*/
delete: async (restockHdrUid) => {
await executeRequest({
method: 'DELETE',
path: `/restock-hdr/${restockHdrUid}`,
responseSchema: zod_1.z.unknown(),
});
return true;
},
};
}
/**
* Creates the restockHdrData resource methods (data-only versions)
*/
function createRestockHdrDataResource(restockHdr) {
return {
list: async (params) => {
const response = await restockHdr.list(params);
return response.data;
},
get: async (restockHdrUid) => {
const response = await restockHdr.get(restockHdrUid);
return response.data;
},
create: async (request) => {
const response = await restockHdr.create(request);
return response.data;
},
update: async (restockHdrUid, request) => {
const response = await restockHdr.update(restockHdrUid, request);
return response.data;
},
};
}
//# sourceMappingURL=restock-hdr.js.map