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 🙏

© 2025 – Pkg Stats / Ryan Hefner

vahansdk

v1.0.5

Published

Vahan SDK provides a easy-to-use APIs for seamless integration

Readme

Software Development Kit for Universal Car Backend.

Table of contents.

Prerequisites:


  • Must have a VahanAPI account.
  • Complete vendor specific prerequisites.
  • Node and node package manager(NPM) must be installed.

Installation Outline:


  1. Create a VahanAPI account.
  2. Complete vendor specific prerequisites.
  3. Installing node and npm.
  4. Install the SDK from npm.

Installation and Setup.

Create VahanAPI account

  • Create your VahanAPI account from this Link.

Vendor Specific Prequisites

  • Follow this link to reach vendor specfic tasks.

Don't have npm installed?

  • Follow this link for the guide to install npm.

How to Install the SDK.

  • Install the SDK from npm.
    npm i vahansdk

Steps to Run.

  • Initialise a npm project
    npm init
  • In the package.json add "type": "module" as mentioned below.
    {
        "name": "project",
        "main": "index.js",
        "type": "module",
    }
  1. Import the VahanSDK from the npm package.
    import { VahanSDK } from "vahansdk";
  1. Initialise the VahanSDK with your Vahan account.
    const Vahan = new VahanSDK(username, password);
  1. Generate the accessToken for authorization.
    const token = await Vahan.TokenManager.getVahanAccessToken();
  1. Now any api can be called using their specified function calls.
    const Response = await Vahan.Vehicles.vehicleSummary(`required-parameters`);
    console.log(Response)

How to use the supported functions


  • To use supported functions, follow this approach.

  • To utilize supported functions, adhere to the following approach:

  • Identify the function type from the list below:

    1. TokenManager
    2. Vehicle
    3. State
    4. Control
    5. General
  • Select the appropriate function from the corresponding category.


    const Vahan = new VahanSDK(username, password);

    try{
        const token = await Vahan.{functionType}.{function}( `required-parameters` );// Use the resolved data
    }catch(error){
        console.log(new Error(error)); // Handle errors
    }

                              (or)


    Vahan.{functionType}.{function}()
        .then((`required-parameters`) => {
            console.log('result'); // Use the resolved data
        })
        .catch((error) => {
            console.error('Error:', error); // Handle errors
        });

Explore our APIs


  • For detailed information about our APIs, visit this link.

List of Supported Functions


  • Both methods, async/await and promise chaining, are suitable for resolving promises returned by the mentioned functions.

  • Ensure that the promise is resolved before proceeding with its usage when utilizing promise chaining.

For Auth Type(Vahan.TokenManager. { functionName })

  1. getAccessToken
  2. refreshAccessToken

Read More about TokenManager functions.


For Vehicle Type(Vahan.Vehicles. { functionName } )

  1. vehicleSummary
  2. vehicleSpecifications

Read More about Vehicle functions.


For State Type(Vahan.State. { functionName } )

  1. batteryState
  2. climateState
  3. locationState
  4. vehicleState

Read More about State functions.


For Control Type(Vahan.Control. { functionName } )

  1. getVehicleControls
  2. chargePortControl
  3. engineControl
  4. flashLightControl
  5. frunkControl
  6. hornControl
  7. vehicleLockControl
  8. sentryModeControl
  9. vehicleSoftwareControl
  10. sunroofControl
  11. thermostatControl
  12. trunkControl
  13. valetModeControl
  14. ventControl
  15. wakeUpControl

Read More about Control functions.


For General Type(Vahan.General. { functionName } )

  1. diagnostics (DNE on Mock server so would be returning 404)
  2. releaseNotes

Read More about General functions.

Parameters

1. username
   - Vahan username.

2. password
   - Vahan password.

3. vahanAccessToken
   - accesstoken for authentication for Vahan.

4. vendorAccessToken
   - accesstoken for authentication for Vendor.

5. vendor.
   - vehicle brand name.
   - supported vendors.
     1. tesla
     2. rivian
     3. velocity (mock vehicle)
   - must be a string

6. keyId.
   - keyId of the vehicle.
   - must be a string.

7. body.
   - object body containing data.

8. action.
   - states the action to be performed on the control.
   - true indicates affirmative action (open, turn on, etc).
   - false indicates negative action (close, turn off, etc).
   - must be a boolean.

9. valetPassword.
   - password required to disable the valet mode for tesla.
   - must be a string.

10. additionalParameters.
   - additional parameters are necessary for specific vendor requests.

Token Manager functions


  • Serves to both generate an accessToken and refresh it upon expiration.

  • The accessToken, once generated, has an expiration period of 30 days.

  • Employ the refreshAccessToken() function to renew the accessToken.

How to generate accessToken:


  • Please provide your VahanAPI username and password to initialize an instance of the SDK.
    const Vahan = new VahanSDK(username, password);
  • Generate the accessToken by invoking the getAccessToken() function.

    const Vahan = new VahanSDK(username, password);

    const token = await Vahan.TokenManager.getAccessToken();

Refresh the accessToken


  • Token renewal can be accomplished utilizing the refreshToken() function.

  • Ensure that the accessToken is generated prior to refreshing it.


    const Vahan = new VahanSDK(username, password);

    let token = await Vahan.TokenManager.getAccessToken();

    token = await Vahan.TokenManager.refreshAcessToken()
  • Ensure that the functions are encapsulated within an async function.

Return to table of contents

Vehicle functions

Obtaining Vehicle Specifications

  • Retrieve specifications of your vehicle.
    const response = await Vahan.Vehicles.vehicleSpecifications(vendor, keyId, vahanAccessToken, vendorAccessToken, additionalParameters);

Obtaining Vehicle Summary

  • Retrieve summary of your vehicle.
    const response = await Vahan.Vehicles.vehicleSummary(vendor, keyId, vahanAccessToken, vendorAccessToken, additionalParameters);

Return to table of contents

State functions

Assess the battery condition of your vehicle.

  • Retrieve all vehicles linked to the requesting user.
    const response = await Vahan.State.batteryState(vendor, keyId, vahanAccessToken, vendorAccessToken, additionalParameters);

Assess the climate condition of your vehicle.

  • Retrieve all vehicles linked to the requesting user.
    const response = await Vahan.State.climateState(vendor, keyId, vahanAccessToken, vendorAccessToken, additionalParameters);

Assess the location of your vehicle.

  • Retrieve all vehicles linked to the requesting user.
    const response = await Vahan.State.locationState(vendor, keyId, vahanAccessToken, vendorAccessToken, additionalParameters);

Assess the state of the vehicle.

  • Retrieve all vehicles linked to the requesting user.
    const response = await Vahan.State.vehicleState(vendor, keyId, vahanAccessToken, vendorAccessToken, additionalParameters);

Return to table of contents

Control functions.

Retrieve a comprehensive list of all controls supported by your vehicle

  • Retrieves controls supported by your vehicles.
    const response = await Vahan.Control.getVehicleControls(vendor, keyId, vahanAccessToken, vendorAccessToken, additionalParameters);

Control Charge Port

  • Manage the charging port functionality of your vehicle.
    const response = await Vahan.Control.chargePortControl(vendor, keyId, action, vahanAccessToken, vendorAccessToken, additionalParameters);

Control Engine

  • Manage the engine control functionality of your vehicle.
    const response = await Vahan.Control.engineControl(vendor, keyId, vahanAccessToken, vendorAccessToken, additionalParameters);

Control Flash light

  • Manage the flash light functionality of your vehicle.
    const response = await Vahan.Control.flashLightControl(vendor, keyId, vahanAccessToken, vendorAccessToken, additionalParameters);

Control Frunk

  • Manage the frunk(front trunk) functionality of your vehicle.
    const response = await Vahan.Control.frunkControl(vendor, keyId, vahanAccessToken, vendorAccessToken, additionalParameters);

Control Horn

  • Manage the horn functionality of your vehicle.
    const response = await Vahan.Control.hornControl(vendor, keyId, vahanAccessToken, vendorAccessToken, additionalParameters);

Control locking mechanism

  • Manage the locking functionality of your vehicle.
    const response = await Vahan.Control.vehicleLockControl(vendor, keyId, action, vahanAccessToken, vendorAccessToken, additionalParameters);

Control sentry mode

  • Manage the sentry mode functionality of your vehicle.
    const response = await Vahan.Control.sentryModeControl(vendor, keyId, action, vahanAccessToken, vendorAccessToken, additionalParameters);

Control vehicle software

  • Initiate or cancel the vehicle software updates of your vehicle.
    const response = await Vahan.Control.vehicleSoftwareControl(vendor, keyId, action, vahanAccessToken, vendorAccessToken, additionalParameters);

Control sunroof

  • Manage the sunroof functionality of your vehicle.
    const response = await Vahan.Control.sunroofControl(vendor, keyId, action, vahanAccessToken, vendorAccessToken, additionalParameters);

Control thermostat

  • Manage the thermostat functionality of your vehicle.
    const response = await Vahan.Control.thermostatControl(vendor, keyId, action, vahanAccessToken, vendorAccessToken, additionalParameters);

Control trunk

  • Manage the trunk functionality of your vehicle.
    const response = await Vahan.Control.trunkControl(vendor, keyId, vahanAccessToken, vendorAccessToken, additionalParameters);

Control valet mode

  • Manage the valet mode functionality of your vehicle.
    const response = await Vahan.Control.valetModeControl(vendor, keyId, action, valetPassword, vahanAccessToken, vendorAccessToken, additionalParameters);

Control vents

  • Manage the vent functionality of your vehicle.
    const response = await Vahan.Control.ventControl(vendor, keyId, action, vahanAccessToken, vendorAccessToken, additionalParameters);

Wake up your Vehicle

  • Wake up the car from sleep.
    const response = await Vahan.Control.wakeUpControl(vendor, keyId, action, vahanAccessToken, vendorAccessToken, additionalParameters);

Return to table of contents

General functions.

Retrieve diagnostics details

  • Retrieve diagnostics details for your vehicle.
    const response = await Vahan.General.diagnostics(vendor, keyId, vahanAccessToken, vendorAccessToken, additionalParameters);

Retrieve release notes details

  • Retrieve release notes details for your vehicle.
    const response = await Vahan.General.releaseNotes(vendor, keyId, vahanAccessToken, vendorAccessToken, additionalParameters);

Return to table of contents

Vendor prerequisites

Prerequisites for Tesla

  • For Tesla:

    • Have Tesla mobile app installed on your device.
    • Install virtual key on the vehicle.
    • Generate vendorAccessToken.

Setup for Tesla

Installation of Virtual key on vehicle

  • Ensure you have the Tesla mobile app installed.
  • To install the virtual key on your vehicle, please proceed with this link
  • Proceed according to the Tesla app's instructions.

Generate vendorAccessToken

  • Follow this link to generate the vendorAccessToken and use it to call the functions for tesla.

  • This token needs to be refreshed every 8 hours.

Parameters for Tesla

To ensure proper configuration follow these steps

  • Please enter the vendor field as 'tesla' or utilize Vahan's enum as Vendor.TESLA, ensuring consistency across the configuration.
  • Please use the vehicle's VIN number as the keyId for Tesla.
  • Please enter the vahanAccessToken and vendorAccessToken without the 'Bearer' prefix.
  • Additional parameters are not required for Tesla configurations.

Return to table of contents