New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

mot-js-sdk

Package Overview
Dependencies
Maintainers
0
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mot-js-sdk

A TypeScript SDK for the MOT History API.

  • 1.0.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

GitHub top language GitHub package.json version GitHub last commit npm GitHub issues

MOT History API JS SDK

A TypeScript SDK for the MOT History API.

Build

To build the package, execute the following command:

npm run build

Testing

Developers/Engineers can test the SDK with or without client credentials.

a. The test uses environment variables with fallback values if you test without credentials:

const clientId = process.env.MOT_CLIENT_ID || "dummy-client-id";
const clientSecret = process.env.MOT_CLIENT_SECRET || "dummy-client-secret";
const apiKey = process.env.MOT_API_KEY || "dummy-api-key";

It uses dummy values if you don't set environment variables, allowing folks to run tests without real credentials.

b. You can set the environment variables before running the tests to use real credentials:

export MOT_CLIENT_ID=enter_real_client-id
export MOT_CLIENT_SECRET=enter_real_client_secret
export MOT_API_KEY=enter_real_api_key
npm run test

Unset the environment variables after completing the tests:

unset MOT_CLIENT_ID && unset MOT_CLIENT_SECRET && unset MOT_API_KEY

Installation

To install the package, run the following command:

npm install mot-js-sdk

Integration Example

Here is an example of how you can use the SDK to build real-world applications:

import MotApiSdk from 'mot-js-sdk';

// Initialize the SDK with your credentials
const sdk = new MotApiSdk(
  process.env.MOT_CLIENT_ID!,
  process.env.MOT_CLIENT_SECRET!,
  process.env.MOT_API_KEY!
);

async function integrateMotApiSdk() {
  try {
    // Retrieve vehicle by registration
    console.log("Retrieving vehicle by registration:");
    const vehicleByReg = await sdk.getVehicleByRegistration('AB12CDE');
    console.log(vehicleByReg);

    // Retrieve vehicle by VIN
    console.log("\nRetrieving vehicle by VIN:");
    const vehicleByVin = await sdk.getVehicleByVin('WBAJL51050G799651');
    console.log(vehicleByVin);

    // Bulk download
    console.log("\nBulk download data:");
    const bulkDownload = await sdk.getBulkDownload();
    console.log(bulkDownload);

    // Renew credentials
    console.log("\nRenewing credentials:");
    const newCredentials = await sdk.renewCredentials({
      awsApiKeyValue: process.env.MOT_API_KEY!,
      email: 'firstname.lastname@example.com'
    });
    console.log("New client secret:", newCredentials.clientSecret);

  } catch (error) {
    console.error("An error occurred:", error);
  }
}

// Run the integration
integrateMotApiSdk();

Set up your environment variables:

export MOT_CLIENT_ID=enter_real_client_id
export MOT_CLIENT_SECRET=enter_real_client_secret
export MOT_API_KEY=enter_real_api_key

Execute the script with ts-node:

ts-node mot-js-sdk-integration.ts

Setting up a MOT History API

You can use this support form to request an API Key.

Using the MOT History API

You can read the API documentation to understand what's possible with the MOT History API. If you need further assistance, don't hesitate to contact the DVSA.

License

This project is licensed under the MIT License.

(c) 2024 - 2025 Finbarrs Oketunji.

The MOT History API JavaScript/TypeScript SDK is Licensed under the Open Government Licence v3.0

Keywords

FAQs

Package last updated on 14 Jan 2025

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