brave

package
v0.50.0 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package brave wires Brave's Web Search API into web.Searcher.

Requests use GET /web/search with the X-Subscription-Token header.

web.SearchRequest maps to Brave query parameters:

  • Query → q, with domain filters rewritten as site:/-site: operators
  • MaxResults → count (10 when omitted)
  • Recency → freshness=pd/pw/pm/py; hourly filtering is rejected

Brave web.results[] map to web.SearchResult: title → Title, url → URL, description → Snippet, and page_age → PublishedTime when it is RFC 3339. The relative "age" field is ignored.

Reference: https://api-dashboard.search.brave.com/app/documentation/web-search/get-started

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(config Config) (*Client, error)

func (*Client) Search

func (c *Client) Search(ctx context.Context, request *web.SearchRequest) (*web.SearchResponse, error)

type Config

type Config struct {
	APIKey     string
	BaseURL    string
	HTTPClient *http.Client
}

Config configures a Client. APIKey is required; an empty BaseURL selects Brave's public endpoint and a nil HTTPClient selects a default client.

Jump to

Keyboard shortcuts

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