Git Product home page Git Product logo

paccurate's Introduction

paccurate

NPM

NPM version build codecov

Node.js client library for Paccurate. See docs and demo. The types are generated from Paccurate Swagger v1.5.7.

Quick Start

import { pack } from 'paccurate'

const data = await pack({
  key: 'YOUR_API_KEY',
  itemSets: [
    {
      refId: 0,
      dimensions: { x: 5.5, y: 6, z: 6 },
      quantity: 3,
      weight: 4.5,
    },
  ],
  boxTypeSets: ['fedex'],
})

console.log(data)

Documentation

Prerequisites

Installation

NPM:

npm install paccurate

Yarn:

yarn add paccurate

Usage

The package needs to be configured with your account's secret key:

const { Paccurate } = require('paccurate')

const paccurate = new Paccurate('YOUR_API_KEY')

paccurate
  .pack({
    // ...
  })
  .then((data) => console.dir(data, { depth: null }))
  .catch((error) => console.error(error.code, error.message))

The same can be done with ES Modules and async-await:

import { Paccurate } from 'paccurate'

const paccurate = new Paccurate('YOUR_API_KEY')

async function main() {
  try {
    const data = await paccurate.pack({
      // ...
    })
    console.dir(data, { depth: null })
  } catch (error) {
    console.error(error.code, error.message)
  }
}

main()

API Endpoint

The request can be sent to two endpoints:

Endpoint Description
https://api.paccurate.io/ 30-second timeout, best for real-time
https://cloud.api.paccurate.io/ 1 hour timeout, best for large, parallel batch jobs

The default endpoint is https://api.paccurate.io/. To send to a different endpoint, you can:

  1. Instantiate with endpoint:

    import { Paccurate } from 'paccurate'
    
    const paccurate = new Paccurate('YOUR_API_KEY', 'https://cloud.api.paccurate.io/')
    await paccurate.pack(data)
  2. Call method with endpoint:

    import { Paccurate } from 'paccurate'
    
    const paccurate = new Paccurate('YOUR_API_KEY')
    await paccurate.pack(data, 'https://cloud.api.paccurate.io/')
  3. Call function with endpoint:

    import { pack } from 'paccurate'
    
    await pack(data, 'https://cloud.api.paccurate.io/')

TypeScript

The following types can be imported:

import type { Body, Response } from 'paccurate'

Contributing

Contributions are welcome! See our guide on how to proceed. ๐Ÿ‘‹

License

MIT

paccurate's People

Contributors

dependabot[bot] avatar mergify[bot] avatar remarkablemark avatar github-actions[bot] avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.