Open Rich2k opened 1 year ago
I needed this for my project and I integrated it on my own today. It only needs a few lines of code in your WeatherKit.php file.
Modified the $dataSets array
protected array $dataSets = ['currentWeather', 'forecastDaily', 'forecastHourly', 'forecastNextHour', 'weatherAlerts'];
Added a new helper
public function alerts(): Collection { return $this->getSingleDataSet('weatherAlerts'); }
Added required country to the buildParams array
if ($this->country) { $this->params['country'] = $this->country; }
And it works. Apple requires the country code or it won't return the weatherAlerts data.
Nice work Rich2k! I hope this helps
@tafn3t thanks, I knew it wasn't much work, just not had the chance to add it yet. I will be soon so if you still need to add it from Composer, etc then I'll update this issue when I've completed it
https://developer.apple.com/documentation/weatherkitrestapi/get_api_v1_weatheralert_language_id