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

mot-js-sdk

v1.0.2

Published

A TypeScript SDK for the MOT History API.

Downloads

95

Readme

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: '[email protected]'
    });
    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.

Copyright

(c) 2024 Finbarrs Oketunji.

The MOT History API Go SDK is Licensed under the Open Government Licence v3.0