UNPKG

@simpleapps-com/augur-api

Version:

TypeScript client library for Augur microservices API endpoints

156 lines 7.04 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.createSpeedshipResource = createSpeedshipResource; exports.createSpeedshipDataResource = createSpeedshipDataResource; const schemas_1 = require("../schemas"); /** * Creates the speedship resource methods * OpenAPI Path: /speedship/* → speedship.* * @description Speedship freight shipping endpoints */ function createSpeedshipResource(executeRequest) { return { freight: { /** * Get freight shipping rates from Speedship carriers * * @fullPath api.logistics.speedship.freight.get * @service logistics * @domain freight-shipping * @dataMethod speedshipData.freight.get * @discoverable true * @searchTerms ["freight", "shipping", "rates", "speedship", "carriers", "logistics", "delivery", "transportation", "ltl", "smallpack"] * @relatedEndpoints ["api.commerce.orders.create", "api.commerce.cartHeaders.checkout", "api.customers.addresses.validate", "api.avalara.rates.calculate"] * @commonPatterns ["Get shipping rates", "Compare freight carriers", "Calculate shipping costs", "Freight quote", "Logistics pricing", "Carrier comparison"] * @workflow ["order-fulfillment", "shipping-calculation", "carrier-selection", "cost-optimization", "freight-management"] * @prerequisites ["Valid shipping addresses", "Package dimensions and weight", "Public bearer token", "x-site-id header"] * @nextSteps ["Select carrier and service", "Create shipping label", "Process order fulfillment", "Track shipment"] * @businessRules ["Requires valid origin and destination addresses", "Supports LTL and SMALLPACK product types", "Multiple response formats available", "Weight and dimension validation", "Carrier-specific requirements"] * @functionalArea "shipping-and-fulfillment" * @crossSite "Multi-site shipping rate calculation support" * @caching "Cache for 30 minutes for identical shipments, rates change throughout the day" * @performance "Response time varies by carrier availability, use response format optimization for faster results" * * @param params Comprehensive freight shipping parameters including addresses, package details, and service preferences * @returns Promise<SpeedshipFreightResponse> Complete freight rate information with carrier options and pricing details * * @example * ```typescript * // Get freight rates for LTL shipment * const freightRequest = { * // Origin address * fromAddressLine: '123 Warehouse St', * fromCity: 'Los Angeles', * fromState: 'CA', * fromPostalCode: '90210', * fromCountryCode: 'US', * fromCompanyName: 'ABC Logistics', * fromFirstName: 'John', * fromLastName: 'Doe', * fromPhone: '555-0123', * * // Destination address * toAddressLine: '456 Customer Ave', * toCity: 'New York', * toRegion: 'NY', * toPostalCode: '10001', * toCountryCode: 'US', * toCompanyName: 'Customer Corp', * toFirstName: 'Jane', * toLastName: 'Smith', * toPhone: '555-0456', * * // Package details * packageLength: 48, * packageWidth: 40, * packageHeight: 36, * totalWeight: 500, * quantity: 1, * * // Service configuration * productType: 'LTL', * responseFormat: 'detailed', * dimensionUnit: 'IN', * weightUnit: 'LB' * }; * * const response = await client.speedship.freight.get(freightRequest); * console.log(response.data); // Detailed freight rates * * // Get just the rate data * const rates = await client.speedshipData.freight.get(freightRequest); * console.log(rates); // Direct access to freight rates * * // Get cheapest rate only * const cheapestRequest = { * ...freightRequest, * responseFormat: 'cheapest' as const * }; * const cheapest = await client.speedshipData.freight.get(cheapestRequest); * * // Small package shipment * const smallPackRequest = { * fromAddressLine: '789 Ship St', * fromCity: 'Chicago', * fromState: 'IL', * fromPostalCode: '60601', * fromCountryCode: 'US', * fromCompanyName: 'Small Biz', * fromFirstName: 'Bob', * fromLastName: 'Wilson', * fromPhone: '555-0789', * * toAddressLine: '321 Delivery Ln', * toCity: 'Miami', * toRegion: 'FL', * toPostalCode: '33101', * toCountryCode: 'US', * toCompanyName: 'Customer LLC', * toFirstName: 'Alice', * toLastName: 'Johnson', * toPhone: '555-0321', * * packageLength: 12, * packageWidth: 8, * packageHeight: 6, * totalWeight: 5, * quantity: 1, * productType: 'SMALLPACK', * responseFormat: 'summary', * dimensionUnit: 'IN', * weightUnit: 'LB' * }; * * const smallPackRates = await client.speedshipData.freight.get(smallPackRequest); * ``` */ get: async (params) => { return executeRequest({ method: 'GET', path: '/speedship/freight', paramsSchema: schemas_1.SpeedshipFreightRequestParamsSchema, responseSchema: schemas_1.SpeedshipFreightResponseSchema, }, params); }, }, }; } /** * Creates the speedshipData resource methods (data-only versions) */ function createSpeedshipDataResource(speedship) { return { freight: { /** * Get freight shipping rates data only * @param params Freight shipping request parameters * @returns Promise<SpeedshipFreightResult> Freight rate data with carrier options and pricing */ get: async (params) => { const response = await speedship.freight.get(params); return response.data; }, }, }; } //# sourceMappingURL=speedship.js.map