browserbase

package
v0.0.147 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 27, 2025 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetFlagOrEnvironmentVariable

func GetFlagOrEnvironmentVariable(cmd *cobra.Command, flagName string, environmentVariableName string) (string, error)

GetFlagOrEnvironmentVariable retrieves a value from either a command flag or an environment variable. It first checks the environment variable, then falls back to the command flag. Returns an error if neither source has a value.

Types

type BrowserSettings

type BrowserSettings struct {
	BlockAds      bool `json:"blockAds,omitempty"`
	SolveCaptchas bool `json:"solveCaptchas,omitempty"`
	RecordSession bool `json:"recordSession,omitempty"`
	LogSession    bool `json:"logSession,omitempty"`
}

type Client

type Client struct {
	APIKey        string
	URL           string
	ConnectionURL string
	ProjectID     string
	Sessions      []*Session
	Options       *common.BrowserbaseRequestConfig
}

func NewBrowserbaseClient

func NewBrowserbaseClient(browserbaseConfig *common.BrowserbaseRequestConfig, browserbaseSecrets *common.BrowserbaseRequestSecrets) *Client

func (*Client) CloseAllSessions

func (b *Client) CloseAllSessions(ctx context.Context) error

func (*Client) CloseSession

func (b *Client) CloseSession(ctx context.Context, sessionID string) error

func (*Client) ConnectionString

func (b *Client) ConnectionString(session Session) string

func (*Client) CreateSession

func (b *Client) CreateSession(ctx context.Context) (*Session, error)

type CloseSessionRequest

type CloseSessionRequest struct {
	ProjectID string `json:"projectId,omitempty"`
	Status    string `json:"status,omitempty"`
}

type CreateSessionRequest

type CreateSessionRequest struct {
	ProjectID       string          `json:"projectId,omitempty"`
	BrowserSettings BrowserSettings `json:"browserSettings,omitempty"`
	Proxies         []Proxy         `json:"proxies,omitempty"`
}

type Geolocation

type Geolocation struct {
	City    string `json:"city,omitempty"`
	State   string `json:"state,omitempty"`
	Country string `json:"country,omitempty"`
}

type Option

type Option interface {
	// contains filtered or unexported methods
}

func WithProxyCountries

func WithProxyCountries(countries []string) Option

type Options

type Options struct {
	Proxy     bool
	Countries []string
}

func NewBrowserbaseOptions

func NewBrowserbaseOptions(ctx context.Context, proxy bool, countries []string) *Options

type Proxy

type Proxy struct {
	Type        string       `json:"type"`
	Geolocation *Geolocation `json:"geolocation,omitempty"`
}

type ProxyCountryOption

type ProxyCountryOption struct {
	Countries []string
}

type Requester

type Requester struct {
	Client    Client
	Requester *headless.Requester
}

Requester is a struct that contains a Client and a Requester

func NewBrowserbaseRequester

func NewBrowserbaseRequester(
	ctx context.Context,
	browserbaseClient Client,
	timeout int,
	minDOMStabalizeTime int,
) *Requester

NewBrowserbaseRequester creates a new BrowserbaseRequester

func (*Requester) Close

func (b *Requester) Close(ctx context.Context) error

func (*Requester) SendRequest

type Session

type Session struct {
	ID        string `json:"id,omitempty"`
	Status    string `json:"status,omitempty"`
	ContextID string `json:"contextId,omitempty"`
}

type WebSocket

type WebSocket struct {
	// contains filtered or unexported fields
}

func NewWebSocket

func NewWebSocket(ctx context.Context, url string) *WebSocket

func (*WebSocket) Read

func (w *WebSocket) Read() ([]byte, error)

func (*WebSocket) Send

func (w *WebSocket) Send(b []byte) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL