UNPKG

@simpleapps-com/augur-api

Version:

TypeScript client library for Augur microservices API endpoints

270 lines 11.2 kB
import { AlsoBoughtListResponseSchema, InvMastTagListResponseSchema, InvMastTagResponseSchema, CreateInvMastTagRequestSchema, UpdateInvMastTagRequestSchema, InvMastWebDescListResponseSchema, InvMastWebDescResponseSchema, CreateInvMastWebDescRequestSchema, UpdateInvMastWebDescRequestSchema, DeleteResponseSchema, } from '../schemas'; /** * Creates the invMast resource methods * OpenAPI Path: /inv-mast → invMast.* * @description Inventory master operations including also-bought, tags, and web descriptions */ export function createInvMastResource(executeRequest) { return { /** * Also-bought analysis operations */ alsoBought: { /** * List products frequently bought with a specific item * @fullPath api.legacy.invMast.alsoBought.list * @service legacy * @domain product-recommendations * @dataMethod invMastData.alsoBought.list * @discoverable true */ list: async (invMastUid) => { return executeRequest({ method: 'GET', path: '/inv-mast/{id}/also-bought', responseSchema: AlsoBoughtListResponseSchema, }, undefined, { id: String(invMastUid) }); }, }, /** * Inventory tags management */ tags: { /** * List tags for an inventory item * @fullPath api.legacy.invMast.tags.list * @service legacy * @domain inventory-metadata * @dataMethod invMastData.tags.list * @discoverable true */ list: async (invMastUid) => { return executeRequest({ method: 'GET', path: '/inv-mast/{id}/tags', responseSchema: InvMastTagListResponseSchema, }, undefined, { id: String(invMastUid) }); }, /** * Get specific tag details * @fullPath api.legacy.invMast.tags.get * @service legacy * @domain inventory-metadata * @dataMethod invMastData.tags.get * @discoverable true */ get: async (invMastUid, invMastTagsUid) => { return executeRequest({ method: 'GET', path: '/inv-mast/{invMastUid}/tags/{invMastTagsUid}', responseSchema: InvMastTagResponseSchema, }, undefined, { invMastUid: String(invMastUid), invMastTagsUid: String(invMastTagsUid), }); }, /** * Create a new tag for an inventory item * @fullPath api.legacy.invMast.tags.create * @service legacy * @domain inventory-metadata * @dataMethod invMastData.tags.create * @discoverable true */ create: async (invMastUid, tagData) => { return executeRequest({ method: 'POST', path: '/inv-mast/{id}/tags', paramsSchema: CreateInvMastTagRequestSchema, responseSchema: InvMastTagResponseSchema, }, tagData, { id: String(invMastUid) }); }, /** * Update an existing inventory tag * @fullPath api.legacy.invMast.tags.update * @service legacy * @domain inventory-metadata * @dataMethod invMastData.tags.update * @discoverable true */ update: async (invMastUid, invMastTagsUid, tagData) => { return executeRequest({ method: 'PUT', path: '/inv-mast/{invMastUid}/tags/{invMastTagsUid}', paramsSchema: UpdateInvMastTagRequestSchema, responseSchema: InvMastTagResponseSchema, }, tagData, { invMastUid: String(invMastUid), invMastTagsUid: String(invMastTagsUid), }); }, /** * Delete an inventory tag * @fullPath api.legacy.invMast.tags.delete * @service legacy * @domain inventory-metadata * @dataMethod invMastData.tags.delete * @discoverable true */ delete: async (invMastUid, invMastTagsUid) => { return executeRequest({ method: 'DELETE', path: '/inv-mast/{invMastUid}/tags/{invMastTagsUid}', responseSchema: DeleteResponseSchema, }, undefined, { invMastUid: String(invMastUid), invMastTagsUid: String(invMastTagsUid), }); }, }, /** * Web descriptions management */ webDesc: { /** * List web descriptions for an inventory item * @fullPath api.legacy.invMast.webDesc.list * @service legacy * @domain content-management * @dataMethod invMastData.webDesc.list * @discoverable true */ list: async (invMastUid) => { return executeRequest({ method: 'GET', path: '/inv-mast/{id}/web-desc', responseSchema: InvMastWebDescListResponseSchema, }, undefined, { id: String(invMastUid) }); }, /** * Get specific web description details * @fullPath api.legacy.invMast.webDesc.get * @service legacy * @domain content-management * @dataMethod invMastData.webDesc.get * @discoverable true */ get: async (invMastUid, invMastWebDescUid) => { return executeRequest({ method: 'GET', path: '/inv-mast/{invMastUid}/web-desc/{invMastWebDescUid}', responseSchema: InvMastWebDescResponseSchema, }, undefined, { invMastUid: String(invMastUid), invMastWebDescUid: String(invMastWebDescUid), }); }, /** * Create a new web description * @fullPath api.legacy.invMast.webDesc.create * @service legacy * @domain content-management * @dataMethod invMastData.webDesc.create * @discoverable true */ create: async (invMastUid, descData) => { return executeRequest({ method: 'POST', path: '/inv-mast/{id}/web-desc', paramsSchema: CreateInvMastWebDescRequestSchema, responseSchema: InvMastWebDescResponseSchema, }, descData, { id: String(invMastUid) }); }, /** * Update an existing web description * @fullPath api.legacy.invMast.webDesc.update * @service legacy * @domain content-management * @dataMethod invMastData.webDesc.update * @discoverable true */ update: async (invMastUid, invMastWebDescUid, descData) => { return executeRequest({ method: 'PUT', path: '/inv-mast/{invMastUid}/web-desc/{invMastWebDescUid}', paramsSchema: UpdateInvMastWebDescRequestSchema, responseSchema: InvMastWebDescResponseSchema, }, descData, { invMastUid: String(invMastUid), invMastWebDescUid: String(invMastWebDescUid), }); }, /** * Delete a web description * @fullPath api.legacy.invMast.webDesc.delete * @service legacy * @domain content-management * @dataMethod invMastData.webDesc.delete * @discoverable true */ delete: async (invMastUid, invMastWebDescUid) => { return executeRequest({ method: 'DELETE', path: '/inv-mast/{invMastUid}/web-desc/{invMastWebDescUid}', responseSchema: DeleteResponseSchema, }, undefined, { invMastUid: String(invMastUid), invMastWebDescUid: String(invMastWebDescUid), }); }, }, }; } /** * Creates the invMastData resource methods (data-only versions) */ export function createInvMastDataResource(invMast) { return { alsoBought: { list: async (invMastUid) => { const response = await invMast.alsoBought.list(invMastUid); return response.data; }, }, tags: { list: async (invMastUid) => { const response = await invMast.tags.list(invMastUid); return response.data; }, get: async (invMastUid, invMastTagsUid) => { const response = await invMast.tags.get(invMastUid, invMastTagsUid); return response.data; }, create: async (invMastUid, tagData) => { const response = await invMast.tags.create(invMastUid, tagData); return response.data; }, update: async (invMastUid, invMastTagsUid, tagData) => { const response = await invMast.tags.update(invMastUid, invMastTagsUid, tagData); return response.data; }, delete: async (invMastUid, invMastTagsUid) => { const response = await invMast.tags.delete(invMastUid, invMastTagsUid); return response.data; }, }, webDesc: { list: async (invMastUid) => { const response = await invMast.webDesc.list(invMastUid); return response.data; }, get: async (invMastUid, invMastWebDescUid) => { const response = await invMast.webDesc.get(invMastUid, invMastWebDescUid); return response.data; }, create: async (invMastUid, descData) => { const response = await invMast.webDesc.create(invMastUid, descData); return response.data; }, update: async (invMastUid, invMastWebDescUid, descData) => { const response = await invMast.webDesc.update(invMastUid, invMastWebDescUid, descData); return response.data; }, delete: async (invMastUid, invMastWebDescUid) => { const response = await invMast.webDesc.delete(invMastUid, invMastWebDescUid); return response.data; }, }, }; } //# sourceMappingURL=inv-mast.js.map