UNPKG

@simpleapps-com/augur-api

Version:

TypeScript client library for Augur microservices API endpoints

79 lines 3.35 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.UPSClient = void 0; const base_client_1 = require("../../core/base-client"); const resources_1 = require("./resources"); /** * UPS Shipping Service Client * * Provides comprehensive UPS shipping rate calculation, service comparison, * and shipping cost optimization. Offers detailed UPS service options with * accurate pricing for domestic and international shipments. * * **CRITICAL: This client follows OpenAPI Path Mirroring Pattern** * - /health-check → client.healthCheck.get() * - /rates-shop → client.ratesShop.get() * * @service ups * @domain shipping-and-logistics * @fullPath api.ups * @discoverable true * @searchTerms ["ups", "shipping", "rates", "logistics", "carrier", "package delivery"] * @relatedEndpoints ["api.shipping.rates.calculate", "api.logistics.speedship.freight.get", "api.commerce.cart.shipping.calculate"] * @commonPatterns ["UPS rate shopping", "Shipping cost calculation", "Carrier service comparison", "Delivery estimation"] * @workflow ["e-commerce-checkout", "order-fulfillment", "shipping-estimation", "carrier-selection"] * @functionalArea "shipping-and-logistics" * @businessRules ["Requires UPS API access", "Supports domestic and international shipping", "Provides real-time rate quotes"] * @performance "Optimized for UPS rate shopping with caching support" * * @example * ```typescript * import { HTTPClient } from '@augur/api-client/core'; * import { UPSClient } from '@augur/api-client/services/ups'; * * const http = new HTTPClient('ups', { siteId: 'your-site-id', bearerToken: 'your-token' }); * const ups = new UPSClient(http); * * // Check service health * const health = await ups.healthCheck.get({ 'x-site-id': 'SITE123' }); * const healthData = await ups.healthCheckData.get({ 'x-site-id': 'SITE123' }); * * // Shop UPS rates * const rates = await ups.ratesShop.get({ * fromAddress1: '123 Warehouse Blvd', * fromCity: 'Los Angeles', * fromStateProvinceCode: 'CA', * fromPostalCode: '90210', * fromCountryCode: 'US', * toAddress1: '456 Customer St', * toCity: 'New York', * toStateProvinceCode: 'NY', * toPostalCode: '10001', * toCountryCode: 'US', * weight: 5, * 'x-site-id': 'SITE123' * }); * * // Get just the rates data * const ratesData = await ups.ratesShopData.get({...}); * ``` */ class UPSClient extends base_client_1.BaseServiceClient { constructor(http, baseUrl) { super('ups', http, baseUrl || 'https://ups.augur-api.com'); // Bind executeRequest for resource factories const boundExecuteRequest = (config, params, pathParams) => { return this.executeRequest(config, params, pathParams); }; // Initialize resources this.healthCheck = (0, resources_1.createHealthCheckResource)(boundExecuteRequest); this.healthCheckData = (0, resources_1.createHealthCheckDataResource)(this.healthCheck); this.ratesShop = (0, resources_1.createRatesShopResource)(boundExecuteRequest); this.ratesShopData = (0, resources_1.createRatesShopDataResource)(this.ratesShop); } getServiceDescription() { return 'UPS shipping rate calculation and service comparison service'; } } exports.UPSClient = UPSClient; //# sourceMappingURL=client.js.map