Notice: This library is beta and subject to change.
This is the official implementation of the First Street Foundation API in Go. Please use this client if you are using Go to interact with the First Street Foundation API.
For more in-depth guides, usage and API access, please see the documentation at docs.firststreet.dev.
First install firststreet-go
:
go get -u github.com/firststreet/firststreet-go
Next, import firststreet
and client
to your project. firststreet
is the backend that defines which version and server the client will use.
import (
"github.com/firststreet/firststreet-go"
"github.com/firststreet/firststreet-go/client"
)
In order to use the First Street Foundation API, you must register for an API key at https://firststreet.dev. For more in-depth documentation and API reference, see https://docs.firststreet.dev
// Create a new backend
backend := firststreet.NewBackend("api-key")
// Create the API client
fsf := client.New(backend)
Provide a Lookup
to the specific product. A lookup determines how the location will be queried.
lookup := &firststreet.Lookup{
FSID: "123456",
}
lookup := &firststreet.Lookup{
Lat: 51.4779,
Lng: 0.0015,
}
lookup := &firststreet.Lookup{
Address: "247 Water Street, Brooklyn NY, 11201",
}
The Risk Summary API provides metadata and risks summary for a given location
. Depending on the location type, a PropertySummary
or CitySummary
will be returned.
fsf.PropertySummary.Lookup(lookup)
fsf.CitySummary.Lookup(lookup)
When doing a data request that is outside of Risk Summary, a locationType
is required, depending on the type of location you are querying.
firststreet.PropertyLocationType
provides theproperty
location typefirststreet.CityLocationType
provides thecity
location type
The Hurricane Risk API provides hurricane risk for a given location
.
fsf.Hurricane.Lookup(locationType, lookup)
The Tidal Risk API provides tidal risk for a given location
.
fsf.Tidal.Lookup(locationType, lookup)
The Market Value Impact API provides tidal risk for a given location
.
fsf.MVI.Lookup(locationType, lookup)
All errors will have a Code
, Status
and Message
attached to it.
Rate limit information is provided wit