* * 200: Address updated */ public function usePersonalAddress(): DataResponse { return new DataResponse($this->service->usePersonalAddress()); } /** * @NoAdminRequired * * Change the weather status mode. There are currently 2 modes: * - ask the browser * - use the user defined address * * @param int $mode New mode * @return DataResponse * * 200: Weather status mode updated */ public function setMode(int $mode): DataResponse { return new DataResponse($this->service->setMode($mode)); } /** * @NoAdminRequired * * Set address and resolve it to get coordinates * or directly set coordinates and get address with reverse geocoding * * @param string|null $address Any approximative or exact address * @param float|null $lat Latitude in decimal degree format * @param float|null $lon Longitude in decimal degree format * @return DataResponse * * 200: Location updated */ public function setLocation(?string $address, ?float $lat, ?float $lon): DataResponse { $currentWeather = $this->service->setLocation($address, $lat, $lon); return new DataResponse($currentWeather); } /** * @NoAdminRequired * * Get stored user location * * @return DataResponse * * 200: Location returned */ public function getLocation(): DataResponse { $location = $this->service->getLocation(); return new DataResponse($location); } /** * @NoAdminRequired * * Get forecast for current location * * @return DataResponse|DataResponse * * 200: Forecast returned * 404: Forecast not found */ public function getForecast(): DataResponse { $forecast = $this->service->getForecast(); if (isset($forecast['success']) && $forecast['success'] === false) { return new DataResponse($forecast, Http::STATUS_NOT_FOUND); } else { return new DataResponse($forecast); } } /** * @NoAdminRequired * * Get favorites list * * @return DataResponse * * 200: Favorites returned */ public function getFavorites(): DataResponse { return new DataResponse($this->service->getFavorites()); } /** * @NoAdminRequired * * Set favorites list * * @param string[] $favorites Favorite addresses * @return DataResponse * * 200: Favorites updated */ public function setFavorites(array $favorites): DataResponse { return new DataResponse($this->service->setFavorites($favorites)); } }