|
4 | 4 |
|
5 | 5 | namespace AsyncAws\CodeGenerator\Generator\ResponseParser; |
6 | 6 |
|
| 7 | +use AsyncAws\CodeGenerator\Definition\DocumentShape; |
7 | 8 | use AsyncAws\CodeGenerator\Definition\ListShape; |
8 | 9 | use AsyncAws\CodeGenerator\Definition\MapShape; |
9 | 10 | use AsyncAws\CodeGenerator\Definition\Member; |
@@ -193,6 +194,8 @@ private function parseElement(string $input, Shape $shape, bool $required, bool |
193 | 194 | return $this->parseResponseStructure($shape, $input, $required); |
194 | 195 | case $shape instanceof MapShape: |
195 | 196 | return $this->parseResponseMap($shape, $input, $required, $inObject); |
| 197 | + case $shape instanceof DocumentShape: |
| 198 | + return $this->parseResponseDocument($input, $required); |
196 | 199 | } |
197 | 200 |
|
198 | 201 | switch ($shape->getType()) { |
@@ -296,6 +299,15 @@ private function parseResponseBlob(string $input, bool $required): string |
296 | 299 | return strtr('isset(INPUT) ? base64_decode((string) INPUT) : null', ['INPUT' => $input]); |
297 | 300 | } |
298 | 301 |
|
| 302 | + private function parseResponseDocument(string $input, bool $required): string |
| 303 | + { |
| 304 | + if ($required) { |
| 305 | + return strtr('INPUT', ['INPUT' => $input]); |
| 306 | + } |
| 307 | + |
| 308 | + return strtr('INPUT ?? null', ['INPUT' => $input]); |
| 309 | + } |
| 310 | + |
299 | 311 | private function parseResponseList(ListShape $shape, string $input, bool $required, bool $inObject): string |
300 | 312 | { |
301 | 313 | $shapeMember = $shape->getMember(); |
|
0 commit comments