Skip to content
This repository was archived by the owner on Jul 16, 2025. It is now read-only.

Commit 517bb84

Browse files
committed
feat: allow access of methods and read of properties through AsyncResponse
1 parent 6f2a43e commit 517bb84

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

examples/image-generator-dall-e-3.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,6 @@
2424
],
2525
);
2626

27-
if ($response instanceof AsyncResponse) {
28-
$response = $response->unwrap();
29-
}
30-
3127
assert($response instanceof ImageResponse);
3228

3329
echo 'Revised Prompt: '.$response->revisedPrompt.PHP_EOL.PHP_EOL;

src/Model/Response/AsyncResponse.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,17 @@ public function unwrap(): ResponseInterface
3636

3737
return $this->convertedResponse;
3838
}
39+
40+
/**
41+
* @param array<int, mixed> $arguments
42+
*/
43+
public function __call(string $name, array $arguments): mixed
44+
{
45+
return $this->unwrap()->{$name}(...$arguments);
46+
}
47+
48+
public function __get(string $name): mixed
49+
{
50+
return $this->unwrap()->{$name};
51+
}
3952
}

0 commit comments

Comments
 (0)