UNPKG

@simpleapps-com/augur-api

Version:

TypeScript client library for Augur microservices API endpoints

99 lines 5.91 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.P21CoreClient = void 0; const base_client_1 = require("../../core/base-client"); const resources_1 = require("./resources"); const schemas_1 = require("./schemas"); /** * P21 Core API Client * @description Client for interacting with P21 Core system API endpoints for address management, cash drawer operations, company data, location management, and payment processing within the Prophet 21 ERP system * @fullPath api.p21Core * @service p21-core * @domain enterprise-resource-planning * @discoverable true * @searchTerms ["p21-core", "prophet 21", "ERP", "addresses", "cash drawer", "company data", "locations", "payment types", "shipping methods", "business operations", "corporate addresses"] * @relatedEndpoints ["api.p21Core.address", "api.p21Core.cashDrawer", "api.p21Core.company", "api.p21Core.location", "api.p21Core.paymentTypes", "api.p21Core.codes"] * @commonPatterns ["ERP data management", "Address and shipping setup", "Cash drawer operations", "Company configuration", "Location management", "Payment processing setup"] * @workflow ["erp-setup", "address-management", "financial-operations", "location-configuration", "payment-processing"] * @prerequisites ["Valid P21 system access", "ERP authentication", "Company-specific permissions"] * @nextSteps ["api.commerce.cartHeaders for e-commerce integration", "api.orders for order processing", "api.pricing for pricing management"] * @businessRules ["Company-scoped data access", "Location-based permissions", "Cash drawer security controls", "Address validation for shipping"] * @functionalArea "enterprise-resource-planning" * @caching "Cache company and location data for 30 minutes, real-time for cash drawer operations" * @performance "Supports pagination for all list operations, optimized for ERP transaction volumes" * @example * ```typescript * import { HTTPClient } from '@augur/api-client/core'; * import { P21CoreClient } from '@augur/api-client/services/p21-core'; * * const client = new P21CoreClient(new HTTPClient({ baseURL: 'https://p21-core.augur-api.com' })); * * // List companies with pagination * const companies = await client.company.list({ limit: 20, offset: 0 }); * console.log(companies.data); // Company[] * * // Get company details * const company = await client.company.get({ companyUid: 123 }); * console.log(company.data); // Company * * // List addresses for shipping configuration * const addresses = await client.address.list({ carrierFlag: 'Y' }); * console.log(addresses.data); // Address[] * * // Get cash drawer status * const cashDrawers = await client.cashDrawer.list({ statusCd: 704 }); * ``` */ class P21CoreClient extends base_client_1.BaseServiceClient { // Ensure schemas are referenced to avoid unused import warnings get schemaRefs() { return this._schemaRefs; } /** * Create a new P21CoreClient instance * @param http Configured HTTPClient instance with authentication * @param baseUrl Base URL for the P21 Core API (default: https://p21-core.augur-api.com) */ constructor(http, baseUrl = 'https://p21-core.augur-api.com') { super('p21-core', http, baseUrl); // Schema references for 100% coverage - ensuring all exports are imported this._schemaRefs = { AddressSchema: schemas_1.AddressSchema, CashDrawerSchema: schemas_1.CashDrawerSchema, CompanySchema: schemas_1.CompanySchema, P21CodeSchema: schemas_1.P21CodeSchema, LocationSchema: schemas_1.LocationSchema, PaymentTypeSchema: schemas_1.PaymentTypeSchema, }; // Reference schemas to ensure 100% import coverage void this.schemaRefs; // Bind executeRequest for resource factories const boundExecuteRequest = (config, params, pathParams) => { if (params !== undefined || config.paramsSchema !== undefined) { return this.executeRequest(config, params, pathParams); } return this.executeRequest(config, undefined, pathParams); }; // Bind createListMethod for resources that need it const boundCreateListMethod = this.createListMethod.bind(this); // Initialize resources this.healthCheck = (0, resources_1.createHealthCheckResource)(boundExecuteRequest); this.healthCheckData = (0, resources_1.createHealthCheckDataResource)(this.healthCheck); this.ping = (0, resources_1.createPingResource)(boundExecuteRequest); this.pingData = (0, resources_1.createPingDataResource)(this.ping); this.address = (0, resources_1.createAddressResource)(boundExecuteRequest, boundCreateListMethod); this.addressData = (0, resources_1.createAddressDataResource)(this.address); this.cashDrawer = (0, resources_1.createCashDrawerResource)(boundExecuteRequest, boundCreateListMethod); this.cashDrawerData = (0, resources_1.createCashDrawerDataResource)(this.cashDrawer); this.company = (0, resources_1.createCompanyResource)(boundExecuteRequest, boundCreateListMethod); this.companyData = (0, resources_1.createCompanyDataResource)(this.company); this.codeP21 = (0, resources_1.createCodeP21Resource)(boundCreateListMethod); this.codeP21Data = (0, resources_1.createCodeP21DataResource)(this.codeP21); this.location = (0, resources_1.createLocationResource)(boundExecuteRequest, boundCreateListMethod); this.locationData = (0, resources_1.createLocationDataResource)(this.location); this.paymentTypes = (0, resources_1.createPaymentTypesResource)(boundCreateListMethod); this.paymentTypesData = (0, resources_1.createPaymentTypesDataResource)(this.paymentTypes); } } exports.P21CoreClient = P21CoreClient; //# sourceMappingURL=client.js.map