UNPKG

@simpleapps-com/augur-api

Version:

TypeScript client library for Augur microservices API endpoints

131 lines 5.67 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.P21PimClient = void 0; const base_client_1 = require("../../core/base-client"); const schemas_1 = require("./schemas"); /** * P21 PIM (Product Information Management) API client * * Provides access to extended inventory data, AI-powered content generation, * and podcast management capabilities. * * @example * ```typescript * const api = new AugurAPI({ bearerToken: 'your-jwt', siteId: 'your-site' }); * * // List inventory extensions * const extensions = await api.p21Pim.invMastExt.list({ limit: 20 }); * * // Generate AI descriptions * const suggestions = await api.p21Pim.items.suggestDisplayDescription(12345); * * // Manage podcasts * const podcasts = await api.p21Pim.podcasts.list(); * ``` */ class P21PimClient extends base_client_1.BaseServiceClient { constructor(http, baseUrl = 'https://p21-pim.augur-api.com') { super('p21-pim', http, baseUrl); /** * Inventory Master Extensions operations * * Manage extended inventory master data including UPC/EAN codes, * brand information, and SEO metadata. */ this.invMastExt = { /** * List inventory master extensions with filtering and pagination */ list: this.createListMethod('/inv-mast-ext', schemas_1.InventoryMasterExtensionListParamsSchema, schemas_1.InventoryMasterExtensionListResponseSchema), /** * Get a specific inventory master extension by UID */ get: this.createGetMethod('/inv-mast-ext/{id}', schemas_1.InventoryMasterExtensionResponseSchema), /** * Create a new inventory master extension record */ create: this.createCreateMethod('/inv-mast-ext', schemas_1.InventoryMasterExtensionCreateParamsSchema, schemas_1.InventoryMasterExtensionResponseSchema), /** * Update an existing inventory master extension */ update: this.createUpdateMethod('/inv-mast-ext/{id}', schemas_1.InventoryMasterExtensionUpdateParamsSchema, schemas_1.InventoryMasterExtensionResponseSchema), /** * Soft delete an inventory master extension (sets status_cd to 700) */ delete: this.createDeleteMethod('/inv-mast-ext/{id}', schemas_1.InventoryMasterExtensionResponseSchema), }; /** * AI-Powered Item Services * * Generate AI-powered product descriptions using advanced language models. */ this.items = { /** * Generate marketing-focused display descriptions (255 character limit) * * @param invMastUid - Inventory master UID * @param params - Optional parameters including limit and model selection * @returns Array of suggestions or false if no suggestions available */ suggestDisplayDescription: async (invMastUid, params) => { return this.executeRequest({ method: 'GET', path: `/items/${invMastUid}/suggest-display-desc`, paramsSchema: schemas_1.AISuggestionParamsSchema, responseSchema: schemas_1.SuggestDisplayDescResponseSchema, }, params || {}); }, /** * Generate detailed web descriptions (4000 character limit) * * @param invMastUid - Inventory master UID * @param params - Optional parameters including limit and model selection * @returns Array of web description suggestions */ suggestWebDescription: async (invMastUid, params) => { return this.executeRequest({ method: 'GET', path: `/items/${invMastUid}/suggest-web-desc`, paramsSchema: schemas_1.AISuggestionParamsSchema, responseSchema: schemas_1.SuggestWebDescResponseSchema, }, params || {}); }, }; /** * Podcast Management * * Manage podcast content with full transcript support. */ this.podcasts = { /** * List podcasts with filtering and search capabilities */ list: this.createListMethod('/podcasts', schemas_1.PodcastListParamsSchema, schemas_1.PodcastListResponseSchema), /** * Get a specific podcast by UID */ get: this.createGetMethod('/podcasts/{id}', schemas_1.PodcastResponseSchema), /** * Create a new podcast record */ create: this.createCreateMethod('/podcasts', schemas_1.PodcastCreateParamsSchema, schemas_1.PodcastResponseSchema), /** * Update an existing podcast record */ update: this.createUpdateMethod('/podcasts/{id}', schemas_1.PodcastUpdateParamsSchema, schemas_1.PodcastResponseSchema), /** * Soft delete a podcast record */ delete: this.createDeleteMethod('/podcasts/{id}', schemas_1.PodcastResponseSchema), }; /** * Health check endpoint * * Monitor service health and availability. * Note: Only requires x-site-id header, no Bearer token needed. */ this.getHealthCheck = this.createHealthCheckMethod(schemas_1.HealthCheckResponseSchema); } } exports.P21PimClient = P21PimClient; //# sourceMappingURL=client.js.map