diff --git a/.release-please-manifest.json b/.release-please-manifest.json index ff1c7af..2437b41 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "3.3.0" + ".": "3.4.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 9c0f6d9..1c9fda1 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 7 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/browserbase%2Fstagehand-d91dfd9ce727aefac56505ac86feb5cc665d3d5cef80ff17605f45e09b258251.yml -openapi_spec_hash: 0d1cae70e9d1debc5ac1a69fc665af37 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/browserbase%2Fstagehand-22af3433e4e2d94d5ba19598d795e91939118eb58af20179f2b07c916907c0b6.yml +openapi_spec_hash: a1ca99a2148ba2eddd0f0d8aab133a35 config_hash: 64c9cc393de93af70e11dbf0b1ba9388 diff --git a/CHANGELOG.md b/CHANGELOG.md index 089a87d..c34efae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 3.4.0 (2026-01-20) + +Full Changelog: [v3.3.0...v3.4.0](https://github.com/browserbase/stagehand-php/compare/v3.3.0...v3.4.0) + +### Features + +* End endpoint cleanup ([3146db4](https://github.com/browserbase/stagehand-php/commit/3146db4768aab42af9ce6c2add2aa583bed8b86f)) + ## 3.3.0 (2026-01-20) Full Changelog: [v3.2.2...v3.3.0](https://github.com/browserbase/stagehand-php/compare/v3.2.2...v3.3.0) diff --git a/src/ServiceContracts/SessionsContract.php b/src/ServiceContracts/SessionsContract.php index ce30b23..2cc3e51 100644 --- a/src/ServiceContracts/SessionsContract.php +++ b/src/ServiceContracts/SessionsContract.php @@ -84,16 +84,14 @@ public function actStream( /** * @api * - * @param string $id Path param: Unique session identifier - * @param mixed $_forceBody Body param - * @param \Stagehand\Sessions\SessionEndParams\XStreamResponse|value-of<\Stagehand\Sessions\SessionEndParams\XStreamResponse> $xStreamResponse Header param: Whether to stream the response via SSE + * @param string $id Unique session identifier + * @param \Stagehand\Sessions\SessionEndParams\XStreamResponse|value-of<\Stagehand\Sessions\SessionEndParams\XStreamResponse> $xStreamResponse Whether to stream the response via SSE * @param RequestOpts|null $requestOptions * * @throws APIException */ public function end( string $id, - mixed $_forceBody = null, \Stagehand\Sessions\SessionEndParams\XStreamResponse|string|null $xStreamResponse = null, RequestOptions|array|null $requestOptions = null, ): SessionEndResponse; diff --git a/src/ServiceContracts/SessionsRawContract.php b/src/ServiceContracts/SessionsRawContract.php index 9806066..af38c79 100644 --- a/src/ServiceContracts/SessionsRawContract.php +++ b/src/ServiceContracts/SessionsRawContract.php @@ -66,7 +66,7 @@ public function actStream( /** * @api * - * @param string $id Path param: Unique session identifier + * @param string $id Unique session identifier * @param array|SessionEndParams $params * @param RequestOpts|null $requestOptions * diff --git a/src/Services/SessionsRawService.php b/src/Services/SessionsRawService.php index 951c3f4..50c2bea 100644 --- a/src/Services/SessionsRawService.php +++ b/src/Services/SessionsRawService.php @@ -157,9 +157,8 @@ public function actStream( * * Terminates the browser session and releases all associated resources. * - * @param string $id Path param: Unique session identifier + * @param string $id Unique session identifier * @param array{ - * _forceBody?: mixed, * xStreamResponse?: SessionEndParams\XStreamResponse|value-of, * }|SessionEndParams $params * @param RequestOpts|null $requestOptions @@ -177,19 +176,14 @@ public function end( $params, $requestOptions, ); - $header_params = ['xStreamResponse' => 'x-stream-response']; // @phpstan-ignore-next-line return.type return $this->client->request( method: 'post', path: ['v1/sessions/%1$s/end', $id], headers: Util::array_transform_keys( - array_intersect_key($parsed, array_flip(array_keys($header_params))), - $header_params, - ), - body: (object) array_diff_key( $parsed, - array_flip(array_keys($header_params)) + ['xStreamResponse' => 'x-stream-response'] ), options: $options, convert: SessionEndResponse::class, diff --git a/src/Services/SessionsService.php b/src/Services/SessionsService.php index 2dc3838..82577f7 100644 --- a/src/Services/SessionsService.php +++ b/src/Services/SessionsService.php @@ -132,22 +132,18 @@ public function actStream( * * Terminates the browser session and releases all associated resources. * - * @param string $id Path param: Unique session identifier - * @param mixed $_forceBody Body param - * @param \Stagehand\Sessions\SessionEndParams\XStreamResponse|value-of<\Stagehand\Sessions\SessionEndParams\XStreamResponse> $xStreamResponse Header param: Whether to stream the response via SSE + * @param string $id Unique session identifier + * @param \Stagehand\Sessions\SessionEndParams\XStreamResponse|value-of<\Stagehand\Sessions\SessionEndParams\XStreamResponse> $xStreamResponse Whether to stream the response via SSE * @param RequestOpts|null $requestOptions * * @throws APIException */ public function end( string $id, - mixed $_forceBody = null, \Stagehand\Sessions\SessionEndParams\XStreamResponse|string|null $xStreamResponse = null, RequestOptions|array|null $requestOptions = null, ): SessionEndResponse { - $params = Util::removeNulls( - ['_forceBody' => $_forceBody, 'xStreamResponse' => $xStreamResponse] - ); + $params = Util::removeNulls(['xStreamResponse' => $xStreamResponse]); // @phpstan-ignore-next-line argument.type $response = $this->raw->end($id, params: $params, requestOptions: $requestOptions); diff --git a/src/Sessions/SessionEndParams.php b/src/Sessions/SessionEndParams.php index 45d12dc..ee51acf 100644 --- a/src/Sessions/SessionEndParams.php +++ b/src/Sessions/SessionEndParams.php @@ -16,8 +16,7 @@ * @see Stagehand\Services\SessionsService::end() * * @phpstan-type SessionEndParamsShape = array{ - * _forceBody?: mixed, - * xStreamResponse?: null|XStreamResponse|value-of, + * xStreamResponse?: null|XStreamResponse|value-of * } */ final class SessionEndParams implements BaseModel @@ -26,9 +25,6 @@ final class SessionEndParams implements BaseModel use SdkModel; use SdkParams; - #[Optional] - public mixed $_forceBody; - /** * Whether to stream the response via SSE. * @@ -50,25 +46,15 @@ public function __construct() * @param XStreamResponse|value-of|null $xStreamResponse */ public static function with( - mixed $_forceBody = null, XStreamResponse|string|null $xStreamResponse = null ): self { $self = new self; - null !== $_forceBody && $self['_forceBody'] = $_forceBody; null !== $xStreamResponse && $self['xStreamResponse'] = $xStreamResponse; return $self; } - public function withForceBody(mixed $_forceBody): self - { - $self = clone $this; - $self['_forceBody'] = $_forceBody; - - return $self; - } - /** * Whether to stream the response via SSE. * diff --git a/src/Sessions/SessionStartParams/Browser/LaunchOptions.php b/src/Sessions/SessionStartParams/Browser/LaunchOptions.php index f629136..ce410ab 100644 --- a/src/Sessions/SessionStartParams/Browser/LaunchOptions.php +++ b/src/Sessions/SessionStartParams/Browser/LaunchOptions.php @@ -32,6 +32,7 @@ * ignoreDefaultArgs?: IgnoreDefaultArgsShape|null, * ignoreHTTPSErrors?: bool|null, * locale?: string|null, + * port?: float|null, * preserveUserDataDir?: bool|null, * proxy?: null|Proxy|ProxyShape, * userDataDir?: string|null, @@ -87,6 +88,9 @@ final class LaunchOptions implements BaseModel #[Optional] public ?string $locale; + #[Optional] + public ?float $port; + #[Optional] public ?bool $preserveUserDataDir; @@ -129,6 +133,7 @@ public static function with( bool|array|null $ignoreDefaultArgs = null, ?bool $ignoreHTTPSErrors = null, ?string $locale = null, + ?float $port = null, ?bool $preserveUserDataDir = null, Proxy|array|null $proxy = null, ?string $userDataDir = null, @@ -150,6 +155,7 @@ public static function with( null !== $ignoreDefaultArgs && $self['ignoreDefaultArgs'] = $ignoreDefaultArgs; null !== $ignoreHTTPSErrors && $self['ignoreHTTPSErrors'] = $ignoreHTTPSErrors; null !== $locale && $self['locale'] = $locale; + null !== $port && $self['port'] = $port; null !== $preserveUserDataDir && $self['preserveUserDataDir'] = $preserveUserDataDir; null !== $proxy && $self['proxy'] = $proxy; null !== $userDataDir && $self['userDataDir'] = $userDataDir; @@ -276,6 +282,14 @@ public function withLocale(string $locale): self return $self; } + public function withPort(float $port): self + { + $self = clone $this; + $self['port'] = $port; + + return $self; + } + public function withPreserveUserDataDir(bool $preserveUserDataDir): self { $self = clone $this; diff --git a/src/Version.php b/src/Version.php index 8fcd28f..e906129 100644 --- a/src/Version.php +++ b/src/Version.php @@ -5,5 +5,5 @@ namespace Stagehand; // x-release-please-start-version -const VERSION = '3.3.0'; +const VERSION = '3.4.0'; // x-release-please-end diff --git a/tests/Services/SessionsTest.php b/tests/Services/SessionsTest.php index e8dedbb..ab5749d 100644 --- a/tests/Services/SessionsTest.php +++ b/tests/Services/SessionsTest.php @@ -257,6 +257,7 @@ public function testStartWithOptionalParams(): void 'ignoreDefaultArgs' => true, 'ignoreHTTPSErrors' => true, 'locale' => 'locale', + 'port' => 0, 'preserveUserDataDir' => true, 'proxy' => [ 'server' => 'server',