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

topship-africa

v0.1.1

Published

A node package to interface with the Topship.Africa API and create a shipping method for your store.

Downloads

709

Readme

Topship Open Server Docs

This library allows you to quickly and easily use the Topship Africa Shipping API via Node.js.

Installation

The following recommended installation requires npm. If you are unfamiliar with npm, see the npm docs. Npm comes installed with Node.js since node version 0.8.x, therefore, you likely already have it.

Obtain an API Key

Grab your API Key from the Topship Africa.

Setup Environment Variables

Do not hardcode your Topship Africa into your code. Instead, use an environment variable or some other secure means of protecting your Topship API Key. Following is an example of using an environment variable.

Install Package

$ npm install topship-africa

You may also use yarn to install

$ yarn add topship-africa

The following is the minimum needed code to get Qoutes and Prices for Shipment. Use this example, and modify the to and from variables:

const { quotesAndPrices } = require("topship-africa");

quotesAndPrices(
    {
        shipmentDetail: {
            {
            senderDetails: {
                cityName: "Yaba",
                countryCode: "NG"
            },
            receiverDetails: {
                cityName: "Washington",
                countryCode: "US"
            },
            totalWeight: 4
        }
    }
);

The following is the minimum needed code to get Pickup Rate for Shipment. Use this example, and modify the to and from variables:

const { pickupRate } = require("topship-africa");

pickupRate({
  input: {
    senderDetail: {
      addressLine1: "268, Herbert Macauly way",
      addressLine2: "",
      country: "Nigeria",
      countryCode: "NG",
      state: "Lagos",
      city: "Yaba"
    },
    pickupDate: "2024-02-15T09:14:29.000Z"
  }
});

The following is the minimum needed code to get Booked Shipment. Use this example, and modify the to and from variables:

const { getBookedShipment } = require("topship-africa");

getBookedShipment({
  filter: {
    take: 10,
    page: 2
  }
});

The following is the minimum needed code to get Single Shipment. Use this example, and modify the to and from variables:

const { getShipmentById } = require("topship-africa");

getShipmentById("5e9f8f9f8d8f8d8f8d8f8f8f");

The following is the minimum needed code to Cancel Single Shipment. Use this example, and modify the to and from variables:

const { cancelShipmentById } = require("topship-africa");

cancelShipmentById("5e9f8f9f8d8f8d8f8d8f8f8f");

The following is the minimum needed code to Track Shipment. Use this example, and modify the to and from variables:

const { trackShipment } = require("topship-africa");

trackShipment("T619979552");

The following is the minimum needed code to get State List. Use this example, and modify the to and from variables:

const { getStates } = require("topship-africa");

getStates("NG");

The following is the minimum needed code to get City List. Use this example, and modify the to and from variables:

const { getCities } = require("topship-africa");

getCities("NG");

The following is the minimum needed code to Book a Shipment. Use this example, and modify the to and from variables:

const { saveShipment } = require("topship-africa");

saveShipment(
  {
    shipment: [
      {
        items: [
          {
            category:
              "Appliance || BeautyProducts || Jewelry || ComputerSupplies || HomeDecor || BabySupplies || TelevisionAndEntertainment || KitchenAccessories || Furniture || Gadgets || SolarPanelsAndInverter || VehicleParts || ClothingAndTextile || SportAccessories || GymEquipment || Fashion || Furniture || Education || Drones || Document || OriginalArtwork || ArtPrints || FoodItems || Medication || Fish || Herbs || BatteryLiquidElectrical || Crayfish || Driedfish || Prawns || Otherfish || GoatMeat || CowSkin || Beef || Snail || OtherMeats || PaintingsAndDrawings || ArtifactsAndHistoricalMonuments || LaptopsAndTablets || Phones || HeadphonesOrEarphonesOrAirPods || Wristwatches || VideoGames || OtherElectronicsOrGadgets || GoldSilverAndFineJewelry || PreciousStonesAndJewels || CostumeJewelry || HerbsAndPlants || FoodstuffAndFoodProducts || Drinks || Others",
            description: "Gucci Bag",
            weight: 4,
            quantity: 1,
            value: 99
          }
        ],
        itemCollectionMode: "DropOff || PickUp",
        pricingTier: "Budget || Express || FedEx || Premium || LastMileBudget",
        insuranceType: "None || Premium || Extended",
        insuranceCharge: 0,
        discount: 200,
        shipmentRoute: "Import || Export || Domestic",
        shipmentCharge: 128000,
        pickupCharge: 4000,
        deliveryLocation: "Lagos",
        pickupId: "topship-1234",
        pickupPartner: "Fez || Standard || Dellyman || Sendstack || Messenger",
        valueAddedTaxCharge: 800,
        senderDetail: {
          name: "John Doe",
          email: "[email protected]",
          phoneNumber: "08080808080",
          addressLine1: "SPencer",
          addressLine2: "Alagomeji",
          addressLine3: "Yaba",
          country: "Nigeria",
          state: "Lagos",
          city: "Lagos",
          countryCode: "NG",
          postalCode: "100001"
        },
        receiverDetail: {
          name: "Jane Doe",
          email: "jane.doe@gmail.",
          phoneNumber: "070347890",
          addressLine1: "Garki",
          addressLine2: "Maitama",
          addressLine3: "Suleja",
          country: "Nigeria",
          state: "Abuja",
          city: "Abuja",
          countryCode: "NG",
          postalCode: "111000"
        }
      }
    ]
  },
  process.env.TOPSHIP_API_KEY
);

The following is the minimum needed code to Pay for Shipment. Use this example, and modify the to and from variables:

const { payForShipment } = require("topship-africa");

payForShipment(
  {
    detail: {
      shipmentId: "string"
    }
  },
  process.env.TOPSHIP_API_KEY
);