Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

clearweatherapi

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

clearweatherapi

Transform Open Weather API data with Clear Weather API

  • 0.0.8
  • unpublished
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

Clear Weather API

Clear Weather API transforms OpenWeather Map OneCall data into human-readable code so you can get to building apps faster.

I built this library to make it easier to use the ClearWeather API.

Learn more about Clear Weather API.

Features

  • Data Transformation (Premium)
  • Avoid hitting rate limits with Caching (Premium)
  • Cool Weather Icons (Premium)
  • Limit errors with types for all weather data
  • This package will make it smooth and easy to develop

Getting Started

You need an OpenWeather Map API key to use this library, and you can get one by signing up at Open Weather Map.

You can get more information about the One Call API at Open Weather Map Onecall.

Installation

npm

npm install clearweatherapi

yarn

yarn add clearweatherapi

Usage


Instantiate Weather class and pass options to it.

const options = {
  openWeatherApiKey: 'YOUR_OPENWEATHER_API_KEY',
  userId: 'YOUR-CLEATHERWEATHERAPI-USERID',
  coords: {
    latitude: '',
    longitude: '',
  },
  cacheTime: 4800,
  formated: false,
  lang: 'en',
  units: 'imperial',
  version: '3.0',
};

const weather = new Weather(options);

To get more information about what each method returns refer to the docs.

Current weather
const current = await weather.fetchCurrentWeather();
Daily weather
const daily = await weather.fetchDailyWeather();
Hourly weather
const hourly = await weather.fetchHourly();
Onecall weather
const onecall = await weather.fetchOneCall();
Weather alerts
const alerts = await weather.fetchAlerts();
Icons

Icons are available for premium users and can be found in each weather data object.

If you are not a premium user you can get more information on how to fetch the icons here.

options
NameTypeRequiredDescription
openWeatherApiKeystringtrueYour OpenWeatherMap API key. You can get a free API key here.
userIdstringtrueYour Clear Weather API user ID Sign up at Clear Weather API to get you free user id.
coordsobjecttrueThe coordinates to get weather data for. This is an object with latitude and longitude properties.
cacheTimenumberfalseThe time in seconds to cache data for. Maximum time is 43200 (12 hours) at a time (Premium)
formatedbooleanfalseWhether or not to format the data (Premium)
unitsstringfalseThe units to use for the data. Default is imperial. Options are metric, imperial, and standard
versionstringfalseThe version of the API to use. Default is 3.0. Options are 2.5 and 3.0

Keywords

FAQs

Package last updated on 13 Sep 2022

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