Skip to content

Commit 86c57b8

Browse files
feat(api): allow setting a custom name on a browser session at create time
1 parent 3e647a8 commit 86c57b8

11 files changed

Lines changed: 44 additions & 5 deletions

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 117
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel/kernel-e6c711f0d29a7d956cc8ca621440da966c1f1575b1205d01328b1099edf1c517.yml
3-
openapi_spec_hash: c06e7e36de1c6f9b29b54a6e3dc08ee5
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel/kernel-e7925f5cb9626a47fd24470851ff4149c27bc89795f75e8641c618fff93a076c.yml
3+
openapi_spec_hash: 955d4bf81e9838b0732c0e52716a2030
44
config_hash: 36159c262d293fbeacf513ab600a1729

src/kernel/resources/browsers/browsers.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ def create(
169169
headless: bool | Omit = omit,
170170
invocation_id: str | Omit = omit,
171171
kiosk_mode: bool | Omit = omit,
172+
name: str | Omit = omit,
172173
profile: BrowserProfile | Omit = omit,
173174
proxy_id: str | Omit = omit,
174175
start_url: str | Omit = omit,
@@ -205,6 +206,10 @@ def create(
205206
kiosk_mode: If true, launches the browser in kiosk mode to hide address bar and tabs in live
206207
view.
207208
209+
name: Optional human-readable name for the browser session, used to find it later in
210+
the dashboard. Must be unique among active sessions within the project. Set at
211+
creation time only.
212+
208213
profile: Profile selection for the browser session. Provide either id or name. If
209214
specified, the matching profile will be loaded into the browser session.
210215
Profiles must be created beforehand.
@@ -262,6 +267,7 @@ def create(
262267
"headless": headless,
263268
"invocation_id": invocation_id,
264269
"kiosk_mode": kiosk_mode,
270+
"name": name,
265271
"profile": profile,
266272
"proxy_id": proxy_id,
267273
"start_url": start_url,
@@ -413,7 +419,7 @@ def list(
413419
414420
offset: Number of results to skip. Defaults to 0.
415421
416-
query: Search browsers by session ID, profile ID, proxy ID, or pool name.
422+
query: Search browsers by name, session ID, profile ID, proxy ID, or pool name.
417423
418424
status: Filter sessions by status. "active" returns only active sessions (default),
419425
"deleted" returns only soft-deleted sessions, "all" returns both.
@@ -717,6 +723,7 @@ async def create(
717723
headless: bool | Omit = omit,
718724
invocation_id: str | Omit = omit,
719725
kiosk_mode: bool | Omit = omit,
726+
name: str | Omit = omit,
720727
profile: BrowserProfile | Omit = omit,
721728
proxy_id: str | Omit = omit,
722729
start_url: str | Omit = omit,
@@ -753,6 +760,10 @@ async def create(
753760
kiosk_mode: If true, launches the browser in kiosk mode to hide address bar and tabs in live
754761
view.
755762
763+
name: Optional human-readable name for the browser session, used to find it later in
764+
the dashboard. Must be unique among active sessions within the project. Set at
765+
creation time only.
766+
756767
profile: Profile selection for the browser session. Provide either id or name. If
757768
specified, the matching profile will be loaded into the browser session.
758769
Profiles must be created beforehand.
@@ -810,6 +821,7 @@ async def create(
810821
"headless": headless,
811822
"invocation_id": invocation_id,
812823
"kiosk_mode": kiosk_mode,
824+
"name": name,
813825
"profile": profile,
814826
"proxy_id": proxy_id,
815827
"start_url": start_url,
@@ -961,7 +973,7 @@ def list(
961973
962974
offset: Number of results to skip. Defaults to 0.
963975
964-
query: Search browsers by session ID, profile ID, proxy ID, or pool name.
976+
query: Search browsers by name, session ID, profile ID, proxy ID, or pool name.
965977
966978
status: Filter sessions by status. "active" returns only active sessions (default),
967979
"deleted" returns only soft-deleted sessions, "all" returns both.

src/kernel/types/browser_create_params.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,13 @@ class BrowserCreateParams(TypedDict, total=False):
4949
view.
5050
"""
5151

52+
name: str
53+
"""
54+
Optional human-readable name for the browser session, used to find it later in
55+
the dashboard. Must be unique among active sessions within the project. Set at
56+
creation time only.
57+
"""
58+
5259
profile: BrowserProfile
5360
"""Profile selection for the browser session.
5461

src/kernel/types/browser_create_response.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ class BrowserCreateResponse(BaseModel):
6363
kiosk_mode: Optional[bool] = None
6464
"""Whether the browser session is running in kiosk mode."""
6565

66+
name: Optional[str] = None
67+
"""Human-readable name of the browser session, if one was set at creation."""
68+
6669
pool: Optional[BrowserPoolRef] = None
6770
"""Browser pool this session was acquired from, if any."""
6871

src/kernel/types/browser_list_params.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class BrowserListParams(TypedDict, total=False):
2222
"""Number of results to skip. Defaults to 0."""
2323

2424
query: str
25-
"""Search browsers by session ID, profile ID, proxy ID, or pool name."""
25+
"""Search browsers by name, session ID, profile ID, proxy ID, or pool name."""
2626

2727
status: Literal["active", "deleted", "all"]
2828
"""Filter sessions by status.

src/kernel/types/browser_list_response.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ class BrowserListResponse(BaseModel):
6363
kiosk_mode: Optional[bool] = None
6464
"""Whether the browser session is running in kiosk mode."""
6565

66+
name: Optional[str] = None
67+
"""Human-readable name of the browser session, if one was set at creation."""
68+
6669
pool: Optional[BrowserPoolRef] = None
6770
"""Browser pool this session was acquired from, if any."""
6871

src/kernel/types/browser_pool_acquire_response.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ class BrowserPoolAcquireResponse(BaseModel):
6363
kiosk_mode: Optional[bool] = None
6464
"""Whether the browser session is running in kiosk mode."""
6565

66+
name: Optional[str] = None
67+
"""Human-readable name of the browser session, if one was set at creation."""
68+
6669
pool: Optional[BrowserPoolRef] = None
6770
"""Browser pool this session was acquired from, if any."""
6871

src/kernel/types/browser_retrieve_response.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ class BrowserRetrieveResponse(BaseModel):
6363
kiosk_mode: Optional[bool] = None
6464
"""Whether the browser session is running in kiosk mode."""
6565

66+
name: Optional[str] = None
67+
"""Human-readable name of the browser session, if one was set at creation."""
68+
6669
pool: Optional[BrowserPoolRef] = None
6770
"""Browser pool this session was acquired from, if any."""
6871

src/kernel/types/browser_update_response.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ class BrowserUpdateResponse(BaseModel):
6363
kiosk_mode: Optional[bool] = None
6464
"""Whether the browser session is running in kiosk mode."""
6565

66+
name: Optional[str] = None
67+
"""Human-readable name of the browser session, if one was set at creation."""
68+
6669
pool: Optional[BrowserPoolRef] = None
6770
"""Browser pool this session was acquired from, if any."""
6871

src/kernel/types/invocation_list_browsers_response.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ class Browser(BaseModel):
6363
kiosk_mode: Optional[bool] = None
6464
"""Whether the browser session is running in kiosk mode."""
6565

66+
name: Optional[str] = None
67+
"""Human-readable name of the browser session, if one was set at creation."""
68+
6669
pool: Optional[BrowserPoolRef] = None
6770
"""Browser pool this session was acquired from, if any."""
6871

0 commit comments

Comments
 (0)