autom

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2026 License: MIT Imports: 18 Imported by: 0

README

Autom Go SDK

The official Go SDK for the Autom SERP API.

Google, Bing and Brave search results as structured JSON — web, maps, news, shopping, images, jobs and AI Mode.

The SDK exposes 23 typed methods, one per documented endpoint, plus a generic Request(). It has no dependencies outside the standard library.

Requirements

  • Go 1.22 or newer

Installation

go get github.com/automdev/autom-go

Get your API key

Sign up for Autom or sign in, then copy your API key from the dashboard. NewClient("", nil) reads the AUTOM_API_KEY environment variable.

Quick start

package main

import (
	"context"
	"fmt"
	"log"

	"github.com/automdev/autom-go"
)

func main() {
	client, err := autom.NewClient("", nil) // reads AUTOM_API_KEY
	if err != nil {
		log.Fatal(err)
	}
	ctx := context.Background()
	response, err := client.GoogleSearch(ctx, &autom.GoogleSearchParams{Query: "web scraping api"})
	if err != nil {
		log.Fatal(err)
	}
	data, err := response.Map()
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(data)
}

Parameter structs mirror the API reference. Required fields are plain values; optional fields are pointers — use autom.String, autom.Float, autom.Int and autom.Bool.

Decode into your own types with response.Decode(&value).

Async jobs

Any call accepts is_async: true (useful past the 60-second server limit): the response is then a job_id. WaitForJob polls GET /v1/jobs/{id} until a terminal status (CompletedJob, Error, NotFound, BadRequest):

submitted, err := client.GoogleSearch(ctx, &autom.GoogleSearchParams{Query: "web scraping api", IsAsync: autom.Bool(true)})
if err != nil {
	log.Fatal(err)
}
var accepted struct{ JobID string `json:"job_id"` }
if err := submitted.Decode(&accepted); err != nil {
	log.Fatal(err)
}
job, err := client.WaitForJob(ctx, accepted.JobID, &autom.WaitForJobOptions{
	OnProgress: func(job map[string]any) { fmt.Println(job["status"], job["progress"]) },
})

GET or POST

Methods use GET when the endpoint supports it (parameters in the query string); WithMethod("POST") sends them as a JSON body.

response, err := client.BingSearch(ctx, &autom.BingSearchParams{Query: "test"}, autom.WithMethod("POST"))

Any endpoint

response, err := client.Request(ctx, "GET", "/v1/usage", nil)

Errors

response, err := client.GoogleSearch(ctx, &autom.GoogleSearchParams{Query: "web scraping api"})
if apiError, ok := autom.IsAPIError(err); ok {
	log.Printf("HTTP %d: %s", apiError.StatusCode, apiError.Message)
}
Error When
*ConfigurationError Missing API key, invalid options or unsupported method.
*SerializationError A required parameter is missing or a value can't be sent.
*TransportError Network failure, timeout or cancelled context (errors.Is(err, context.DeadlineExceeded)).
*APIError Non-2xx status (StatusCode, Message, Response).
*ResponseDecodingError A success response could not be decoded.

Retries

Requests are retried up to 3 times after a network error, a 408, 500, 502, 503 or 504, or a rate limit — which the API returns as 401 (or 429) with a Rate limit exceeded message. Per-key quota errors (…: quota daily) are not retried, nor are 400, 402, 404 or client-side timeouts. The delay starts at 1 second and grows 1.5× per retry (capped at 30 seconds); a Retry-After header wins.

client, err := autom.NewClient("", &autom.ClientOptions{
	MaxRetries: 5,                      // negative disables retries
	RetryDelay: 500 * time.Millisecond,
})

// or for one request
response, err := client.GoogleSearch(ctx, &autom.GoogleSearchParams{Query: "web scraping api"}, autom.WithMaxRetries(0))

Batch requests

autom.Batch runs a function per item with at most 10 calls in flight and returns one BatchResult per item, in input order. A failing item never stops the others.

inputs := []string{"web scraping api", "serp api", "rank tracker"}
results := autom.Batch(ctx, inputs, 5, func(ctx context.Context, value string) (*autom.Response, error) {
	return client.GoogleSearch(ctx, &autom.GoogleSearchParams{Query: value})
})
for _, result := range results {
	if result.Err != nil {
		log.Printf("%s: %v", inputs[result.Index], result.Err)
		continue
	}
	fmt.Println(string(result.Value.Body))
}
Constant Default Description
DefaultConcurrency 10 Tasks run at the same time by batch
DefaultTimeout 120 * time.Second Request timeout
MaxRetries 3 Retry attempts after a network error, a 408/5xx or a rate limit
RetryBackoffFactor 1.5 Exponential backoff multiplier
DefaultRetryDelay time.Second Delay before the first retry

Timeouts and custom HTTP clients

client, err := autom.NewClient("", &autom.ClientOptions{
	Timeout:    60 * time.Second, // default 120 s; negative disables
	HTTPClient: &http.Client{Transport: myTransport},
})

Every method also honours the deadline and cancellation of the context.Context you pass.

Endpoints

23 methods, generated from the OpenAPI document.

Method HTTP Description
BingSearch GET / POST /v1/bing/search Query Bing Search via API and retrieve structured organic results (title, link, snippet, position).
BraveImages GET / POST /v1/brave/images Search Brave Images via API and retrieve structured image results with pagination and SafeSearch.
BraveSearch GET / POST /v1/brave/search Search Brave Search via API and retrieve structured organic results with pagination.
BraveVideos GET / POST /v1/brave/videos Search Brave Videos via API and retrieve structured video results with pagination and SafeSearch.
DuckduckgoSearch GET / POST /v1/duckduckgo/search Query DuckDuckGo via API and retrieve structured organic results with region and language.
FinderGoogleCountries GET /v1/finder/google-countries Search Google countries and retrieve country codes (free Finder endpoint).
FinderGoogleLanguages GET /v1/finder/google-languages Search Google languages and retrieve language codes (free Finder endpoint).
FinderGoogleLocations GET /v1/finder/google-locations Find supported Google locations and retrieve location IDs and country codes (free endpoint).
GoogleImages GET / POST /v1/google/images Search Google Images via API and retrieve image results (URLs, titles, sources, dimensions).
GoogleJobs GET / POST /v1/google/jobs Scrape Google Jobs results via API and retrieve structured job listings with title, company, location, and pagination.
GoogleMaps GET / POST /v1/google/maps Search Google Maps via API and retrieve structured place results (address, website, phone).
GoogleNews GET / POST /v1/google/news Search Google News via API and retrieve structured news results with pagination.
GoogleSearch GET / POST /v1/google/search Scrape Google Search results via API and retrieve structured SERP data with pagination.
GoogleSearchAI GET / POST /v1/google/search/ai Query Google AI Mode via API. JSON with text_blocks, references, and shopping_results.
GoogleSearchAutocomplete GET / POST /v1/google/search/autocomplete Get Google Search autocomplete suggestions via API for a given query.
GoogleSearchLight GET / POST /v1/google/search/light Scrape lightweight Google Search results via API: fast, cost-efficient, organic results only.
GoogleShopping GET / POST /v1/google/shopping Scrape Google Shopping results via API and retrieve structured product listings with prices, ratings, and merchant data.
GoogleVideos GET / POST /v1/google/videos Search Google Videos via API and retrieve structured video results with metadata.
Jobs GET /v1/jobs/{id} Poll the status, progress (0–100) and result of a job started with is_async=true. Polling is free. Poll until status is terminal: Completed…
Search GET / POST /v1/search One call walks engines in order and returns the first organic results. engines=auto tries Google, then Brave, Bing, DuckDuckGo, Yahoo, and…
Stats GET /v1/stats Infrastructure health for an engine or endpoint over the last hour. Not scoped to your account or tenant. Enabled per account: HTTP 403 mea…
Usage GET /v1/usage Retrieve real-time usage statistics and credit balance for your Autom account.
YahooSearch GET / POST /v1/yahoo/search Query Yahoo via API and retrieve structured organic results with country and language.

License

MIT — see LICENSE.

Documentation

Overview

Package autom is the official Go SDK for the Autom API (https://www.autom.dev).

Google, Bing and Brave search results as structured JSON — web, maps, news, shopping, images, jobs and AI Mode.

Create one client and reuse it:

client, err := autom.NewClient("", nil) // reads AUTOM_API_KEY
response, err := client.GoogleSearch(ctx, ...)

Every documented endpoint has a typed method; Client.Request reaches any other path.

Index

Constants

View Source
const (
	// DefaultBaseURL is the production API origin.
	DefaultBaseURL = "https://api.autom.dev"
	// DefaultTimeout bounds every request unless ClientOptions.Timeout says otherwise.
	DefaultTimeout = 120 * time.Second
	// APIKeyEnvironmentVariable is read when NewClient receives an empty API key.
	APIKeyEnvironmentVariable = "AUTOM_API_KEY"
	// DefaultConcurrency is the number of tasks Batch runs at the same time.
	DefaultConcurrency = 10
	// MaxRetries is the default number of retries after a network error or a 408, 429, 500, 502, 503 or 504.
	MaxRetries = 3
	// RetryBackoffFactor multiplies the delay before each new retry (a Retry-After header wins).
	RetryBackoffFactor = 1.5
	// DefaultRetryDelay is the delay before the first retry.
	DefaultRetryDelay = time.Second
	// MaxRetryDelay caps the delay between two attempts.
	MaxRetryDelay = 30 * time.Second
)
View Source
const Version = "0.1.0"

Version is the SDK version sent in the User-Agent header.

Variables

View Source
var JobTerminalStatuses = []string{"CompletedJob", "Error", "NotFound", "BadRequest"}

JobTerminalStatuses are the job statuses WaitForJob stops on.

Functions

func Bool

func Bool(v bool) *bool

Bool returns a pointer to v, for optional boolean parameters.

func Float

func Float(v float64) *float64

Float returns a pointer to v, for optional number parameters.

func Int

func Int(v int64) *int64

Int returns a pointer to v, for optional integer parameters.

func String

func String(v string) *string

String returns a pointer to v, for optional parameters.

Types

type APIError

type APIError struct {
	StatusCode int
	// Message is the "error" (or "message") field of the JSON body, when present.
	Message  string
	Response *Response
}

APIError is returned for non-2xx responses.

func IsAPIError

func IsAPIError(err error) (*APIError, bool)

IsAPIError reports whether err is an *APIError and returns it.

func (*APIError) Error

func (e *APIError) Error() string

type BatchResult

type BatchResult[T any] struct {
	Index int
	Value T
	Err   error
}

BatchResult is the outcome of one Batch item.

func Batch

func Batch[I, T any](ctx context.Context, items []I, concurrency int, task func(ctx context.Context, item I) (T, error)) []BatchResult[T]

Batch runs task for every item with at most concurrency calls in flight (DefaultConcurrency when concurrency <= 0) and returns one result per item, in input order. A failing item never stops the others; items not started when ctx is done get ctx.Err().

type BingSearchParams

type BingSearchParams struct {
	// The search query you want to run on Bing.
	Query string `json:"query" api:"query,required"`
	// Page number for pagination (1 = first page). Default: 1.
	Page *float64 `json:"page" api:"page"`
	// Number of results per page (e.g. 10, 20, 50). This value is a suggestion. Default: 10.
	Num *float64 `json:"num" api:"num"`
	// Search origin location (e.g. city).
	Location *string `json:"location" api:"location"`
	// GPS latitude for the search origin.
	Lat *float64 `json:"lat" api:"lat"`
	// GPS longitude for the search origin.
	Lon *float64 `json:"lon" api:"lon"`
	// Market code where results come from (e.g. en-US). Cannot be used together with cc.
	Mkt *string `json:"mkt" api:"mkt"`
	// Country code to search from (2-letter ISO 3166-1). Cannot be used together with mkt.
	Cc *string `json:"cc" api:"cc"`
	// Comma-separated list of fields to keep in the response, with dot notation for nested fields (e.g. name,location.city). Does not change the credit cost.
	Fields *string `json:"fields" api:"fields"`
	// Process the request asynchronously: the response is a job_id to poll on /v1/jobs/{id} (see waitForJob). Default: false.
	IsAsync *bool `json:"is_async" api:"is_async"`
	// Return HTTP 200 even when an error occurs; the error is then in the response body. Default: false.
	SoftFail *bool `json:"soft_fail" api:"soft_fail"`
}

BingSearchParams holds the parameters of BingSearch (GET / POST /v1/bing/search). Required fields are plain values; optional fields are pointers (use autom.String, autom.Float, autom.Bool) or nil slices and maps.

type BraveImagesParams

type BraveImagesParams struct {
	// The search query you want to run on Brave Images.
	Query string `json:"query" api:"query,required"`
	// Page number for pagination (50 results per page). Default: 1.
	Page *float64 `json:"page" api:"page"`
	// Country code (e.g. fr, us). Mapped to Brave country.
	Gl *string `json:"gl" api:"gl"`
	// Language code (e.g. fr, en). Mapped to Brave lang.
	Hl *string `json:"hl" api:"hl"`
	// SafeSearch: active | off | moderate | strict. Google-style active maps to Brave strict.
	Safe *string `json:"safe" api:"safe"`
	// Comma-separated list of fields to keep in the response, with dot notation for nested fields (e.g. name,location.city). Does not change the credit cost.
	Fields *string `json:"fields" api:"fields"`
	// Process the request asynchronously: the response is a job_id to poll on /v1/jobs/{id} (see waitForJob). Default: false.
	IsAsync *bool `json:"is_async" api:"is_async"`
	// Return HTTP 200 even when an error occurs; the error is then in the response body. Default: false.
	SoftFail *bool `json:"soft_fail" api:"soft_fail"`
}

BraveImagesParams holds the parameters of BraveImages (GET / POST /v1/brave/images). Required fields are plain values; optional fields are pointers (use autom.String, autom.Float, autom.Bool) or nil slices and maps.

type BraveSearchParams

type BraveSearchParams struct {
	// The search query you want to run on Brave Search.
	Query string `json:"query" api:"query,required"`
	// Page number for pagination. Default: 1.
	Page *float64 `json:"page" api:"page"`
	// Country code, for example us, fr, gb, de. Default: "us".
	Gl *string `json:"gl" api:"gl"`
	// Language code, for example en, fr, de. Default: "en".
	Hl *string `json:"hl" api:"hl"`
	// Comma-separated list of fields to keep in the response, with dot notation for nested fields (e.g. name,location.city). Does not change the credit cost.
	Fields *string `json:"fields" api:"fields"`
	// Process the request asynchronously: the response is a job_id to poll on /v1/jobs/{id} (see waitForJob). Default: false.
	IsAsync *bool `json:"is_async" api:"is_async"`
	// Return HTTP 200 even when an error occurs; the error is then in the response body. Default: false.
	SoftFail *bool `json:"soft_fail" api:"soft_fail"`
}

BraveSearchParams holds the parameters of BraveSearch (GET / POST /v1/brave/search). Required fields are plain values; optional fields are pointers (use autom.String, autom.Float, autom.Bool) or nil slices and maps.

type BraveVideosParams

type BraveVideosParams struct {
	// The search query you want to run on Brave Videos.
	Query string `json:"query" api:"query,required"`
	// Page number for pagination. Default: 1.
	Page *float64 `json:"page" api:"page"`
	// Country code (e.g. fr, us). Mapped to Brave country.
	Gl *string `json:"gl" api:"gl"`
	// Language code (e.g. fr, en). Mapped to Brave lang.
	Hl *string `json:"hl" api:"hl"`
	// SafeSearch: active | off | moderate | strict. Google-style active maps to Brave strict.
	Safe *string `json:"safe" api:"safe"`
	// Comma-separated list of fields to keep in the response, with dot notation for nested fields (e.g. name,location.city). Does not change the credit cost.
	Fields *string `json:"fields" api:"fields"`
	// Process the request asynchronously: the response is a job_id to poll on /v1/jobs/{id} (see waitForJob). Default: false.
	IsAsync *bool `json:"is_async" api:"is_async"`
	// Return HTTP 200 even when an error occurs; the error is then in the response body. Default: false.
	SoftFail *bool `json:"soft_fail" api:"soft_fail"`
}

BraveVideosParams holds the parameters of BraveVideos (GET / POST /v1/brave/videos). Required fields are plain values; optional fields are pointers (use autom.String, autom.Float, autom.Bool) or nil slices and maps.

type Client

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

Client is a reusable, concurrency-safe Autom API client.

func NewClient

func NewClient(apiKey string, options *ClientOptions) (*Client, error)

NewClient creates a client. An empty apiKey falls back to the AUTOM_API_KEY environment variable.

func (*Client) BingSearch

func (c *Client) BingSearch(ctx context.Context, params *BingSearchParams, options ...RequestOption) (*Response, error)

BingSearch — Bing Search. Query Bing Search via API and retrieve structured organic results (title, link, snippet, position). Credit cost: 1 credit per call.

GET / POST /v1/bing/search

func (*Client) BraveImages

func (c *Client) BraveImages(ctx context.Context, params *BraveImagesParams, options ...RequestOption) (*Response, error)

BraveImages — Brave Images. Search Brave Images via API and retrieve structured image results with pagination and SafeSearch. Credit cost: 1 credit per call.

GET / POST /v1/brave/images

func (*Client) BraveSearch

func (c *Client) BraveSearch(ctx context.Context, params *BraveSearchParams, options ...RequestOption) (*Response, error)

BraveSearch — Brave Search. Search Brave Search via API and retrieve structured organic results with pagination. Credit cost: 1 credit per call.

GET / POST /v1/brave/search

func (*Client) BraveVideos

func (c *Client) BraveVideos(ctx context.Context, params *BraveVideosParams, options ...RequestOption) (*Response, error)

BraveVideos — Brave Videos. Search Brave Videos via API and retrieve structured video results with pagination and SafeSearch. Credit cost: 1 credit per call.

GET / POST /v1/brave/videos

func (*Client) DuckduckgoSearch

func (c *Client) DuckduckgoSearch(ctx context.Context, params *DuckduckgoSearchParams, options ...RequestOption) (*Response, error)

DuckduckgoSearch — DuckDuckGo Search. Query DuckDuckGo via API and retrieve structured organic results with region and language. Credit cost: 1 credit per call.

GET / POST /v1/duckduckgo/search

func (*Client) FinderGoogleCountries

func (c *Client) FinderGoogleCountries(ctx context.Context, params *FinderGoogleCountriesParams, options ...RequestOption) (*Response, error)

FinderGoogleCountries — Google Countries. Search Google countries and retrieve country codes (free Finder endpoint).

GET /v1/finder/google-countries

func (*Client) FinderGoogleLanguages

func (c *Client) FinderGoogleLanguages(ctx context.Context, params *FinderGoogleLanguagesParams, options ...RequestOption) (*Response, error)

FinderGoogleLanguages — Google Languages. Search Google languages and retrieve language codes (free Finder endpoint).

GET /v1/finder/google-languages

func (*Client) FinderGoogleLocations

func (c *Client) FinderGoogleLocations(ctx context.Context, params *FinderGoogleLocationsParams, options ...RequestOption) (*Response, error)

FinderGoogleLocations — Google Locations. Find supported Google locations and retrieve location IDs and country codes (free endpoint).

GET /v1/finder/google-locations

func (*Client) GoogleImages

func (c *Client) GoogleImages(ctx context.Context, params *GoogleImagesParams, options ...RequestOption) (*Response, error)

GoogleImages — Google Images. Search Google Images via API and retrieve image results (URLs, titles, sources, dimensions). Credit cost: 1 credit per call.

GET / POST /v1/google/images

func (*Client) GoogleJobs

func (c *Client) GoogleJobs(ctx context.Context, params *GoogleJobsParams, options ...RequestOption) (*Response, error)

GoogleJobs — Google Jobs. Scrape Google Jobs results via API and retrieve structured job listings with title, company, location, and pagination. Credit cost: 1 credit per call.

GET / POST /v1/google/jobs

func (*Client) GoogleMaps

func (c *Client) GoogleMaps(ctx context.Context, params *GoogleMapsParams, options ...RequestOption) (*Response, error)

GoogleMaps — Google Maps. Search Google Maps via API and retrieve structured place results (address, website, phone). Credit cost: 1 credit per call.

GET / POST /v1/google/maps

func (*Client) GoogleNews

func (c *Client) GoogleNews(ctx context.Context, params *GoogleNewsParams, options ...RequestOption) (*Response, error)

GoogleNews — Google News. Search Google News via API and retrieve structured news results with pagination. Credit cost: 1 credit per call.

GET / POST /v1/google/news

func (*Client) GoogleSearch

func (c *Client) GoogleSearch(ctx context.Context, params *GoogleSearchParams, options ...RequestOption) (*Response, error)

GoogleSearch — Google Search. Scrape Google Search results via API and retrieve structured SERP data with pagination. Credit cost: 1 credit per call.

GET / POST /v1/google/search

func (*Client) GoogleSearchAI

func (c *Client) GoogleSearchAI(ctx context.Context, params *GoogleSearchAIParams, options ...RequestOption) (*Response, error)

GoogleSearchAI — Google AI Mode. Query Google AI Mode via API. JSON with text_blocks, references, and shopping_results. Credit cost: 3 credits per call.

GET / POST /v1/google/search/ai

func (*Client) GoogleSearchAutocomplete

func (c *Client) GoogleSearchAutocomplete(ctx context.Context, params *GoogleSearchAutocompleteParams, options ...RequestOption) (*Response, error)

GoogleSearchAutocomplete — Google Search Autocomplete. Get Google Search autocomplete suggestions via API for a given query. Credit cost: 1 credit per call.

GET / POST /v1/google/search/autocomplete

func (*Client) GoogleSearchLight

func (c *Client) GoogleSearchLight(ctx context.Context, params *GoogleSearchLightParams, options ...RequestOption) (*Response, error)

GoogleSearchLight — Google Search Light. Scrape lightweight Google Search results via API: fast, cost-efficient, organic results only. Credit cost: 1 credit per call.

GET / POST /v1/google/search/light

func (*Client) GoogleShopping

func (c *Client) GoogleShopping(ctx context.Context, params *GoogleShoppingParams, options ...RequestOption) (*Response, error)

GoogleShopping — Google Shopping. Scrape Google Shopping results via API and retrieve structured product listings with prices, ratings, and merchant data. Credit cost: 1 credit per call.

GET / POST /v1/google/shopping

func (*Client) GoogleVideos

func (c *Client) GoogleVideos(ctx context.Context, params *GoogleVideosParams, options ...RequestOption) (*Response, error)

GoogleVideos — Google Videos. Search Google Videos via API and retrieve structured video results with metadata. Credit cost: 1 credit per call.

GET / POST /v1/google/videos

func (*Client) Jobs

func (c *Client) Jobs(ctx context.Context, params *JobsParams, options ...RequestOption) (*Response, error)

Jobs — Jobs. Poll the status, progress (0–100) and result of a job started with is_async=true. Polling is free. Poll until status is terminal: CompletedJob, Error, NotFound or BadRequest.

GET /v1/jobs/{id}

func (*Client) Request

func (c *Client) Request(ctx context.Context, method, path string, params map[string]any, options ...RequestOption) (*Response, error)

Request sends any request, including endpoints released after this SDK version. GET parameters travel in the query string; POST parameters travel in a JSON body.

func (*Client) Search

func (c *Client) Search(ctx context.Context, params *SearchParams, options ...RequestOption) (*Response, error)

Search — Search. One call walks engines in order and returns the first organic results. engines=auto tries Google, then Brave, Bing, DuckDuckGo, Yahoo, and Baidu. Omitted gl is us and omitted hl is en. There is no page parameter: the response is always pag… Credit cost: 1 credit per call.

GET / POST /v1/search

func (*Client) Stats

func (c *Client) Stats(ctx context.Context, params *StatsParams, options ...RequestOption) (*Response, error)

Stats — Stats. Infrastructure health for an engine or endpoint over the last hour. Not scoped to your account or tenant. Enabled per account: HTTP 403 means contact support to activate it.

GET /v1/stats

func (*Client) Usage

func (c *Client) Usage(ctx context.Context, options ...RequestOption) (*Response, error)

Usage — Usage. Retrieve real-time usage statistics and credit balance for your Autom account.

GET /v1/usage

func (*Client) WaitForJob

func (c *Client) WaitForJob(ctx context.Context, jobID string, options *WaitForJobOptions) (*Response, error)

WaitForJob polls GET /v1/jobs/{id} until the job reaches a terminal status and returns the last response.

func (*Client) YahooSearch

func (c *Client) YahooSearch(ctx context.Context, params *YahooSearchParams, options ...RequestOption) (*Response, error)

YahooSearch — Yahoo Search. Query Yahoo via API and retrieve structured organic results with country and language. Credit cost: 1 credit per call.

GET / POST /v1/yahoo/search

type ClientOptions

type ClientOptions struct {
	// BaseURL overrides DefaultBaseURL.
	BaseURL string
	// Timeout bounds each request. Zero uses DefaultTimeout; a negative value disables it.
	Timeout time.Duration
	// HTTPClient is copied and used for requests. Redirects are never followed.
	HTTPClient *http.Client
	// Headers are sent with every request.
	Headers map[string]string
	// MaxRetries overrides the number of retries. Zero uses MaxRetries; a negative value disables retries.
	MaxRetries int
	// RetryDelay is the delay before the first retry. Zero uses DefaultRetryDelay.
	RetryDelay time.Duration
}

ClientOptions configures a Client. The zero value is valid.

type ConfigurationError

type ConfigurationError struct {
	Message string
	Err     error
}

ConfigurationError reports a missing or unusable client configuration.

func (*ConfigurationError) Error

func (e *ConfigurationError) Error() string

func (*ConfigurationError) Unwrap

func (e *ConfigurationError) Unwrap() error

type DuckduckgoSearchParams

type DuckduckgoSearchParams struct {
	// Search query sent to DuckDuckGo Search.
	Query string `json:"query" api:"query,required"`
	// Page number. Page 1 is the first page of results. Default: 1.
	Page *float64 `json:"page" api:"page"`
	// Country code, for example us, fr, gb, de, jp.
	Gl *string `json:"gl" api:"gl"`
	// Language code, for example en, fr, de, ja, zh.
	Hl *string `json:"hl" api:"hl"`
	// Comma-separated list of fields to keep in the response, with dot notation for nested fields (e.g. name,location.city). Does not change the credit cost.
	Fields *string `json:"fields" api:"fields"`
	// Process the request asynchronously: the response is a job_id to poll on /v1/jobs/{id} (see waitForJob). Default: false.
	IsAsync *bool `json:"is_async" api:"is_async"`
	// Return HTTP 200 even when an error occurs; the error is then in the response body. Default: false.
	SoftFail *bool `json:"soft_fail" api:"soft_fail"`
}

DuckduckgoSearchParams holds the parameters of DuckduckgoSearch (GET / POST /v1/duckduckgo/search). Required fields are plain values; optional fields are pointers (use autom.String, autom.Float, autom.Bool) or nil slices and maps.

type FinderGoogleCountriesParams

type FinderGoogleCountriesParams struct {
	// Filter countries by a search string (case-insensitive). Returns all countries whose code or name matches the specified query.
	Query string `json:"query" api:"query,required"`
	// Comma-separated list of fields to keep in the response, with dot notation for nested fields (e.g. name,location.city). Does not change the credit cost.
	Fields *string `json:"fields" api:"fields"`
	// Process the request asynchronously: the response is a job_id to poll on /v1/jobs/{id} (see waitForJob). Default: false.
	IsAsync *bool `json:"is_async" api:"is_async"`
	// Return HTTP 200 even when an error occurs; the error is then in the response body. Default: false.
	SoftFail *bool `json:"soft_fail" api:"soft_fail"`
}

FinderGoogleCountriesParams holds the parameters of FinderGoogleCountries (GET /v1/finder/google-countries). Required fields are plain values; optional fields are pointers (use autom.String, autom.Float, autom.Bool) or nil slices and maps.

type FinderGoogleLanguagesParams

type FinderGoogleLanguagesParams struct {
	// Filter languages by a search string (case-insensitive). Returns all languages whose names contain the specified string.
	Query string `json:"query" api:"query,required"`
	// Comma-separated list of fields to keep in the response, with dot notation for nested fields (e.g. name,location.city). Does not change the credit cost.
	Fields *string `json:"fields" api:"fields"`
	// Process the request asynchronously: the response is a job_id to poll on /v1/jobs/{id} (see waitForJob). Default: false.
	IsAsync *bool `json:"is_async" api:"is_async"`
	// Return HTTP 200 even when an error occurs; the error is then in the response body. Default: false.
	SoftFail *bool `json:"soft_fail" api:"soft_fail"`
}

FinderGoogleLanguagesParams holds the parameters of FinderGoogleLanguages (GET /v1/finder/google-languages). Required fields are plain values; optional fields are pointers (use autom.String, autom.Float, autom.Bool) or nil slices and maps.

type FinderGoogleLocationsParams

type FinderGoogleLocationsParams struct {
	// Search locations supported by Piloterr (cities, countries, etc.) by providing a query string. Returns matching locations ordered by reach.
	Query string `json:"query" api:"query,required"`
	// Comma-separated list of fields to keep in the response, with dot notation for nested fields (e.g. name,location.city). Does not change the credit cost.
	Fields *string `json:"fields" api:"fields"`
	// Process the request asynchronously: the response is a job_id to poll on /v1/jobs/{id} (see waitForJob). Default: false.
	IsAsync *bool `json:"is_async" api:"is_async"`
	// Return HTTP 200 even when an error occurs; the error is then in the response body. Default: false.
	SoftFail *bool `json:"soft_fail" api:"soft_fail"`
}

FinderGoogleLocationsParams holds the parameters of FinderGoogleLocations (GET /v1/finder/google-locations). Required fields are plain values; optional fields are pointers (use autom.String, autom.Float, autom.Bool) or nil slices and maps.

type GoogleImagesParams

type GoogleImagesParams struct {
	// Query you want to search on Google Images (e.g. "lion", "nike logo", "modern house exterior").
	Query string `json:"query" api:"query,required"`
	// Page number for pagination (1 = first page). Default: 1.
	Page *float64 `json:"page" api:"page"`
	// Google domain to use for the search. Defaults to google.com. Default: "google.com".
	GoogleDomain *string `json:"google_domain" api:"google_domain"`
	// Country to use for the Google search. Two-letter country code (e.g. us for the United States, uk for United Kingdom, or fr for France).
	Gl *string `json:"gl" api:"gl"`
	// Language to use for the Google search. Two or three-letter language code (e.g. en, es, fr), optionally followed by a region code (e.g. en-gb, es-419).
	Hl *string `json:"hl" api:"hl"`
	// Limit results to one or more countries. Use country{XX} with | as delimiter (e.g. countryFR|countryDE).
	Cr *string `json:"cr" api:"cr"`
	// Limit results to one or more languages. Use lang_{xx} with | as delimiter (e.g. lang_fr|lang_de).
	Lr *string `json:"lr" api:"lr"`
	// If true, returns a job and lets you fetch results asynchronously. Default: false.
	Async *bool `json:"async" api:"async"`
	// Adult content filter. active enables Google SafeSearch; off disables it. Omit to use Google default.
	Safe *string `json:"safe" api:"safe"`
	// Comma-separated list of fields to keep in the response, with dot notation for nested fields (e.g. name,location.city). Does not change the credit cost.
	Fields *string `json:"fields" api:"fields"`
	// Process the request asynchronously: the response is a job_id to poll on /v1/jobs/{id} (see waitForJob). Default: false.
	IsAsync *bool `json:"is_async" api:"is_async"`
	// Return HTTP 200 even when an error occurs; the error is then in the response body. Default: false.
	SoftFail *bool `json:"soft_fail" api:"soft_fail"`
}

GoogleImagesParams holds the parameters of GoogleImages (GET / POST /v1/google/images). Required fields are plain values; optional fields are pointers (use autom.String, autom.Float, autom.Bool) or nil slices and maps.

type GoogleJobsParams

type GoogleJobsParams struct {
	// The job search query to run on Google Jobs (e.g. developer, barista new york).
	Query string `json:"query" api:"query,required"`
	// Advanced search filters string for Google Jobs (encoded filter chips).
	Uds *string `json:"uds" api:"uds"`
	// Search radius in kilometers. Does not strictly limit the radius, but influences result proximity.
	Lrad *float64 `json:"lrad" api:"lrad"`
	// Filter results by work type. Set to 1 to filter for work from home / remote jobs.
	Ltype *float64 `json:"ltype" api:"ltype"`
	// Human-readable location to originate the search from (e.g. New York, NY, Paris, France). If several locations match, the most popular one is used. Note: location and uule cannot be used together.
	Location *string `json:"location" api:"location"`
	// Google encoded location parameter. Use for precise geo targeting. Note: uule and location cannot be used together.
	Uule *string `json:"uule" api:"uule"`
	// Google domain to use for the search. Defaults to google.com. Default: "google.com".
	GoogleDomain *string `json:"google_domain" api:"google_domain"`
	// Country to use for the Google search. Two-letter country code (e.g. us for the United States, uk for United Kingdom, or fr for France). Default: "us".
	Gl *string `json:"gl" api:"gl"`
	// Language to use for the Google search. Two or three-letter language code (e.g. en, es, fr), optionally followed by a region code (e.g. en-gb, es-419). Default: "en".
	Hl *string `json:"hl" api:"hl"`
	// Limit results to one or more countries. Use country{XX} with | as delimiter (e.g. countryFR|countryDE).
	Cr *string `json:"cr" api:"cr"`
	// Limit results to one or more languages. Use lang_{xx} with | as delimiter (e.g. lang_fr|lang_de).
	Lr *string `json:"lr" api:"lr"`
	// Token to fetch the next page of results. Returned in the serpapi_pagination.next_page_token field of the previous response.
	NextPageToken *string `json:"next_page_token" api:"next_page_token"`
	// Comma-separated list of fields to keep in the response, with dot notation for nested fields (e.g. name,location.city). Does not change the credit cost.
	Fields *string `json:"fields" api:"fields"`
	// Process the request asynchronously: the response is a job_id to poll on /v1/jobs/{id} (see waitForJob). Default: false.
	IsAsync *bool `json:"is_async" api:"is_async"`
	// Return HTTP 200 even when an error occurs; the error is then in the response body. Default: false.
	SoftFail *bool `json:"soft_fail" api:"soft_fail"`
}

GoogleJobsParams holds the parameters of GoogleJobs (GET / POST /v1/google/jobs). Required fields are plain values; optional fields are pointers (use autom.String, autom.Float, autom.Bool) or nil slices and maps.

type GoogleMapsParams

type GoogleMapsParams struct {
	// Search query for Google Maps (e.g. business type, brand, or place name).
	Query string `json:"query" api:"query,required"`
	// Page number for pagination (1 = first page). Default: 1.
	Page *float64 `json:"page" api:"page"`
	// Google domain to use for the search. Defaults to google.com. Default: "google.com".
	GoogleDomain *string `json:"google_domain" api:"google_domain"`
	// Country to use for the Google search. Two-letter country code (e.g. us for the United States, uk for United Kingdom, or fr for France).
	Gl *string `json:"gl" api:"gl"`
	// Language to use for the Google search. Two or three-letter language code (e.g. en, es, fr), optionally followed by a region code (e.g. en-gb, es-419).
	Hl *string `json:"hl" api:"hl"`
	// Limit results to one or more countries. Use country{XX} with | as delimiter (e.g. countryFR|countryDE).
	Cr *string `json:"cr" api:"cr"`
	// Limit results to one or more languages. Use lang_{xx} with | as delimiter (e.g. lang_fr|lang_de).
	Lr *string `json:"lr" api:"lr"`
	// Map center / geo hint in Google format (e.g. @43.5131985,1.4600501,60m). Helps focus results around a coordinate and zoom radius.
	Ll *string `json:"ll" api:"ll"`
	// Comma-separated list of fields to keep in the response, with dot notation for nested fields (e.g. name,location.city). Does not change the credit cost.
	Fields *string `json:"fields" api:"fields"`
	// Process the request asynchronously: the response is a job_id to poll on /v1/jobs/{id} (see waitForJob). Default: false.
	IsAsync *bool `json:"is_async" api:"is_async"`
	// Return HTTP 200 even when an error occurs; the error is then in the response body. Default: false.
	SoftFail *bool `json:"soft_fail" api:"soft_fail"`
}

GoogleMapsParams holds the parameters of GoogleMaps (GET / POST /v1/google/maps). Required fields are plain values; optional fields are pointers (use autom.String, autom.Float, autom.Bool) or nil slices and maps.

type GoogleNewsParams

type GoogleNewsParams struct {
	// Query to search on Google News (keywords, company, topic).
	Query string `json:"query" api:"query,required"`
	// Page number for pagination (1 = first page). Default: 1.
	Page *float64 `json:"page" api:"page"`
	// Maximum number of results per page (e.g. 10). Default: 10.
	Num *float64 `json:"num" api:"num"`
	// Google domain to use for the search. Defaults to google.com. Default: "google.com".
	GoogleDomain *string `json:"google_domain" api:"google_domain"`
	// Country to use for the Google search. Two-letter country code (e.g. us for the United States, uk for United Kingdom, or fr for France).
	Gl *string `json:"gl" api:"gl"`
	// Language to use for the Google search. Two or three-letter language code (e.g. en, es, fr), optionally followed by a region code (e.g. en-gb, es-419).
	Hl *string `json:"hl" api:"hl"`
	// Limit results to one or more countries. Use country{XX} with | as delimiter (e.g. countryFR|countryDE).
	Cr *string `json:"cr" api:"cr"`
	// Limit results to one or more languages. Use lang_{xx} with | as delimiter (e.g. lang_fr|lang_de).
	Lr *string `json:"lr" api:"lr"`
	// Comma-separated list of fields to keep in the response, with dot notation for nested fields (e.g. name,location.city). Does not change the credit cost.
	Fields *string `json:"fields" api:"fields"`
	// Process the request asynchronously: the response is a job_id to poll on /v1/jobs/{id} (see waitForJob). Default: false.
	IsAsync *bool `json:"is_async" api:"is_async"`
	// Return HTTP 200 even when an error occurs; the error is then in the response body. Default: false.
	SoftFail *bool `json:"soft_fail" api:"soft_fail"`
}

GoogleNewsParams holds the parameters of GoogleNews (GET / POST /v1/google/news). Required fields are plain values; optional fields are pointers (use autom.String, autom.Float, autom.Bool) or nil slices and maps.

type GoogleSearchAIParams

type GoogleSearchAIParams struct {
	// The question or search query you want Google AI Mode to answer (supports advanced operators like site:, inurl:, intitle:).
	Query string `json:"query" api:"query,required"`
	// Human-readable location to originate the search from (e.g. New York, NY, Paris, France). If several locations match, the most popular one is used. Note: location and uule cannot be used together.
	Location *string `json:"location" api:"location"`
	// Google encoded location parameter. Use for precise geo targeting. Note: uule and location cannot be used together.
	Uule *string `json:"uule" api:"uule"`
	// Google domain to use for the search. Defaults to google.com. Default: "google.com".
	GoogleDomain *string `json:"google_domain" api:"google_domain"`
	// Country to use for the Google search. Two-letter country code (e.g. us for the United States, uk for United Kingdom, or fr for France).
	Gl *string `json:"gl" api:"gl"`
	// Language to use for the Google search. Two or three-letter language code (e.g. en, es, fr), optionally followed by a region code (e.g. en-gb, es-419).
	Hl *string `json:"hl" api:"hl"`
	// Limit results to one or more countries. Use country{XX} with | as delimiter (e.g. countryFR|countryDE).
	Cr *string `json:"cr" api:"cr"`
	// Limit results to one or more languages. Use lang_{xx} with | as delimiter (e.g. lang_fr|lang_de).
	Lr *string `json:"lr" api:"lr"`
	// Comma-separated list of fields to keep in the response, with dot notation for nested fields (e.g. name,location.city). Does not change the credit cost.
	Fields *string `json:"fields" api:"fields"`
	// Process the request asynchronously: the response is a job_id to poll on /v1/jobs/{id} (see waitForJob). Default: false.
	IsAsync *bool `json:"is_async" api:"is_async"`
	// Return HTTP 200 even when an error occurs; the error is then in the response body. Default: false.
	SoftFail *bool `json:"soft_fail" api:"soft_fail"`
}

GoogleSearchAIParams holds the parameters of GoogleSearchAI (GET / POST /v1/google/search/ai). Required fields are plain values; optional fields are pointers (use autom.String, autom.Float, autom.Bool) or nil slices and maps.

type GoogleSearchAutocompleteParams

type GoogleSearchAutocompleteParams struct {
	// The search query for which you want to get autocomplete suggestions.
	Query string `json:"query" api:"query,required"`
	// Cursor position in the search query where you want to get autocomplete suggestions. Default: 0.
	Cp *float64 `json:"cp" api:"cp"`
	// Google domain to use for the search. Defaults to google.com. Default: "google.com".
	GoogleDomain *string `json:"google_domain" api:"google_domain"`
	// Country to use for the Google search. Two-letter country code (e.g. us for the United States, uk for United Kingdom, or fr for France).
	Gl *string `json:"gl" api:"gl"`
	// Language to use for the Google search. Two or three-letter language code (e.g. en, es, fr), optionally followed by a region code (e.g. en-gb, es-419).
	Hl *string `json:"hl" api:"hl"`
	// Limit results to one or more countries. Use country{XX} with | as delimiter (e.g. countryFR|countryDE).
	Cr *string `json:"cr" api:"cr"`
	// Limit results to one or more languages. Use lang_{xx} with | as delimiter (e.g. lang_fr|lang_de).
	Lr *string `json:"lr" api:"lr"`
	// Comma-separated list of fields to keep in the response, with dot notation for nested fields (e.g. name,location.city). Does not change the credit cost.
	Fields *string `json:"fields" api:"fields"`
	// Process the request asynchronously: the response is a job_id to poll on /v1/jobs/{id} (see waitForJob). Default: false.
	IsAsync *bool `json:"is_async" api:"is_async"`
	// Return HTTP 200 even when an error occurs; the error is then in the response body. Default: false.
	SoftFail *bool `json:"soft_fail" api:"soft_fail"`
}

GoogleSearchAutocompleteParams holds the parameters of GoogleSearchAutocomplete (GET / POST /v1/google/search/autocomplete). Required fields are plain values; optional fields are pointers (use autom.String, autom.Float, autom.Bool) or nil slices and maps.

type GoogleSearchLightParams

type GoogleSearchLightParams struct {
	// The search query you want to run on Google (supports advanced operators like site:, inurl:, intitle:).
	Query string `json:"query" api:"query,required"`
	// Google domain to use for the search. Defaults to google.com. Default: "google.com".
	GoogleDomain *string `json:"google_domain" api:"google_domain"`
	// Country to use for the Google search. Two-letter country code (e.g. us for the United States, uk for United Kingdom, or fr for France).
	Gl *string `json:"gl" api:"gl"`
	// Language to use for the Google search. Two or three-letter language code (e.g. en, es, fr), optionally followed by a region code (e.g. en-gb, es-419).
	Hl *string `json:"hl" api:"hl"`
	// Limit results to one or more countries. Use country{XX} with | as delimiter (e.g. countryFR|countryDE).
	Cr *string `json:"cr" api:"cr"`
	// Limit results to one or more languages. Use lang_{xx} with | as delimiter (e.g. lang_fr|lang_de).
	Lr *string `json:"lr" api:"lr"`
	// Comma-separated list of fields to keep in the response, with dot notation for nested fields (e.g. name,location.city). Does not change the credit cost.
	Fields *string `json:"fields" api:"fields"`
	// Process the request asynchronously: the response is a job_id to poll on /v1/jobs/{id} (see waitForJob). Default: false.
	IsAsync *bool `json:"is_async" api:"is_async"`
	// Return HTTP 200 even when an error occurs; the error is then in the response body. Default: false.
	SoftFail *bool `json:"soft_fail" api:"soft_fail"`
}

GoogleSearchLightParams holds the parameters of GoogleSearchLight (GET / POST /v1/google/search/light). Required fields are plain values; optional fields are pointers (use autom.String, autom.Float, autom.Bool) or nil slices and maps.

type GoogleSearchParams

type GoogleSearchParams struct {
	// The search query you want to run on Google (supports advanced operators like site:, inurl:, intitle:).
	Query string `json:"query" api:"query,required"`
	// Advanced search filters string (e.g. time ranges: qdr:h last hour, qdr:d last day, qdr:w last week, qdr:m last month, qdr:y last year).
	Tbs *string `json:"tbs" api:"tbs"`
	// Adult content filter. active enables Google SafeSearch; off disables it. Omit to use Google default.
	Safe *string `json:"safe" api:"safe"`
	// Human-readable location to originate the search from (e.g. New York, NY, Paris, France). If several locations match, the most popular one is used. Note: location and uule cannot be used together.
	Location *string `json:"location" api:"location"`
	// Google encoded location parameter. Use for precise geo targeting. Note: uule and location cannot be used together.
	Uule *string `json:"uule" api:"uule"`
	// Google domain to use for the search. Defaults to google.com. Default: "google.com".
	GoogleDomain *string `json:"google_domain" api:"google_domain"`
	// Country to use for the Google search. Two-letter country code (e.g. us for the United States, uk for United Kingdom, or fr for France).
	Gl *string `json:"gl" api:"gl"`
	// Language to use for the Google search. Two or three-letter language code (e.g. en, es, fr), optionally followed by a region code (e.g. en-gb, es-419).
	Hl *string `json:"hl" api:"hl"`
	// Limit results to one or more countries. Use country{XX} with | as delimiter (e.g. countryFR|countryDE).
	Cr *string `json:"cr" api:"cr"`
	// Limit results to one or more languages. Use lang_{xx} with | as delimiter (e.g. lang_fr|lang_de).
	Lr *string `json:"lr" api:"lr"`
	// Page number / offset used for pagination. Default: 1.
	Page *float64 `json:"page" api:"page"`
	// Maximum number of results to return per page (deprecated). Default: 10.
	Num *float64 `json:"num" api:"num"`
	// Comma-separated list of fields to keep in the response, with dot notation for nested fields (e.g. name,location.city). Does not change the credit cost.
	Fields *string `json:"fields" api:"fields"`
	// Process the request asynchronously: the response is a job_id to poll on /v1/jobs/{id} (see waitForJob). Default: false.
	IsAsync *bool `json:"is_async" api:"is_async"`
	// Return HTTP 200 even when an error occurs; the error is then in the response body. Default: false.
	SoftFail *bool `json:"soft_fail" api:"soft_fail"`
}

GoogleSearchParams holds the parameters of GoogleSearch (GET / POST /v1/google/search). Required fields are plain values; optional fields are pointers (use autom.String, autom.Float, autom.Bool) or nil slices and maps.

type GoogleShoppingParams

type GoogleShoppingParams struct {
	// Query to search on Google Shopping (product name, brand, category).
	Query string `json:"query" api:"query,required"`
	// Page number for pagination (1 = first page). Default: 1.
	Page *float64 `json:"page" api:"page"`
	// Location to localize results (e.g. New York, United States). Generates a UULE parameter automatically.
	Location *string `json:"location" api:"location"`
	// Encoded location parameter (UULE). Use location instead if you don't have a pre-encoded value.
	Uule *string `json:"uule" api:"uule"`
	// Google domain to use for the search. Defaults to google.com. Default: "google.com".
	GoogleDomain *string `json:"google_domain" api:"google_domain"`
	// Country to use for the Google search. Two-letter country code (e.g. us for the United States, uk for United Kingdom, or fr for France). Default: "us".
	Gl *string `json:"gl" api:"gl"`
	// Language to use for the Google search. Two or three-letter language code (e.g. en, es, fr), optionally followed by a region code (e.g. en-gb, es-419). Default: "en".
	Hl *string `json:"hl" api:"hl"`
	// Limit results to one or more countries. Use country{XX} with | as delimiter (e.g. countryFR|countryDE).
	Cr *string `json:"cr" api:"cr"`
	// Limit results to one or more languages. Use lang_{xx} with | as delimiter (e.g. lang_fr|lang_de).
	Lr *string `json:"lr" api:"lr"`
	// Adult content filter. active enables Google SafeSearch; off disables it. Omit to use Google default.
	Safe *string `json:"safe" api:"safe"`
	// Comma-separated list of fields to keep in the response, with dot notation for nested fields (e.g. name,location.city). Does not change the credit cost.
	Fields *string `json:"fields" api:"fields"`
	// Process the request asynchronously: the response is a job_id to poll on /v1/jobs/{id} (see waitForJob). Default: false.
	IsAsync *bool `json:"is_async" api:"is_async"`
	// Return HTTP 200 even when an error occurs; the error is then in the response body. Default: false.
	SoftFail *bool `json:"soft_fail" api:"soft_fail"`
}

GoogleShoppingParams holds the parameters of GoogleShopping (GET / POST /v1/google/shopping). Required fields are plain values; optional fields are pointers (use autom.String, autom.Float, autom.Bool) or nil slices and maps.

type GoogleVideosParams

type GoogleVideosParams struct {
	// The search query you want to run on Google Videos.
	Query string `json:"query" api:"query,required"`
	// Human-readable location to originate the search from. Note: location and uule cannot be used together.
	Location *string `json:"location" api:"location"`
	// Google encoded location parameter. Note: uule and location cannot be used together.
	Uule *string `json:"uule" api:"uule"`
	// Google domain to use for the search. Defaults to google.com. Default: "google.com".
	GoogleDomain *string `json:"google_domain" api:"google_domain"`
	// Country to use for the Google search. Two-letter country code (e.g. us for the United States, uk for United Kingdom, or fr for France).
	Gl *string `json:"gl" api:"gl"`
	// Language to use for the Google search. Two or three-letter language code (e.g. en, es, fr), optionally followed by a region code (e.g. en-gb, es-419).
	Hl *string `json:"hl" api:"hl"`
	// Limit results to one or more countries. Use country{XX} with | as delimiter (e.g. countryFR|countryDE).
	Cr *string `json:"cr" api:"cr"`
	// Limit results to one or more languages. Use lang_{xx} with | as delimiter (e.g. lang_fr|lang_de).
	Lr *string `json:"lr" api:"lr"`
	// Page number for pagination (1 = first page). Default: 1.
	Page float64 `json:"page" api:"page,required"`
	// Maximum number of results per page (e.g. 10). Default: 10.
	Num *float64 `json:"num" api:"num"`
	// Adult content filter. active enables Google SafeSearch; off disables it. Omit to use Google default.
	Safe *string `json:"safe" api:"safe"`
	// Comma-separated list of fields to keep in the response, with dot notation for nested fields (e.g. name,location.city). Does not change the credit cost.
	Fields *string `json:"fields" api:"fields"`
	// Process the request asynchronously: the response is a job_id to poll on /v1/jobs/{id} (see waitForJob). Default: false.
	IsAsync *bool `json:"is_async" api:"is_async"`
	// Return HTTP 200 even when an error occurs; the error is then in the response body. Default: false.
	SoftFail *bool `json:"soft_fail" api:"soft_fail"`
}

GoogleVideosParams holds the parameters of GoogleVideos (GET / POST /v1/google/videos). Required fields are plain values; optional fields are pointers (use autom.String, autom.Float, autom.Bool) or nil slices and maps.

type JobTimeoutError

type JobTimeoutError struct {
	JobID        string
	LastResponse *Response
}

JobTimeoutError reports an async job that did not finish before the deadline.

func (*JobTimeoutError) Error

func (e *JobTimeoutError) Error() string

type JobsParams

type JobsParams struct {
	// The job_id returned by an endpoint called with is_async=true.
	ID string `json:"id" api:"id,required"`
}

JobsParams holds the parameters of Jobs (GET /v1/jobs/{id}). Required fields are plain values; optional fields are pointers (use autom.String, autom.Float, autom.Bool) or nil slices and maps.

type RequestOption

type RequestOption func(*requestOptions)

RequestOption customizes one request.

func WithHeader

func WithHeader(name, value string) RequestOption

WithHeader adds a header to one request.

func WithMaxRetries

func WithMaxRetries(n int) RequestOption

WithMaxRetries overrides the number of retries for one request (0 disables them).

func WithMethod

func WithMethod(method string) RequestOption

WithMethod selects GET or POST. Operations default to GET when they support it.

type Response

type Response struct {
	StatusCode  int
	Header      http.Header
	ContentType string
	// Body holds the raw bytes: JSON text, or a file such as an image or PDF.
	Body []byte
	// IsJSON reports whether the body is JSON (Content-Type application/json or +json).
	IsJSON bool
}

Response is a buffered, successful API response.

func (*Response) Decode

func (r *Response) Decode(v any) error

Decode unmarshals a JSON body into v.

func (*Response) Map

func (r *Response) Map() (map[string]any, error)

Map decodes a JSON object body.

type ResponseDecodingError

type ResponseDecodingError struct {
	Message  string
	Response *Response
	Err      error
}

ResponseDecodingError reports a success response that could not be decoded.

func (*ResponseDecodingError) Error

func (e *ResponseDecodingError) Error() string

func (*ResponseDecodingError) Unwrap

func (e *ResponseDecodingError) Unwrap() error

type SearchParams

type SearchParams struct {
	// Search query.
	Query string `json:"query" api:"query,required"`
	// Engine order. Default auto tries google, brave, bing, duckduckgo, yahoo, then baidu. A comma-separated list is followed as given. ddg and duck mean duckduckgo. Unknown names are ignored. Default: "auto".
	Engines *string `json:"engines" api:"engines"`
	// Country code. Defaults to us when omitted. For example us, fr, gb, de.
	Gl *string `json:"gl" api:"gl"`
	// Language code. Defaults to en when omitted. For example en, fr, de.
	Hl *string `json:"hl" api:"hl"`
	// Comma-separated list of fields to keep in the response, with dot notation for nested fields (e.g. name,location.city). Does not change the credit cost.
	Fields *string `json:"fields" api:"fields"`
	// Process the request asynchronously: the response is a job_id to poll on /v1/jobs/{id} (see waitForJob). Default: false.
	IsAsync *bool `json:"is_async" api:"is_async"`
	// Return HTTP 200 even when an error occurs; the error is then in the response body. Default: false.
	SoftFail *bool `json:"soft_fail" api:"soft_fail"`
}

SearchParams holds the parameters of Search (GET / POST /v1/search). Required fields are plain values; optional fields are pointers (use autom.String, autom.Float, autom.Bool) or nil slices and maps.

type SerializationError

type SerializationError struct {
	Param   string
	Message string
	Err     error
}

SerializationError reports a parameter that is missing or cannot be sent.

func (*SerializationError) Error

func (e *SerializationError) Error() string

func (*SerializationError) Unwrap

func (e *SerializationError) Unwrap() error

type StatsParams

type StatsParams struct {
	// API family to check, for example google. Provide at least engine or path.
	Engine *string `json:"engine" api:"engine"`
	// Specific endpoint to check, for example /v1/google/search. If you also pass engine, use an endpoint from that API.
	Path *string `json:"path" api:"path"`
}

StatsParams holds the parameters of Stats (GET /v1/stats). Required fields are plain values; optional fields are pointers (use autom.String, autom.Float, autom.Bool) or nil slices and maps.

type TransportError

type TransportError struct {
	Message string
	Err     error
}

TransportError reports a failure before a complete HTTP response was received, including client-side timeouts and context cancellation (see Unwrap).

func (*TransportError) Error

func (e *TransportError) Error() string

func (*TransportError) Unwrap

func (e *TransportError) Unwrap() error

type WaitForJobOptions

type WaitForJobOptions struct {
	Interval   time.Duration
	Timeout    time.Duration
	OnProgress func(job map[string]any)
}

WaitForJobOptions configures WaitForJob. The zero value polls after 3 s, then 1.5x longer each time up to 60 s, for up to 12 hours.

type YahooSearchParams

type YahooSearchParams struct {
	// Search query sent to Yahoo Search.
	Query string `json:"query" api:"query,required"`
	// Page number. Page 1 is the first page of results. Default: 1.
	Page *float64 `json:"page" api:"page"`
	// Country code, for example us, fr, gb, de, jp.
	Gl *string `json:"gl" api:"gl"`
	// Language code, for example en, fr, de, ja, zh.
	Hl *string `json:"hl" api:"hl"`
	// Comma-separated list of fields to keep in the response, with dot notation for nested fields (e.g. name,location.city). Does not change the credit cost.
	Fields *string `json:"fields" api:"fields"`
	// Process the request asynchronously: the response is a job_id to poll on /v1/jobs/{id} (see waitForJob). Default: false.
	IsAsync *bool `json:"is_async" api:"is_async"`
	// Return HTTP 200 even when an error occurs; the error is then in the response body. Default: false.
	SoftFail *bool `json:"soft_fail" api:"soft_fail"`
}

YahooSearchParams holds the parameters of YahooSearch (GET / POST /v1/yahoo/search). Required fields are plain values; optional fields are pointers (use autom.String, autom.Float, autom.Bool) or nil slices and maps.

Directories

Path Synopsis
examples
json command
request command
wait-for-job command

Jump to

Keyboard shortcuts

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