Skip to content

Commit b15e097

Browse files
feat: Added optional param to force empty object
1 parent d5a8361 commit b15e097

File tree

6 files changed

+38
-3
lines changed

6 files changed

+38
-3
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 7
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/browserbase%2Fstagehand-2c6c017cc9ca1fcfe7b3902edfa64fb0420bdb46b1740c7c862e81e2132d4f7c.yml
3-
openapi_spec_hash: 220daf7e8f5897909a6c10e3385386e3
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/browserbase%2Fstagehand-39cd9547d16412cf0568f6ce2ad8d43805dffe65bde830beeff630b903ae3b38.yml
3+
openapi_spec_hash: 9cd7c9fefa686f9711392782d948470f
44
config_hash: 1f709f8775e13029dc60064ef3a94355

api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ from stagehand.types import (
2020
Methods:
2121

2222
- <code title="post /v1/sessions/{id}/act">client.sessions.<a href="./src/stagehand/resources/sessions.py">act</a>(id, \*\*<a href="src/stagehand/types/session_act_params.py">params</a>) -> <a href="./src/stagehand/types/session_act_response.py">SessionActResponse</a></code>
23-
- <code title="post /v1/sessions/{id}/end">client.sessions.<a href="./src/stagehand/resources/sessions.py">end</a>(id) -> <a href="./src/stagehand/types/session_end_response.py">SessionEndResponse</a></code>
23+
- <code title="post /v1/sessions/{id}/end">client.sessions.<a href="./src/stagehand/resources/sessions.py">end</a>(id, \*\*<a href="src/stagehand/types/session_end_params.py">params</a>) -> <a href="./src/stagehand/types/session_end_response.py">SessionEndResponse</a></code>
2424
- <code title="post /v1/sessions/{id}/agentExecute">client.sessions.<a href="./src/stagehand/resources/sessions.py">execute</a>(id, \*\*<a href="src/stagehand/types/session_execute_params.py">params</a>) -> <a href="./src/stagehand/types/session_execute_response.py">SessionExecuteResponse</a></code>
2525
- <code title="post /v1/sessions/{id}/extract">client.sessions.<a href="./src/stagehand/resources/sessions.py">extract</a>(id, \*\*<a href="src/stagehand/types/session_extract_params.py">params</a>) -> <a href="./src/stagehand/types/session_extract_response.py">SessionExtractResponse</a></code>
2626
- <code title="post /v1/sessions/{id}/navigate">client.sessions.<a href="./src/stagehand/resources/sessions.py">navigate</a>(id, \*\*<a href="src/stagehand/types/session_navigate_params.py">params</a>) -> <a href="./src/stagehand/types/session_navigate_response.py">SessionNavigateResponse</a></code>

src/stagehand/resources/sessions.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
from ..types import (
1212
session_act_params,
13+
session_end_params,
1314
session_start_params,
1415
session_execute_params,
1516
session_extract_params,
@@ -271,6 +272,7 @@ def end(
271272
self,
272273
id: str,
273274
*,
275+
_force_body: object | Omit = omit,
274276
x_language: Literal["typescript", "python", "playground"] | Omit = omit,
275277
x_sdk_version: str | Omit = omit,
276278
x_sent_at: Union[str, datetime] | Omit = omit,
@@ -319,6 +321,7 @@ def end(
319321
}
320322
return self._post(
321323
f"/v1/sessions/{id}/end",
324+
body=maybe_transform({"_force_body": _force_body}, session_end_params.SessionEndParams),
322325
options=make_request_options(
323326
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
324327
),
@@ -1350,6 +1353,7 @@ async def end(
13501353
self,
13511354
id: str,
13521355
*,
1356+
_force_body: object | Omit = omit,
13531357
x_language: Literal["typescript", "python", "playground"] | Omit = omit,
13541358
x_sdk_version: str | Omit = omit,
13551359
x_sent_at: Union[str, datetime] | Omit = omit,
@@ -1398,6 +1402,7 @@ async def end(
13981402
}
13991403
return await self._post(
14001404
f"/v1/sessions/{id}/end",
1405+
body=await async_maybe_transform({"_force_body": _force_body}, session_end_params.SessionEndParams),
14011406
options=make_request_options(
14021407
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
14031408
),

src/stagehand/types/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from .stream_event import StreamEvent as StreamEvent
77
from .model_config_param import ModelConfigParam as ModelConfigParam
88
from .session_act_params import SessionActParams as SessionActParams
9+
from .session_end_params import SessionEndParams as SessionEndParams
910
from .session_act_response import SessionActResponse as SessionActResponse
1011
from .session_end_response import SessionEndResponse as SessionEndResponse
1112
from .session_start_params import SessionStartParams as SessionStartParams
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from __future__ import annotations
4+
5+
from typing import Union
6+
from datetime import datetime
7+
from typing_extensions import Literal, Annotated, TypedDict
8+
9+
from .._utils import PropertyInfo
10+
11+
__all__ = ["SessionEndParams"]
12+
13+
14+
class SessionEndParams(TypedDict, total=False):
15+
_force_body: Annotated[object, PropertyInfo(alias="_forceBody")]
16+
17+
x_language: Annotated[Literal["typescript", "python", "playground"], PropertyInfo(alias="x-language")]
18+
"""Client SDK language"""
19+
20+
x_sdk_version: Annotated[str, PropertyInfo(alias="x-sdk-version")]
21+
"""Version of the Stagehand SDK"""
22+
23+
x_sent_at: Annotated[Union[str, datetime], PropertyInfo(alias="x-sent-at", format="iso8601")]
24+
"""ISO timestamp when request was sent"""
25+
26+
x_stream_response: Annotated[Literal["true", "false"], PropertyInfo(alias="x-stream-response")]
27+
"""Whether to stream the response via SSE"""

tests/api_resources/test_sessions.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ def test_method_end(self, client: Stagehand) -> None:
174174
def test_method_end_with_all_params(self, client: Stagehand) -> None:
175175
session = client.sessions.end(
176176
id="c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123",
177+
_force_body={},
177178
x_language="typescript",
178179
x_sdk_version="3.0.6",
179180
x_sent_at=parse_datetime("2025-01-15T10:30:00Z"),
@@ -984,6 +985,7 @@ async def test_method_end(self, async_client: AsyncStagehand) -> None:
984985
async def test_method_end_with_all_params(self, async_client: AsyncStagehand) -> None:
985986
session = await async_client.sessions.end(
986987
id="c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123",
988+
_force_body={},
987989
x_language="typescript",
988990
x_sdk_version="3.0.6",
989991
x_sent_at=parse_datetime("2025-01-15T10:30:00Z"),

0 commit comments

Comments
 (0)