Skip to content

rewiringamerica/ra-api-rem-ts-node

Repository files navigation

@rewiringamerica/rem

An API for REM, the Residential Electrification Model.

Rewiring America's other APIs can be found at our main API site.

Example code demonstrating how to use the APIs can be found in the api_demos Github repo.

This Typescript package is automatically generated by the OpenAPI Generator project:

  • Generator version: 7.10.0
  • Build package: org.openapitools.codegen.languages.TypeScriptNodeClientCodegen

For more information, please visit https://www.rewiringamerica.org/

Requirements.

Typescript ^4.0 or ^5.0

Installation & Usage

npm

You can install using:

npm install @rewiringamerica/rem

yarn

You can install using:

yarn add @rewiringamerica/rem

Getting Started

Sign up for an API key and follow the installation procedure. Then, run the following:

import { ResidentialElectrificationModelApi } from "@rewiringamerica/rem/api/apis";
import { SupportedUpgrade } from "@rewiringamerica/rem/model/supportedUpgrade";
import { HeatingFuel } from "@rewiringamerica/rem/model/heatingFuel";
import { HttpBearerAuth } from "@rewiringamerica/rem/model/models";

// Initialize the client and key
const key = new HttpBearerAuth()
key.accessToken = "key_example"

const rem_api = new ResidentialElectrificationModelApi();
rem_api.setDefaultAuthentication(key)

// Get savings by address
async function getRemByAddress(upgrade: SupportedUpgrade, address: string, heatingFuel: HeatingFuel) {
  try {
    const response = await rem_api.getByAddress(upgrade, address, heatingFuel);

    console.log(response.body);
  } catch (error) {
    console.error("Error:", error.response.body);
  }
}

// Call the async function
const address = "address_example"
getRemByAddress(SupportedUpgrade.Baseline, address, HeatingFuel.NaturalGas);

Documentation For Authorization

Sign up for an API key here.

Authentication schemes defined for the API:

auth

  • Type: Bearer authentication

Author

datascience@rewiringamerica.org

About

Typescript client stubs for the REM API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors