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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@letsparky/api-client

v1.0.2

Published

TypeScript SDK for Letsparky API

Downloads

10

Readme

Letsparky TypeScript API Client

A TypeScript client for interacting with the Letsparky User API.

Installation

npm install @letsparky/api-client

Usage

import { LetsparkyClient } from 'letsparky-api-client';

// Initialize the client
const client = new LetsparkyClient({
  baseUrl: 'https://api.letsparky.com',
  // Either use an API key
  apiKey: 'your-api-key',
  // Or use access token (typically after login)
  // accessToken: 'your-access-token',
  // refreshToken: 'your-refresh-token'
});

Authentication

Login with Email and Password

const loginResponse = await client.auth.login({
  email: '[email protected]',
  password: 'password123'
});

// The client automatically stores the tokens
console.log(loginResponse.userId);
console.log(loginResponse.accessToken);

Refresh Token

const refreshResponse = await client.auth.refreshToken();
console.log(refreshResponse.accessToken);
console.log(refreshResponse.refreshToken);

Set Authentication Manually

// Set access token
client.setAccessToken('your-access-token', 'your-refresh-token');

// Or set API key
client.setApiKey('your-api-key');

Device Management

Create a Device

const createDeviceResponse = await client.device.createDevice({
  serialNo: 'DEVICE123',
  type: 'PARKY_TCP',
  terminalArmonId: 'ARMON123',
  firmwareVersion: '1.0.0',
  macAddress: '00:11:22:33:44:55',
  imeiNumber: '123456789012345',
  blePassword: 'password123'
});

console.log(createDeviceResponse.deviceId);

Get Device by ID

const device = await client.device.getDeviceById('device-id');

Get Device by QR Data

const device = await client.device.getDeviceByQRData('qr-data');

User Device Management

Get User Devices

const userDevices = await client.userDevice.getUserDevices();

Add Owner to Device

const addDeviceResponse = await client.userDevice.addOwnerToDevice({
  serialNo: 'DEVICE123',
  nickName: 'My Device',
  qrData: 'qr-data',
  terminalType: 'type',
  photo: 'base64-encoded-photo',
  geoLat: 40.7128,
  geoLng: -74.0060
});

console.log(addDeviceResponse.id);
console.log(addDeviceResponse.deviceId);

Factory Reset a Device

const resetResponse = await client.userDevice.factoryResetDevice('device-id');
console.log(resetResponse.success);

Get User Device by Device ID

const userDevice = await client.userDevice.getUserDeviceByDeviceId('device-id');

Get User Device by QR Data

const userDevice = await client.userDevice.getUserDeviceByQrData('qr-data');

TCP Device Operations

Get Operational Status

const status = await client.tcpDevice.getOperationalStatus('device-id');
console.log(status.operationalStatus);
console.log(status.batteryVoltage);

Block Device

const blockResponse = await client.tcpDevice.blockDevice('device-id');
console.log(blockResponse.command);

Unblock Device

const unblockResponse = await client.tcpDevice.unblockDevice('device-id');
console.log(unblockResponse.command);

Webhook Configuration

Create Webhook Configuration

const webhookConfig = await client.webhookConfiguration.createWebhookConfiguration({
  callbackUrl: 'https://your-callback-url.com/webhook'
});

Update Webhook Configuration

const updatedConfig = await client.webhookConfiguration.updateWebhookConfiguration({
  id: 'config-id',
  callbackUrl: 'https://your-new-callback-url.com/webhook'
});

Get Webhook Configuration

const config = await client.webhookConfiguration.getWebhookConfiguration();
console.log(config.callbackUrl);

Error Handling

try {
  const response = await client.device.getDeviceById('invalid-id');
} catch (error) {
  console.error(error.message);
}

Models

The client includes TypeScript interfaces for all request and response objects, ensuring type safety throughout your application.

License

MIT