Skip to content

Latest commit

 

History

History
36 lines (24 loc) · 1.14 KB

README.md

File metadata and controls

36 lines (24 loc) · 1.14 KB

EC3 Client for TypeScript

This is a programmatically-generated client for the EC3 public API based on the openEPD standard. It is based on EC3's OpenAPI spec, and generated using openapi-typescript-codegen.

Usage

For example:

import { EC3 } from '@cercula-io/ec3'
import type { EPD_List } from '@cercula-io/ec3'

const client = new EC3({
  BASE: 'https://openepd.buildingtransparency.org/api',
  TOKEN: process.env.TOKEN,
})

client.epds.getEpds().then((result) => {
  console.log((result as EPD_List[]).map((e) => e.product_description))
})

See the /examples directory for more.

Developing

Getting set up:

  1. Clone the repo
  2. Run npm install to pull dependencies

Iterating:

  1. Update the OpenAPI spec from https://openepd.buildingtransparency.org/openapi.json and put the contents in openapi.json, if desired
  2. Run npm run gen to generate new code
  3. Run npm run build to transpile the TypeScript code