Skip to content

Commit 7f0039a

Browse files
committed
docs: clarify API usage details
1 parent 9e5db00 commit 7f0039a

5 files changed

Lines changed: 49 additions & 44 deletions

File tree

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ air pollution, geocoding, maps, stations, and One Call. Responses use typed
99
entities that safely handle conditional, missing, and `null` data.
1010

1111
The library is built on
12-
[`programmatordev/php-api-sdk`](https://github.com/programmatordev/php-api-sdk)
13-
and supports client-wide and request-local configuration.
12+
[`programmatordev/php-api-sdk`](https://github.com/programmatordev/php-api-sdk),
13+
which provides HTTP client discovery and optional caching, logging, plugins,
14+
and request hooks.
1415

1516
## Requirements
1617

docs/maps.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,11 @@ For example:
106106
| 2 | 4 × 4 | 0–3 |
107107
| 6 | 64 × 64 | 0–63 |
108108

109-
Zoom must be zero or greater. At any zoom level, the largest valid X or Y value
110-
is `(2 ** $zoom) - 1`. Mapping libraries normally calculate these indexes from
111-
the displayed geographic area; they should not be replaced directly with a
112-
location's longitude and latitude.
113-
114-
Applications displaying Weather Maps data must provide visible OpenWeather
115-
attribution. Consult the
116-
[official FAQ](https://openweathermap.org/faq)
117-
for the current attribution requirements.
109+
Zoom must be zero or greater. X and Y start at 0, and their highest valid value
110+
is one less than the number of tiles along that axis, as shown in the table.
111+
Mapping libraries normally calculate these indexes from the displayed
112+
geographic area; they should not be replaced directly with a location's
113+
longitude and latitude.
114+
115+
OpenWeather's attribution requirements depend on the applicable license. See
116+
the [official FAQ](https://openweathermap.org/faq) for current guidance.

docs/one-call.md

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -39,30 +39,6 @@ foreach ($current->conditions() as $condition) {
3939
}
4040
```
4141

42-
Configure units and language for a request:
43-
44-
```php
45-
use ProgrammatorDev\OpenWeatherMap\Enum\Language;
46-
use ProgrammatorDev\OpenWeatherMap\Enum\Units;
47-
48-
$current = $api
49-
->oneCall()
50-
->withUnits(Units::IMPERIAL)
51-
->withLanguage(Language::PORTUGUESE)
52-
->current(38.7223, -9.1393);
53-
```
54-
55-
Measurement getters return nullable values. Related methods provide the unit
56-
and a formatted value. With the default metric configuration, for example:
57-
58-
```php
59-
use ProgrammatorDev\OpenWeatherMap\Enum\Unit;
60-
61-
$current->temperature(); // 24.34
62-
$current->temperatureUnit(); // Unit::CELSIUS
63-
$current->temperatureWithUnit(); // '24.34 °C'
64-
```
65-
6642
## Minute Timeline
6743

6844
See OpenWeather's
@@ -241,7 +217,7 @@ these getters return nullable floats without conversion.
241217

242218
## Timeline Pagination
243219

244-
The 15-minute, one-hour, and one-day timelines support pagination.
220+
The 15-minute, hour, and day timelines support pagination.
245221

246222
```php
247223
$timeline = $api->oneCall()->hourTimeline(
@@ -268,6 +244,34 @@ The availability checks and URL getters do not make another API request.
268244
is available and otherwise return `null`. The library does not fetch every page
269245
automatically. Each page navigation sends a separate API request.
270246

247+
## Units And Language
248+
249+
Current and timeline requests use the client configuration by default. Use
250+
`withUnits()` and `withLanguage()` to change those values for one request
251+
chain.
252+
253+
```php
254+
use ProgrammatorDev\OpenWeatherMap\Enum\Language;
255+
use ProgrammatorDev\OpenWeatherMap\Enum\Units;
256+
257+
$current = $api
258+
->oneCall()
259+
->withUnits(Units::IMPERIAL)
260+
->withLanguage(Language::PORTUGUESE)
261+
->current(38.7223, -9.1393);
262+
```
263+
264+
Measurement getters return nullable values. Related methods provide the unit
265+
and a formatted value. With the default metric configuration, for example:
266+
267+
```php
268+
use ProgrammatorDev\OpenWeatherMap\Enum\Unit;
269+
270+
$current->temperature(); // 24.34
271+
$current->temperatureUnit(); // Unit::CELSIUS
272+
$current->temperatureWithUnit(); // '24.34 °C'
273+
```
274+
271275
## Alert
272276

273277
See OpenWeather's

docs/setup.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ The examples below use objects supplied by the application:
1515
`$httpClient` implements PSR-18, `$cachePool` implements PSR-6, and `$logger`
1616
implements PSR-3.
1717

18-
Setup changes apply to subsequent requests made by the client. They do not
19-
affect methods such as `maps()->tileUrl()` and `maps()->tileUrlTemplate()`,
20-
which generate URLs without making an HTTP request.
18+
Setup changes apply to later requests made by the client. Some methods do not
19+
send an HTTP request and are therefore unaffected. Their API guides note this
20+
where relevant.
2121

2222
## HTTP Client
2323

docs/weather.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ echo $current->humidity();
3636
echo $current->visibility();
3737
```
3838

39-
`minimumTemperature()` and `maximumTemperature()` are the lowest and highest
40-
temperatures currently observed within the requested location. OpenWeather
41-
notes that they are mainly useful for geographically large cities; they are not
39+
`minimumTemperature()` and `maximumTemperature()` are OpenWeather's optional
40+
minimum and maximum temperatures for the city at the current moment. They are
41+
mainly useful for large cities and often match `temperature()`. They are not
4242
the day's forecast low and high.
4343

4444
Conditions, wind, and clouds are exposed as nested entities. A condition keeps
@@ -78,8 +78,9 @@ See the
7878
[official forecast documentation](https://openweathermap.org/api/forecast5)
7979
for API details.
8080

81-
Use `forecast()` with a latitude and longitude. The optional `count` limits the
82-
number of three-hour periods returned and must be positive.
81+
Use `forecast()` with a latitude and longitude to retrieve up to five days of
82+
weather forecasts, with one period every three hours. The optional `count`
83+
limits the number of periods returned and must be positive.
8384

8485
```php
8586
$forecast = $api->weather()->forecast(

0 commit comments

Comments
 (0)