Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tmt-api-sdk-test

Package Overview
Dependencies
Maintainers
1
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tmt-api-sdk-test

Software Development Kit for the Trust My Travel API.

  • 1.0.0-alpha.3
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
3
Maintainers
1
Weekly downloads
 
Created
Source

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

  • Node

Installation

Install the package with:

npm install tmt-api-sdk
# or
yarn add tmt-api-sdk

Usage

The SDK needs to be configured with an API token and your site path. The library also exports an Enums helper for the currency, country and language fields.

Example for when using CJS modules:

const TMT = require("tmt-api-sdk");
const Enums = require("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: "jd@somedomain.com",
    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 "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: "jd@somedomain.com",
  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 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.

Development

Run all tests:

$ npm install
$ npm test

Detailed development documentation here.

FAQs

Package last updated on 15 Mar 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc