UNPKG

@simpleapps-com/augur-api

Version:

TypeScript client library for Augur microservices API endpoints

79 lines 4.01 kB
import { BaseServiceClient } from '../../core/base-client'; import { createHealthCheckResource, createHealthCheckDataResource, createInvMastResource, createInvMastDataResource, createItemCategoryResource, createItemCategoryDataResource, createOrdersResource, createOrdersDataResource, createStateResource, createStateDataResource, } from './resources'; /** * Legacy API Client * @description Client for interacting with Legacy microservice API endpoints following OpenAPI Path Mirroring Pattern * @fullPath api.legacy * @service legacy * @domain legacy-data-management * @discoverable true * @searchTerms ["legacy", "states", "inventory", "orders", "tags", "categories"] * @relatedEndpoints ["items", "customers", "orders"] * @commonPatterns ["CRUD operations", "state management", "inventory tagging"] * @example * ```typescript * import { HTTPClient } from '@augur/api-client/core'; * import { LegacyClient } from '@augur/api-client/services/legacy'; * * const http = new HTTPClient('legacy', { siteId: 'your-site-id', bearerToken: 'your-token' }); * const legacy = new LegacyClient(http); * * // Health check * const health = await legacy.healthCheck.get(); * * // Inventory operations * const alsoBought = await legacy.invMast.alsoBought.list(12345); * const tags = await legacy.invMast.tags.list(12345); * const webDesc = await legacy.invMast.webDesc.list(12345); * * // State management * const states = await legacy.legacy.state.list({ limit: 25, twoLetterCode: 'CA' }); * * // Categories and orders * const category = await legacy.itemCategory.get(67890); * const resetResult = await legacy.orders.reset.get(98765); * ``` */ export class LegacyClient extends BaseServiceClient { /** * Create a new LegacyClient instance * @param http Configured HTTPClient instance * @param baseUrl Base URL for the Legacy API (default: https://legacy.augur-api.com) */ constructor(http, baseUrl = 'https://legacy.augur-api.com') { super('legacy', http, baseUrl); // 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 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); const boundCreateUpdateMethod = this.createUpdateMethod.bind(this); const boundCreateDeleteMethod = this.createDeleteMethod.bind(this); // Initialize resources this.healthCheck = createHealthCheckResource(boundCreateHealthCheckMethod); this.healthCheckData = createHealthCheckDataResource(this.healthCheck); this.invMast = createInvMastResource(boundExecuteRequest); this.invMastData = createInvMastDataResource(this.invMast); this.itemCategory = createItemCategoryResource(boundExecuteRequest); this.itemCategoryData = createItemCategoryDataResource(this.itemCategory); this.orders = createOrdersResource(boundExecuteRequest); this.ordersData = createOrdersDataResource(this.orders); // State resource under legacy namespace const stateResource = createStateResource(boundCreateListMethod, boundCreateGetMethod, boundCreateCreateMethod, boundCreateUpdateMethod, boundCreateDeleteMethod); const stateDataResource = createStateDataResource(stateResource); this.legacy = { state: stateResource, }; this.legacyData = { state: stateDataResource, }; } } //# sourceMappingURL=client.js.map