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 (*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 remains host-owned. Requests and redirects are restricted to
// BaseURL's origin, including when the host redirect policy changes a request.
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.
Click to show internal directories.
Click to hide internal directories.