Skip to content

Commit 0bcdaec

Browse files
committed
refactor(one-call): simplify timeline naming
1 parent 057356a commit 0bcdaec

15 files changed

Lines changed: 88 additions & 88 deletions

File tree

docs/one-call.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -147,18 +147,18 @@ $period->precipitationProbabilityUnit(); // Unit::PERCENT
147147
$period->precipitationProbabilityWithUnit(); // '91 %'
148148
```
149149

150-
## One-hour Timeline
150+
## Hour Timeline
151151

152152
See OpenWeather's
153153
[official One Call 4.0 hourly forecast documentation](https://openweathermap.org/api/one-call-4#hourly)
154154
for API details.
155155

156-
Use `oneHourTimeline()` with a latitude and longitude to retrieve hourly
156+
Use `hourTimeline()` with a latitude and longitude to retrieve hourly
157157
periods. When `startAt` is omitted, OpenWeather starts the timeline at the
158158
current UTC time.
159159

160160
```php
161-
$timeline = $api->oneCall()->oneHourTimeline(
161+
$timeline = $api->oneCall()->hourTimeline(
162162
latitude: 38.7223,
163163
longitude: -9.1393,
164164
);
@@ -169,7 +169,7 @@ limit the number of periods returned. `count` must be positive when provided,
169169
and timeline availability depends on OpenWeather.
170170

171171
```php
172-
$timeline = $api->oneCall()->oneHourTimeline(
172+
$timeline = $api->oneCall()->hourTimeline(
173173
latitude: 38.7223,
174174
longitude: -9.1393,
175175
startAt: new DateTimeImmutable('2 days ago'),
@@ -190,18 +190,18 @@ foreach ($timeline->periods() as $period) {
190190
}
191191
```
192192

193-
## One-day Timeline
193+
## Day Timeline
194194

195195
See OpenWeather's
196196
[official One Call 4.0 daily forecast documentation](https://openweathermap.org/api/one-call-4#daily)
197197
for API details.
198198

199-
Use `oneDayTimeline()` with a latitude and longitude to retrieve daily periods.
199+
Use `dayTimeline()` with a latitude and longitude to retrieve daily periods.
200200
When `startAt` is omitted, OpenWeather starts the timeline at the current UTC
201201
time.
202202

203203
```php
204-
$timeline = $api->oneCall()->oneDayTimeline(
204+
$timeline = $api->oneCall()->dayTimeline(
205205
latitude: 38.7223,
206206
longitude: -9.1393,
207207
);
@@ -212,7 +212,7 @@ limit the number of periods returned. Both are optional, and `count` must be
212212
positive when provided.
213213

214214
```php
215-
$timeline = $api->oneCall()->oneDayTimeline(
215+
$timeline = $api->oneCall()->dayTimeline(
216216
latitude: 38.7223,
217217
longitude: -9.1393,
218218
startAt: new DateTimeImmutable('2 days from now'),
@@ -245,7 +245,7 @@ values, so these getters return raw nullable floats.
245245
The 15-minute, one-hour, and one-day timelines provide explicit pagination.
246246

247247
```php
248-
$timeline = $api->oneCall()->oneHourTimeline(
248+
$timeline = $api->oneCall()->hourTimeline(
249249
latitude: 38.7223,
250250
longitude: -9.1393,
251251
);
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
use ProgrammatorDev\Api\Context\Context;
66
use ProgrammatorDev\Api\Contract\EntityInterface;
77
use ProgrammatorDev\OpenWeatherMap\Entity\Coordinates;
8-
use ProgrammatorDev\OpenWeatherMap\Entity\OneCall\OneDayTimeline\Period;
8+
use ProgrammatorDev\OpenWeatherMap\Entity\OneCall\DayTimeline\Period;
99
use ProgrammatorDev\OpenWeatherMap\Entity\OneCall\Timeline\Pagination;
1010
use ProgrammatorDev\OpenWeatherMap\Entity\OneCall\Timeline\TimelinePage;
1111

12-
final class OneDayTimeline implements EntityInterface
12+
final class DayTimeline implements EntityInterface
1313
{
1414
/**
1515
* @param TimelinePage<Period, self> $page

src/Entity/OneCall/OneDayTimeline/FeelsLikeTemperature.php renamed to src/Entity/OneCall/DayTimeline/FeelsLikeTemperature.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace ProgrammatorDev\OpenWeatherMap\Entity\OneCall\OneDayTimeline;
3+
namespace ProgrammatorDev\OpenWeatherMap\Entity\OneCall\DayTimeline;
44

55
use ProgrammatorDev\Api\Context\Context;
66
use ProgrammatorDev\Api\Contract\EntityInterface;

src/Entity/OneCall/OneDayTimeline/Period.php renamed to src/Entity/OneCall/DayTimeline/Period.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace ProgrammatorDev\OpenWeatherMap\Entity\OneCall\OneDayTimeline;
3+
namespace ProgrammatorDev\OpenWeatherMap\Entity\OneCall\DayTimeline;
44

55
use ProgrammatorDev\Api\Context\Context;
66
use ProgrammatorDev\Api\Contract\EntityInterface;

src/Entity/OneCall/OneDayTimeline/Temperature.php renamed to src/Entity/OneCall/DayTimeline/Temperature.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace ProgrammatorDev\OpenWeatherMap\Entity\OneCall\OneDayTimeline;
3+
namespace ProgrammatorDev\OpenWeatherMap\Entity\OneCall\DayTimeline;
44

55
use ProgrammatorDev\Api\Context\Context;
66
use ProgrammatorDev\Api\Contract\EntityInterface;
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
use ProgrammatorDev\Api\Context\Context;
66
use ProgrammatorDev\Api\Contract\EntityInterface;
77
use ProgrammatorDev\OpenWeatherMap\Entity\Coordinates;
8-
use ProgrammatorDev\OpenWeatherMap\Entity\OneCall\OneHourTimeline\Period;
8+
use ProgrammatorDev\OpenWeatherMap\Entity\OneCall\HourTimeline\Period;
99
use ProgrammatorDev\OpenWeatherMap\Entity\OneCall\Timeline\Pagination;
1010
use ProgrammatorDev\OpenWeatherMap\Entity\OneCall\Timeline\TimelinePage;
1111

12-
final class OneHourTimeline implements EntityInterface
12+
final class HourTimeline implements EntityInterface
1313
{
1414
/**
1515
* @param TimelinePage<Period, self> $page

src/Entity/OneCall/OneHourTimeline/Period.php renamed to src/Entity/OneCall/HourTimeline/Period.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace ProgrammatorDev\OpenWeatherMap\Entity\OneCall\OneHourTimeline;
3+
namespace ProgrammatorDev\OpenWeatherMap\Entity\OneCall\HourTimeline;
44

55
use ProgrammatorDev\OpenWeatherMap\Entity\OneCall\Timeline\WeatherPeriod;
66

src/Resource/OneCall.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
use ProgrammatorDev\Api\Resource;
66
use ProgrammatorDev\OpenWeatherMap\Entity\OneCall\Alert;
77
use ProgrammatorDev\OpenWeatherMap\Entity\OneCall\Current;
8+
use ProgrammatorDev\OpenWeatherMap\Entity\OneCall\DayTimeline;
89
use ProgrammatorDev\OpenWeatherMap\Entity\OneCall\FifteenMinuteTimeline;
10+
use ProgrammatorDev\OpenWeatherMap\Entity\OneCall\HourTimeline;
911
use ProgrammatorDev\OpenWeatherMap\Entity\OneCall\MinuteTimeline;
10-
use ProgrammatorDev\OpenWeatherMap\Entity\OneCall\OneDayTimeline;
11-
use ProgrammatorDev\OpenWeatherMap\Entity\OneCall\OneHourTimeline;
1212
use ProgrammatorDev\OpenWeatherMap\Resource\Concern\WithLanguage;
1313
use ProgrammatorDev\OpenWeatherMap\Resource\Concern\WithUnits;
1414
use ProgrammatorDev\OpenWeatherMap\Validation\Assert;
@@ -91,12 +91,12 @@ public function fifteenMinuteTimeline(
9191
return $timeline;
9292
}
9393

94-
public function oneHourTimeline(
94+
public function hourTimeline(
9595
float $latitude,
9696
float $longitude,
9797
?\DateTimeInterface $startAt = null,
9898
?int $count = null,
99-
): OneHourTimeline {
99+
): HourTimeline {
100100
$latitude = Assert::latitude($latitude);
101101
$longitude = Assert::longitude($longitude);
102102

@@ -105,7 +105,7 @@ public function oneHourTimeline(
105105
}
106106

107107
// https://openweathermap.org/api/one-call-4#hourly
108-
/** @var OneHourTimeline $timeline */
108+
/** @var HourTimeline $timeline */
109109
$timeline = $this
110110
->endpoint()
111111
->queries([
@@ -117,17 +117,17 @@ public function oneHourTimeline(
117117
'lang' => $this->resolvedLanguage(),
118118
])
119119
->get('/data/4.0/onecall/timeline/1h')
120-
->entity(OneHourTimeline::class);
120+
->entity(HourTimeline::class);
121121

122122
return $timeline;
123123
}
124124

125-
public function oneDayTimeline(
125+
public function dayTimeline(
126126
float $latitude,
127127
float $longitude,
128128
?\DateTimeInterface $startAt = null,
129129
?int $count = null,
130-
): OneDayTimeline {
130+
): DayTimeline {
131131
$latitude = Assert::latitude($latitude);
132132
$longitude = Assert::longitude($longitude);
133133

@@ -136,7 +136,7 @@ public function oneDayTimeline(
136136
}
137137

138138
// https://openweathermap.org/api/one-call-4#daily
139-
/** @var OneDayTimeline $timeline */
139+
/** @var DayTimeline $timeline */
140140
$timeline = $this
141141
->endpoint()
142142
->queries([
@@ -148,7 +148,7 @@ public function oneDayTimeline(
148148
'lang' => $this->resolvedLanguage(),
149149
])
150150
->get('/data/4.0/onecall/timeline/1day')
151-
->entity(OneDayTimeline::class);
151+
->entity(DayTimeline::class);
152152

153153
return $timeline;
154154
}

tests/Unit/Entity/OneCall/OneDayTimeline/FeelsLikeTemperatureTest.php renamed to tests/Unit/Entity/OneCall/DayTimeline/FeelsLikeTemperatureTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<?php
22

3-
namespace ProgrammatorDev\OpenWeatherMap\Test\Unit\Entity\OneCall\OneDayTimeline;
3+
namespace ProgrammatorDev\OpenWeatherMap\Test\Unit\Entity\OneCall\DayTimeline;
44

55
use PHPUnit\Framework\Attributes\DataProvider;
66
use PHPUnit\Framework\TestCase;
77
use ProgrammatorDev\Api\Config\Config;
88
use ProgrammatorDev\Api\Context\Context;
9-
use ProgrammatorDev\OpenWeatherMap\Entity\OneCall\OneDayTimeline\FeelsLikeTemperature;
9+
use ProgrammatorDev\OpenWeatherMap\Entity\OneCall\DayTimeline\FeelsLikeTemperature;
1010
use ProgrammatorDev\OpenWeatherMap\Enum\Unit;
1111
use ProgrammatorDev\OpenWeatherMap\Enum\Units;
1212
use ProgrammatorDev\OpenWeatherMap\Exception\HydrationException;

tests/Unit/Entity/OneCall/OneDayTimeline/PeriodTest.php renamed to tests/Unit/Entity/OneCall/DayTimeline/PeriodTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<?php
22

3-
namespace ProgrammatorDev\OpenWeatherMap\Test\Unit\Entity\OneCall\OneDayTimeline;
3+
namespace ProgrammatorDev\OpenWeatherMap\Test\Unit\Entity\OneCall\DayTimeline;
44

55
use PHPUnit\Framework\Attributes\DataProvider;
66
use PHPUnit\Framework\TestCase;
77
use ProgrammatorDev\Api\Config\Config;
88
use ProgrammatorDev\Api\Context\Context;
9-
use ProgrammatorDev\OpenWeatherMap\Entity\OneCall\OneDayTimeline\Period;
9+
use ProgrammatorDev\OpenWeatherMap\Entity\OneCall\DayTimeline\Period;
1010
use ProgrammatorDev\OpenWeatherMap\Enum\Unit;
1111
use ProgrammatorDev\OpenWeatherMap\Enum\Units;
1212
use ProgrammatorDev\OpenWeatherMap\Exception\HydrationException;

0 commit comments

Comments
 (0)