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

@qbtech/tmt-api-sdk

v1.0.0-alpha.4

Published

Software Development Kit for the Trust My Travel API.

Downloads

7

Readme

TMT API SDK for JavaScript

This is the server-side JavaScript SDK for the TMT API. The intention is that this provides a wrapper with a simplified interface for end users to interact with the TMT API. Currently only limited access to the bookings endpoint is supported.

Requirements

Installation

Install the package with:

npm install @qbtech/tmt-api-sdk
# or
yarn add @qbtech/tmt-api-sdk

Usage

The SDK needs to be configured with an API token and your site path. You will also need the ID of the channel you wish to create a booking in and the currency code for the base currency of that channel. The library exports an Enums helper for the currency, country and language fields.

Example for when using CJS modules:

const TMT = require("@qbtech/tmt-api-sdk");
const Enums = require("@qbtech/tmt-api-sdk").Enums;

const tmtServerSdk = new TMT({
  apiToken: "123|abcDEFg1Hfjk...",
  sitePath: "path-of-site",
});

tmtServerSdk
  .createBooking({
    title: "Booking title",
    firstname: "John",
    surname: "Doe",
    email: "[email protected]",
    date: "2025-01-31",
    total: 1000,
    currencies: Enums.Currency.USD,
    channels: 1234,
    content: "Holiday for two in London",
    pax: 2,
    reference: "someinternalreference",
    countries: Enums.Country.US,
  })
  .then((booking) => console.log(booking.id))
  .catch((error) => console.error(error));

Or using ES modules and async/await:

import TMT, { Enums } from "@qbtech/tmt-api-sdk";

const tmtServerSdk = new TMT({
  apiToken: "123|abcDEFg1Hfjk...",
  sitePath: "path-of-site",
});

const booking = await tmtServerSdk.createBooking({
  title: "Booking title",
  firstname: "John",
  surname: "Doe",
  email: "[email protected]",
  date: "2025-01-31",
  total: 1000,
  currencies: Enums.Currency.USD,
  channels: 1234,
  content: "Holiday for two in London",
  pax: 2,
  reference: "someinternalreference",
  countries: Enums.Country.US,
});

console.log(booking.id);

You can also update an existing booking, or retrieve a booking using its id:

tmtServerSdk.updateBooking(id, { reference: "editedreference" });

tmtServerSdk.getBookingById(id);

Module support

We support both CommonJS modules and ECMAScript modules. Please see the node documentation for more context on how these module systems are utilized and how to correctly configure your project to use them. If using TypeScript, note that enabling esModuleInterop could result in your project using an export not intended for your module system. This might work but should ideally not be used as this as is workaround and may result in unexpected behaviour.

Version support

The latest major version of the @qbtech/tmt-api-sdk package introduces new features and addresses bugs. To access these enhancements and bug fixes, including those for security issues, it's advisable to upgrade from older versions. Although older major versions remain accessible, they won't receive further updates.

Note that this library was developed using Node v21 and is meant to be run server-side, in a Node environment, and not in a browser i.e. client-side. If you need support for a specific Node version, please contact support.

Development

Run all tests:

$ npm install
$ npm test