Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vineyardbovines/darksky-api
Wrapper around the Dark Sky API
https://github.com/vineyardbovines/darksky-api
dark-sky darksky darksky-api darksky-weather-api darkskyapi weather weather-api
Last synced: about 2 months ago
JSON representation
Wrapper around the Dark Sky API
- Host: GitHub
- URL: https://github.com/vineyardbovines/darksky-api
- Owner: vineyardbovines
- License: mit
- Created: 2020-09-01T16:22:23.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-12-15T02:31:03.000Z (about 1 year ago)
- Last Synced: 2024-10-16T09:30:03.260Z (3 months ago)
- Topics: dark-sky, darksky, darksky-api, darksky-weather-api, darkskyapi, weather, weather-api
- Language: TypeScript
- Homepage:
- Size: 104 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# darksky-api
Wrapper around the [Dark Sky API](https://darksky.net/dev/docs).
## Usage
```bash
yarn add @gretzky/darksky-api
// or
npm install --save @gretzky/darksky-api
```### Methods
This is a single method wrapper around the API where you pass in the appropriate params. The only required keys are `key` (your Dark Sky API key), `latitude`, and `longitude`, and Dark Sky will return the current forecast for the location provided. You can pass a UNIX epoch time string to the `time` param to get the forecast for a specific time at a given location.
See the [API docs](https://darksky.net/dev/docs) for request params.
```ts
import darkskyApi from "darksky-api";const key = "yoursecretkey";
// get the latest forecast for a given latitude/longitude
const currentForecast = darkskyApi.getForecast({
key,
latitude: 43.65806,
longitude: -70.24417,
params: {
exclude: ["minutely", "daily", "hourly"], // returns 'currently', 'alerts', 'flags'
units: "ca",
},
});// or, get the forecast for a given time at a given latitude/longitude
const tomorrowAfternoonForecast = darkskyApi.getForecast({
key,
latitude,
longitude,
time: 1599053400, // UNIX epoch timestamp. Date object may work
});
```