UNPKG

@simpleapps-com/augur-api

Version:

TypeScript client library for Augur microservices API endpoints

127 lines 5.76 kB
import { BaseServiceClient } from '../../core/base-client'; import { HealthCheckResponseSchema, InventoryMasterExtensionResponseSchema, InventoryMasterExtensionListResponseSchema, InventoryMasterExtensionListParamsSchema, InventoryMasterExtensionCreateParamsSchema, InventoryMasterExtensionUpdateParamsSchema, SuggestDisplayDescResponseSchema, SuggestWebDescResponseSchema, AISuggestionParamsSchema, PodcastResponseSchema, PodcastListResponseSchema, PodcastListParamsSchema, PodcastCreateParamsSchema, PodcastUpdateParamsSchema, } from './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(); * ``` */ export class P21PimClient extends 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', InventoryMasterExtensionListParamsSchema, InventoryMasterExtensionListResponseSchema), /** * Get a specific inventory master extension by UID */ get: this.createGetMethod('/inv-mast-ext/{id}', InventoryMasterExtensionResponseSchema), /** * Create a new inventory master extension record */ create: this.createCreateMethod('/inv-mast-ext', InventoryMasterExtensionCreateParamsSchema, InventoryMasterExtensionResponseSchema), /** * Update an existing inventory master extension */ update: this.createUpdateMethod('/inv-mast-ext/{id}', InventoryMasterExtensionUpdateParamsSchema, InventoryMasterExtensionResponseSchema), /** * Soft delete an inventory master extension (sets status_cd to 700) */ delete: this.createDeleteMethod('/inv-mast-ext/{id}', 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: AISuggestionParamsSchema, responseSchema: 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: AISuggestionParamsSchema, responseSchema: SuggestWebDescResponseSchema, }, params || {}); }, }; /** * Podcast Management * * Manage podcast content with full transcript support. */ this.podcasts = { /** * List podcasts with filtering and search capabilities */ list: this.createListMethod('/podcasts', PodcastListParamsSchema, PodcastListResponseSchema), /** * Get a specific podcast by UID */ get: this.createGetMethod('/podcasts/{id}', PodcastResponseSchema), /** * Create a new podcast record */ create: this.createCreateMethod('/podcasts', PodcastCreateParamsSchema, PodcastResponseSchema), /** * Update an existing podcast record */ update: this.createUpdateMethod('/podcasts/{id}', PodcastUpdateParamsSchema, PodcastResponseSchema), /** * Soft delete a podcast record */ delete: this.createDeleteMethod('/podcasts/{id}', PodcastResponseSchema), }; /** * Health check endpoint * * Monitor service health and availability. * Note: Only requires x-site-id header, no Bearer token needed. */ this.getHealthCheck = this.createHealthCheckMethod(HealthCheckResponseSchema); } } //# sourceMappingURL=client.js.map