New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

feathers-shippo

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

feathers-shippo

A Feathers JS adapter for the Shippo API

  • 0.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4
decreased by-96.85%
Maintainers
1
Weekly downloads
 
Created
Source

feathers-shippo

A FeathersJS adapter for the Shippo API. For more information, visit the Shippo API Docs and Shippo API Reference. This library automatically handles rate limits by using bottleneck under the hood.

import { ShippoShipments } from 'feathers-shippo';

const options = {
  token: 'YOUR_SHIPPO_TOKEN'
}

app.use('shipments', new ShippoShipments(options, app));


const shipments = await app.service('shipments').find({
  query: {
    results: 10,
    object_created_gt: '2023-01-01'
  }
});

Most services are a light wrapper around the corresponding Shippo resource. Some services implement custom params.query and custom methods to accomodate certain Shippo actions. To learn more about each service's capabilities, view the service's source code and read the Shippo API Reference. Note this library does not try to implement the Feathers Common query syntax, instead params.query is passed directly to Shippo.

  • ShippoAddresses
  • ShippoBatches
  • ShippoCarrierAccounts
  • ShippoCarrierParcelTemplates
  • ShippoCustomsDeclarations
  • ShippoCustomsItems
  • ShippoManifests
  • ShippoOrders
  • ShippoParcels
  • ShippoPickups
  • ShippoRates
  • ShippoRefunds
  • ShippoServiceGroups
  • ShippoShipments
  • ShippoTracks
  • ShippoTransactions
  • ShippoUserParcelTemplates

The library also exports some utility functions and classes

  • ShippoServce
  • shippo

Rate Limits

All services use Bottleneck to queue requests to the Shippo API. The limits are determined by whether the options.token starts with shippo_live or shippo_test and correspond to the Shippo Rate Limits. This means that requests should never exceed the rate limit because the Bottleneck will ensure they are limited properly. Note Bottleneck is a queue, not a rate limiter. You can also disable or pass your own rate limiters.

import { ShippoShipments } from 'feathers-shippo';
import Bottleneck from 'bottleneck';

 // disable rate limiting
const options = {
  token: 'YOUR_SHIPPO_TOKEN',
  limiters: null
}

// provide custom limiters
const options = {
  token: 'YOUR_SHIPPO_TOKEN',
  limiters: {
    get: new Bottleneck({ ... }) // GET/:id
    find: new Bottleneck({ ... }) // GET
    create: new Bottleneck({ ... }) // POST
    update: new Bottleneck({ ... }) // PUT
    remove: new Bottleneck({ ... }) // DELETE
  }
}

app.use('shipments', new ShippoShipmentsService(options, app));

ShippoService

You generally won't need to use this service directly, but its available to you. It is the base class used to create all other services.

import { ShippoService } from 'feathers-shippo';

const options = {
  token: 'YOUR_SHIPPO_TOKEN',
  path: 'shipments',
  methods: ['get', 'find', 'create']
}

app.use('shipments', new ShippoService(options, app));

Shippo Client

The shippo function creates a new axios instance with the Shippo API baseURL and Authorization header. It is used under the hood for all service requests. It is exported for you to handle any Shippo functionality not covered by this library. This client does not handle rate limiting.

import { shippo } from 'feathers-shippo';

const shippoClient = shippo('YOUR_SHIPPO_TOKEN');

Keywords

FAQs

Package last updated on 10 Jan 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc