https://github.com/taciturnaxolotl/pirateship-api
the pirateship api - typed
https://github.com/taciturnaxolotl/pirateship-api
pirateship
Last synced: 13 days ago
JSON representation
the pirateship api - typed
- Host: GitHub
- URL: https://github.com/taciturnaxolotl/pirateship-api
- Owner: taciturnaxolotl
- Created: 2024-09-17T14:25:31.000Z (7 months ago)
- Default Branch: master
- Last Pushed: 2025-01-22T20:03:30.000Z (3 months ago)
- Last Synced: 2025-04-04T09:17:43.689Z (24 days ago)
- Topics: pirateship
- Language: TypeScript
- Homepage: https://pirateship.com
- Size: 27.3 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Pirateship API
An unoffical typed wrapper for the PirateShip API.
## Installation
```bash
bun i pirateship-api
```# Usage
```ts
import { fetchShippingRates } from "pirateship-api";const options: ShippingOptions = {
originZip: "20001",
originCity: "Washington",
originRegionCode: "DC",
isResidential: true,
destinationZip: "90028",
destinationCountryCode: "US",
mailClassKeys: [
"PriorityExpress",
"First",
"ParcelSelect",
"Priority",
],
packageTypeKeys: ["SoftEnvelope"],
weight: 14,
dimensionX: 9,
dimensionY: 10,
showUpsRatesWhen2x7Selected: true,
};const rates = await fetchShippingRates(options);
console.log(rates.map((rate) => rate.title + " - " + rate.carrier.title + " - $" + rate.totalPrice));
```Running the above code will output the following:
```ts
[ "Priority Mail - USPS - $10.07", "Priority Mail Express - USPS - $47.25" ]
```This is a work in progress and the types are accurate as of 2024-09-17 but can't be guaranteed to be 100% correct as this is an undocumented internal API.