1.0.0 • Published 5 years ago

@serodigital/octopus-api-client v1.0.0

Weekly downloads
69
License
ISC
Repository
-
Last release
5 years ago

Octopus Api Client

A Typescript Api Client for Octopus Energy.

Built using OpenAPIGenerator.

Installing

npm i @sero-digital/octopus-energy-api

Usage

const apiClient = new OctopusApiClient();
const result = await apiClient.energyProductsApi.getEnergyProducts();
console.log(result.data.result);

Authentication

Some routes are authenticated such as consumption. To Authenticate, you will need to get an API_KEY from Optopus's developer dashboard.

Use the generateAuthHeader method supplied as part of the package.

const apiClient = new OctopusApiClient();
await apiClient.consumptionApi.getElectricityMeterConsumption(
  process.env.OCTOPUS_MPAN || '',
  process.env.OCTOPUS_SERIAL_NUMBER || '',
  undefined,
  undefined,
  undefined,
  undefined,
  undefined,
  generateAuthHeader(process.env.OCTOPUS_API_KEY || '')
);