# firststreet-js

> "A Javascript API Client for the First Street Foundation API"

Latest version **1.0.0** (published 2021-05-17) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install firststreet-js
pnpm add firststreet-js
yarn add firststreet-js
bun add firststreet-js
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2021-05-17 |
| First published | 2019-11-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 112.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | First Street Foundation |
| Maintainers | excellent, vacas |
| Keywords | firststreet |

## Links

- npm: https://www.npmjs.com/package/firststreet-js
- Repository: https://github.com/FirstStreet/firststreet-js
- Homepage: https://github.com/FirstStreet/firststreet-js#readme
- Issues: https://github.com/FirstStreet/firststreet-js/issues
- npm.io page: https://npm.io/package/firststreet-js

## Dependencies (4)

- [-](https://npm.io/package/-.md) 0.0.1
- [lodash](https://npm.io/package/lodash.md) ^4.17.21
- [node-fetch](https://npm.io/package/node-fetch.md) ^2.6.1
- [@babel/runtime](https://npm.io/package/@babel/runtime.md) ^7.14.0

## Recent versions

- 1.0.0 (latest) — 2021-05-17
- 0.1.5 — 2019-11-19
- 0.1.4 — 2019-11-18
- 0.1.3 — 2019-11-18
- 0.1.2 — 2019-11-18
- 0.1.1 — 2019-11-18
- 0.1.0 — 2019-11-18

## README

# First Street JavaScript Client

[![CircleCI](https://circleci.com/gh/FirstStreet/firststreet-js.svg?style=svg&circle-token=168be542d7448e05f502e123f0f3dbe0f9f8f66b)](https://circleci.com/gh/FirstStreet/firststreet-js)
[![codecov](https://codecov.io/gh/firststreet/firststreet-js/branch/master/graph/badge.svg?token=TATSnMXhTx)](https://codecov.io/gh/firststreet/firststreet-js)

This is the official implementation of the First Street Foundation API in JavaScript.

For more in-depth guides, usage and API access, please see the documentation at [docs.firststreet.dev](https://docs.firststreet.dev).

## Installation

First install firststreet-js:

```bash
npm install firststreet-js
```

Next, import it into your project

```javascript
import FirstStreet from 'firststreet-js';

// Or commonjs
const FirstStreet = require('firststreet-js');
```


## Documentation

In order to use the First Street Foundation API, you must register for an API key at [https://firststreet.dev](https://firststreet.dev).

### Intializing Client

```javascript
// Create a new First Street Foundation API Client
const fs = new FirstStreet("api-key");
```

### Using the client

The client supports querying Firststreet API endpoints corresponding to documentation, extensive examples can be found in ```./tests``` directory.

Generally, for endpoints that require location and fsid, first need to initialize lookup object as in below example, and then use it for querying the data:

```javascript
    const fs = new FirstStreet(apiKey);
    const lookup = fs.lookup('city', { fsid: 4808860 });
    const probability = await lookup.probability('count');
```

For endpoints that do not use fsid, please pass the parameter(s) directly to the endpoint call, as in this example:

```javascript
    const fs = new FirstStreet(apiKey);
    const historic = await fs.historic('event', { id: 12 });
```

Similarly, if endpoint accepts other parameters in addition to location lookup, then these can be passed to the endpoint call directly:
```javascript
    const fs = new FirstStreet(apiKey);
    const lookup = fs.lookup('property', { fsid: 4801470191 });
    const aal = await lookup.economic('aal', { basement: true, floorElevation: 122, depth: 100 });
```

### Errors
Errors from the API and network errors are propagated to caller.

---
_Source: https://npm.io/package/firststreet-js · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
