Skip to content

Kayxue/AccuWeatherAPIWrapper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Accu Weather API Wrapper

Updated in version 1.1.0:
Fixed bugs of getHourlyForecast function

NPM version Package Size Downloads Github Package Version Type Definitions

Wrapper of Accu Weather API

Now avalivable APIs of this package:

  • Location API
  • Forecast API
  • Current Conditions API
  • Indices API
  • Weather Alarms API
  • Alerts API
  • Imagery API
  • Tropical API
  • Translations API

Installation

npm install accu-weather-api-wrapper

Basic Usages

1. Using client which includes all api clients:

TypeScript:

import AccuWeatherClient from "accu-weather-wrapper";

const client = new AccuWeatherClient({
    apikey: "key",     //Required. Accu Weather API key.
    language: "en-us", //Optional. Language of retrieve data. Default: "en-us"
    detail: true,      //Optional. Whether return full object when searching. Default: false
    offset: 100,       //Optional. The limit that determines the first resource to be returned. Default: 100
    metric: true;      //Optional. Whether or not to return metric values. Default: false
})

//Get city data
client.location.citySearch("Taipei").then(console.log)

//Get 1 day forecast data ("4-315078_1_AL" is location key)
client.forecast.getDailyForecast(1,"4-315078_1_AL").then(console.log)

//Get current conditions data
client.currentConditions.currentCondition("4-315078_1_AL").then(console.log)

JavaScript

const AccuWeatherClient = require("accu-weather-wrapper").default;

const client = new AccuWeatherClient({
    apikey: "key",     //Required. Accu Weather API key.
    language: "en-us", //Optional. Language of retrieve data. Default: "en-us"
    detail: true,      //Optional. Whether return full object when searching. Default: false
    offset: 100,       //Optional. The limit that determines the first resource to be returned. Default: 100
    metric: true;      //Optional. Whether or not to return metric values. Default: false
})

//Get city data
client.location.citySearch("Taipei").then(console.log)

//Get 1 day forecast data ("4-315078_1_AL" is location key)
client.forecast.getDailyForecast(1,"4-315078_1_AL").then(console.log)

//Get current conditions data
client.currentConditions.currentCondition("4-315078_1_AL").then(console.log)

2. Using single API Client:

TypeScript:

import { LocationAPI } from "accu-weather-wrapper";

const client = new LocationAPI({
    apikey: "key", //Required. Accu Weather API key.
    language: "en-us", //Optional. Language of retrieve data. Default: "en-us"
    detail: true, //Optional. Whether return full object when searching. Default: false
    offset: 100, //Optional. The limit that determines the first resource to be returned. Default: 100
});

//Get city data
client.citySearch("Taipei").then(console.log);

JavaScript

const { LocationAPI } = require("accu-weather-wrapper");

const client = new LocationAPI({
    apikey: "key", //Required. Accu Weather API key.
    language: "en-us", //Optional. Language of retrieve data. Default: "en-us"
    detail: true, //Optional. Whether return full object when searching. Default: false
    offset: 100, //Optional. The limit that determines the first resource to be returned. Default: 100
});

//Get city data
client.citySearch("Taipei").then(console.log);

Documentation

https://accuweatherapiwrapperdocs.pages.dev

API Provider

Accu Weather Company: https://developer.accuweather.com/apis

Issue & Support

If you have any question to ask or bugs to report, you can open issue on github: https://github.com/Kayxue/AccuWeatherAPIWrapper

Or join my discord server to get help: (Not finished yet)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published