Skip to content

Commit 260f1a2

Browse files
feat(api): update via SDK Studio
1 parent f0f0e85 commit 260f1a2

File tree

7 files changed

+85
-7
lines changed

7 files changed

+85
-7
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/kernel%2Fkernel-39aa058a60035c34a636e7f580b4b9c76b05400ae401ef04a761572b20a5425b.yml
3-
openapi_spec_hash: bb79a204f9edb6b6ccfe783a0a82a423
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-2813f659cb4e9e81cd3d9c94df748fd6c54f966fd6fd4881da369394aa981ace.yml
3+
openapi_spec_hash: facb760f50156c700b5c016087a70d64
44
config_hash: 3eb1ed1dd0067258984b31d53a0dab48

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,22 @@ Nested request parameters are [TypedDicts](https://docs.python.org/3/library/typ
8787

8888
Typed requests and responses provide autocomplete and documentation within your editor. If you would like to see type errors in VS Code to help catch bugs earlier, set `python.analysis.typeCheckingMode` to `basic`.
8989

90+
## Nested params
91+
92+
Nested parameters are dictionaries, typed using `TypedDict`, for example:
93+
94+
```python
95+
from kernel import Kernel
96+
97+
client = Kernel()
98+
99+
browser = client.browsers.create(
100+
invocation_id="ckqwer3o20000jb9s7abcdef",
101+
persistence={"id": "my-shared-browser"},
102+
)
103+
print(browser.persistence)
104+
```
105+
90106
## File uploads
91107

92108
Request parameters that correspond to file uploads can be passed as `bytes`, or a [`PathLike`](https://docs.python.org/3/library/os.html#os.PathLike) instance or a tuple of `(filename, contents, media type)`.

src/kernel/resources/browsers.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ def create(
4646
self,
4747
*,
4848
invocation_id: str,
49+
persistence: browser_create_params.Persistence | NotGiven = NOT_GIVEN,
4950
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
5051
# The extra values given here take precedence over values defined on the client or passed to this method.
5152
extra_headers: Headers | None = None,
@@ -59,6 +60,8 @@ def create(
5960
Args:
6061
invocation_id: action invocation ID
6162
63+
persistence: Optional persistence configuration for the browser session.
64+
6265
extra_headers: Send extra headers
6366
6467
extra_query: Add additional query parameters to the request
@@ -69,7 +72,13 @@ def create(
6972
"""
7073
return self._post(
7174
"/browsers",
72-
body=maybe_transform({"invocation_id": invocation_id}, browser_create_params.BrowserCreateParams),
75+
body=maybe_transform(
76+
{
77+
"invocation_id": invocation_id,
78+
"persistence": persistence,
79+
},
80+
browser_create_params.BrowserCreateParams,
81+
),
7382
options=make_request_options(
7483
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
7584
),
@@ -134,6 +143,7 @@ async def create(
134143
self,
135144
*,
136145
invocation_id: str,
146+
persistence: browser_create_params.Persistence | NotGiven = NOT_GIVEN,
137147
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
138148
# The extra values given here take precedence over values defined on the client or passed to this method.
139149
extra_headers: Headers | None = None,
@@ -147,6 +157,8 @@ async def create(
147157
Args:
148158
invocation_id: action invocation ID
149159
160+
persistence: Optional persistence configuration for the browser session.
161+
150162
extra_headers: Send extra headers
151163
152164
extra_query: Add additional query parameters to the request
@@ -158,7 +170,11 @@ async def create(
158170
return await self._post(
159171
"/browsers",
160172
body=await async_maybe_transform(
161-
{"invocation_id": invocation_id}, browser_create_params.BrowserCreateParams
173+
{
174+
"invocation_id": invocation_id,
175+
"persistence": persistence,
176+
},
177+
browser_create_params.BrowserCreateParams,
162178
),
163179
options=make_request_options(
164180
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout

src/kernel/types/browser_create_params.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,17 @@
44

55
from typing_extensions import Required, TypedDict
66

7-
__all__ = ["BrowserCreateParams"]
7+
__all__ = ["BrowserCreateParams", "Persistence"]
88

99

1010
class BrowserCreateParams(TypedDict, total=False):
1111
invocation_id: Required[str]
1212
"""action invocation ID"""
13+
14+
persistence: Persistence
15+
"""Optional persistence configuration for the browser session."""
16+
17+
18+
class Persistence(TypedDict, total=False):
19+
id: Required[str]
20+
"""Unique identifier for the persistent browser session."""

src/kernel/types/browser_create_response.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3+
from typing import Optional
4+
35
from .._models import BaseModel
46

5-
__all__ = ["BrowserCreateResponse"]
7+
__all__ = ["BrowserCreateResponse", "Persistence"]
8+
9+
10+
class Persistence(BaseModel):
11+
id: str
12+
"""Unique identifier for the persistent browser session."""
613

714

815
class BrowserCreateResponse(BaseModel):
@@ -14,3 +21,6 @@ class BrowserCreateResponse(BaseModel):
1421

1522
session_id: str
1623
"""Unique identifier for the browser session"""
24+
25+
persistence: Optional[Persistence] = None
26+
"""Optional persistence configuration for the browser session."""

src/kernel/types/browser_retrieve_response.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3+
from typing import Optional
4+
35
from .._models import BaseModel
46

5-
__all__ = ["BrowserRetrieveResponse"]
7+
__all__ = ["BrowserRetrieveResponse", "Persistence"]
8+
9+
10+
class Persistence(BaseModel):
11+
id: str
12+
"""Unique identifier for the persistent browser session."""
613

714

815
class BrowserRetrieveResponse(BaseModel):
@@ -14,3 +21,6 @@ class BrowserRetrieveResponse(BaseModel):
1421

1522
session_id: str
1623
"""Unique identifier for the browser session"""
24+
25+
persistence: Optional[Persistence] = None
26+
"""Optional persistence configuration for the browser session."""

tests/api_resources/test_browsers.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,15 @@ def test_method_create(self, client: Kernel) -> None:
2525
)
2626
assert_matches_type(BrowserCreateResponse, browser, path=["response"])
2727

28+
@pytest.mark.skip()
29+
@parametrize
30+
def test_method_create_with_all_params(self, client: Kernel) -> None:
31+
browser = client.browsers.create(
32+
invocation_id="ckqwer3o20000jb9s7abcdef",
33+
persistence={"id": "my-shared-browser"},
34+
)
35+
assert_matches_type(BrowserCreateResponse, browser, path=["response"])
36+
2837
@pytest.mark.skip()
2938
@parametrize
3039
def test_raw_response_create(self, client: Kernel) -> None:
@@ -105,6 +114,15 @@ async def test_method_create(self, async_client: AsyncKernel) -> None:
105114
)
106115
assert_matches_type(BrowserCreateResponse, browser, path=["response"])
107116

117+
@pytest.mark.skip()
118+
@parametrize
119+
async def test_method_create_with_all_params(self, async_client: AsyncKernel) -> None:
120+
browser = await async_client.browsers.create(
121+
invocation_id="ckqwer3o20000jb9s7abcdef",
122+
persistence={"id": "my-shared-browser"},
123+
)
124+
assert_matches_type(BrowserCreateResponse, browser, path=["response"])
125+
108126
@pytest.mark.skip()
109127
@parametrize
110128
async def test_raw_response_create(self, async_client: AsyncKernel) -> None:

0 commit comments

Comments
 (0)