UNPKG

@simpleapps-com/augur-api

Version:

TypeScript client library for Augur microservices API endpoints

70 lines 4.57 kB
import { BaseServiceClient } from '../../core/base-client'; import { createHealthCheckResource, createHealthCheckDataResource, createInvoiceHdrResource, createInvoiceHdrDataResource, createOeHdrResource, createOeHdrDataResource, createOeHdrSalesrepResource, createOeHdrSalesrepDataResource, createPickTicketsResource, createPickTicketsDataResource, createPoHdrResource, createPoHdrDataResource, } from './resources'; /** * Orders Service Client - OpenAPI Path Mirroring Implementation * @description Comprehensive order management functionality for the Augur platform covering the complete order lifecycle from creation through fulfillment, including order processing, invoicing, purchase orders, and sales representative management. Follows strict OpenAPI path mirroring pattern. * * @fullPath api.orders * @service orders * @domain order-management * @discoverable true * @searchTerms ["orders", "order management", "purchase orders", "invoices", "sales orders", "order processing", "fulfillment"] * @relatedEndpoints ["api.customers.customer.list", "api.items.products.list", "api.pricing.job-pricing.create", "api.commerce.checkout.process"] * @commonPatterns ["Order lookup", "Order tracking", "Purchase order management", "Invoice processing", "Sales rep orders"] * @functionalArea "order-and-fulfillment-management" * @workflow ["order-processing", "purchase-order-workflow", "invoice-management", "sales-order-lifecycle"] * @businessRules ["Orders require valid customer and items", "Purchase orders track receiving status", "Invoices integrate with Prophet 21", "Access filtered by sales rep permissions"] * @performance "Supports pagination and filtering. Use edgeCache for frequently accessed data." * * @example * ```typescript * const api = new AugurAPI({ bearerToken: 'token', siteId: 'site' }); * * // OpenAPI Path Mirroring Examples: * // /oe-hdr/lookup → api.orders.oeHdr.lookup.list() * const ordersResponse = await api.orders.oeHdr.lookup.list({ limit: 10, q: '12345' }); * console.log(`Found ${ordersResponse.total} orders`); * * // /oe-hdr/{orderNo}/doc → api.orders.oeHdr.doc.get(orderNo) * const orderDoc = await api.orders.oeHdr.doc.get(12345678, { postalCode: '12345' }); * * // /oe-hdr-salesrep/{salesrepId}/oe-hdr → api.orders.oeHdrSalesrep.oeHdr.list(salesrepId) * const repOrders = await api.orders.oeHdrSalesrep.oeHdr.list(12345); * * // /po-hdr/scan → api.orders.poHdr.scan.create(params) * const similarPOs = await api.orders.poHdr.scan.create({ vendorId: 'VENDOR001' }); * ``` */ export class OrdersClient extends BaseServiceClient { /** * Create a new OrdersClient instance * @param http Configured HTTPClient instance with authentication * @param baseUrl Base URL for the Orders API (default: https://orders.augur-api.com) */ constructor(http, baseUrl = 'https://orders.augur-api.com') { super('orders', http, baseUrl); // Bind executeRequest for resource factories const boundExecuteRequest = (config, params, pathParams) => { return this.executeRequest(config, params, pathParams); }; // Bind helper methods for resources that need them const boundCreateHealthCheckMethod = this.createHealthCheckMethod.bind(this); const boundCreateListMethod = this.createListMethod.bind(this); const boundCreateGetMethod = this.createGetMethod.bind(this); const boundCreateCreateMethod = this.createCreateMethod.bind(this); // Initialize resources this.healthCheck = createHealthCheckResource(boundCreateHealthCheckMethod); this.healthCheckData = createHealthCheckDataResource(this.healthCheck); this.invoiceHdr = createInvoiceHdrResource(boundExecuteRequest); this.invoiceHdrData = createInvoiceHdrDataResource(this.invoiceHdr); this.oeHdr = createOeHdrResource(boundExecuteRequest, boundCreateListMethod); this.oeHdrData = createOeHdrDataResource(this.oeHdr); this.oeHdrSalesrep = createOeHdrSalesrepResource(boundExecuteRequest); this.oeHdrSalesrepData = createOeHdrSalesrepDataResource(this.oeHdrSalesrep); this.pickTickets = createPickTicketsResource(boundExecuteRequest, boundCreateListMethod); this.pickTicketsData = createPickTicketsDataResource(this.pickTickets); this.poHdr = createPoHdrResource(boundExecuteRequest, boundCreateListMethod, boundCreateGetMethod, boundCreateCreateMethod); this.poHdrData = createPoHdrDataResource(this.poHdr); } } //# sourceMappingURL=client.js.map