@@ -4,6 +4,7 @@ package kernel
44
55import (
66 "context"
7+ "encoding/json"
78 "errors"
89 "fmt"
910 "net/http"
@@ -36,15 +37,15 @@ func NewBrowserService(opts ...option.RequestOption) (r BrowserService) {
3637 return
3738}
3839
39- // Create Browser Session
40+ // Create a new browser session from within an action.
4041func (r * BrowserService ) New (ctx context.Context , body BrowserNewParams , opts ... option.RequestOption ) (res * BrowserNewResponse , err error ) {
4142 opts = append (r .Options [:], opts ... )
4243 path := "browsers"
4344 err = requestconfig .ExecuteNewRequest (ctx , http .MethodPost , path , body , & res , opts ... )
4445 return
4546}
4647
47- // Get Browser Session by ID
48+ // Get information about a browser session.
4849func (r * BrowserService ) Get (ctx context.Context , id string , opts ... option.RequestOption ) (res * BrowserGetResponse , err error ) {
4950 opts = append (r .Options [:], opts ... )
5051 if id == "" {
@@ -56,15 +57,15 @@ func (r *BrowserService) Get(ctx context.Context, id string, opts ...option.Requ
5657 return
5758}
5859
59- // List active browser sessions for the authenticated user
60+ // List active browser sessions
6061func (r * BrowserService ) List (ctx context.Context , opts ... option.RequestOption ) (res * []BrowserListResponse , err error ) {
6162 opts = append (r .Options [:], opts ... )
6263 path := "browsers"
6364 err = requestconfig .ExecuteNewRequest (ctx , http .MethodGet , path , nil , & res , opts ... )
6465 return
6566}
6667
67- // Delete a persistent browser session by persistent_id query parameter .
68+ // Delete a persistent browser session by its persistent_id .
6869func (r * BrowserService ) Delete (ctx context.Context , body BrowserDeleteParams , opts ... option.RequestOption ) (err error ) {
6970 opts = append (r .Options [:], opts ... )
7071 opts = append ([]option.RequestOption {option .WithHeader ("Accept" , "" )}, opts ... )
@@ -73,7 +74,7 @@ func (r *BrowserService) Delete(ctx context.Context, body BrowserDeleteParams, o
7374 return
7475}
7576
76- // Delete Browser Session by ID
77+ // Delete a browser session by ID
7778func (r * BrowserService ) DeleteByID (ctx context.Context , id string , opts ... option.RequestOption ) (err error ) {
7879 opts = append (r .Options [:], opts ... )
7980 opts = append ([]option.RequestOption {option .WithHeader ("Accept" , "" )}, opts ... )
@@ -110,7 +111,7 @@ func (r *BrowserPersistence) UnmarshalJSON(data []byte) error {
110111// be used at the last possible moment before sending a request. Test for this with
111112// BrowserPersistenceParam.Overrides()
112113func (r BrowserPersistence ) ToParam () BrowserPersistenceParam {
113- return param.Override [BrowserPersistenceParam ](r .RawJSON ())
114+ return param.Override [BrowserPersistenceParam ](json . RawMessage ( r .RawJSON () ))
114115}
115116
116117// Optional persistence configuration for the browser session.
@@ -211,6 +212,9 @@ func (r *BrowserListResponse) UnmarshalJSON(data []byte) error {
211212type BrowserNewParams struct {
212213 // action invocation ID
213214 InvocationID string `json:"invocation_id,required"`
215+ // If true, launches the browser in stealth mode to reduce detection by anti-bot
216+ // mechanisms.
217+ Stealth param.Opt [bool ] `json:"stealth,omitzero"`
214218 // Optional persistence configuration for the browser session.
215219 Persistence BrowserPersistenceParam `json:"persistence,omitzero"`
216220 paramObj
0 commit comments