0.0.10 • Published 2 years ago

postmen-ts v0.0.10

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

postmen-ts

npm version install size npm downloads

Postmen types for third-party use

Installing

Using npm:

$ npm install postmen-ts

Example Usage

import { CalculateRatesRequest, CalculateRatesResponse, Common, ShipperAccount, Shipment } from "postmen-ts";
import axios, { AxiosError, AxiosInstance, AxiosResponse } from 'axios';

public Rate(shipment: any) {
    return new Promise<any> ((resolve, reject) => {
        const CalculateRatesRequest = {} as CalculateRatesRequest;
        CalculateRatesRequest.async = false;
        CalculateRatesRequest.is_document = false;
        CalculateRatesRequest.ship_date = new Date().toISOString().slice(0, 10);
        CalculateRatesRequest.shipment = this._mapShipment(shipment) as Shipment;
        CalculateRatesRequest.shipper_accounts = this._getShipperAccounts() as ShipperAccount[];

         this.axios.post(Common.Endpoint.Rates, CalculateRatesRequest)
        .then((response: AxiosResponse) => {
            const calculateRateResponse = response.data?.data as CalculateRatesResponse;
            resolve(calculateRateResponse);
        })
        .catch((error: any) => {
            reject(error);
        });
    });
}
0.0.10

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago