https://github.com/kasvith/openweathermap-ballerina
Open Weather Map connector for ballerina
https://github.com/kasvith/openweathermap-ballerina
api api-client ballerina ballerina-connector ballerina-lang connector openweathermap openweathermap-api weather weather-api
Last synced: 7 months ago
JSON representation
Open Weather Map connector for ballerina
- Host: GitHub
- URL: https://github.com/kasvith/openweathermap-ballerina
- Owner: kasvith
- License: mit
- Created: 2019-03-02T03:43:22.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-04-08T11:52:32.000Z (over 6 years ago)
- Last Synced: 2025-02-04T04:14:23.280Z (9 months ago)
- Topics: api, api-client, ballerina, ballerina-connector, ballerina-lang, connector, openweathermap, openweathermap-api, weather, weather-api
- Language: Ballerina
- Size: 19.5 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Open Weather Map API for Ballerina
[](https://travis-ci.com/kasvith/openweathermap-ballerina) 
The Open Weather Maps connector allows you to fetch data from Open Weather Maps based on city name, zip, id etc.
It also allows to fetch data over a circle or a box of coordinates.## Sample
Import the libary from `kasvith/openweathermaps` to your project
```ballerina
import kasvith/openweathermap
```### Obtain app id from Open Weather Maps
Visit [Open Weather Maps](https://openweathermap.org/api) and Grab a **APPID** by registering.
### Initializing Client
To initialize client after obtaining APPID you need to select language and metrics. They are defaulted to English and Kelvin(for temperature).
```ballerina
openweathermap:OpenWeatherMapClient owmClient = new({
appid: "YOUR_APP_ID"
});
```### Use client to obtain weather of a city by Name
```ballerina
var result = owmClient->getWeatherByCityName("Colombo");
io:println(result);
```### Use client to obtain weather of a location
```ballerina
var result = owmClient->getWeatherByCityCoordinates({lat: 10, lon: 10});
io:println(result);
```## Developer Guide
You need Ballerina 0.990.3 for development