UNPKG

@simpleapps-com/augur-api

Version:

TypeScript client library for Augur microservices API endpoints

255 lines 12.3 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.createInvProfileHdrResource = createInvProfileHdrResource; exports.createInvProfileHdrDataResource = createInvProfileHdrDataResource; const zod_1 = require("zod"); const schemas_1 = require("../schemas"); /** * Creates the invProfileHdr resource methods * OpenAPI Path: /inv-profile-hdr → invProfileHdr.* * @description Methods for managing inventory profiles that define min/max/reorder quantities for automated replenishment */ function createInvProfileHdrResource(executeRequest) { const resource = { /** * List inventory profile headers * @description Returns inventory profile headers for a customer with pagination * @param params Filtering and pagination parameters (customerId is required) * @returns Array of inventory profile header objects * @throws ValidationError When parameters are invalid or response is malformed */ list: async (params) => { return executeRequest({ method: 'GET', path: '/inv-profile-hdr', paramsSchema: schemas_1.InvProfileHdrListParamsSchema, responseSchema: schemas_1.InvProfileHdrListResponseSchema, }, params); }, /** * Get inventory profile header details * @description Returns detailed information for a specific inventory profile header * @param invProfileHdrUid Inventory profile header unique identifier * @returns Inventory profile header details * @throws ValidationError When response is malformed */ get: async (invProfileHdrUid) => { return executeRequest({ method: 'GET', path: `/inv-profile-hdr/${invProfileHdrUid}`, responseSchema: schemas_1.InvProfileHdrResponseSchema, }, undefined); }, /** * Create new inventory profile header * @description Creates a new inventory profile header container * @param request Inventory profile header creation data * @returns Created inventory profile header information * @throws ValidationError When request is invalid or response is malformed */ create: async (request) => { return executeRequest({ method: 'POST', path: '/inv-profile-hdr', paramsSchema: schemas_1.CreateInvProfileHdrRequestSchema, responseSchema: schemas_1.InvProfileHdrResponseSchema, }, request); }, /** * Update inventory profile header * @description Updates inventory profile header information * @param invProfileHdrUid Inventory profile header unique identifier * @param request Inventory profile header update data * @returns Updated inventory profile header information * @throws ValidationError When request is invalid or response is malformed */ update: async (invProfileHdrUid, request) => { return executeRequest({ method: 'PUT', path: `/inv-profile-hdr/${invProfileHdrUid}`, paramsSchema: schemas_1.UpdateInvProfileHdrRequestSchema, responseSchema: schemas_1.InvProfileHdrResponseSchema, }, request); }, /** * Delete inventory profile header * @description Removes inventory profile header and associated lines * @param invProfileHdrUid Inventory profile header unique identifier * @returns Boolean indicating successful deletion * @throws ValidationError When response is malformed */ delete: async (invProfileHdrUid) => { await executeRequest({ method: 'DELETE', path: `/inv-profile-hdr/${invProfileHdrUid}`, responseSchema: zod_1.z.unknown(), }); return true; }, /** * Upload endpoints for bulk profile creation * @description Methods for uploading Excel files to create inventory profiles */ upload: { /** * Upload Excel file to create inventory profile headers * @description Uploads an Excel file to bulk create inventory profile headers for a customer * @param customerId Customer unique identifier * @returns Upload result response * @throws ValidationError When request is invalid or response is malformed */ create: async (customerId) => { return executeRequest({ method: 'POST', path: '/inv-profile-hdr/{customerId}/upload', paramsSchema: schemas_1.InvProfileUploadParamsSchema, responseSchema: schemas_1.InvProfileUploadResponseSchema, }, { customerId }, { customerId: String(customerId) }); }, }, /** * Inventory profile lines sub-endpoints * @description Methods for managing inventory profile lines (individual item configurations within headers) */ invProfileLine: { /** * List inventory profile lines for a header * @description Returns inventory profile lines within a specific header with pagination * @param invProfileHdrUid Inventory profile header unique identifier * @param params Optional pagination parameters * @returns Array of inventory profile line objects * @throws ValidationError When parameters are invalid or response is malformed */ list: async (invProfileHdrUid, params) => { return executeRequest({ method: 'GET', path: '/inv-profile-hdr/{invProfileHdrUid}/inv-profile-line', paramsSchema: schemas_1.InvProfileLineListParamsSchema, responseSchema: schemas_1.InvProfileLineListResponseSchema, }, params, { invProfileHdrUid: String(invProfileHdrUid) }); }, /** * Get specific inventory profile line * @description Returns detailed information for a specific inventory profile line * @param invProfileHdrUid Inventory profile header unique identifier * @param invProfileLineUid Inventory profile line unique identifier * @returns Inventory profile line details * @throws ValidationError When response is malformed */ get: async (invProfileHdrUid, invProfileLineUid) => { return executeRequest({ method: 'GET', path: '/inv-profile-hdr/{invProfileHdrUid}/inv-profile-line/{invProfileLineUid}', responseSchema: schemas_1.InvProfileLineResponseSchema, }, undefined, { invProfileHdrUid: String(invProfileHdrUid), invProfileLineUid: String(invProfileLineUid), }); }, /** * Create inventory profile line * @description Creates a new inventory profile line with min/max/reorder quantities * @param invProfileHdrUid Inventory profile header unique identifier * @param request Inventory profile line creation data * @returns Created inventory profile line information * @throws ValidationError When request is invalid or response is malformed */ create: async (invProfileHdrUid, request) => { return executeRequest({ method: 'POST', path: '/inv-profile-hdr/{invProfileHdrUid}/inv-profile-line', paramsSchema: schemas_1.CreateInvProfileLineRequestSchema, responseSchema: schemas_1.InvProfileLineResponseSchema, }, request, { invProfileHdrUid: String(invProfileHdrUid) }); }, /** * Update inventory profile line * @description Updates inventory profile line quantities and settings * @param invProfileHdrUid Inventory profile header unique identifier * @param invProfileLineUid Inventory profile line unique identifier * @param request Inventory profile line update data * @returns Updated inventory profile line information * @throws ValidationError When request is invalid or response is malformed */ update: async (invProfileHdrUid, invProfileLineUid, request) => { return executeRequest({ method: 'PUT', path: '/inv-profile-hdr/{invProfileHdrUid}/inv-profile-line/{invProfileLineUid}', paramsSchema: schemas_1.UpdateInvProfileLineRequestSchema, responseSchema: schemas_1.InvProfileLineResponseSchema, }, request, { invProfileHdrUid: String(invProfileHdrUid), invProfileLineUid: String(invProfileLineUid), }); }, /** * Delete inventory profile line * @description Removes inventory profile line from header * @param invProfileHdrUid Inventory profile header unique identifier * @param invProfileLineUid Inventory profile line unique identifier * @returns Boolean indicating successful deletion * @throws ValidationError When response is malformed */ delete: async (invProfileHdrUid, invProfileLineUid) => { await executeRequest({ method: 'DELETE', path: '/inv-profile-hdr/{invProfileHdrUid}/inv-profile-line/{invProfileLineUid}', responseSchema: zod_1.z.unknown(), }, undefined, { invProfileHdrUid: String(invProfileHdrUid), invProfileLineUid: String(invProfileLineUid), }); return true; }, }, }; return resource; } /** * Creates the invProfileHdrData resource methods (data-only versions) */ function createInvProfileHdrDataResource(invProfileHdr) { return { list: async (params) => { const response = await invProfileHdr.list(params); return response.data; }, get: async (invProfileHdrUid) => { const response = await invProfileHdr.get(invProfileHdrUid); return response.data; }, create: async (request) => { const response = await invProfileHdr.create(request); return response.data; }, update: async (invProfileHdrUid, request) => { const response = await invProfileHdr.update(invProfileHdrUid, request); return response.data; }, upload: { create: async (customerId) => { const response = await invProfileHdr.upload.create(customerId); return response.data; }, }, invProfileLine: { list: async (invProfileHdrUid, params) => { const response = await invProfileHdr.invProfileLine.list(invProfileHdrUid, params); return response.data; }, get: async (invProfileHdrUid, invProfileLineUid) => { const response = await invProfileHdr.invProfileLine.get(invProfileHdrUid, invProfileLineUid); return response.data; }, create: async (invProfileHdrUid, request) => { const response = await invProfileHdr.invProfileLine.create(invProfileHdrUid, request); return response.data; }, update: async (invProfileHdrUid, invProfileLineUid, request) => { const response = await invProfileHdr.invProfileLine.update(invProfileHdrUid, invProfileLineUid, request); return response.data; }, }, }; } //# sourceMappingURL=inv-profile-hdr.js.map