Skip to content

Commit e9a6d4e

Browse files
feat: Support updating browser session name and tags via PATCH
1 parent 232191f commit e9a6d4e

3 files changed

Lines changed: 19 additions & 5 deletions

File tree

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 119
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel/kernel-f9a96fe14f0b3c93230a26f9b64827a35a19a28d4e7cd2719315c4d76cce78fc.yml
3-
openapi_spec_hash: 852e2a64b850f759ccbcf81b1579497a
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel/kernel-e66c3f8aedccc39104386a3ec619f3fdcef7e8b00d9e5aa82e414a1b387351c2.yml
3+
openapi_spec_hash: afeddf18ebc3da1521b3e6f6739411fa
44
config_hash: 80eef1b592110714ea55cd26c470fabb

browser.go

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -676,8 +676,8 @@ type BrowserNewParams struct {
676676
// view.
677677
KioskMode param.Opt[bool] `json:"kiosk_mode,omitzero"`
678678
// Optional human-readable name for the browser session, used to find it later in
679-
// the dashboard. Must be unique among active sessions within the project. Set at
680-
// creation time only.
679+
// the dashboard. Must be unique among active sessions within the project. Can be
680+
// changed later via PATCH /browsers/{id_or_name}.
681681
Name param.Opt[string] `json:"name,omitzero"`
682682
// Optional proxy to associate to the browser session. Must reference a proxy
683683
// belonging to the caller's org.
@@ -713,7 +713,8 @@ type BrowserNewParams struct {
713713
// Profiles must be created beforehand.
714714
Profile shared.BrowserProfileParam `json:"profile,omitzero"`
715715
// Optional user-defined key-value tags for the browser session, used to find and
716-
// group sessions later. Set at creation time only. Up to 50 pairs.
716+
// group sessions later. Can be changed later via PATCH /browsers/{id_or_name}. Up
717+
// to 50 pairs.
717718
Tags Tags `json:"tags,omitzero"`
718719
// Initial browser window size in pixels with optional refresh rate. If omitted,
719720
// image defaults apply (1920x1080@25). For GPU images, the default is
@@ -781,6 +782,10 @@ func (r BrowserGetParams) URLQuery() (v url.Values, err error) {
781782
}
782783

783784
type BrowserUpdateParams struct {
785+
// Human-readable name for the browser session. Omit to leave unchanged, set to an
786+
// empty string to clear the name. When set, must be unique among active sessions
787+
// within the project.
788+
Name param.Opt[string] `json:"name,omitzero"`
784789
// ID of the proxy to use. Omit to leave unchanged, set to empty string to remove
785790
// proxy.
786791
ProxyID param.Opt[string] `json:"proxy_id,omitzero"`
@@ -796,6 +801,10 @@ type BrowserUpdateParams struct {
796801
// Profile to load into the browser session. Only allowed if the session does not
797802
// already have a profile loaded.
798803
Profile shared.BrowserProfileParam `json:"profile,omitzero"`
804+
// User-defined key-value tags for the browser session. Omit to leave unchanged.
805+
// Provide a map to replace the entire tag set (full replace, not a merge). Set to
806+
// an empty object ({}) to clear all tags. Up to 50 pairs.
807+
Tags Tags `json:"tags,omitzero"`
799808
// Viewport configuration to apply to the browser session.
800809
Viewport BrowserUpdateParamsViewport `json:"viewport,omitzero"`
801810
paramObj

browser_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,12 +149,17 @@ func TestBrowserUpdateWithOptionalParams(t *testing.T) {
149149
"htzv5orfit78e1m2biiifpbv",
150150
kernel.BrowserUpdateParams{
151151
DisableDefaultProxy: kernel.Bool(true),
152+
Name: kernel.String("checkout-flow-1"),
152153
Profile: shared.BrowserProfileParam{
153154
ID: kernel.String("id"),
154155
Name: kernel.String("name"),
155156
SaveChanges: kernel.Bool(true),
156157
},
157158
ProxyID: kernel.String("proxy_id"),
159+
Tags: kernel.Tags{
160+
"team": "backend",
161+
"env": "staging",
162+
},
158163
Telemetry: kernel.BrowserUpdateParamsTelemetry{
159164
Browser: kernel.BrowserTelemetryCategoriesConfigParam{
160165
Captcha: kernel.BrowserTelemetryCategoryConfigParam{

0 commit comments

Comments
 (0)