{"id":15018559,"url":"https://github.com/pierreamgabriel/nativescript-weather-api","last_synced_at":"2026-01-21T16:02:10.560Z","repository":{"id":57308833,"uuid":"411861628","full_name":"pierreamgabriel/nativescript-weather-api","owner":"pierreamgabriel","description":"Real-time weather information for any location on Earth, including over 200,000 cities.","archived":false,"fork":false,"pushed_at":"2023-05-08T06:01:07.000Z","size":21,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-05T20:18:17.913Z","etag":null,"topics":["nativescript","weather-api"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pierreamgabriel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2021-09-29T23:44:00.000Z","updated_at":"2024-05-30T16:58:19.000Z","dependencies_parsed_at":"2023-11-21T17:03:57.586Z","dependency_job_id":"bc0f3836-a158-4b48-b168-b06d8c2bbc87","html_url":"https://github.com/pierreamgabriel/nativescript-weather-api","commit_stats":{"total_commits":6,"total_committers":1,"mean_commits":6.0,"dds":0.0,"last_synced_commit":"38a721ccf95b8c262a20e9fa2d68c78585b7bdb6"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/pierreamgabriel/nativescript-weather-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pierreamgabriel%2Fnativescript-weather-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pierreamgabriel%2Fnativescript-weather-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pierreamgabriel%2Fnativescript-weather-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pierreamgabriel%2Fnativescript-weather-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pierreamgabriel","download_url":"https://codeload.github.com/pierreamgabriel/nativescript-weather-api/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pierreamgabriel%2Fnativescript-weather-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28635926,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-21T15:01:31.228Z","status":"ssl_error","status_checked_at":"2026-01-21T14:42:58.942Z","response_time":86,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["nativescript","weather-api"],"created_at":"2024-09-24T19:52:06.850Z","updated_at":"2026-01-21T16:02:10.543Z","avatar_url":"https://github.com/pierreamgabriel.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NativeScript Weather API\r\n\r\nReal-time weather information for any location on Earth, including over 200,000 cities.\r\n\r\n## Installation\r\n\r\n```bash\r\ntns plugin add nativescript-weather-api\r\n```\r\n\r\n## Permission\r\n\r\n**Android**\r\n\r\nTo request access to location, you need to add the following line to your app's AndroidManifest.xml:\r\n\r\n```xml\r\n\u003cuses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\" /\u003e\r\n```\r\n\r\n**iOS**\r\n\r\nYou need to include the `NSLocationWhenInUseUsageDescription` key in Info.plist to enable geolocation when using the app.\r\n\r\n## Usage\r\n\r\nThis plugin uses the OpenWeather API to show weather information, so you need to create an account on https://openweathermap.org and get your key. Free accounts are allowed to perform 1,000,000 calls/month and 60 calls/minute.\r\n\r\n### Import the plugin\r\n\r\n```javascript\r\nimport { getWeather, dailyForecast, showWeather, getLocation } from 'nativescript-weather-api';\r\n```\r\n\r\n### API calls \r\n\r\n**By geographic coordinates**\r\n\r\nWhen using coordinates, you can't pass the city and ZIP code parameters.\r\n\r\n```javascript\r\nvar temp;\r\nvar wind;\r\n\r\ngetLocation().then((location) =\u003e {\r\n\r\ngetWeather({\r\n\r\n\tkey: \"your_key\",\r\n\tlat: location.latitude,\r\n\tlon: location.longitude,\r\n\tunit: \"metric\"\r\n\r\n}).then(() =\u003e {\r\n\r\n\tvar data = new showWeather();\r\n\ttemp = data.temp;\r\n\twind = data.wind;\r\n});\r\n\r\n});\r\n```\r\n\r\n**By city name**\r\n\r\nWhen calling by city name, you can't pass the latitude, longitude, and ZIP code parameters.\r\n\r\n```javascript\r\nvar temp;\r\nvar wind;\r\n\r\ngetWeather({\r\n\r\n\tkey: \"your_key\",\r\n\tcity: \"London\",\r\n\tcountry: \"GB\"\r\n\r\n}).then(() =\u003e {\r\n\r\n\tvar data = new showWeather();\r\n\ttemp = data.temp;\r\n\twind = data.wind;\r\n});\r\n```\r\n\r\n**By ZIP code**\r\n\r\nThis method doesn't seem to work with all countries. For example, the API didn't recognize ZIP codes from Brazil during my tests.\r\n\r\nDon't pass the latitude, longitude, and city parameters.\r\n\r\n```javascript\r\nvar temp;\r\nvar wind;\r\n\r\ngetWeather({\r\n\r\n\tkey: \"your_key\",\r\n\tzip_code: \"90001\",\r\n\tcountry: \"US\"\r\n\r\n}).then(() =\u003e {\r\n\r\n\tvar data = new showWeather();\r\n\ttemp = data.temp;\r\n\twind = data.wind;\r\n});\r\n```\r\n\r\n## Parameters\r\n\r\n`key` - Your OpenWeather key.\u003cbr\u003e \r\n`lat` - Latitude.\u003cbr\u003e \r\n`lon` - Longitude.\u003cbr\u003e \r\n`city` - City name, e.g., Los Angeles.\u003cbr\u003e \r\n`country` - Country code, e.g., US, CA, GB.\u003cbr\u003e \r\n`zip_code` - Numeric or alphanumeric codes, e.g., 90001.\u003cbr\u003e\r\n`unit` - If you set it to `metric`, the temperature will be in Celsius and wind speed in meter/s. If you choose `imperial`, the temperature will be in Fahrenheit and wind speed in miles/h. If you don't set this parameter, Kelvin and meter/s are the standards.\u003cbr\u003e\r\n`lang` - The output language for the city name and description fields, e.g., en, pt_br, fr, es.\r\n\r\n## Identifiers\r\n\r\n`name` - Location name.\u003cbr\u003e\r\n`country` - Country name.\u003cbr\u003e\r\n`temp` - Temperature.\u003cbr\u003e\r\n`temp_min` - Minimum temperature.\u003cbr\u003e\r\n`temp_max` - Maximum temperature.\u003cbr\u003e\r\n`feels_like` - Feels like temperature.\u003cbr\u003e\r\n`wind` - Wind speed.\u003cbr\u003e\r\n`pressure` - Pressure.\u003cbr\u003e\r\n`humidity` - Humidity.\u003cbr\u003e\r\n`description` - Weather description, e.g., clear sky.\u003cbr\u003e\r\n`icon` - Weather icon URL.\r\n\r\n## Daily forecast for 7 days\r\n\r\nWith only one call, you can get weather information for 7 days plus the current day. \r\n\r\n```javascript\r\nvar temp_min;\r\nvar temp_max;\r\nvar description;\r\n\r\ngetLocation().then((location) =\u003e {\r\n\r\ndailyForecast({\r\n\r\n\tkey: \"your_key\",\r\n\tlat: location.latitude,\r\n\tlon: location.longitude,\r\n\tunit: \"metric\"\r\n\r\n}).then((data) =\u003e {\r\n\r\n\ttemp_min = data.daily[0].temp.min;\r\n\ttemp_max = data.daily[0].temp.max;\r\n\tdescription = data.daily[0].weather[0].description;\r\n});\r\n\r\n});\r\n```\r\n\r\nThe `dailyForecast` function only accepts latitude and longitude to determine the location. In the example, we retrieved the minimum and maximum temperature and the weather description for the current day. If we wanted information for the following day, we'd change `daily[0]` to `daily[1]`, and so on up to `daily[7]`. To see all the fields available besides the ones we used in this section, create an `alert(JSON.stringify(data, null, 4))`, but don't forget to remove it before building for production.\r\n\r\n## NS compatibility\r\n\r\nUpdate your NS version to 8+, or you might get an error with the @nativescript/geolocation plugin.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpierreamgabriel%2Fnativescript-weather-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpierreamgabriel%2Fnativescript-weather-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpierreamgabriel%2Fnativescript-weather-api/lists"}