npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

twinjet-atc-client

v1.0.2

Published

JavaScript client for TwinJet ATC service (https://twinjet.co/)

Downloads

12

Readme

TwinJet ATC Client

JavaScript client for TwinJet ATC service (https://twinjet.co/)

Build Status codecov

For more information about the TwinJet ATC API: https://twinjet.co/developer/

Installation

npm install --save twinjet-atc-client

Usage

New client

Before making requests, you need to instantiate a new client:

const TwinJetATC = require('twinjet-atc-client');

const options = {
    api_token: 'Ahngohsieb5aijooghugheF6iel0AeGh',
};
const client = new TwinJetATC.Client(options);

More options

You can use more options in client constructor:

const options = {
    api_token: 'Ahngohsieb5aijooghugheF6iel0AeGh', // Required
    base_url: 'https://api.other.io/v1', // Override API base URL. Default: 'https://www.twinjet.co/api/v1'
    timeout: 2000, // Requests timeout, in milliseconds. 0 to disable. Default: 10000
    live: false // Live or test mode. Default: true
}

Create a job

const requestId = await client.create({
    order_contact_name: 'Larry Bluejeans',
    order_contact_phone: '5555555555',
    pick_address: {
        address_name: 'TCB Courier',
        street_address: '565 Ellis St',
        floor: 'Unit B',
        city: 'San Francisco',
        state: 'CA',
        zip_code: '94109',
        contact: 'Larry Bluejeans',
        special_instructions: 'Come right in',
    },
    deliver_address: {
        address_name: 'Important Office Building',
        street_address: '560 Mission St',
        floor: '13th floor',
        city: 'San Francisco',
        state: 'CA',
        zip_code: '94105',
        contact: 'P. Pete',
        special_instructions: 'Go to the messenger center',
    },
    ready_time: new Date(),
    deliver_from_time: Date.now(),
    deliver_to_time: '2014-08-04T14:54:28.630613-07:00',
    service_id: 21,
    order_total: 20.0,
    tip: 5.0,
    webhook_url: 'https://www.myawesomecompany.io/order/1234/',
    job_items: [
        {
            quantity: 4,
            description: 'Fried Chickens',
        },
        {
            quantity: 1,
            description: 'Coke',
        },
    ],
});

// requestId = 'A1B2C3D4E5'

Cancel a job

const response = await client.cancel({
    request_id: 'A1B2C3D4E5',
});

// response example: https://twinjet.co/developer/#statusjson

You can also use external_id or job_id to identify the job.

Update a job

const response = await client.update(
    {
        request_id: 'A1B2C3D4E5',
    },
    {
        order_contact_name: 'Larry Bluejeans',
        order_contact_phone: '5555555555',
        ready_time: new Date(),
        deliver_from_time: Date.now(),
        deliver_to_time: '2014-08-04T14:54:28.630613-07:00',
        webhook_url: 'https://www.myawesomecompany.io/order/1234/',
        job_items: [
            {
                quantity: 4,
                description: 'Fried Chickens',
            },
            {
                quantity: 1,
                description: 'Coke',
            },
        ],
    }
);

// response example: https://twinjet.co/developer/#statusjson

You can also use external_id or job_id to identify the job.

Job status

const response = await client.status({
    request_id: 'A1B2C3D4E5',
});

// response example: https://twinjet.co/developer/#statusjson

You can also use external_id or job_id to identify the job.

Address validation

const response = await client.addressValidation({
    pick_address: {
        address_name: 'TCB Courier',
        street_address: '565 Ellis St',
        floor: 'Unit B',
        city: 'San Francisco',
        state: 'CA',
        zip_code: '94109',
        contact: 'Larry Bluejeans',
        special_instructions: 'Come right in',
    },
    deliver_address: {
        address_name: 'Important Office Building',
        street_address: '560 Mission St',
        floor: '13th floor',
        city: 'San Francisco',
        state: 'CA',
        zip_code: '94105',
        contact: 'P. Pete',
        special_instructions: 'Go to the messenger center',
    },
});

// response example: https://twinjet.co/developer/#verifyjson

TypeScript

This package includes TypeScript definitions.

import TwinJetATCClient from 'twinjet-atc-client';

const client = new TwinJetATCClient({ api_token: '...'});

License

MIT