Skip to content

Commit 5c567c9

Browse files
feat(api): update via SDK Studio
1 parent 8b46076 commit 5c567c9

3 files changed

Lines changed: 67 additions & 3 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: 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

browser.go

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,14 @@ type BrowserNewResponse struct {
6161
CdpWsURL string `json:"cdp_ws_url,required"`
6262
// Unique identifier for the browser session
6363
SessionID string `json:"session_id,required"`
64+
// Optional persistence configuration for the browser session.
65+
Persistence BrowserNewResponsePersistence `json:"persistence"`
6466
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
6567
JSON struct {
6668
BrowserLiveViewURL respjson.Field
6769
CdpWsURL respjson.Field
6870
SessionID respjson.Field
71+
Persistence respjson.Field
6972
ExtraFields map[string]respjson.Field
7073
raw string
7174
} `json:"-"`
@@ -77,18 +80,39 @@ func (r *BrowserNewResponse) UnmarshalJSON(data []byte) error {
7780
return apijson.UnmarshalRoot(data, r)
7881
}
7982

83+
// Optional persistence configuration for the browser session.
84+
type BrowserNewResponsePersistence struct {
85+
// Unique identifier for the persistent browser session.
86+
ID string `json:"id,required"`
87+
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
88+
JSON struct {
89+
ID respjson.Field
90+
ExtraFields map[string]respjson.Field
91+
raw string
92+
} `json:"-"`
93+
}
94+
95+
// Returns the unmodified JSON received from the API
96+
func (r BrowserNewResponsePersistence) RawJSON() string { return r.JSON.raw }
97+
func (r *BrowserNewResponsePersistence) UnmarshalJSON(data []byte) error {
98+
return apijson.UnmarshalRoot(data, r)
99+
}
100+
80101
type BrowserGetResponse struct {
81102
// Remote URL for live viewing the browser session
82103
BrowserLiveViewURL string `json:"browser_live_view_url,required"`
83104
// Websocket URL for Chrome DevTools Protocol connections to the browser session
84105
CdpWsURL string `json:"cdp_ws_url,required"`
85106
// Unique identifier for the browser session
86107
SessionID string `json:"session_id,required"`
108+
// Optional persistence configuration for the browser session.
109+
Persistence BrowserGetResponsePersistence `json:"persistence"`
87110
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
88111
JSON struct {
89112
BrowserLiveViewURL respjson.Field
90113
CdpWsURL respjson.Field
91114
SessionID respjson.Field
115+
Persistence respjson.Field
92116
ExtraFields map[string]respjson.Field
93117
raw string
94118
} `json:"-"`
@@ -100,9 +124,29 @@ func (r *BrowserGetResponse) UnmarshalJSON(data []byte) error {
100124
return apijson.UnmarshalRoot(data, r)
101125
}
102126

127+
// Optional persistence configuration for the browser session.
128+
type BrowserGetResponsePersistence struct {
129+
// Unique identifier for the persistent browser session.
130+
ID string `json:"id,required"`
131+
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
132+
JSON struct {
133+
ID respjson.Field
134+
ExtraFields map[string]respjson.Field
135+
raw string
136+
} `json:"-"`
137+
}
138+
139+
// Returns the unmodified JSON received from the API
140+
func (r BrowserGetResponsePersistence) RawJSON() string { return r.JSON.raw }
141+
func (r *BrowserGetResponsePersistence) UnmarshalJSON(data []byte) error {
142+
return apijson.UnmarshalRoot(data, r)
143+
}
144+
103145
type BrowserNewParams struct {
104146
// action invocation ID
105147
InvocationID string `json:"invocation_id,required"`
148+
// Optional persistence configuration for the browser session.
149+
Persistence BrowserNewParamsPersistence `json:"persistence,omitzero"`
106150
paramObj
107151
}
108152

@@ -113,3 +157,20 @@ func (r BrowserNewParams) MarshalJSON() (data []byte, err error) {
113157
func (r *BrowserNewParams) UnmarshalJSON(data []byte) error {
114158
return apijson.UnmarshalRoot(data, r)
115159
}
160+
161+
// Optional persistence configuration for the browser session.
162+
//
163+
// The property ID is required.
164+
type BrowserNewParamsPersistence struct {
165+
// Unique identifier for the persistent browser session.
166+
ID string `json:"id,required"`
167+
paramObj
168+
}
169+
170+
func (r BrowserNewParamsPersistence) MarshalJSON() (data []byte, err error) {
171+
type shadow BrowserNewParamsPersistence
172+
return param.MarshalObject(r, (*shadow)(&r))
173+
}
174+
func (r *BrowserNewParamsPersistence) UnmarshalJSON(data []byte) error {
175+
return apijson.UnmarshalRoot(data, r)
176+
}

browser_test.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
"github.com/onkernel/kernel-go-sdk/option"
1414
)
1515

16-
func TestBrowserNew(t *testing.T) {
16+
func TestBrowserNewWithOptionalParams(t *testing.T) {
1717
t.Skip("skipped: tests are disabled for the time being")
1818
baseURL := "http://localhost:4010"
1919
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
@@ -28,6 +28,9 @@ func TestBrowserNew(t *testing.T) {
2828
)
2929
_, err := client.Browsers.New(context.TODO(), kernel.BrowserNewParams{
3030
InvocationID: "ckqwer3o20000jb9s7abcdef",
31+
Persistence: kernel.BrowserNewParamsPersistence{
32+
ID: "my-shared-browser",
33+
},
3134
})
3235
if err != nil {
3336
var apierr *kernel.Error

0 commit comments

Comments
 (0)