55use Http \Client \Exception ;
66use ProgrammatorDev \OpenWeatherMap \Endpoint \Util \WithLanguageTrait ;
77use ProgrammatorDev \OpenWeatherMap \Endpoint \Util \WithUnitSystemTrait ;
8- use ProgrammatorDev \OpenWeatherMap \Entity \OneCall \HistoryDaySummary ;
9- use ProgrammatorDev \OpenWeatherMap \Entity \OneCall \HistoryMoment ;
8+ use ProgrammatorDev \OpenWeatherMap \Entity \OneCall \WeatherAggregate ;
9+ use ProgrammatorDev \OpenWeatherMap \Entity \OneCall \WeatherMoment ;
1010use ProgrammatorDev \OpenWeatherMap \Entity \OneCall \OneCall ;
1111use ProgrammatorDev \OpenWeatherMap \Exception \BadRequestException ;
1212use ProgrammatorDev \OpenWeatherMap \Exception \NotFoundException ;
@@ -28,7 +28,7 @@ class OneCallEndpoint extends AbstractEndpoint
2828
2929 private string $ urlOneCallHistoryMoment = 'https://api.openweathermap.org/data/3.0/onecall/timemachine ' ;
3030
31- private string $ urlOneCallHistoryDaySummary = 'https://api.openweathermap.org/data/3.0/onecall/day_summary ' ;
31+ private string $ urlOneCallHistoryAggregate = 'https://api.openweathermap.org/data/3.0/onecall/day_summary ' ;
3232
3333 /**
3434 * @throws Exception
@@ -66,7 +66,7 @@ public function getWeather(float $latitude, float $longitude): OneCall
6666 * @throws UnexpectedErrorException
6767 * @throws ValidationException
6868 */
69- public function getHistoryMoment (float $ latitude , float $ longitude , \DateTimeInterface $ dateTime ): HistoryMoment
69+ public function getHistoryMoment (float $ latitude , float $ longitude , \DateTimeInterface $ dateTime ): WeatherMoment
7070 {
7171 $ this ->validateCoordinate ($ latitude , $ longitude );
7272 $ this ->validateLessThan ('dateTime ' , $ dateTime , new \DateTimeImmutable ('now ' ));
@@ -83,7 +83,7 @@ public function getHistoryMoment(float $latitude, float $longitude, \DateTimeInt
8383 ]
8484 );
8585
86- return new HistoryMoment ($ data );
86+ return new WeatherMoment ($ data );
8787 }
8888
8989 /**
@@ -95,14 +95,14 @@ public function getHistoryMoment(float $latitude, float $longitude, \DateTimeInt
9595 * @throws UnexpectedErrorException
9696 * @throws ValidationException
9797 */
98- public function getHistoryDaySummary (float $ latitude , float $ longitude , \DateTimeInterface $ dateTime ): HistoryDaySummary
98+ public function getHistoryAggregate (float $ latitude , float $ longitude , \DateTimeInterface $ dateTime ): WeatherAggregate
9999 {
100100 $ this ->validateCoordinate ($ latitude , $ longitude );
101101 $ this ->validateLessThan ('dateTime ' , $ dateTime , new \DateTimeImmutable ('now ' ));
102102
103103 $ data = $ this ->sendRequest (
104104 method: 'GET ' ,
105- baseUrl: $ this ->urlOneCallHistoryDaySummary ,
105+ baseUrl: $ this ->urlOneCallHistoryAggregate ,
106106 query: [
107107 'lat ' => $ latitude ,
108108 'lon ' => $ longitude ,
@@ -112,6 +112,6 @@ public function getHistoryDaySummary(float $latitude, float $longitude, \DateTim
112112 ]
113113 );
114114
115- return new HistoryDaySummary ($ data );
115+ return new WeatherAggregate ($ data );
116116 }
117117}
0 commit comments