Skip to content

Commit 8f779a4

Browse files
Update generated code (#1722)
* update generated code * Update src/Service/LocationService/CHANGELOG.md --------- Co-authored-by: Jérémy Derussé <[email protected]>
1 parent f7f8bca commit 8f779a4

31 files changed

+769
-762
lines changed

manifest.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"variables": {
3-
"${LATEST}": "3.308.5"
3+
"${LATEST}": "3.311.1"
44
},
55
"endpoints": "https://raw.githubusercontent.com/aws/aws-sdk-php/${LATEST}/src/data/endpoints.json",
66
"services": {

src/Service/LocationService/CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
### Changed
66

7+
- AWS enhancement: Documentation updates.
78
- Add `Accept: application/json` header in request to fix incompatibility with 3rd party providers
89

910
## 1.0.2

src/Service/LocationService/composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
},
2929
"extra": {
3030
"branch-alias": {
31-
"dev-master": "1.0-dev"
31+
"dev-master": "1.1-dev"
3232
}
3333
}
3434
}

src/Service/LocationService/src/Exception/ValidationException.php

+8-8
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,18 @@
1313
final class ValidationException extends ClientException
1414
{
1515
/**
16-
* The field where the invalid entry was detected.
16+
* A message with the reason for the validation exception error.
1717
*
18-
* @var ValidationExceptionField[]
18+
* @var ValidationExceptionReason::*
1919
*/
20-
private $fieldList;
20+
private $reason;
2121

2222
/**
23-
* A message with the reason for the validation exception error.
23+
* The field where the invalid entry was detected.
2424
*
25-
* @var ValidationExceptionReason::*
25+
* @var ValidationExceptionField[]
2626
*/
27-
private $reason;
27+
private $fieldList;
2828

2929
/**
3030
* @return ValidationExceptionField[]
@@ -46,15 +46,15 @@ protected function populateResult(ResponseInterface $response): void
4646
{
4747
$data = $response->toArray(false);
4848

49-
$this->fieldList = $this->populateResultValidationExceptionFieldList($data['fieldList'] ?? []);
5049
$this->reason = (string) $data['reason'];
50+
$this->fieldList = $this->populateResultValidationExceptionFieldList($data['fieldList'] ?? []);
5151
}
5252

5353
private function populateResultValidationExceptionField(array $json): ValidationExceptionField
5454
{
5555
return new ValidationExceptionField([
56-
'Message' => (string) $json['message'],
5756
'Name' => (string) $json['name'],
57+
'Message' => (string) $json['message'],
5858
]);
5959
}
6060

src/Service/LocationService/src/Input/CalculateRouteMatrixRequest.php

+84-85
Original file line numberDiff line numberDiff line change
@@ -22,28 +22,6 @@ final class CalculateRouteMatrixRequest extends Input
2222
*/
2323
private $calculatorName;
2424

25-
/**
26-
* Specifies route preferences when traveling by `Car`, such as avoiding routes that use ferries or tolls.
27-
*
28-
* Requirements: `TravelMode` must be specified as `Car`.
29-
*
30-
* @var CalculateRouteCarModeOptions|null
31-
*/
32-
private $carModeOptions;
33-
34-
/**
35-
* Sets the time of departure as the current time. Uses the current time to calculate the route matrix. You can't set
36-
* both `DepartureTime` and `DepartNow`. If neither is set, the best time of day to travel with the best traffic
37-
* conditions is used to calculate the route matrix.
38-
*
39-
* Default Value: `false`
40-
*
41-
* Valid Values: `false` | `true`
42-
*
43-
* @var bool|null
44-
*/
45-
private $departNow;
46-
4725
/**
4826
* The list of departure (origin) positions for the route matrix. An array of points, each of which is itself a 2-value
4927
* array defined in WGS 84 [^1] format: `[longitude, latitude]`. For example, `[-123.115, 49.285]`.
@@ -67,21 +45,6 @@ final class CalculateRouteMatrixRequest extends Input
6745
*/
6846
private $departurePositions;
6947

70-
/**
71-
* Specifies the desired time of departure. Uses the given time to calculate the route matrix. You can't set both
72-
* `DepartureTime` and `DepartNow`. If neither is set, the best time of day to travel with the best traffic conditions
73-
* is used to calculate the route matrix.
74-
*
75-
* > Setting a departure time in the past returns a `400 ValidationException` error.
76-
*
77-
* - In ISO 8601 [^1] format: `YYYY-MM-DDThh:mm:ss.sssZ`. For example, `2020–07-2T12:15:20.000Z+01:00`
78-
*
79-
* [^1]: https://www.iso.org/iso-8601-date-and-time-format.html
80-
*
81-
* @var \DateTimeImmutable|null
82-
*/
83-
private $departureTime;
84-
8548
/**
8649
* The list of destination positions for the route matrix. An array of points, each of which is itself a 2-value array
8750
* defined in WGS 84 [^1] format: `[longitude, latitude]`. For example, `[-122.339, 47.615]`.
@@ -105,24 +68,6 @@ final class CalculateRouteMatrixRequest extends Input
10568
*/
10669
private $destinationPositions;
10770

108-
/**
109-
* Set the unit system to specify the distance.
110-
*
111-
* Default Value: `Kilometers`
112-
*
113-
* @var DistanceUnit::*|null
114-
*/
115-
private $distanceUnit;
116-
117-
/**
118-
* The optional API key [^1] to authorize the request.
119-
*
120-
* [^1]: https://docs.aws.amazon.com/location/latest/developerguide/using-apikeys.html
121-
*
122-
* @var string|null
123-
*/
124-
private $key;
125-
12671
/**
12772
* Specifies the mode of transport when calculating a route. Used in estimating the speed of travel and road
12873
* compatibility.
@@ -147,6 +92,52 @@ final class CalculateRouteMatrixRequest extends Input
14792
*/
14893
private $travelMode;
14994

95+
/**
96+
* Specifies the desired time of departure. Uses the given time to calculate the route matrix. You can't set both
97+
* `DepartureTime` and `DepartNow`. If neither is set, the best time of day to travel with the best traffic conditions
98+
* is used to calculate the route matrix.
99+
*
100+
* > Setting a departure time in the past returns a `400 ValidationException` error.
101+
*
102+
* - In ISO 8601 [^1] format: `YYYY-MM-DDThh:mm:ss.sssZ`. For example, `2020–07-2T12:15:20.000Z+01:00`
103+
*
104+
* [^1]: https://www.iso.org/iso-8601-date-and-time-format.html
105+
*
106+
* @var \DateTimeImmutable|null
107+
*/
108+
private $departureTime;
109+
110+
/**
111+
* Sets the time of departure as the current time. Uses the current time to calculate the route matrix. You can't set
112+
* both `DepartureTime` and `DepartNow`. If neither is set, the best time of day to travel with the best traffic
113+
* conditions is used to calculate the route matrix.
114+
*
115+
* Default Value: `false`
116+
*
117+
* Valid Values: `false` | `true`
118+
*
119+
* @var bool|null
120+
*/
121+
private $departNow;
122+
123+
/**
124+
* Set the unit system to specify the distance.
125+
*
126+
* Default Value: `Kilometers`
127+
*
128+
* @var DistanceUnit::*|null
129+
*/
130+
private $distanceUnit;
131+
132+
/**
133+
* Specifies route preferences when traveling by `Car`, such as avoiding routes that use ferries or tolls.
134+
*
135+
* Requirements: `TravelMode` must be specified as `Car`.
136+
*
137+
* @var CalculateRouteCarModeOptions|null
138+
*/
139+
private $carModeOptions;
140+
150141
/**
151142
* Specifies route preferences when traveling by `Truck`, such as avoiding routes that use ferries or tolls, and truck
152143
* specifications to consider when choosing an optimal road.
@@ -157,48 +148,57 @@ final class CalculateRouteMatrixRequest extends Input
157148
*/
158149
private $truckModeOptions;
159150

151+
/**
152+
* The optional API key [^1] to authorize the request.
153+
*
154+
* [^1]: https://docs.aws.amazon.com/location/latest/developerguide/using-apikeys.html
155+
*
156+
* @var string|null
157+
*/
158+
private $key;
159+
160160
/**
161161
* @param array{
162162
* CalculatorName?: string,
163-
* CarModeOptions?: null|CalculateRouteCarModeOptions|array,
164-
* DepartNow?: null|bool,
165163
* DeparturePositions?: array[],
166-
* DepartureTime?: null|\DateTimeImmutable|string,
167164
* DestinationPositions?: array[],
168-
* DistanceUnit?: null|DistanceUnit::*,
169-
* Key?: null|string,
170165
* TravelMode?: null|TravelMode::*,
166+
* DepartureTime?: null|\DateTimeImmutable|string,
167+
* DepartNow?: null|bool,
168+
* DistanceUnit?: null|DistanceUnit::*,
169+
* CarModeOptions?: null|CalculateRouteCarModeOptions|array,
171170
* TruckModeOptions?: null|CalculateRouteTruckModeOptions|array,
171+
* Key?: null|string,
172172
* '@region'?: string|null,
173173
* } $input
174174
*/
175175
public function __construct(array $input = [])
176176
{
177177
$this->calculatorName = $input['CalculatorName'] ?? null;
178-
$this->carModeOptions = isset($input['CarModeOptions']) ? CalculateRouteCarModeOptions::create($input['CarModeOptions']) : null;
179-
$this->departNow = $input['DepartNow'] ?? null;
180178
$this->departurePositions = $input['DeparturePositions'] ?? null;
181-
$this->departureTime = !isset($input['DepartureTime']) ? null : ($input['DepartureTime'] instanceof \DateTimeImmutable ? $input['DepartureTime'] : new \DateTimeImmutable($input['DepartureTime']));
182179
$this->destinationPositions = $input['DestinationPositions'] ?? null;
183-
$this->distanceUnit = $input['DistanceUnit'] ?? null;
184-
$this->key = $input['Key'] ?? null;
185180
$this->travelMode = $input['TravelMode'] ?? null;
181+
$this->departureTime = !isset($input['DepartureTime']) ? null : ($input['DepartureTime'] instanceof \DateTimeImmutable ? $input['DepartureTime'] : new \DateTimeImmutable($input['DepartureTime']));
182+
$this->departNow = $input['DepartNow'] ?? null;
183+
$this->distanceUnit = $input['DistanceUnit'] ?? null;
184+
$this->carModeOptions = isset($input['CarModeOptions']) ? CalculateRouteCarModeOptions::create($input['CarModeOptions']) : null;
186185
$this->truckModeOptions = isset($input['TruckModeOptions']) ? CalculateRouteTruckModeOptions::create($input['TruckModeOptions']) : null;
186+
$this->key = $input['Key'] ?? null;
187187
parent::__construct($input);
188188
}
189189

190190
/**
191191
* @param array{
192192
* CalculatorName?: string,
193-
* CarModeOptions?: null|CalculateRouteCarModeOptions|array,
194-
* DepartNow?: null|bool,
195193
* DeparturePositions?: array[],
196-
* DepartureTime?: null|\DateTimeImmutable|string,
197194
* DestinationPositions?: array[],
198-
* DistanceUnit?: null|DistanceUnit::*,
199-
* Key?: null|string,
200195
* TravelMode?: null|TravelMode::*,
196+
* DepartureTime?: null|\DateTimeImmutable|string,
197+
* DepartNow?: null|bool,
198+
* DistanceUnit?: null|DistanceUnit::*,
199+
* CarModeOptions?: null|CalculateRouteCarModeOptions|array,
201200
* TruckModeOptions?: null|CalculateRouteTruckModeOptions|array,
201+
* Key?: null|string,
202202
* '@region'?: string|null,
203203
* }|CalculateRouteMatrixRequest $input
204204
*/
@@ -388,12 +388,6 @@ private function requestBody(): array
388388
{
389389
$payload = [];
390390

391-
if (null !== $v = $this->carModeOptions) {
392-
$payload['CarModeOptions'] = $v->requestBody();
393-
}
394-
if (null !== $v = $this->departNow) {
395-
$payload['DepartNow'] = (bool) $v;
396-
}
397391
if (null === $v = $this->departurePositions) {
398392
throw new InvalidArgument(sprintf('Missing parameter "DeparturePositions" for "%s". The value cannot be null.', __CLASS__));
399393
}
@@ -411,9 +405,6 @@ private function requestBody(): array
411405
}
412406
}
413407

414-
if (null !== $v = $this->departureTime) {
415-
$payload['DepartureTime'] = $v->format(\DateTimeInterface::ATOM);
416-
}
417408
if (null === $v = $this->destinationPositions) {
418409
throw new InvalidArgument(sprintf('Missing parameter "DestinationPositions" for "%s". The value cannot be null.', __CLASS__));
419410
}
@@ -431,18 +422,26 @@ private function requestBody(): array
431422
}
432423
}
433424

425+
if (null !== $v = $this->travelMode) {
426+
if (!TravelMode::exists($v)) {
427+
throw new InvalidArgument(sprintf('Invalid parameter "TravelMode" for "%s". The value "%s" is not a valid "TravelMode".', __CLASS__, $v));
428+
}
429+
$payload['TravelMode'] = $v;
430+
}
431+
if (null !== $v = $this->departureTime) {
432+
$payload['DepartureTime'] = $v->format(\DateTimeInterface::ATOM);
433+
}
434+
if (null !== $v = $this->departNow) {
435+
$payload['DepartNow'] = (bool) $v;
436+
}
434437
if (null !== $v = $this->distanceUnit) {
435438
if (!DistanceUnit::exists($v)) {
436439
throw new InvalidArgument(sprintf('Invalid parameter "DistanceUnit" for "%s". The value "%s" is not a valid "DistanceUnit".', __CLASS__, $v));
437440
}
438441
$payload['DistanceUnit'] = $v;
439442
}
440-
441-
if (null !== $v = $this->travelMode) {
442-
if (!TravelMode::exists($v)) {
443-
throw new InvalidArgument(sprintf('Invalid parameter "TravelMode" for "%s". The value "%s" is not a valid "TravelMode".', __CLASS__, $v));
444-
}
445-
$payload['TravelMode'] = $v;
443+
if (null !== $v = $this->carModeOptions) {
444+
$payload['CarModeOptions'] = $v->requestBody();
446445
}
447446
if (null !== $v = $this->truckModeOptions) {
448447
$payload['TruckModeOptions'] = $v->requestBody();

0 commit comments

Comments
 (0)