UNPKG

@simpleapps-com/augur-api

Version:

TypeScript client library for Augur microservices API endpoints

81 lines 3.55 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.LogisticsClient = void 0; const base_client_1 = require("../../core/base-client"); const resources_1 = require("./resources"); /** * Logistics Service Client * * Provides access to shipping and logistics endpoints for freight rate calculation, * carrier comparison, and shipping cost optimization. * * @service logistics * @domain shipping-and-logistics * @discoverable true * @searchTerms ["logistics", "shipping", "freight", "carriers", "delivery", "speedship"] * @relatedEndpoints ["api.commerce.orders.create", "api.commerce.cartHeaders.checkout", "api.customers.addresses.validate"] * @commonPatterns ["Freight shipping", "Rate calculation", "Carrier comparison", "Shipping cost optimization"] * @workflow ["order-fulfillment", "shipping-calculation", "carrier-selection", "freight-management"] * @functionalArea "shipping-and-logistics" * @performance "Optimized for freight rate calculation and carrier comparison" * @example * ```typescript * import { HTTPClient } from '@augur/api-client/core'; * import { LogisticsClient } from '@augur/api-client/services/logistics'; * * const http = new HTTPClient('logistics', { siteId: 'your-site-id', bearerToken: 'your-token' }); * const logistics = new LogisticsClient(http); * * // Check service health * const health = await logistics.healthCheck.get(); * const healthData = await logistics.healthCheckData.get(); * * // Test connectivity * const pong = await logistics.ping.get(); * * // Get freight rates * const rates = await logistics.speedship.freight.get({ * fromAddressLine: '123 Warehouse St', * fromCity: 'Los Angeles', * fromState: 'CA', * fromPostalCode: '90210', * fromCountryCode: 'US', * toAddressLine: '456 Customer Ave', * toCity: 'New York', * toRegion: 'NY', * toPostalCode: '10001', * toCountryCode: 'US', * packageLength: 48, * packageWidth: 40, * packageHeight: 36, * totalWeight: 500, * productType: 'LTL' * }); * ``` */ class LogisticsClient extends base_client_1.BaseServiceClient { constructor(http, baseUrl) { super('logistics', http, baseUrl || 'https://logistics.augur-api.com'); // 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); }; // 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.speedship = (0, resources_1.createSpeedshipResource)(boundExecuteRequest); this.speedshipData = (0, resources_1.createSpeedshipDataResource)(this.speedship); this.shipvia = (0, resources_1.createShipviaResource)(boundExecuteRequest); this.shipviaData = (0, resources_1.createShipviaDataResource)(this.shipvia); } getServiceDescription() { return 'Shipping and logistics service for freight rate calculation and carrier comparison'; } } exports.LogisticsClient = LogisticsClient; //# sourceMappingURL=client.js.map