go-tracking-sdk
v2.0.13
Published
NodeJS client for go-tracking-sdk
Downloads
612
Readme
README for Go Tracking API SDK
Overview
The Go Tracking API SDK provides a comprehensive solution for integrating real-time shipment tracking across various carriers. This SDK is ideal for businesses seeking to streamline their shipment tracking process, offering functionalities to manage tracking records, access carrier information, and track shipments in real-time.
Version
- OpenAPI Document: 1.0
Prerequisites
- Node.js
- npm (Node Package Manager)
Installation
To use the Go Tracking API SDK in your project, you need to install it via npm:
npm install go-tracking-api-sdk
Usage
Import the necessary modules from the SDK to your project. Here's an example of how to import and use the CarriersApi
and TrackersApi
classes:
import { CarriersApi, TrackersApi } from "go-tracking-api-sdk";
// Initialize the APIs
const carriersApi = new CarriersApi();
const trackersApi = new TrackersApi();
Working with Carriers
Use the CarriersApi
class to interact with carriers. For example, to retrieve a list of available carriers:
carriersApi
.findAllCarriers()
.then((response) => {
console.log(response.body); // Array of carriers
})
.catch((error) => {
console.error(error);
});
Tracking Shipments
Use the TrackersApi
class for shipment tracking. For instance, to create a new tracker:
import { CreateTrackerDto } from "go-tracking-api-sdk";
let createTrackerDto = new CreateTrackerDto(/* ... */);
trackersApi
.createTracker(createTrackerDto)
.then((response) => {
console.log(response.body); // Tracker information
})
.catch((error) => {
console.error(error);
});
Handling Responses
Responses from the API are wrapped in a promise. Use .then()
for success scenarios and .catch()
for error handling.
Authentication
Set up authentication using API keys. Example:
trackersApi.setApiKey(TrackersApiApiKeys.ClientId, "YOUR_CLIENT_ID");
trackersApi.setApiKey(TrackersApiApiKeys.ClientSecret, "YOUR_CLIENT_SECRET");
Interceptors
You can add interceptors to customize request handling:
trackersApi.addInterceptor(/* ... */);
Documentation
For more detailed documentation, please visit: Go Tracking API Documentation
Note
This SDK is auto-generated by OpenAPI Generator. Direct modifications are not recommended.