Documentation
¶
Index ¶
- func Bool(b bool) param.Opt[bool]
- func BoolPtr(v bool) *bool
- func DefaultClientOptions() []option.RequestOption
- func File(rdr io.Reader, filename string, contentType string) file
- func Float(f float64) param.Opt[float64]
- func FloatPtr(v float64) *float64
- func Int(i int64) param.Opt[int64]
- func IntPtr(v int64) *int64
- func Opt[T comparable](v T) param.Opt[T]
- func Ptr[T any](v T) *T
- func String(s string) param.Opt[string]
- func StringPtr(v string) *string
- func Time(t time.Time) param.Opt[time.Time]
- func TimePtr(v time.Time) *time.Time
- type Client
- func (r *Client) Delete(ctx context.Context, path string, params any, res any, ...) error
- func (r *Client) Execute(ctx context.Context, method string, path string, params any, res any, ...) error
- func (r *Client) Get(ctx context.Context, path string, params any, res any, ...) error
- func (r *Client) Patch(ctx context.Context, path string, params any, res any, ...) error
- func (r *Client) Post(ctx context.Context, path string, params any, res any, ...) error
- func (r *Client) Put(ctx context.Context, path string, params any, res any, ...) error
- type ContextGetResponse
- type ContextNewParams
- type ContextService
- func (r *ContextService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *ContextGetResponse, err error)
- func (r *ContextService) New(ctx context.Context, body ContextNewParams, opts ...option.RequestOption) (res *CreateContextResponse, err error)
- func (r *ContextService) Update(ctx context.Context, id string, opts ...option.RequestOption) (res *CreateContextResponse, err error)
- type CreateContextResponse
- type Error
- type Extension
- type ExtensionNewParams
- type ExtensionService
- func (r *ExtensionService) Delete(ctx context.Context, id string, opts ...option.RequestOption) (err error)
- func (r *ExtensionService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *Extension, err error)
- func (r *ExtensionService) New(ctx context.Context, body ExtensionNewParams, opts ...option.RequestOption) (res *Extension, err error)
- type Project
- type ProjectService
- func (r *ProjectService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *Project, err error)
- func (r *ProjectService) List(ctx context.Context, opts ...option.RequestOption) (res *[]Project, err error)
- func (r *ProjectService) Usage(ctx context.Context, id string, opts ...option.RequestOption) (res *ProjectUsageResponse, err error)
- type ProjectUsageResponse
- type Region
- type Session
- type SessionDebugResponse
- type SessionDebugResponsePage
- type SessionListParams
- type SessionLogsResponse
- type SessionLogsResponseRequest
- type SessionLogsResponseResponse
- type SessionNewParams
- type SessionNewParamsBrowserSettings
- type SessionNewParamsBrowserSettingsContext
- type SessionNewParamsBrowserSettingsFingerprint
- type SessionNewParamsBrowserSettingsFingerprintScreen
- type SessionNewParamsBrowserSettingsViewport
- type SessionNewResponse
- type SessionNewUploadsParams
- type SessionNewUploadsResponse
- type SessionRecordingResponse
- type SessionService
- func (r *SessionService) Debug(ctx context.Context, id string, opts ...option.RequestOption) (res *SessionDebugResponse, err error)
- func (r *SessionService) Downloads(ctx context.Context, id string, opts ...option.RequestOption) (res *http.Response, err error)
- func (r *SessionService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *Session, err error)
- func (r *SessionService) List(ctx context.Context, query SessionListParams, opts ...option.RequestOption) (res *[]Session, err error)
- func (r *SessionService) Logs(ctx context.Context, id string, opts ...option.RequestOption) (res *[]SessionLogsResponse, err error)
- func (r *SessionService) New(ctx context.Context, body SessionNewParams, opts ...option.RequestOption) (res *SessionNewResponse, err error)
- func (r *SessionService) NewUploads(ctx context.Context, id string, body SessionNewUploadsParams, ...) (res *SessionNewUploadsResponse, err error)
- func (r *SessionService) Recording(ctx context.Context, id string, opts ...option.RequestOption) (res *[]SessionRecordingResponse, err error)
- func (r *SessionService) Update(ctx context.Context, id string, body SessionUpdateParams, ...) (res *Session, err error)
- type SessionStatus
- type SessionUpdateParams
- type SessionUpdateParamsStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultClientOptions ¶
func DefaultClientOptions() []option.RequestOption
DefaultClientOptions read from the environment (BROWSERBASE_UNOFFICIAL_API_KEY, BROWSERBASE_UNOFFICIAL_BASE_URL). This should be used to initialize new clients.
func Opt ¶
func Opt[T comparable](v T) param.Opt[T]
Types ¶
type Client ¶
type Client struct {
Options []option.RequestOption
Contexts ContextService
Extensions ExtensionService
Projects ProjectService
Sessions SessionService
}
Client creates a struct with services and top level methods that help with interacting with the browserbase-unofficial API. You should not instantiate this client directly, and instead use the NewClient method instead.
func NewClient ¶
func NewClient(opts ...option.RequestOption) (r Client)
NewClient generates a new client with the default option read from the environment (BROWSERBASE_UNOFFICIAL_API_KEY, BROWSERBASE_UNOFFICIAL_BASE_URL). The option passed in as arguments are applied after these default arguments, and all option will be passed down to the services and requests that this client makes.
func (*Client) Delete ¶
func (r *Client) Delete(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error
Delete makes a DELETE request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.
func (*Client) Execute ¶
func (r *Client) Execute(ctx context.Context, method string, path string, params any, res any, opts ...option.RequestOption) error
Execute makes a request with the given context, method, URL, request params, response, and request options. This is useful for hitting undocumented endpoints while retaining the base URL, auth, retries, and other options from the client.
If a byte slice or an io.Reader is supplied to params, it will be used as-is for the request body.
The params is by default serialized into the body using encoding/json. If your type implements a MarshalJSON function, it will be used instead to serialize the request. If a URLQuery method is implemented, the returned url.Values will be used as query strings to the url.
If your params struct uses param.Field, you must provide either [MarshalJSON], [URLQuery], and/or [MarshalForm] functions. It is undefined behavior to use a struct uses param.Field without specifying how it is serialized.
Any "…Params" object defined in this library can be used as the request argument. Note that 'path' arguments will not be forwarded into the url.
The response body will be deserialized into the res variable, depending on its type:
- A pointer to a *http.Response is populated by the raw response.
- A pointer to a byte array will be populated with the contents of the request body.
- A pointer to any other type uses this library's default JSON decoding, which respects UnmarshalJSON if it is defined on the type.
- A nil value will not read the response body.
For even greater flexibility, see option.WithResponseInto and option.WithResponseBodyInto.
func (*Client) Get ¶
func (r *Client) Get(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error
Get makes a GET request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.
func (*Client) Patch ¶
func (r *Client) Patch(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error
Patch makes a PATCH request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.
type ContextGetResponse ¶
type ContextGetResponse struct {
ID string `json:"id,required"`
CreatedAt time.Time `json:"createdAt,required" format:"date-time"`
// The Project ID linked to the uploaded Context.
ProjectID string `json:"projectId,required"`
UpdatedAt time.Time `json:"updatedAt,required" format:"date-time"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
CreatedAt respjson.Field
ProjectID respjson.Field
UpdatedAt respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (ContextGetResponse) RawJSON ¶
func (r ContextGetResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*ContextGetResponse) UnmarshalJSON ¶
func (r *ContextGetResponse) UnmarshalJSON(data []byte) error
type ContextNewParams ¶
type ContextNewParams struct {
// The Project ID. Can be found in
// [Settings](https://www.browserbase.com/settings).
ProjectID string `json:"projectId,required"`
// contains filtered or unexported fields
}
func (ContextNewParams) MarshalJSON ¶
func (r ContextNewParams) MarshalJSON() (data []byte, err error)
func (*ContextNewParams) UnmarshalJSON ¶
func (r *ContextNewParams) UnmarshalJSON(data []byte) error
type ContextService ¶
type ContextService struct {
Options []option.RequestOption
}
ContextService contains methods and other services that help with interacting with the browserbase-unofficial API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewContextService method instead.
func NewContextService ¶
func NewContextService(opts ...option.RequestOption) (r ContextService)
NewContextService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*ContextService) Get ¶
func (r *ContextService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *ContextGetResponse, err error)
Context
func (*ContextService) New ¶
func (r *ContextService) New(ctx context.Context, body ContextNewParams, opts ...option.RequestOption) (res *CreateContextResponse, err error)
Create a Context
func (*ContextService) Update ¶
func (r *ContextService) Update(ctx context.Context, id string, opts ...option.RequestOption) (res *CreateContextResponse, err error)
Update Context
type CreateContextResponse ¶
type CreateContextResponse struct {
ID string `json:"id,required"`
// The cipher algorithm used to encrypt the user-data-directory. AES-256-CBC is
// currently the only supported algorithm.
CipherAlgorithm string `json:"cipherAlgorithm,required"`
// The initialization vector size used to encrypt the user-data-directory.
// [Read more about how to use it](/features/contexts).
InitializationVectorSize int64 `json:"initializationVectorSize,required"`
// The public key to encrypt the user-data-directory.
PublicKey string `json:"publicKey,required"`
// An upload URL to upload a custom user-data-directory.
UploadURL string `json:"uploadUrl,required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
CipherAlgorithm respjson.Field
InitializationVectorSize respjson.Field
PublicKey respjson.Field
UploadURL respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (CreateContextResponse) RawJSON ¶
func (r CreateContextResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*CreateContextResponse) UnmarshalJSON ¶
func (r *CreateContextResponse) UnmarshalJSON(data []byte) error
type Extension ¶
type Extension struct {
ID string `json:"id,required"`
CreatedAt time.Time `json:"createdAt,required" format:"date-time"`
FileName string `json:"fileName,required"`
// The Project ID linked to the uploaded Extension.
ProjectID string `json:"projectId,required"`
UpdatedAt time.Time `json:"updatedAt,required" format:"date-time"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
CreatedAt respjson.Field
FileName respjson.Field
ProjectID respjson.Field
UpdatedAt respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (*Extension) UnmarshalJSON ¶
type ExtensionNewParams ¶
type ExtensionNewParams struct {
File io.Reader `json:"file,omitzero,required" format:"binary"`
// contains filtered or unexported fields
}
func (ExtensionNewParams) MarshalMultipart ¶
func (r ExtensionNewParams) MarshalMultipart() (data []byte, contentType string, err error)
type ExtensionService ¶
type ExtensionService struct {
Options []option.RequestOption
}
ExtensionService contains methods and other services that help with interacting with the browserbase-unofficial API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewExtensionService method instead.
func NewExtensionService ¶
func NewExtensionService(opts ...option.RequestOption) (r ExtensionService)
NewExtensionService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*ExtensionService) Delete ¶
func (r *ExtensionService) Delete(ctx context.Context, id string, opts ...option.RequestOption) (err error)
Delete Extension
func (*ExtensionService) Get ¶
func (r *ExtensionService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *Extension, err error)
Extension
func (*ExtensionService) New ¶
func (r *ExtensionService) New(ctx context.Context, body ExtensionNewParams, opts ...option.RequestOption) (res *Extension, err error)
Upload an Extension
type Project ¶
type Project struct {
ID string `json:"id,required"`
CreatedAt time.Time `json:"createdAt,required" format:"date-time"`
DefaultTimeout int64 `json:"defaultTimeout,required"`
Name string `json:"name,required"`
OwnerID string `json:"ownerId,required"`
UpdatedAt time.Time `json:"updatedAt,required" format:"date-time"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
CreatedAt respjson.Field
DefaultTimeout respjson.Field
Name respjson.Field
OwnerID respjson.Field
UpdatedAt respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (*Project) UnmarshalJSON ¶
type ProjectService ¶
type ProjectService struct {
Options []option.RequestOption
}
ProjectService contains methods and other services that help with interacting with the browserbase-unofficial API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewProjectService method instead.
func NewProjectService ¶
func NewProjectService(opts ...option.RequestOption) (r ProjectService)
NewProjectService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*ProjectService) Get ¶
func (r *ProjectService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *Project, err error)
Project
func (*ProjectService) List ¶
func (r *ProjectService) List(ctx context.Context, opts ...option.RequestOption) (res *[]Project, err error)
List all projects
func (*ProjectService) Usage ¶
func (r *ProjectService) Usage(ctx context.Context, id string, opts ...option.RequestOption) (res *ProjectUsageResponse, err error)
Project Usage
type ProjectUsageResponse ¶
type ProjectUsageResponse struct {
BrowserMinutes int64 `json:"browserMinutes,required"`
ProxyBytes int64 `json:"proxyBytes,required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
BrowserMinutes respjson.Field
ProxyBytes respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (ProjectUsageResponse) RawJSON ¶
func (r ProjectUsageResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*ProjectUsageResponse) UnmarshalJSON ¶
func (r *ProjectUsageResponse) UnmarshalJSON(data []byte) error
type Session ¶
type Session struct {
ID string `json:"id,required"`
CreatedAt time.Time `json:"createdAt,required" format:"date-time"`
ExpiresAt time.Time `json:"expiresAt,required" format:"date-time"`
// Indicates if the Session was created to be kept alive upon disconnections
KeepAlive bool `json:"keepAlive,required"`
// The Project ID linked to the Session.
ProjectID string `json:"projectId,required"`
// Bytes used via the [Proxy](/features/stealth-mode#proxies-and-residential-ips)
ProxyBytes int64 `json:"proxyBytes,required"`
// The region where the Session is running.
//
// Any of "us-west-2", "us-east-1", "eu-central-1", "ap-southeast-1".
Region Region `json:"region,required"`
StartedAt time.Time `json:"startedAt,required" format:"date-time"`
// Any of "RUNNING", "ERROR", "TIMED_OUT", "COMPLETED".
Status SessionStatus `json:"status,required"`
UpdatedAt time.Time `json:"updatedAt,required" format:"date-time"`
// CPU used by the Session
AvgCPUUsage int64 `json:"avgCpuUsage"`
// Optional. The Context linked to the Session.
ContextID string `json:"contextId"`
EndedAt time.Time `json:"endedAt" format:"date-time"`
// Memory used by the Session
MemoryUsage int64 `json:"memoryUsage"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
CreatedAt respjson.Field
ExpiresAt respjson.Field
KeepAlive respjson.Field
ProjectID respjson.Field
ProxyBytes respjson.Field
Region respjson.Field
StartedAt respjson.Field
Status respjson.Field
UpdatedAt respjson.Field
AvgCPUUsage respjson.Field
ContextID respjson.Field
EndedAt respjson.Field
MemoryUsage respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (*Session) UnmarshalJSON ¶
type SessionDebugResponse ¶
type SessionDebugResponse struct {
DebuggerFullscreenURL string `json:"debuggerFullscreenUrl,required" format:"uri"`
DebuggerURL string `json:"debuggerUrl,required" format:"uri"`
Pages []SessionDebugResponsePage `json:"pages,required"`
WsURL string `json:"wsUrl,required" format:"uri"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
DebuggerFullscreenURL respjson.Field
DebuggerURL respjson.Field
Pages respjson.Field
WsURL respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (SessionDebugResponse) RawJSON ¶
func (r SessionDebugResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*SessionDebugResponse) UnmarshalJSON ¶
func (r *SessionDebugResponse) UnmarshalJSON(data []byte) error
type SessionDebugResponsePage ¶
type SessionDebugResponsePage struct {
ID string `json:"id,required"`
DebuggerFullscreenURL string `json:"debuggerFullscreenUrl,required" format:"uri"`
DebuggerURL string `json:"debuggerUrl,required" format:"uri"`
FaviconURL string `json:"faviconUrl,required" format:"uri"`
Title string `json:"title,required"`
URL string `json:"url,required" format:"uri"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
DebuggerFullscreenURL respjson.Field
DebuggerURL respjson.Field
FaviconURL respjson.Field
Title respjson.Field
URL respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (SessionDebugResponsePage) RawJSON ¶
func (r SessionDebugResponsePage) RawJSON() string
Returns the unmodified JSON received from the API
func (*SessionDebugResponsePage) UnmarshalJSON ¶
func (r *SessionDebugResponsePage) UnmarshalJSON(data []byte) error
type SessionListParams ¶
type SessionListParams struct {
// Any of "RUNNING", "ERROR", "TIMED_OUT", "COMPLETED".
Status SessionStatus `query:"status,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (SessionListParams) URLQuery ¶
func (r SessionListParams) URLQuery() (v url.Values, err error)
URLQuery serializes SessionListParams's query parameters as `url.Values`.
type SessionLogsResponse ¶
type SessionLogsResponse struct {
EventID string `json:"eventId,required"`
Method string `json:"method,required"`
PageID int64 `json:"pageId,required"`
SessionID string `json:"sessionId,required"`
// milliseconds that have elapsed since the UNIX epoch
Timestamp int64 `json:"timestamp,required"`
FrameID string `json:"frameId"`
LoaderID string `json:"loaderId"`
Request SessionLogsResponseRequest `json:"request"`
Response SessionLogsResponseResponse `json:"response"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
EventID respjson.Field
Method respjson.Field
PageID respjson.Field
SessionID respjson.Field
Timestamp respjson.Field
FrameID respjson.Field
LoaderID respjson.Field
Request respjson.Field
Response respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (SessionLogsResponse) RawJSON ¶
func (r SessionLogsResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*SessionLogsResponse) UnmarshalJSON ¶
func (r *SessionLogsResponse) UnmarshalJSON(data []byte) error
type SessionLogsResponseRequest ¶
type SessionLogsResponseRequest struct {
Params map[string]any `json:"params,required"`
RawBody string `json:"rawBody,required"`
// milliseconds that have elapsed since the UNIX epoch
Timestamp int64 `json:"timestamp,required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Params respjson.Field
RawBody respjson.Field
Timestamp respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (SessionLogsResponseRequest) RawJSON ¶
func (r SessionLogsResponseRequest) RawJSON() string
Returns the unmodified JSON received from the API
func (*SessionLogsResponseRequest) UnmarshalJSON ¶
func (r *SessionLogsResponseRequest) UnmarshalJSON(data []byte) error
type SessionLogsResponseResponse ¶
type SessionLogsResponseResponse struct {
RawBody string `json:"rawBody,required"`
Result map[string]any `json:"result,required"`
// milliseconds that have elapsed since the UNIX epoch
Timestamp int64 `json:"timestamp,required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
RawBody respjson.Field
Result respjson.Field
Timestamp respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (SessionLogsResponseResponse) RawJSON ¶
func (r SessionLogsResponseResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*SessionLogsResponseResponse) UnmarshalJSON ¶
func (r *SessionLogsResponseResponse) UnmarshalJSON(data []byte) error
type SessionNewParams ¶
type SessionNewParams struct {
// The Project ID. Can be found in
// [Settings](https://www.browserbase.com/settings).
ProjectID string `json:"projectId,required"`
// The uploaded Extension ID. See
// [Upload Extension](/reference/api/upload-an-extension).
ExtensionID param.Opt[string] `json:"extensionId,omitzero"`
// Set to true to keep the session alive even after disconnections. This is
// available on the Startup plan only.
KeepAlive param.Opt[bool] `json:"keepAlive,omitzero"`
// Duration in seconds after which the session will automatically end. Defaults to
// the Project's `defaultTimeout`.
Timeout param.Opt[int64] `json:"timeout,omitzero"`
BrowserSettings SessionNewParamsBrowserSettings `json:"browserSettings,omitzero"`
// Proxy configuration. Can be true for default proxy, or an array of proxy
// configurations.
Proxies any `json:"proxies,omitzero"`
// The region where the Session should run.
//
// Any of "us-west-2", "us-east-1", "eu-central-1", "ap-southeast-1".
Region Region `json:"region,omitzero"`
// contains filtered or unexported fields
}
func (SessionNewParams) MarshalJSON ¶
func (r SessionNewParams) MarshalJSON() (data []byte, err error)
func (*SessionNewParams) UnmarshalJSON ¶
func (r *SessionNewParams) UnmarshalJSON(data []byte) error
type SessionNewParamsBrowserSettings ¶
type SessionNewParamsBrowserSettings struct {
// Enable or disable ad blocking in the browser. Defaults to `false`.
BlockAds param.Opt[bool] `json:"blockAds,omitzero"`
// The uploaded Extension ID. See
// [Upload Extension](/reference/api/upload-an-extension).
ExtensionID param.Opt[string] `json:"extensionId,omitzero"`
// Enable or disable session logging. Defaults to `true`.
LogSession param.Opt[bool] `json:"logSession,omitzero"`
// Enable or disable session recording. Defaults to `true`.
RecordSession param.Opt[bool] `json:"recordSession,omitzero"`
// Enable or disable captcha solving in the browser. Defaults to `true`.
SolveCaptchas param.Opt[bool] `json:"solveCaptchas,omitzero"`
Context SessionNewParamsBrowserSettingsContext `json:"context,omitzero"`
// See usage examples
// [in the Stealth Mode page](/features/stealth-mode#fingerprinting).
Fingerprint SessionNewParamsBrowserSettingsFingerprint `json:"fingerprint,omitzero"`
Viewport SessionNewParamsBrowserSettingsViewport `json:"viewport,omitzero"`
// contains filtered or unexported fields
}
func (SessionNewParamsBrowserSettings) MarshalJSON ¶
func (r SessionNewParamsBrowserSettings) MarshalJSON() (data []byte, err error)
func (*SessionNewParamsBrowserSettings) UnmarshalJSON ¶
func (r *SessionNewParamsBrowserSettings) UnmarshalJSON(data []byte) error
type SessionNewParamsBrowserSettingsContext ¶
type SessionNewParamsBrowserSettingsContext struct {
// The Context ID.
ID string `json:"id,required"`
// Whether or not to persist the context after browsing. Defaults to `false`.
Persist param.Opt[bool] `json:"persist,omitzero"`
// contains filtered or unexported fields
}
The property ID is required.
func (SessionNewParamsBrowserSettingsContext) MarshalJSON ¶
func (r SessionNewParamsBrowserSettingsContext) MarshalJSON() (data []byte, err error)
func (*SessionNewParamsBrowserSettingsContext) UnmarshalJSON ¶
func (r *SessionNewParamsBrowserSettingsContext) UnmarshalJSON(data []byte) error
type SessionNewParamsBrowserSettingsFingerprint ¶
type SessionNewParamsBrowserSettingsFingerprint struct {
// Any of "chrome", "edge", "firefox", "safari".
Browsers []string `json:"browsers,omitzero"`
// Any of "desktop", "mobile".
Devices []string `json:"devices,omitzero"`
// Any of 1, 2.
HTTPVersion float64 `json:"httpVersion,omitzero"`
// Full list of locales is available
// [here](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language).
Locales []string `json:"locales,omitzero"`
// Note: `operatingSystems` set to `ios` or `android` requires `devices` to include
// `"mobile"`.
//
// Any of "android", "ios", "linux", "macos", "windows".
OperatingSystems []string `json:"operatingSystems,omitzero"`
Screen SessionNewParamsBrowserSettingsFingerprintScreen `json:"screen,omitzero"`
// contains filtered or unexported fields
}
See usage examples [in the Stealth Mode page](/features/stealth-mode#fingerprinting).
func (SessionNewParamsBrowserSettingsFingerprint) MarshalJSON ¶
func (r SessionNewParamsBrowserSettingsFingerprint) MarshalJSON() (data []byte, err error)
func (*SessionNewParamsBrowserSettingsFingerprint) UnmarshalJSON ¶
func (r *SessionNewParamsBrowserSettingsFingerprint) UnmarshalJSON(data []byte) error
type SessionNewParamsBrowserSettingsFingerprintScreen ¶
type SessionNewParamsBrowserSettingsFingerprintScreen struct {
MaxHeight param.Opt[int64] `json:"maxHeight,omitzero"`
MaxWidth param.Opt[int64] `json:"maxWidth,omitzero"`
MinHeight param.Opt[int64] `json:"minHeight,omitzero"`
MinWidth param.Opt[int64] `json:"minWidth,omitzero"`
// contains filtered or unexported fields
}
func (SessionNewParamsBrowserSettingsFingerprintScreen) MarshalJSON ¶
func (r SessionNewParamsBrowserSettingsFingerprintScreen) MarshalJSON() (data []byte, err error)
func (*SessionNewParamsBrowserSettingsFingerprintScreen) UnmarshalJSON ¶
func (r *SessionNewParamsBrowserSettingsFingerprintScreen) UnmarshalJSON(data []byte) error
type SessionNewParamsBrowserSettingsViewport ¶
type SessionNewParamsBrowserSettingsViewport struct {
Height param.Opt[int64] `json:"height,omitzero"`
Width param.Opt[int64] `json:"width,omitzero"`
// contains filtered or unexported fields
}
func (SessionNewParamsBrowserSettingsViewport) MarshalJSON ¶
func (r SessionNewParamsBrowserSettingsViewport) MarshalJSON() (data []byte, err error)
func (*SessionNewParamsBrowserSettingsViewport) UnmarshalJSON ¶
func (r *SessionNewParamsBrowserSettingsViewport) UnmarshalJSON(data []byte) error
type SessionNewResponse ¶
type SessionNewResponse struct {
ID string `json:"id,required"`
// WebSocket URL to connect to the Session.
ConnectURL string `json:"connectUrl,required" format:"uri"`
CreatedAt time.Time `json:"createdAt,required" format:"date-time"`
ExpiresAt time.Time `json:"expiresAt,required" format:"date-time"`
// Indicates if the Session was created to be kept alive upon disconnections
KeepAlive bool `json:"keepAlive,required"`
// The Project ID linked to the Session.
ProjectID string `json:"projectId,required"`
// Bytes used via the [Proxy](/features/stealth-mode#proxies-and-residential-ips)
ProxyBytes int64 `json:"proxyBytes,required"`
// The region where the Session is running.
//
// Any of "us-west-2", "us-east-1", "eu-central-1", "ap-southeast-1".
Region Region `json:"region,required"`
// HTTP URL to connect to the Session.
SeleniumRemoteURL string `json:"seleniumRemoteUrl,required" format:"uri"`
// Signing key to use when connecting to the Session via HTTP.
SigningKey string `json:"signingKey,required"`
StartedAt time.Time `json:"startedAt,required" format:"date-time"`
// Any of "RUNNING", "ERROR", "TIMED_OUT", "COMPLETED".
Status SessionStatus `json:"status,required"`
UpdatedAt time.Time `json:"updatedAt,required" format:"date-time"`
// CPU used by the Session
AvgCPUUsage int64 `json:"avgCpuUsage"`
// Optional. The Context linked to the Session.
ContextID string `json:"contextId"`
EndedAt time.Time `json:"endedAt" format:"date-time"`
// Memory used by the Session
MemoryUsage int64 `json:"memoryUsage"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
ConnectURL respjson.Field
CreatedAt respjson.Field
ExpiresAt respjson.Field
KeepAlive respjson.Field
ProjectID respjson.Field
ProxyBytes respjson.Field
Region respjson.Field
SeleniumRemoteURL respjson.Field
SigningKey respjson.Field
StartedAt respjson.Field
Status respjson.Field
UpdatedAt respjson.Field
AvgCPUUsage respjson.Field
ContextID respjson.Field
EndedAt respjson.Field
MemoryUsage respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (SessionNewResponse) RawJSON ¶
func (r SessionNewResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*SessionNewResponse) UnmarshalJSON ¶
func (r *SessionNewResponse) UnmarshalJSON(data []byte) error
type SessionNewUploadsParams ¶
type SessionNewUploadsParams struct {
File io.Reader `json:"file,omitzero,required" format:"binary"`
// contains filtered or unexported fields
}
func (SessionNewUploadsParams) MarshalMultipart ¶
func (r SessionNewUploadsParams) MarshalMultipart() (data []byte, contentType string, err error)
type SessionNewUploadsResponse ¶
type SessionNewUploadsResponse struct {
Message string `json:"message,required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Message respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (SessionNewUploadsResponse) RawJSON ¶
func (r SessionNewUploadsResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*SessionNewUploadsResponse) UnmarshalJSON ¶
func (r *SessionNewUploadsResponse) UnmarshalJSON(data []byte) error
type SessionRecordingResponse ¶
type SessionRecordingResponse struct {
ID string `json:"id,required"`
// See
// [rrweb documentation](https://github.com/rrweb-io/rrweb/blob/master/docs/recipes/dive-into-event.md).
Data map[string]any `json:"data,required"`
SessionID string `json:"sessionId,required"`
// milliseconds that have elapsed since the UNIX epoch
Timestamp int64 `json:"timestamp,required"`
Type int64 `json:"type,required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
Data respjson.Field
SessionID respjson.Field
Timestamp respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (SessionRecordingResponse) RawJSON ¶
func (r SessionRecordingResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*SessionRecordingResponse) UnmarshalJSON ¶
func (r *SessionRecordingResponse) UnmarshalJSON(data []byte) error
type SessionService ¶
type SessionService struct {
Options []option.RequestOption
}
SessionService contains methods and other services that help with interacting with the browserbase-unofficial API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewSessionService method instead.
func NewSessionService ¶
func NewSessionService(opts ...option.RequestOption) (r SessionService)
NewSessionService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*SessionService) Debug ¶
func (r *SessionService) Debug(ctx context.Context, id string, opts ...option.RequestOption) (res *SessionDebugResponse, err error)
Session Live URLs
func (*SessionService) Downloads ¶
func (r *SessionService) Downloads(ctx context.Context, id string, opts ...option.RequestOption) (res *http.Response, err error)
Session Downloads
func (*SessionService) Get ¶
func (r *SessionService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *Session, err error)
Session
func (*SessionService) List ¶
func (r *SessionService) List(ctx context.Context, query SessionListParams, opts ...option.RequestOption) (res *[]Session, err error)
List Sessions
func (*SessionService) Logs ¶
func (r *SessionService) Logs(ctx context.Context, id string, opts ...option.RequestOption) (res *[]SessionLogsResponse, err error)
Session Logs
func (*SessionService) New ¶
func (r *SessionService) New(ctx context.Context, body SessionNewParams, opts ...option.RequestOption) (res *SessionNewResponse, err error)
Create a Session
func (*SessionService) NewUploads ¶
func (r *SessionService) NewUploads(ctx context.Context, id string, body SessionNewUploadsParams, opts ...option.RequestOption) (res *SessionNewUploadsResponse, err error)
Create Session Uploads
func (*SessionService) Recording ¶
func (r *SessionService) Recording(ctx context.Context, id string, opts ...option.RequestOption) (res *[]SessionRecordingResponse, err error)
Session Recording
func (*SessionService) Update ¶
func (r *SessionService) Update(ctx context.Context, id string, body SessionUpdateParams, opts ...option.RequestOption) (res *Session, err error)
Update Session
type SessionStatus ¶
type SessionStatus string
const ( SessionStatusRunning SessionStatus = "RUNNING" SessionStatusError SessionStatus = "ERROR" SessionStatusTimedOut SessionStatus = "TIMED_OUT" SessionStatusCompleted SessionStatus = "COMPLETED" )
type SessionUpdateParams ¶
type SessionUpdateParams struct {
// The Project ID. Can be found in
// [Settings](https://www.browserbase.com/settings).
ProjectID string `json:"projectId,required"`
// Set to `REQUEST_RELEASE` to request that the session complete. Use before
// session's timeout to avoid additional charges.
//
// Any of "REQUEST_RELEASE".
Status SessionUpdateParamsStatus `json:"status,omitzero,required"`
// contains filtered or unexported fields
}
func (SessionUpdateParams) MarshalJSON ¶
func (r SessionUpdateParams) MarshalJSON() (data []byte, err error)
func (*SessionUpdateParams) UnmarshalJSON ¶
func (r *SessionUpdateParams) UnmarshalJSON(data []byte) error
type SessionUpdateParamsStatus ¶
type SessionUpdateParamsStatus string
Set to `REQUEST_RELEASE` to request that the session complete. Use before session's timeout to avoid additional charges.
const (
SessionUpdateParamsStatusRequestRelease SessionUpdateParamsStatus = "REQUEST_RELEASE"
)
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
encoding/json
Package json implements encoding and decoding of JSON as defined in RFC 7159.
|
Package json implements encoding and decoding of JSON as defined in RFC 7159. |
|
encoding/json/shims
This package provides shims over Go 1.2{2,3} APIs which are missing from Go 1.22, and used by the Go 1.24 encoding/json package.
|
This package provides shims over Go 1.2{2,3} APIs which are missing from Go 1.22, and used by the Go 1.24 encoding/json package. |
|
packages
|
|
|
shared
|
|