New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

here-weather

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

here-weather

Simple api helper for HERE Weather api.

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

here-weather

codecov Build Status

A wrapper for HERE Weather API made for NodeJS

Requirements

You will need a api key to access the weather data from HERE.com. You can create a free account HERE Developer

Installation

npm install here-weather

How to use

Get your APP ID and APP CODE from here.com ready.

const weather = require("here-weather");
// Replace with your app details.
weather.setAuth({ app_id:"YOUR_APP_ID", app_code:"YOUR_APP_CODE" });

//7 Day forcast for city chicago with freedom units
weather.location({ name:"chicago" })
weather.metric(false);
weather.forecastSimple()
    .then(({ forecast }) => {
        return forecast.map(day => {
            return {
            highTemp: day.highTemperature,
            lowTemp: day.highTemperature,
            weatherIcon: {
                icon: day.iconLink,
                name: day.iconName
                }
            }
        })
    })

Settings

//Required before any request is made.
weather.setAuth({ app_id: "YOUR_APP_ID", app_code: "YOUR_APP_CODE" })

//Required before any request is made.
//Use either location name,lat/long or zip.
weather.location({ name: "Austin,Texas" })
weather.location({ latitude:30.2672, longitude:97.7431 })
weather.location({ zipcode: 73301 })


//Use them freedom units!
weather.metric(false)

//Change the return data language
weather.language("english_us")

//Or Code
weather.language("en-US")

//Will return weather data from closest observation if true else will get many obervation weather data
weather.oneobservation(true)


//Date for which hourly forecasts are to be retrieved. The format is YYYY-MM-DD or YYYY-MM-DDThh:mm:ss
weather.hourlydate("2019-05-18")


//Will reset location,language,metric,oneobservation,hourlydate and auth info.
weather.resetSettings()

Forecast

All forecast methods return a promise. Before requesting any data you MUST set auth and location.

//Request a simplified seven day weather forecast
const { feedCreation, forecastLocation, forecast } = await weather.forecastSimple()

//Request a full seven day weather forecast
const { feedCreation, forecastLocation, forecast } = await weather.forecastExtended()


//Request an hour-by-hour seven day weather forecast
const { feedCreation, forecastLocation, forecast } = weather.forecastHourly()

//Request current weather observations around a named location, latitude and longitude and or zip code.
const { feedCreation, observationLocations } = await weather.forecastObservation()

//Request information on when the sun and moon will rise and set
const { feedCreation, astronomyLocation, astronomy } = await weather.forecastAstronomy()

//Request severe weather alerts around a city
const { feedCreation, alertLocation, alerts } = await weather.alerts()
//You can get the full alert description type by using
weather.alertTypeDescription(ALERT_TYPE);

//Request severe national weather alerts around a city
//nwsAlerts will be undefined if no alerts are found.
const { feedCreation, nwsAlerts } = await weather.nwsAlerts()

Other

//Get all weather settings
const { location, language, metric, onebsercation, hourlydate} = weather.getSettings;

//Get auth config
const { app_code, app_id } = weather.getAuth;

//Get here api weather url
const url = weather.apiUrl;

//Get accepted language codes array
const languageCodes = weather.acceptedLanguageCodes;

//Get accepted language names array
const languageNames = weather.acceptedLanguageNames;

//Get weather alert type descriptions array
const alertDescription = weather.alertTypeDescriptions;

Keywords

FAQs

Package last updated on 20 May 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc