1.0.1 • Published 9 months ago

@crusaider/leakbot-api v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

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

:warning: 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.

1.0.1

9 months ago

1.0.0

1 year ago