Skip to content

Commit 65562a9

Browse files
authored
Adds LocationService Client (#1472)
Adds Location Service Client
1 parent 3dc4e44 commit 65562a9

File tree

4 files changed

+29
-10
lines changed

4 files changed

+29
-10
lines changed

src/Generator/CodeGenerator/PopulatorGenerator.php

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use AsyncAws\CodeGenerator\Definition\ListShape;
88
use AsyncAws\CodeGenerator\Definition\MapShape;
99
use AsyncAws\CodeGenerator\Definition\Operation;
10+
use AsyncAws\CodeGenerator\Definition\Shape;
1011
use AsyncAws\CodeGenerator\Definition\StructureShape;
1112
use AsyncAws\CodeGenerator\Generator\Composer\RequirementsRegistry;
1213
use AsyncAws\CodeGenerator\Generator\EnumGenerator;
@@ -117,16 +118,12 @@ private function generateProperties(StructureShape $shape, ClassBuilder $classBu
117118

118119
$nullable = false;
119120
} elseif ($memberShape instanceof ListShape) {
120-
$memberShape->getMember()->getShape();
121+
$memberShape = $memberShape->getMember()->getShape();
121122

122-
if (($memberShape = $memberShape->getMember()->getShape()) instanceof StructureShape) {
123-
$this->objectGenerator->generate($memberShape, $forEndpoint);
124-
if ($forEndpoint && 'endpoints' === $propertyName) {
125-
$forEndpoint = false;
126-
}
127-
}
128-
if (!empty($memberShape->getEnum())) {
129-
$this->enumGenerator->generate($memberShape);
123+
$this->generateListShapeMemberShape($memberShape, $forEndpoint);
124+
125+
if ($memberShape instanceof StructureShape && $forEndpoint && 'endpoints' === $propertyName) {
126+
$forEndpoint = false;
130127
}
131128

132129
$nullable = false;
@@ -295,4 +292,16 @@ private function generatePopulator(Operation $operation, StructureShape $shape,
295292
$classBuilder->addUse(Response::class);
296293
}
297294
}
295+
296+
private function generateListShapeMemberShape(Shape $memberShape, bool $forEndpoint): void
297+
{
298+
if ($memberShape instanceof StructureShape) {
299+
$this->objectGenerator->generate($memberShape, $forEndpoint);
300+
} elseif ($memberShape instanceof ListShape) {
301+
$this->generateListShapeMemberShape($memberShape->getMember()->getShape(), $forEndpoint);
302+
}
303+
if (!empty($memberShape->getEnum())) {
304+
$this->enumGenerator->generate($memberShape);
305+
}
306+
}
298307
}

src/Generator/GeneratorHelper.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,10 @@ public static function normalizeName(string $propertyName): string
5757
static $ignored = [
5858
'GB' => 'Gb',
5959
'BFrame' => 'Bframe',
60-
'IFrame' => 'Iframe',
6160
'BReference' => 'Breference',
61+
'BBox' => 'Bbox',
6262
'IInterval' => 'Iinterval',
63+
'IFrame' => 'Iframe',
6364
'XCoordinate' => 'Xcoordinate',
6465
'YCoordinate' => 'Ycoordinate',
6566
'XOffset' => 'Xoffset',

src/Generator/RequestSerializer/RestJsonSerializer.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,11 @@ private function dumpArrayTimestamp(string $output, string $input, Shape $shape)
287287
'OUTPUT' => $output,
288288
'INPUT' => $input,
289289
]);
290+
case 'iso8601':
291+
return strtr('$payloadOUTPUT = INPUT->format(\DateTimeInterface::ATOM);', [
292+
'OUTPUT' => $output,
293+
'INPUT' => $input,
294+
]);
290295
default:
291296
throw new \RuntimeException(sprintf('Timestamp format %s is not yet implemented', $format));
292297
}

src/Generator/ResponseParser/RestJsonParser.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,10 @@ protected function parseResponseTimestamp(Shape $shape, string $input, bool $req
132132
case 'unixTimestamp':
133133
$body = '\DateTimeImmutable::createFromFormat("U.u", sprintf("%.6F", INPUT))';
134134

135+
break;
136+
case 'iso8601':
137+
$body = '\DateTimeImmutable::createFromFormat(\DateTimeInterface::ATOM, INPUT)';
138+
135139
break;
136140
default:
137141
throw new \RuntimeException(sprintf('Timestamp format %s is not yet implemented', $format));

0 commit comments

Comments
 (0)