client

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: May 3, 2026 License: MIT Imports: 7 Imported by: 2

Documentation

Index

Constants

View Source
const (
	OpSearch             = "google_search"
	OpSearchNews         = "google_search_news"
	OpSearchImages       = "google_search_images"
	OpSearchVideos       = "google_search_videos"
	OpSearchPlaces       = "google_search_places"
	OpSearchMaps         = "google_search_maps"
	OpSearchReviews      = "google_search_reviews"
	OpSearchShopping     = "google_search_shopping"
	OpSearchScholar      = "google_search_scholar"
	OpSearchLens         = "google_search_lens"
	OpSearchAutocomplete = "google_search_autocomplete"
	OpScrapeWebpage      = "webpage_scrape"
)

Operation names that map to Engine interface methods

Variables

View Source
var ErrOperationNotSupported = errors.New("operation not supported by current engine")

ErrOperationNotSupported is returned when an operation is not supported by the current engine

Functions

This section is empty.

Types

type Client

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

Client is a unified SDK that fronts multiple search engine backends

func New

func New() (*Client, error)

New creates a new client with all available engines auto-registered It automatically selects an engine based on the SEARCH_ENGINE environment variable

func NewWithEngine

func NewWithEngine(engineName string) (*Client, error)

NewWithEngine creates a new client with a specific engine name selected

func NewWithOptions

func NewWithOptions(opts *Options) (*Client, error)

NewWithOptions creates a new client with custom options

func NewWithRegistry

func NewWithRegistry(registry *omniserp.Registry, engineName string) (*Client, error)

NewWithRegistry creates a new client with a pre-configured registry and engine name

func (*Client) GetCurrentEngine

func (c *Client) GetCurrentEngine() omniserp.Engine

GetCurrentEngine returns the currently selected engine

func (*Client) GetEngine

func (c *Client) GetEngine(name string) (omniserp.Engine, error)

GetEngine retrieves a specific engine by name

func (*Client) GetName

func (c *Client) GetName() string

GetName returns the name of the current search engine

func (*Client) GetRegistry

func (c *Client) GetRegistry() *omniserp.Registry

GetRegistry returns the underlying engine registry

func (*Client) GetSupportedTools

func (c *Client) GetSupportedTools() []string

GetSupportedTools returns a list of tool names supported by the current engine

func (*Client) GetVersion

func (c *Client) GetVersion() string

GetVersion returns the version of the current engine implementation

func (*Client) ListEngines

func (c *Client) ListEngines() []string

ListEngines returns all registered engine names

func (*Client) ScrapeWebpage

func (c *Client) ScrapeWebpage(ctx context.Context, params omniserp.ScrapeParams) (*omniserp.SearchResult, error)

ScrapeWebpage scrapes content from a webpage

func (*Client) Search

Search performs a general web search

func (*Client) SearchAutocomplete

func (c *Client) SearchAutocomplete(ctx context.Context, params omniserp.SearchParams) (*omniserp.SearchResult, error)

SearchAutocomplete gets search suggestions

func (*Client) SearchImages

func (c *Client) SearchImages(ctx context.Context, params omniserp.SearchParams) (*omniserp.SearchResult, error)

SearchImages performs an image search

func (*Client) SearchImagesNormalized

func (c *Client) SearchImagesNormalized(ctx context.Context, params omniserp.SearchParams) (*omniserp.NormalizedSearchResult, error)

SearchImagesNormalized performs an image search and returns a normalized response

func (*Client) SearchLens

func (c *Client) SearchLens(ctx context.Context, params omniserp.SearchParams) (*omniserp.SearchResult, error)

SearchLens performs a visual search (if supported)

func (*Client) SearchMaps

func (c *Client) SearchMaps(ctx context.Context, params omniserp.SearchParams) (*omniserp.SearchResult, error)

SearchMaps performs a maps search

func (*Client) SearchNews

func (c *Client) SearchNews(ctx context.Context, params omniserp.SearchParams) (*omniserp.SearchResult, error)

SearchNews performs a news search

func (*Client) SearchNewsNormalized

func (c *Client) SearchNewsNormalized(ctx context.Context, params omniserp.SearchParams) (*omniserp.NormalizedSearchResult, error)

SearchNewsNormalized performs a news search and returns a normalized response

func (*Client) SearchNormalized

func (c *Client) SearchNormalized(ctx context.Context, params omniserp.SearchParams) (*omniserp.NormalizedSearchResult, error)

SearchNormalized performs a web search and returns a normalized response

func (*Client) SearchPlaces

func (c *Client) SearchPlaces(ctx context.Context, params omniserp.SearchParams) (*omniserp.SearchResult, error)

SearchPlaces performs a places search

func (*Client) SearchReviews

func (c *Client) SearchReviews(ctx context.Context, params omniserp.SearchParams) (*omniserp.SearchResult, error)

SearchReviews performs a reviews search

func (*Client) SearchScholar

func (c *Client) SearchScholar(ctx context.Context, params omniserp.SearchParams) (*omniserp.SearchResult, error)

SearchScholar performs a scholar search

func (*Client) SearchShopping

func (c *Client) SearchShopping(ctx context.Context, params omniserp.SearchParams) (*omniserp.SearchResult, error)

SearchShopping performs a shopping search

func (*Client) SearchVideos

func (c *Client) SearchVideos(ctx context.Context, params omniserp.SearchParams) (*omniserp.SearchResult, error)

SearchVideos performs a video search

func (*Client) SetEngine

func (c *Client) SetEngine(name string) error

SetEngine sets the active engine by name

func (*Client) SupportsOperation

func (c *Client) SupportsOperation(operation string) bool

SupportsOperation checks if the current engine supports a specific operation

type Options

type Options struct {
	// EngineName specifies which engine to use (e.g., "serper", "serpapi")
	// If empty, uses SEARCH_ENGINE env var or defaults to "serper"
	EngineName string

	// Silent suppresses initialization logs
	Silent bool
}

Options configures the client behavior

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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