@crusaider/leakbot-api
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

Leakbot API

A thin wrapper to communicate with the Leakbot service over https.

Should be possible to use this library in both node.js and the browser.

Credits and inspiration

This library is basically a Typescript implementation of the API layer in the home assistant leakbot integration.

Installation

npm install @crusaider/leakbot-api

Usage

import { connect } from '@crusaider/leakbot-api';

const client = await connect({
  username: '<leakbot user name>',
  password: '<leakbot password>',
});

console.log(await client.listUserDevices());

API

connect

connect(options: {
  username: string;
  password: string;
}): Promise<LeakbotAPI>;

LeakbotClient

interface LeakbotAPI {
  listUserDevices(): Promise<ListUserDevicesReponse>;
  getUserAccountInfo(): Promise<GetUserAccountInfoResponse>;
  listUserAddresses(): Promise<ListUserAddressesResponse>;
  getUserTenant(): Promise<GetUserTenantResponse>;
  getDeviceStatus(deviceId: DeviceId): Promise<DeviceStatusResponse>;
  listDevicesMessages(deviceId: DeviceId): Promise<ListDevicesMessagesResponse>;
  getDeviceWaterUsage(
    deviceId: DeviceId,
    timeZoneOffset?: number
  ): Promise<GetDeviceWaterUsageResponse>;
}

Please Read

⚠️ Leakbot Only Allows One Login: If you use this library the token your mobile app is connected to becomes invalid and you get logged out. This happens also if you re-log back into the app it invalidates the token for the integration, however the library should automatically re-authenticate.

Readme

Keywords

Package Sidebar

Install

npm i @crusaider/leakbot-api

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

17.7 kB

Total Files

13

Last publish

Collaborators

  • crusaider