Skip to content

Commit 383cd3c

Browse files
committed
docs: updated one call resource related info
1 parent 5e8d232 commit 383cd3c

File tree

3 files changed

+131
-99
lines changed

3 files changed

+131
-99
lines changed

docs/03-supported-apis.md

Lines changed: 22 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -31,46 +31,41 @@
3131
getWeather(float $latitude, float $longitude): OneCall
3232
```
3333

34-
Get current and forecast (minutely, hourly and daily) weather data.
34+
Get access to current weather, minute forecast for 1 hour, hourly forecast for 48 hours,
35+
daily forecast for 8 days and government weather alerts.
3536

36-
Returns a [`OneCall`](05-entities.md#onecall) object:
37+
Returns a [`Weather`](05-entities.md#weather) object:
3738

3839
```php
39-
$weather = $openWeatherMap->oneCall()->getWeather(50, 50);
40-
41-
echo $weather->getCurrent()->getTemperature();
40+
$weather = $api->oneCall()->getWeather(50, 50);
4241
```
4342

44-
#### `getHistoryMoment`
43+
#### `getWeatherByDate`
4544

4645
```php
47-
getHistoryMoment(float $latitude, float $longitude, \DateTimeInterface $dateTime): WeatherLocation
46+
getWeatherByDate(float $latitude, float $longitude, \DateTimeInterface $dateTime): WeatherMoment
4847
```
4948

50-
Get weather data from a single moment in the past.
49+
Get access to weather data for any datetime.
5150

52-
Returns a [`WeatherLocation`](05-entities.md#weatherlocation) object:
51+
Returns a [`WeatherMoment`](05-entities.md#weathermoment) object:
5352

5453
```php
55-
$weather = $openWeatherMap->oneCall()->getHistoryMoment(50, 50, new \DateTime('2023-01-01 12:00:00'));
56-
57-
echo $weather->getTemperature();
54+
$weather = $api->oneCall()->getWeatherByDate(50, 50, new \DateTime('2023-05-13 16:32:00'));
5855
```
5956

60-
#### `getHistoryAggregate`
57+
#### `getWeatherSummaryByDate`
6158

6259
```php
63-
getHistoryAggregate(float $latitude, float $longitude, \DateTimeInterface $date): WeatherAggregate
60+
getWeatherSummaryByDate(float $latitude, float $longitude, \DateTimeInterface $date): WeatherSummary
6461
```
6562

66-
Get aggregated weather data from a single day in the past.
63+
Get access to aggregated weather data for a particular date.
6764

68-
Returns a [`WeatherAggregate`](05-entities.md#weatheraggregate) object:
65+
Returns a [`WeatherSummary`](05-entities.md#weathersummary) object:
6966

7067
```php
71-
$weather = $openWeatherMap->oneCall()->getHistoryAggregate(50, 50, new \DateTime('1985-07-19'));
72-
73-
echo $weather->getTemperature();
68+
$weatherSummary = $api->oneCall()->getWeatherSummaryByDate(50, 50, new \DateTime('1985-07-19'));
7469
```
7570

7671
### Weather
@@ -81,7 +76,7 @@ echo $weather->getTemperature();
8176
getCurrent(float $latitude, float $longitude): Weather
8277
```
8378

84-
Get current weather data.
79+
Get access to current weather data.
8580

8681
Returns a [`Weather`](05-entities.md#weather-2) object:
8782

@@ -95,7 +90,7 @@ $currentWeather = $api->weather()->getCurrent(50, 50);
9590
getForecast(float $latitude, float $longitude, int $numResults = 40): WeatherCollection
9691
```
9792

98-
Get weather forecast for the next 5 days in 3-hour steps.
93+
Get access to 5-day weather forecast data with 3-hour steps.
9994

10095
Returns a [`WeatherCollection`](05-entities.md#weathercollection) object:
10196

@@ -113,7 +108,7 @@ $weatherForecast = $api->weather()->getForecast(50, 50, 8);
113108
getCurrent(float $latitude, float $longitude): AirPollution
114109
```
115110

116-
Get current air pollution data.
111+
Get access to current air pollution data.
117112

118113
Returns a [`AirPollution`](05-entities.md#airpollution) object:
119114

@@ -127,7 +122,7 @@ $currentAirPollution = $api->airPollution()->getCurrent(50, 50);
127122
getForecast(float $latitude, float $longitude): AirPollutionCollection
128123
```
129124

130-
Get air pollution forecast data per hour.
125+
Get access to air pollution forecast data per hour.
131126

132127
Returns a [`AirPollutionCollection`](05-entities.md#airpollutioncollection) object:
133128

@@ -141,7 +136,7 @@ $airPollutionForecast = $api->airPollution()->getForecast(50, 50);
141136
getHistory(float $latitude, float $longitude, \DateTimeInterface $startDate, \DateTimeInterface $endDate): AirPollutionCollection
142137
```
143138

144-
Get air pollution history data per hour between two dates.
139+
Get access to historical air pollution data per hour between two dates.
145140

146141
Returns a [`AirPollutionCollection`](05-entities.md#airpollutioncollection) object:
147142

@@ -164,7 +159,7 @@ $airPollutionHistory = $api->airPollution()->getHistory(50, 50, $startDate, $end
164159
getByLocationName(string $locationName, int $numResults = 5): array
165160
```
166161

167-
Get locations by location name.
162+
Get geographical coordinates (latitude, longitude) by using the name of the location (city name or area name).
168163

169164
Returns an array of [`Location`](05-entities.md#location) entities.
170165

@@ -181,7 +176,7 @@ $locations = $api->geocoding()->getByLocationName('lisbon');
181176
getByCoordinate(float $latitude, float $longitude, int $numResults = 5): array
182177
```
183178

184-
Get locations by coordinate.
179+
Get name of the location (city name or area name) by using geographical coordinates (latitude, longitude).
185180

186181
Returns an array of [`Location`](05-entities.md#location) entities.
187182

@@ -195,7 +190,7 @@ $locations = $api->geocoding()->getByCoordinate(50, 50);
195190
getByZipCode(string $zipCode, string $countryCode): ZipLocation
196191
```
197192

198-
Get location by zip code.
193+
Get geographical coordinates (latitude, longitude) by using the zip/postal code.
199194

200195
Returns a [`ZipLocation`](05-entities.md#ziplocation) object.
201196

docs/05-entities.md

Lines changed: 107 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
# Entities
22

33
- [One Call](#one-call)
4-
- [Alert](#alert)
5-
- [MinuteForecast](#minuteforecast)
6-
- [OneCall](#onecall)
74
- [Weather](#weather)
8-
- [WeatherAggregate](#weatheraggregate)
9-
- [WeatherLocation](#weatherlocation)
5+
- [WeatherMoment](#weathermoment)
6+
- [WeatherSummary](#weathersummary)
7+
- [WeatherData](#weatherdata)
8+
- [MinuteData](#minutedata)
9+
- [HourData](#hourdata)
10+
- [DayData](#daydata)
11+
- [Alert](#alert)
12+
- [MoonPhase](#moonphase)
13+
- [Temperature](#temperature)
1014
- [Weather](#weather-1)
1115
- [Weather](#weather-2)
1216
- [WeatherCollection](#weathercollection)
@@ -30,54 +34,41 @@
3034

3135
## One Call
3236

33-
### Alert
34-
35-
- `getSenderName()`: `string`
36-
- `getEventName()`: `string`
37-
- `getStartsAt()`: `\DateTimeImmutable`
38-
- `getEndsAt()`: `\DateTimeImmutable`
39-
- `getDescription()`: `string`
40-
- `getTags()`: `array`
41-
42-
### MinuteForecast
43-
44-
- `getDateTime()`: `\DateTimeImmutable`
45-
- `getPrecipitation()`: `float`
46-
47-
### OneCall
37+
### Weather
4838

4939
- `getCoordinate()`: [`Coordinate`](#coordinate)
5040
- `getTimezone()`: [`Timezone`](#timezone)
51-
- `getCurrent()`: [`Weather`](#weather)
52-
- `getMinutelyForecast()`: [`?MinuteForecast[]`](#minuteforecast)
53-
- `getHourlyForecast()`: [`Weather[]`](#weather)
54-
- `getDailyForecast()`: [`Weather[]`](#weather)
41+
- `getCurrent()`: [`WeatherData`](#weatherdata)
42+
- `getMinutelyForecast()`: [`?MinuteData[]`](#minutedata)
43+
- `getHourlyForecast()`: [`HourData[]`](#hourdata)
44+
- `getDailyForecast()`: [`DayData[]`](#daydata)
5545
- `getAlerts()`: [`?Alert[]`](#alert)
5646

57-
### Weather
47+
### WeatherMoment
5848

49+
- `getCoordinate()`: [`Coordinate`](#coordinate)
50+
- `getTimezone()`: [`Timezone`](#timezone)
5951
- `getDateTime()`: `\DateTimeImmutable`
60-
- `getSunriseAt()`: `?\DateTimeImmutable`
61-
- `getSunsetAt()`: `?\DateTimeImmutable`
62-
- `getMoonriseAt()`: `?\DateTimeImmutable`
63-
- `getMoonsetAt()`: `?\DateTimeImmutable`
64-
- `getMoonPhase()`: [`?MoonPhase`](#moonphase)
65-
- `getTemperature()`: `float`|[`Temperature`](#temperature)
66-
- `getTemperatureFeelsLike()`: `float`|[`Temperature`](#temperature)
67-
- `getDescription()`: `?string`
52+
- `getTemperature()`: `float`
53+
- `getTemperatureFeelsLike()`: `float`
6854
- `getAtmosphericPressure()`: `int`
6955
- `getHumidity()`: `int`
70-
- `getDewPoint()`: `?float`
56+
- `getDewPoint()`: `float`
7157
- `getUltraVioletIndex()`: `?float`
7258
- `getCloudiness()`: `int`
7359
- `getVisibility()`: `?int`
7460
- `getWind()`: [`Wind`](#wind)
75-
- `getPrecipitationProbability()`: `?int`
76-
- `getRain()`: `null`|`float`|[`Rain`](#rain)
77-
- `getSnow()`: `null`|`float`|[`Snow`](#snow)
78-
- `getWeatherConditions()`: [`WeatherCondition[]`](#weathercondition)
61+
- `getConditions()`: [`Condition[]`](#condition)
62+
- `getSummary()`: `?string`
63+
- `getRainVolume()`: `?float`
64+
- `getSnowVolume()`: `?float`
65+
- `getMoonPhase()`: [`?MoonPhase`](#moonphase)
66+
- `getSunriseAt()`: `?\DateTimeImmutable`
67+
- `getSunsetAt()`: `?\DateTimeImmutable`
68+
- `getMoonriseAt()`: `?\DateTimeImmutable`
69+
- `getMoonsetAt()`: `?\DateTimeImmutable`
7970

80-
### WeatherAggregate
71+
### WeatherSummary
8172

8273
- `getCoordinate()`: [`Coordinate`](#coordinate)
8374
- `getTimezone()`: [`Timezone`](#timezone)
@@ -89,30 +80,91 @@
8980
- `getAtmosphericPressure()`: `int`
9081
- `getWind()`: [`Wind`](#wind)
9182

92-
### WeatherLocation
83+
### WeatherData
9384

94-
- `getCoordinate()`: [`Coordinate`](#coordinate)
95-
- `getTimezone()`: [`Timezone`](#timezone)
9685
- `getDateTime()`: `\DateTimeImmutable`
86+
- `getTemperature()`: `float`
87+
- `getTemperatureFeelsLike()`: `float`
88+
- `getAtmosphericPressure()`: `int`
89+
- `getVisibility()`: `?int`
90+
- `getHumidity()`: `int`
91+
- `getDewPoint()`: `float`
92+
- `getUltraVioletIndex()`: `?float`
93+
- `getCloudiness()`: `int`
94+
- `getWind()`: [`Wind`](#wind)
95+
- `getConditions()`: [`Condition[]`](#condition)
96+
- `getRainVolume()`: `?float`
97+
- `getSnowVolume()`: `?float`
9798
- `getSunriseAt()`: `?\DateTimeImmutable`
9899
- `getSunsetAt()`: `?\DateTimeImmutable`
99-
- `getMoonriseAt()`: `?\DateTimeImmutable`
100-
- `getMoonsetAt()`: `?\DateTimeImmutable`
101-
- `getMoonPhase()`: [`?MoonPhase`](#moonphase)
102-
- `getTemperature()`: `float`|[`Temperature`](#temperature)
103-
- `getTemperatureFeelsLike()`: `float`|[`Temperature`](#temperature)
104-
- `getDescription()`: `?string`
100+
101+
### MinuteData
102+
103+
- `getDateTime()`: `\DateTimeImmutable`
104+
- `getPrecipitation()`: `float`
105+
106+
### HourData
107+
108+
- `getDateTime()`: `\DateTimeImmutable`
109+
- `getTemperature()`: `float`
110+
- `getTemperatureFeelsLike()`: `float`
111+
- `getVisibility()`: `int`
112+
- `getPrecipitationProbability()`: `int`
105113
- `getAtmosphericPressure()`: `int`
106114
- `getHumidity()`: `int`
107-
- `getDewPoint()`: `?float`
115+
- `getDewPoint()`: `float`
108116
- `getUltraVioletIndex()`: `?float`
109117
- `getCloudiness()`: `int`
110-
- `getVisibility()`: `?int`
111118
- `getWind()`: [`Wind`](#wind)
112-
- `getPrecipitationProbability()`: `?int`
113-
- `getRain()`: `null`|`float`|[`Rain`](#rain)
114-
- `getSnow()`: `null`|`float`|[`Snow`](#snow)
115-
- `getWeatherConditions()`: [`WeatherCondition[]`](#weathercondition)
119+
- `getConditions()`: [`Condition[]`](#condition)
120+
- `getRainVolume()`: `?float`
121+
- `getSnowVolume()`: `?float`
122+
123+
### DayData
124+
125+
- `getDateTime()`: `\DateTimeImmutable`
126+
- `getTemperature()`: [`Temperature`](#temperature)
127+
- `getTemperatureFeelsLike()`: [`Temperature`](#temperature)
128+
- `getPrecipitationProbability()`: `int`
129+
- `getAtmosphericPressure()`: `int`
130+
- `getHumidity()`: `int`
131+
- `getDewPoint()`: `float`
132+
- `getUltraVioletIndex()`: `?float`
133+
- `getCloudiness()`: `int`
134+
- `getWind()`: [`Wind`](#wind)
135+
- `getConditions()`: [`Condition[]`](#condition)
136+
- `getRainVolume()`: `?float`
137+
- `getSnowVolume()`: `?float`
138+
- `getSummary()`: `string`
139+
- `getMoonPhase()`: [`MoonPhase`](#moonphase)
140+
- `getSunriseAt()`: `\DateTimeImmutable`
141+
- `getSunsetAt()`: `\DateTimeImmutable`
142+
- `getMoonriseAt()`: `\DateTimeImmutable`
143+
- `getMoonsetAt()`: `\DateTimeImmutable`
144+
145+
### Alert
146+
147+
- `getSenderName()`: `string`
148+
- `getEventName()`: `string`
149+
- `getStartsAt()`: `\DateTimeImmutable`
150+
- `getEndsAt()`: `\DateTimeImmutable`
151+
- `getDescription()`: `string`
152+
- `getTags()`: `array`
153+
154+
### MoonPhase
155+
156+
- `getValue()`: `float`
157+
- `getName()`: `string`
158+
- `getSystemName()`: `string`
159+
160+
### Temperature
161+
162+
- `getMorning()`: `float`
163+
- `getDay()`: `float`
164+
- `getEvening()`: `float`
165+
- `getNight()`: `float`
166+
- `getMin()`: `?float`
167+
- `getMax()`: `?float`
116168

117169
## Weather
118170

@@ -138,7 +190,7 @@
138190

139191
- `getNumResults()`: `int`
140192
- `getLocation()`: [`Location`](#location)
141-
- `getData()`: [`WeatherData[]`](#weatherdata)
193+
- `getData()`: [`WeatherData[]`](#weatherdata-1)
142194

143195
### WeatherData
144196

@@ -240,21 +292,6 @@
240292
- `getSunriseAt()`: `?\DateTimeImmutable`
241293
- `getSunsetAt()`: `?\DateTimeImmutable`
242294

243-
### MoonPhase
244-
245-
- `getValue()`: `float`
246-
- `getName()`: `string`
247-
- `getSysName()`: `string`
248-
249-
### Temperature
250-
251-
- `getMorning()`: `float`
252-
- `getDay()`: `float`
253-
- `getEvening()`: `float`
254-
- `getNight()`: `float`
255-
- `getMin()`: `?float`
256-
- `getMax()`: `?float`
257-
258295
### Timezone
259296

260297
- `getOffset()`: `int`

src/Resource/AirPollutionResource.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function getCurrent(float $latitude, float $longitude): AirPollution
3333
}
3434

3535
/**
36-
* Get access to air pollution forecast data
36+
* Get access to air pollution forecast data per hour
3737
*
3838
* @throws ValidationException
3939
* @throws ClientExceptionInterface
@@ -55,7 +55,7 @@ public function getForecast(float $latitude, float $longitude): AirPollutionColl
5555
}
5656

5757
/**
58-
* Get access to historical air pollution data
58+
* Get access to historical air pollution data per hour between two dates
5959
*
6060
* @throws ValidationException
6161
* @throws ClientExceptionInterface

0 commit comments

Comments
 (0)