Movatterモバイル変換


[0]ホーム

URL:


customsearch

package
v0.257.0Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2025 License:BSD-3-ClauseImports:18Imported by:97

Details

Repository

github.com/googleapis/google-api-go-client

Links

Documentation

Overview

Package customsearch provides access to the Custom Search API.

For product documentation, see:https://developers.google.com/custom-search/v1/introduction

Library status

These client libraries are officially supported by Google. However, thislibrary is considered complete and is in maintenance mode. This meansthat we will address critical bugs and security issues but will not addany new features.

When possible, we recommend using our newer[Cloud Client Libraries for Go](https://pkg.go.dev/cloud.google.com/go)that are still actively being worked and iterated on.

Creating a client

Usage example:

import "google.golang.org/api/customsearch/v1"...ctx := context.Background()customsearchService, err := customsearch.NewService(ctx)

In this example, Google Application Default Credentials are used forauthentication. For information on how to create and obtain ApplicationDefault Credentials, seehttps://developers.google.com/identity/protocols/application-default-credentials.

Other authentication options

To use an API key for authentication (note: some APIs do not support APIkeys), usegoogle.golang.org/api/option.WithAPIKey:

customsearchService, err := customsearch.NewService(ctx, option.WithAPIKey("AIza..."))

To use an OAuth token (e.g., a user token obtained via a three-legged OAuthflow, usegoogle.golang.org/api/option.WithTokenSource:

config := &oauth2.Config{...}// ...token, err := config.Exchange(ctx, ...)customsearchService, err := customsearch.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))

Seegoogle.golang.org/api/option.ClientOption for details on options.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

typeCseListCall

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

func (*CseListCall)C2coff

func (c *CseListCall) C2coff(c2coffstring) *CseListCall

C2coff sets the optional parameter "c2coff": Enables or disables Simplifiedand Traditional Chinese Search(https://developers.google.com/custom-search/docs/json_api_reference#chineseSearch).The default value for this parameter is 0 (zero), meaning that the featureis enabled. Supported values are: * `1`: Disabled * `0`: Enabled (default)

func (*CseListCall)Context

func (c *CseListCall) Context(ctxcontext.Context) *CseListCall

Context sets the context to be used in this call's Do method.

func (*CseListCall)Cr

func (c *CseListCall) Cr(crstring) *CseListCall

Cr sets the optional parameter "cr": Restricts search results to documentsoriginating in a particular country. You may use Boolean operators(https://developers.google.com/custom-search/docs/json_api_reference#booleanOperators)in the cr parameter's value. Google Search determines the country of adocument by analyzing: * the top-level domain (TLD) of the document's URL *the geographic location of the Web server's IP address See the CountryParameter Values(https://developers.google.com/custom-search/docs/json_api_reference#countryCollections)page for a list of valid values for this parameter.

func (*CseListCall)Cx

func (c *CseListCall) Cx(cxstring) *CseListCall

Cx sets the optional parameter "cx": The Programmable Search Engine ID touse for this request.

func (*CseListCall)DateRestrict

func (c *CseListCall) DateRestrict(dateRestrictstring) *CseListCall

DateRestrict sets the optional parameter "dateRestrict": Restricts resultsto URLs based on date. Supported values include: * `d[number]`: requestsresults from the specified number of past days. * `w[number]`: requestsresults from the specified number of past weeks. * `m[number]`: requestsresults from the specified number of past months. * `y[number]`: requestsresults from the specified number of past years.

func (*CseListCall)Do

func (c *CseListCall) Do(opts ...googleapi.CallOption) (*Search,error)

Do executes the "search.cse.list" call.Any non-2xx status code is an error. Response headers are in either*Search.ServerResponse.Header or (if a response was returned at all) inerror.(*googleapi.Error).Header. Use googleapi.IsNotModified to checkwhether the returned error was because http.StatusNotModified was returned.

func (*CseListCall)EnableAlternateSearchHandleradded inv0.195.0

func (c *CseListCall) EnableAlternateSearchHandler(enableAlternateSearchHandlerbool) *CseListCall

EnableAlternateSearchHandler sets the optional parameter"enableAlternateSearchHandler": Enables routing of Programmable SearchEngine requests to an alternate search handler.

func (*CseListCall)ExactTerms

func (c *CseListCall) ExactTerms(exactTermsstring) *CseListCall

ExactTerms sets the optional parameter "exactTerms": Identifies a phrasethat all documents in the search results must contain.

func (*CseListCall)ExcludeTerms

func (c *CseListCall) ExcludeTerms(excludeTermsstring) *CseListCall

ExcludeTerms sets the optional parameter "excludeTerms": Identifies a wordor phrase that should not appear in any documents in the search results.

func (*CseListCall)Fields

func (c *CseListCall) Fields(s ...googleapi.Field) *CseListCall

Fields allows partial responses to be retrieved. Seehttps://developers.google.com/gdata/docs/2.0/basics#PartialResponse for moredetails.

func (*CseListCall)FileType

func (c *CseListCall) FileType(fileTypestring) *CseListCall

FileType sets the optional parameter "fileType": Restricts results to filesof a specified extension. A list of file types indexable by Google can befound in Search Console Help Center(https://support.google.com/webmasters/answer/35287).

func (*CseListCall)Filter

func (c *CseListCall) Filter(filterstring) *CseListCall

Filter sets the optional parameter "filter": Controls turning on or off theduplicate content filter. * See Automatic Filtering(https://developers.google.com/custom-search/docs/json_api_reference#automaticFiltering)for more information about Google's search results filters. Note that hostcrowding filtering applies only to multi-site searches. * By default, Googleapplies filtering to all search results to improve the quality of thoseresults. Acceptable values are: * `0`: Turns off duplicate content filter. *`1`: Turns on duplicate content filter.

func (*CseListCall)Gl

func (c *CseListCall) Gl(glstring) *CseListCall

Gl sets the optional parameter "gl": Geolocation of end user. * The `gl`parameter value is a two-letter country code. The `gl` parameter boostssearch results whose country of origin matches the parameter value. See theCountry Codes(https://developers.google.com/custom-search/docs/json_api_reference#countryCodes)page for a list of valid values. * Specifying a `gl` parameter value shouldlead to more relevant results. This is particularly true for internationalcustomers and, even more specifically, for customers in English- speakingcountries other than the United States.

func (*CseListCall)Googlehost

func (c *CseListCall) Googlehost(googlehoststring) *CseListCall

Googlehost sets the optional parameter "googlehost": **Deprecated**. Use the`gl` parameter for a similar effect. The local Google domain (for example,google.com, google.de, or google.fr) to use to perform the search.

func (*CseListCall)Header

func (c *CseListCall) Header()http.Header

Header returns a http.Header that can be modified by the caller to addheaders to the request.

func (*CseListCall)HighRange

func (c *CseListCall) HighRange(highRangestring) *CseListCall

HighRange sets the optional parameter "highRange": Specifies the endingvalue for a search range. * Use `lowRange` and `highRange` to append aninclusive search range of `lowRange...highRange` to the query.

func (*CseListCall)Hl

func (c *CseListCall) Hl(hlstring) *CseListCall

Hl sets the optional parameter "hl": Sets the user interface language. *Explicitly setting this parameter improves the performance and the qualityof your search results. * See the Interface Languages(https://developers.google.com/custom-search/docs/json_api_reference#wsInterfaceLanguages)section of Internationalizing Queries and Results Presentation(https://developers.google.com/custom-search/docs/json_api_reference#wsInternationalizing)for more information, and Supported Interface Languages(https://developers.google.com/custom-search/docs/json_api_reference#interfaceLanguages)for a list of supported languages.

func (*CseListCall)Hq

func (c *CseListCall) Hq(hqstring) *CseListCall

Hq sets the optional parameter "hq": Appends the specified query terms tothe query, as if they were combined with a logical AND operator.

func (*CseListCall)IfNoneMatch

func (c *CseListCall) IfNoneMatch(entityTagstring) *CseListCall

IfNoneMatch sets an optional parameter which makes the operation fail if theobject's ETag matches the given value. This is useful for getting updatesonly after the object has changed since the last request.

func (*CseListCall)ImgColorType

func (c *CseListCall) ImgColorType(imgColorTypestring) *CseListCall

ImgColorType sets the optional parameter "imgColorType": Returns black andwhite, grayscale, transparent, or color images. Acceptable values are: *"color" * "gray" * "mono": black and white * "trans": transparentbackground

Possible values:

"imgColorTypeUndefined" - No image color type specified."mono" - Black and white images only."gray" - Grayscale images only."color" - Color images only."trans" - Images with transparent background

func (*CseListCall)ImgDominantColor

func (c *CseListCall) ImgDominantColor(imgDominantColorstring) *CseListCall

ImgDominantColor sets the optional parameter "imgDominantColor": Returnsimages of a specific dominant color. Acceptable values are: * "black" *"blue" * "brown" * "gray" * "green" * "orange" * "pink" *"purple" * "red" * "teal" * "white" * "yellow"

Possible values:

"imgDominantColorUndefined" - No dominant color specified."black" - Predominantly black images only."blue" - Predominantly blue images only."brown" - Predominantly brown images only."gray" - Predominantly gray images only."green" - Predominantly green images only."orange" - Predominantly orange images only."pink" - Predominantly pink images only."purple" - Predominantly purple images only."red" - Predominantly red images only."teal" - Predominantly teal images only."white" - Predominantly white images only."yellow" - Predominantly yellow images only.

func (*CseListCall)ImgSize

func (c *CseListCall) ImgSize(imgSizestring) *CseListCall

ImgSize sets the optional parameter "imgSize": Returns images of a specifiedsize. Acceptable values are: * "huge" * "icon" * "large" * "medium"* "small" * "xlarge" * "xxlarge"

Possible values:

"imgSizeUndefined" - No image size specified."HUGE" - Only the largest possible images."ICON" - Only very small icon-sized images."LARGE" - Only large images."MEDIUM" - Only medium images."SMALL" - Only small images."XLARGE" - Only very large images."XXLARGE" - Only extremely large images.

func (*CseListCall)ImgType

func (c *CseListCall) ImgType(imgTypestring) *CseListCall

ImgType sets the optional parameter "imgType": Returns images of a type.Acceptable values are: * "clipart" * "face" * "lineart" * "stock" *"photo" * "animated"

Possible values:

"imgTypeUndefined" - No image type specified."clipart" - Clipart-style images only."face" - Images of faces only."lineart" - Line art images only."stock" - Stock images only."photo" - Photo images only."animated" - Animated images only.

func (*CseListCall)LinkSite

func (c *CseListCall) LinkSite(linkSitestring) *CseListCall

LinkSite sets the optional parameter "linkSite": Specifies that all searchresults should contain a link to a particular URL.

func (*CseListCall)LowRange

func (c *CseListCall) LowRange(lowRangestring) *CseListCall

LowRange sets the optional parameter "lowRange": Specifies the startingvalue for a search range. Use `lowRange` and `highRange` to append aninclusive search range of `lowRange...highRange` to the query.

func (*CseListCall)Lr

func (c *CseListCall) Lr(lrstring) *CseListCall

Lr sets the optional parameter "lr": Restricts the search to documentswritten in a particular language (e.g., `lr=lang_ja`). Acceptable valuesare: * "lang_ar": Arabic * "lang_bg": Bulgarian * "lang_ca": Catalan *"lang_cs": Czech * "lang_da": Danish * "lang_de": German *"lang_el": Greek * "lang_en": English * "lang_es": Spanish *"lang_et": Estonian * "lang_fi": Finnish * "lang_fr": French *"lang_hr": Croatian * "lang_hu": Hungarian * "lang_id": Indonesian *"lang_is": Icelandic * "lang_it": Italian * "lang_iw": Hebrew *"lang_ja": Japanese * "lang_ko": Korean * "lang_lt": Lithuanian *"lang_lv": Latvian * "lang_nl": Dutch * "lang_no": Norwegian *"lang_pl": Polish * "lang_pt": Portuguese * "lang_ro": Romanian *"lang_ru": Russian * "lang_sk": Slovak * "lang_sl": Slovenian *"lang_sr": Serbian * "lang_sv": Swedish * "lang_tr": Turkish *"lang_zh-CN": Chinese (Simplified) * "lang_zh-TW": Chinese (Traditional)

func (*CseListCall)Num

func (c *CseListCall) Num(numint64) *CseListCall

Num sets the optional parameter "num": Number of search results to return. *Valid values are integers between 1 and 10, inclusive.

func (*CseListCall)OrTerms

func (c *CseListCall) OrTerms(orTermsstring) *CseListCall

OrTerms sets the optional parameter "orTerms": Provides additional searchterms to check for in a document, where each document in the search resultsmust contain at least one of the additional search terms.

func (*CseListCall)Qadded inv0.22.0

Q sets the optional parameter "q": Query

func (*CseListCall)RelatedSite

func (c *CseListCall) RelatedSite(relatedSitestring) *CseListCall

RelatedSite sets the optional parameter "relatedSite": Deprecated.

func (*CseListCall)Rights

func (c *CseListCall) Rights(rightsstring) *CseListCall

Rights sets the optional parameter "rights": Filters based on licensing.Supported values include: `cc_publicdomain`, `cc_attribute`,`cc_sharealike`, `cc_noncommercial`, `cc_nonderived` and combinations ofthese. See typical combinations(https://wiki.creativecommons.org/wiki/CC_Search_integration).

func (*CseListCall)Safe

func (c *CseListCall) Safe(safestring) *CseListCall

Safe sets the optional parameter "safe": Search safety level. Acceptablevalues are: * "active": Enables SafeSearch filtering. * "off": DisablesSafeSearch filtering. (default)

Possible values:

"safeUndefined" - SafeSearch mode unspecified. (Falls back to engine's

configuration.)

"active" - Turn SafeSearch on."high" - Deprecated, equivalent to "active"."medium" - Deprecated, equivalent to "active"."off" - Turn SafeSearch off.

func (*CseListCall)SearchType

func (c *CseListCall) SearchType(searchTypestring) *CseListCall

SearchType sets the optional parameter "searchType": Specifies the searchtype: `image`. If unspecified, results are limited to webpages. Acceptablevalues are: * "image": custom image search.

Possible values:

"searchTypeUndefined" - Search type unspecified (defaults to web search)."image" - Image search.

func (*CseListCall)SiteSearch

func (c *CseListCall) SiteSearch(siteSearchstring) *CseListCall

SiteSearch sets the optional parameter "siteSearch": Specifies a given sitewhich should always be included or excluded from results (see`siteSearchFilter` parameter, below).

func (*CseListCall)SiteSearchFilter

func (c *CseListCall) SiteSearchFilter(siteSearchFilterstring) *CseListCall

SiteSearchFilter sets the optional parameter "siteSearchFilter": Controlswhether to include or exclude results from the site named in the`siteSearch` parameter. Acceptable values are: * "e": exclude * "i":include

Possible values:

"siteSearchFilterUndefined" - Filter mode unspecified."e" - Exclude results from the listed sites."i" - Include only results from the listed sites.

func (*CseListCall)SnippetLengthadded inv0.172.0

func (c *CseListCall) SnippetLength(snippetLengthint64) *CseListCall

SnippetLength sets the optional parameter "snippetLength": Maximum length ofsnippet text, in characters, to be returned with results. Note: this featureis limited to specific engines. * Valid values are integers between 161 and1000, inclusive.

func (*CseListCall)Sort

func (c *CseListCall) Sort(sortstring) *CseListCall

Sort sets the optional parameter "sort": The sort expression to apply to theresults. The sort parameter specifies that the results be sorted accordingto the specified expression i.e. sort by date. Example: sort=date(https://developers.google.com/custom-search/docs/structured_search#sort-by-attribute).

func (*CseListCall)Start

func (c *CseListCall) Start(startint64) *CseListCall

Start sets the optional parameter "start": The index of the first result toreturn. The default number of results per page is 10, so `&start=11` wouldstart at the top of the second page of results. **Note**: The JSON API willnever return more than 100 results, even if more than 100 documents matchthe query, so setting the sum of `start + num` to a number greater than 100will produce an error. Also note that the maximum value for `num` is 10.

typeCseService

type CseService struct {Siterestrict *CseSiterestrictService// contains filtered or unexported fields}

funcNewCseService

func NewCseService(s *Service) *CseService

func (*CseService)List

func (r *CseService) List() *CseListCall

List: Returns metadata about the search performed, metadata about the engineused for the search, and the search results.

typeCseSiterestrictListCall

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

func (*CseSiterestrictListCall)C2coff

C2coff sets the optional parameter "c2coff": Enables or disables Simplifiedand Traditional Chinese Search(https://developers.google.com/custom-search/docs/json_api_reference#chineseSearch).The default value for this parameter is 0 (zero), meaning that the featureis enabled. Supported values are: * `1`: Disabled * `0`: Enabled (default)

func (*CseSiterestrictListCall)Context

Context sets the context to be used in this call's Do method.

func (*CseSiterestrictListCall)Cr

Cr sets the optional parameter "cr": Restricts search results to documentsoriginating in a particular country. You may use Boolean operators(https://developers.google.com/custom-search/docs/json_api_reference#booleanOperators)in the cr parameter's value. Google Search determines the country of adocument by analyzing: * the top-level domain (TLD) of the document's URL *the geographic location of the Web server's IP address See the CountryParameter Values(https://developers.google.com/custom-search/docs/json_api_reference#countryCollections)page for a list of valid values for this parameter.

func (*CseSiterestrictListCall)Cx

Cx sets the optional parameter "cx": The Programmable Search Engine ID touse for this request.

func (*CseSiterestrictListCall)DateRestrict

func (c *CseSiterestrictListCall) DateRestrict(dateRestrictstring) *CseSiterestrictListCall

DateRestrict sets the optional parameter "dateRestrict": Restricts resultsto URLs based on date. Supported values include: * `d[number]`: requestsresults from the specified number of past days. * `w[number]`: requestsresults from the specified number of past weeks. * `m[number]`: requestsresults from the specified number of past months. * `y[number]`: requestsresults from the specified number of past years.

func (*CseSiterestrictListCall)Do

Do executes the "search.cse.siterestrict.list" call.Any non-2xx status code is an error. Response headers are in either*Search.ServerResponse.Header or (if a response was returned at all) inerror.(*googleapi.Error).Header. Use googleapi.IsNotModified to checkwhether the returned error was because http.StatusNotModified was returned.

func (*CseSiterestrictListCall)EnableAlternateSearchHandleradded inv0.195.0

func (c *CseSiterestrictListCall) EnableAlternateSearchHandler(enableAlternateSearchHandlerbool) *CseSiterestrictListCall

EnableAlternateSearchHandler sets the optional parameter"enableAlternateSearchHandler": Enables routing of Programmable SearchEngine requests to an alternate search handler.

func (*CseSiterestrictListCall)ExactTerms

func (c *CseSiterestrictListCall) ExactTerms(exactTermsstring) *CseSiterestrictListCall

ExactTerms sets the optional parameter "exactTerms": Identifies a phrasethat all documents in the search results must contain.

func (*CseSiterestrictListCall)ExcludeTerms

func (c *CseSiterestrictListCall) ExcludeTerms(excludeTermsstring) *CseSiterestrictListCall

ExcludeTerms sets the optional parameter "excludeTerms": Identifies a wordor phrase that should not appear in any documents in the search results.

func (*CseSiterestrictListCall)Fields

Fields allows partial responses to be retrieved. Seehttps://developers.google.com/gdata/docs/2.0/basics#PartialResponse for moredetails.

func (*CseSiterestrictListCall)FileType

FileType sets the optional parameter "fileType": Restricts results to filesof a specified extension. A list of file types indexable by Google can befound in Search Console Help Center(https://support.google.com/webmasters/answer/35287).

func (*CseSiterestrictListCall)Filter

Filter sets the optional parameter "filter": Controls turning on or off theduplicate content filter. * See Automatic Filtering(https://developers.google.com/custom-search/docs/json_api_reference#automaticFiltering)for more information about Google's search results filters. Note that hostcrowding filtering applies only to multi-site searches. * By default, Googleapplies filtering to all search results to improve the quality of thoseresults. Acceptable values are: * `0`: Turns off duplicate content filter. *`1`: Turns on duplicate content filter.

func (*CseSiterestrictListCall)Gl

Gl sets the optional parameter "gl": Geolocation of end user. * The `gl`parameter value is a two-letter country code. The `gl` parameter boostssearch results whose country of origin matches the parameter value. See theCountry Codes(https://developers.google.com/custom-search/docs/json_api_reference#countryCodes)page for a list of valid values. * Specifying a `gl` parameter value shouldlead to more relevant results. This is particularly true for internationalcustomers and, even more specifically, for customers in English- speakingcountries other than the United States.

func (*CseSiterestrictListCall)Googlehost

func (c *CseSiterestrictListCall) Googlehost(googlehoststring) *CseSiterestrictListCall

Googlehost sets the optional parameter "googlehost": **Deprecated**. Use the`gl` parameter for a similar effect. The local Google domain (for example,google.com, google.de, or google.fr) to use to perform the search.

func (*CseSiterestrictListCall)Header

Header returns a http.Header that can be modified by the caller to addheaders to the request.

func (*CseSiterestrictListCall)HighRange

HighRange sets the optional parameter "highRange": Specifies the endingvalue for a search range. * Use `lowRange` and `highRange` to append aninclusive search range of `lowRange...highRange` to the query.

func (*CseSiterestrictListCall)Hl

Hl sets the optional parameter "hl": Sets the user interface language. *Explicitly setting this parameter improves the performance and the qualityof your search results. * See the Interface Languages(https://developers.google.com/custom-search/docs/json_api_reference#wsInterfaceLanguages)section of Internationalizing Queries and Results Presentation(https://developers.google.com/custom-search/docs/json_api_reference#wsInternationalizing)for more information, and Supported Interface Languages(https://developers.google.com/custom-search/docs/json_api_reference#interfaceLanguages)for a list of supported languages.

func (*CseSiterestrictListCall)Hq

Hq sets the optional parameter "hq": Appends the specified query terms tothe query, as if they were combined with a logical AND operator.

func (*CseSiterestrictListCall)IfNoneMatch

func (c *CseSiterestrictListCall) IfNoneMatch(entityTagstring) *CseSiterestrictListCall

IfNoneMatch sets an optional parameter which makes the operation fail if theobject's ETag matches the given value. This is useful for getting updatesonly after the object has changed since the last request.

func (*CseSiterestrictListCall)ImgColorType

func (c *CseSiterestrictListCall) ImgColorType(imgColorTypestring) *CseSiterestrictListCall

ImgColorType sets the optional parameter "imgColorType": Returns black andwhite, grayscale, transparent, or color images. Acceptable values are: *"color" * "gray" * "mono": black and white * "trans": transparentbackground

Possible values:

"imgColorTypeUndefined" - No image color type specified."mono" - Black and white images only."gray" - Grayscale images only."color" - Color images only."trans" - Images with transparent background

func (*CseSiterestrictListCall)ImgDominantColor

func (c *CseSiterestrictListCall) ImgDominantColor(imgDominantColorstring) *CseSiterestrictListCall

ImgDominantColor sets the optional parameter "imgDominantColor": Returnsimages of a specific dominant color. Acceptable values are: * "black" *"blue" * "brown" * "gray" * "green" * "orange" * "pink" *"purple" * "red" * "teal" * "white" * "yellow"

Possible values:

"imgDominantColorUndefined" - No dominant color specified."black" - Predominantly black images only."blue" - Predominantly blue images only."brown" - Predominantly brown images only."gray" - Predominantly gray images only."green" - Predominantly green images only."orange" - Predominantly orange images only."pink" - Predominantly pink images only."purple" - Predominantly purple images only."red" - Predominantly red images only."teal" - Predominantly teal images only."white" - Predominantly white images only."yellow" - Predominantly yellow images only.

func (*CseSiterestrictListCall)ImgSize

ImgSize sets the optional parameter "imgSize": Returns images of a specifiedsize. Acceptable values are: * "huge" * "icon" * "large" * "medium"* "small" * "xlarge" * "xxlarge"

Possible values:

"imgSizeUndefined" - No image size specified."HUGE" - Only the largest possible images."ICON" - Only very small icon-sized images."LARGE" - Only large images."MEDIUM" - Only medium images."SMALL" - Only small images."XLARGE" - Only very large images."XXLARGE" - Only extremely large images.

func (*CseSiterestrictListCall)ImgType

ImgType sets the optional parameter "imgType": Returns images of a type.Acceptable values are: * "clipart" * "face" * "lineart" * "stock" *"photo" * "animated"

Possible values:

"imgTypeUndefined" - No image type specified."clipart" - Clipart-style images only."face" - Images of faces only."lineart" - Line art images only."stock" - Stock images only."photo" - Photo images only."animated" - Animated images only.

func (*CseSiterestrictListCall)LinkSite

LinkSite sets the optional parameter "linkSite": Specifies that all searchresults should contain a link to a particular URL.

func (*CseSiterestrictListCall)LowRange

LowRange sets the optional parameter "lowRange": Specifies the startingvalue for a search range. Use `lowRange` and `highRange` to append aninclusive search range of `lowRange...highRange` to the query.

func (*CseSiterestrictListCall)Lr

Lr sets the optional parameter "lr": Restricts the search to documentswritten in a particular language (e.g., `lr=lang_ja`). Acceptable valuesare: * "lang_ar": Arabic * "lang_bg": Bulgarian * "lang_ca": Catalan *"lang_cs": Czech * "lang_da": Danish * "lang_de": German *"lang_el": Greek * "lang_en": English * "lang_es": Spanish *"lang_et": Estonian * "lang_fi": Finnish * "lang_fr": French *"lang_hr": Croatian * "lang_hu": Hungarian * "lang_id": Indonesian *"lang_is": Icelandic * "lang_it": Italian * "lang_iw": Hebrew *"lang_ja": Japanese * "lang_ko": Korean * "lang_lt": Lithuanian *"lang_lv": Latvian * "lang_nl": Dutch * "lang_no": Norwegian *"lang_pl": Polish * "lang_pt": Portuguese * "lang_ro": Romanian *"lang_ru": Russian * "lang_sk": Slovak * "lang_sl": Slovenian *"lang_sr": Serbian * "lang_sv": Swedish * "lang_tr": Turkish *"lang_zh-CN": Chinese (Simplified) * "lang_zh-TW": Chinese (Traditional)

func (*CseSiterestrictListCall)Num

Num sets the optional parameter "num": Number of search results to return. *Valid values are integers between 1 and 10, inclusive.

func (*CseSiterestrictListCall)OrTerms

OrTerms sets the optional parameter "orTerms": Provides additional searchterms to check for in a document, where each document in the search resultsmust contain at least one of the additional search terms.

func (*CseSiterestrictListCall)Qadded inv0.26.0

Q sets the optional parameter "q": Query

func (*CseSiterestrictListCall)RelatedSite

func (c *CseSiterestrictListCall) RelatedSite(relatedSitestring) *CseSiterestrictListCall

RelatedSite sets the optional parameter "relatedSite": Deprecated.

func (*CseSiterestrictListCall)Rights

Rights sets the optional parameter "rights": Filters based on licensing.Supported values include: `cc_publicdomain`, `cc_attribute`,`cc_sharealike`, `cc_noncommercial`, `cc_nonderived` and combinations ofthese. See typical combinations(https://wiki.creativecommons.org/wiki/CC_Search_integration).

func (*CseSiterestrictListCall)Safe

Safe sets the optional parameter "safe": Search safety level. Acceptablevalues are: * "active": Enables SafeSearch filtering. * "off": DisablesSafeSearch filtering. (default)

Possible values:

"safeUndefined" - SafeSearch mode unspecified. (Falls back to engine's

configuration.)

"active" - Turn SafeSearch on."high" - Deprecated, equivalent to "active"."medium" - Deprecated, equivalent to "active"."off" - Turn SafeSearch off.

func (*CseSiterestrictListCall)SearchType

func (c *CseSiterestrictListCall) SearchType(searchTypestring) *CseSiterestrictListCall

SearchType sets the optional parameter "searchType": Specifies the searchtype: `image`. If unspecified, results are limited to webpages. Acceptablevalues are: * "image": custom image search.

Possible values:

"searchTypeUndefined" - Search type unspecified (defaults to web search)."image" - Image search.

func (*CseSiterestrictListCall)SiteSearch

func (c *CseSiterestrictListCall) SiteSearch(siteSearchstring) *CseSiterestrictListCall

SiteSearch sets the optional parameter "siteSearch": Specifies a given sitewhich should always be included or excluded from results (see`siteSearchFilter` parameter, below).

func (*CseSiterestrictListCall)SiteSearchFilter

func (c *CseSiterestrictListCall) SiteSearchFilter(siteSearchFilterstring) *CseSiterestrictListCall

SiteSearchFilter sets the optional parameter "siteSearchFilter": Controlswhether to include or exclude results from the site named in the`siteSearch` parameter. Acceptable values are: * "e": exclude * "i":include

Possible values:

"siteSearchFilterUndefined" - Filter mode unspecified."e" - Exclude results from the listed sites."i" - Include only results from the listed sites.

func (*CseSiterestrictListCall)SnippetLengthadded inv0.172.0

func (c *CseSiterestrictListCall) SnippetLength(snippetLengthint64) *CseSiterestrictListCall

SnippetLength sets the optional parameter "snippetLength": Maximum length ofsnippet text, in characters, to be returned with results. Note: this featureis limited to specific engines. * Valid values are integers between 161 and1000, inclusive.

func (*CseSiterestrictListCall)Sort

Sort sets the optional parameter "sort": The sort expression to apply to theresults. The sort parameter specifies that the results be sorted accordingto the specified expression i.e. sort by date. Example: sort=date(https://developers.google.com/custom-search/docs/structured_search#sort-by-attribute).

func (*CseSiterestrictListCall)Start

Start sets the optional parameter "start": The index of the first result toreturn. The default number of results per page is 10, so `&start=11` wouldstart at the top of the second page of results. **Note**: The JSON API willnever return more than 100 results, even if more than 100 documents matchthe query, so setting the sum of `start + num` to a number greater than 100will produce an error. Also note that the maximum value for `num` is 10.

typeCseSiterestrictService

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

funcNewCseSiterestrictService

func NewCseSiterestrictService(s *Service) *CseSiterestrictService

func (*CseSiterestrictService)List

List: Returns metadata about the search performed, metadata about the engineused for the search, and the search results. Uses a small set of urlpatterns.

typePromotion

type Promotion struct {// BodyLines: An array of block objects for this promotion.BodyLines []*PromotionBodyLines `json:"bodyLines,omitempty"`// DisplayLink: An abridged version of this search's result URL, e.g.// www.example.com.DisplayLinkstring `json:"displayLink,omitempty"`// HtmlTitle: The title of the promotion, in HTML.HtmlTitlestring `json:"htmlTitle,omitempty"`// Image: Image belonging to a promotion.Image *PromotionImage `json:"image,omitempty"`// Link: The URL of the promotion.Linkstring `json:"link,omitempty"`// Title: The title of the promotion.Titlestring `json:"title,omitempty"`// ForceSendFields is a list of field names (e.g. "BodyLines") to// unconditionally include in API requests. By default, fields with empty or// default values are omitted from API requests. See//https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more// details.ForceSendFields []string `json:"-"`// NullFields is a list of field names (e.g. "BodyLines") to include in API// requests with the JSON null value. By default, fields with empty values are// omitted from API requests. See//https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.NullFields []string `json:"-"`}

Promotion: Promotion result.

func (Promotion)MarshalJSON

func (sPromotion) MarshalJSON() ([]byte,error)

typePromotionBodyLines

type PromotionBodyLines struct {// HtmlTitle: The block object's text in HTML, if it has text.HtmlTitlestring `json:"htmlTitle,omitempty"`// Link: The anchor text of the block object's link, if it has a link.Linkstring `json:"link,omitempty"`// Title: The block object's text, if it has text.Titlestring `json:"title,omitempty"`// Url: The URL of the block object's link, if it has one.Urlstring `json:"url,omitempty"`// ForceSendFields is a list of field names (e.g. "HtmlTitle") to// unconditionally include in API requests. By default, fields with empty or// default values are omitted from API requests. See//https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more// details.ForceSendFields []string `json:"-"`// NullFields is a list of field names (e.g. "HtmlTitle") to include in API// requests with the JSON null value. By default, fields with empty values are// omitted from API requests. See//https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.NullFields []string `json:"-"`}

PromotionBodyLines: Block object belonging to a promotion.

func (PromotionBodyLines)MarshalJSON

func (sPromotionBodyLines) MarshalJSON() ([]byte,error)

typePromotionImage

type PromotionImage struct {// Height: Image height in pixels.Heightint64 `json:"height,omitempty"`// Source: URL of the image for this promotion link.Sourcestring `json:"source,omitempty"`// Width: Image width in pixels.Widthint64 `json:"width,omitempty"`// ForceSendFields is a list of field names (e.g. "Height") to unconditionally// include in API requests. By default, fields with empty or default values are// omitted from API requests. See//https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more// details.ForceSendFields []string `json:"-"`// NullFields is a list of field names (e.g. "Height") to include in API// requests with the JSON null value. By default, fields with empty values are// omitted from API requests. See//https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.NullFields []string `json:"-"`}

PromotionImage: Image belonging to a promotion.

func (PromotionImage)MarshalJSON

func (sPromotionImage) MarshalJSON() ([]byte,error)

typeResult

type Result struct {// CacheId: Indicates the ID of Google's cached version of the search result.CacheIdstring `json:"cacheId,omitempty"`// DisplayLink: An abridged version of this search result’s URL, e.g.// www.example.com.DisplayLinkstring `json:"displayLink,omitempty"`// FileFormat: The file format of the search result.FileFormatstring `json:"fileFormat,omitempty"`// FormattedUrl: The URL displayed after the snippet for each search result.FormattedUrlstring `json:"formattedUrl,omitempty"`// HtmlFormattedUrl: The HTML-formatted URL displayed after the snippet for// each search result.HtmlFormattedUrlstring `json:"htmlFormattedUrl,omitempty"`// HtmlSnippet: The snippet of the search result, in HTML.HtmlSnippetstring `json:"htmlSnippet,omitempty"`// HtmlTitle: The title of the search result, in HTML.HtmlTitlestring `json:"htmlTitle,omitempty"`// Image: Image belonging to a custom search result.Image *ResultImage `json:"image,omitempty"`// Kind: A unique identifier for the type of current object. For this API, it// is `customsearch#result.`Kindstring `json:"kind,omitempty"`// Labels: Encapsulates all information about refinement labels.Labels []*ResultLabels `json:"labels,omitempty"`// Link: The full URL to which the search result is pointing, e.g.//http://www.example.com/foo/bar.Linkstring `json:"link,omitempty"`// Mime: The MIME type of the search result.Mimestring `json:"mime,omitempty"`// Pagemap: Contains PageMap// (https://developers.google.com/custom-search/docs/structured_data#pagemaps)// information for this search result.Pagemapgoogleapi.RawMessage `json:"pagemap,omitempty"`// Snippet: The snippet of the search result, in plain text.Snippetstring `json:"snippet,omitempty"`// Title: The title of the search result, in plain text.Titlestring `json:"title,omitempty"`// ForceSendFields is a list of field names (e.g. "CacheId") to unconditionally// include in API requests. By default, fields with empty or default values are// omitted from API requests. See//https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more// details.ForceSendFields []string `json:"-"`// NullFields is a list of field names (e.g. "CacheId") to include in API// requests with the JSON null value. By default, fields with empty values are// omitted from API requests. See//https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.NullFields []string `json:"-"`}

Result: A custom search result.

func (Result)MarshalJSON

func (sResult) MarshalJSON() ([]byte,error)

typeResultImage

type ResultImage struct {// ByteSize: The size of the image, in bytes.ByteSizeint64 `json:"byteSize,omitempty"`// ContextLink: A URL pointing to the webpage hosting the image.ContextLinkstring `json:"contextLink,omitempty"`// Height: The height of the image, in pixels.Heightint64 `json:"height,omitempty"`// ThumbnailHeight: The height of the thumbnail image, in pixels.ThumbnailHeightint64 `json:"thumbnailHeight,omitempty"`// ThumbnailLink: A URL to the thumbnail image.ThumbnailLinkstring `json:"thumbnailLink,omitempty"`// ThumbnailWidth: The width of the thumbnail image, in pixels.ThumbnailWidthint64 `json:"thumbnailWidth,omitempty"`// Width: The width of the image, in pixels.Widthint64 `json:"width,omitempty"`// ForceSendFields is a list of field names (e.g. "ByteSize") to// unconditionally include in API requests. By default, fields with empty or// default values are omitted from API requests. See//https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more// details.ForceSendFields []string `json:"-"`// NullFields is a list of field names (e.g. "ByteSize") to include in API// requests with the JSON null value. By default, fields with empty values are// omitted from API requests. See//https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.NullFields []string `json:"-"`}

ResultImage: Image belonging to a custom search result.

func (ResultImage)MarshalJSON

func (sResultImage) MarshalJSON() ([]byte,error)

typeResultLabels

type ResultLabels struct {// DisplayName: The display name of a refinement label. This is the name you// should display in your user interface.DisplayNamestring `json:"displayName,omitempty"`// LabelWithOp: Refinement label and the associated refinement operation.LabelWithOpstring `json:"label_with_op,omitempty"`// Name: The name of a refinement label, which you can use to refine searches.// Don't display this in your user interface; instead, use displayName.Namestring `json:"name,omitempty"`// ForceSendFields is a list of field names (e.g. "DisplayName") to// unconditionally include in API requests. By default, fields with empty or// default values are omitted from API requests. See//https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more// details.ForceSendFields []string `json:"-"`// NullFields is a list of field names (e.g. "DisplayName") to include in API// requests with the JSON null value. By default, fields with empty values are// omitted from API requests. See//https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.NullFields []string `json:"-"`}

ResultLabels: Refinement label associated with a custom search result.

func (ResultLabels)MarshalJSON

func (sResultLabels) MarshalJSON() ([]byte,error)

typeSearch

type Search struct {// Context: Metadata and refinements associated with the given search engine,// including: * The name of the search engine that was used for the query. * A// set of facet objects// (https://developers.google.com/custom-search/docs/refinements#create)// (refinements) you can use for refining a search.Contextgoogleapi.RawMessage `json:"context,omitempty"`// Items: The current set of custom search results.Items []*Result `json:"items,omitempty"`// Kind: Unique identifier for the type of current object. For this API, it is// customsearch#search.Kindstring `json:"kind,omitempty"`// Promotions: The set of promotions// (https://developers.google.com/custom-search/docs/promotions). Present only// if the custom search engine's configuration files define any promotions for// the given query.Promotions []*Promotion `json:"promotions,omitempty"`// Queries: Query metadata for the previous, current, and next pages of// results.Queries *SearchQueries `json:"queries,omitempty"`// SearchInformation: Metadata about a search operation.SearchInformation *SearchSearchInformation `json:"searchInformation,omitempty"`// Spelling: Spell correction information for a query.Spelling *SearchSpelling `json:"spelling,omitempty"`// Url: OpenSearch template and URL.Url *SearchUrl `json:"url,omitempty"`// ServerResponse contains the HTTP response code and headers from the server.googleapi.ServerResponse `json:"-"`// ForceSendFields is a list of field names (e.g. "Context") to unconditionally// include in API requests. By default, fields with empty or default values are// omitted from API requests. See//https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more// details.ForceSendFields []string `json:"-"`// NullFields is a list of field names (e.g. "Context") to include in API// requests with the JSON null value. By default, fields with empty values are// omitted from API requests. See//https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.NullFields []string `json:"-"`}

Search: Response to a custom search request.

func (Search)MarshalJSON

func (sSearch) MarshalJSON() ([]byte,error)

typeSearchQueriesadded inv0.22.0

type SearchQueries struct {// NextPage: Metadata representing the next page of results, if applicable.NextPage []*SearchQueriesNextPage `json:"nextPage,omitempty"`// PreviousPage: Metadata representing the previous page of results, if// applicable.PreviousPage []*SearchQueriesPreviousPage `json:"previousPage,omitempty"`// Request: Metadata representing the current request.Request []*SearchQueriesRequest `json:"request,omitempty"`// ForceSendFields is a list of field names (e.g. "NextPage") to// unconditionally include in API requests. By default, fields with empty or// default values are omitted from API requests. See//https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more// details.ForceSendFields []string `json:"-"`// NullFields is a list of field names (e.g. "NextPage") to include in API// requests with the JSON null value. By default, fields with empty values are// omitted from API requests. See//https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.NullFields []string `json:"-"`}

SearchQueries: Query metadata for the previous, current, and next pages ofresults.

func (SearchQueries)MarshalJSONadded inv0.22.0

func (sSearchQueries) MarshalJSON() ([]byte,error)

typeSearchQueriesNextPageadded inv0.22.0

type SearchQueriesNextPage struct {// Count: Number of search results returned in this set.Countint64 `json:"count,omitempty"`// Cr: Restricts search results to documents originating in a particular// country. You may use Boolean operators// (https://developers.google.com/custom-search/docs/json_api_reference#BooleanOrSearch)// in the `cr` parameter's value. Google WebSearch determines the country of a// document by analyzing the following: * The top-level domain (TLD) of the// document's URL. * The geographic location of the web server's IP address.// See Country (cr) Parameter Values// (https://developers.google.com/custom-search/docs/json_api_reference#countryCollections)// for a list of valid values for this parameter.Crstring `json:"cr,omitempty"`// Cx: The identifier of an engine created using the Programmable Search Engine// Control Panel (https://programmablesearchengine.google.com/). This is a// custom property not defined in the OpenSearch spec. This parameter is// **required**.Cxstring `json:"cx,omitempty"`// DateRestrict: Restricts results to URLs based on date. Supported values// include: * `d[number]`: requests results from the specified number of past// days. * `w[number]`: requests results from the specified number of past// weeks. * `m[number]`: requests results from the specified number of past// months. * `y[number]`: requests results from the specified number of past// years.DateRestrictstring `json:"dateRestrict,omitempty"`// DisableCnTwTranslation: Enables or disables the Simplified and Traditional// Chinese Search// (https://developers.google.com/custom-search/docs/json_api_reference#chineseSearch)// feature. Supported values are: * `0`: enabled (default) * `1`: disabledDisableCnTwTranslationstring `json:"disableCnTwTranslation,omitempty"`// ExactTerms: Identifies a phrase that all documents in the search results// must contain.ExactTermsstring `json:"exactTerms,omitempty"`// ExcludeTerms: Identifies a word or phrase that should not appear in any// documents in the search results.ExcludeTermsstring `json:"excludeTerms,omitempty"`// FileType: Restricts results to files of a specified extension. Filetypes// supported by Google include: * Adobe Portable Document Format (`pdf`) *// Adobe PostScript (`ps`) * Lotus 1-2-3 (`wk1`, `wk2`, `wk3`, `wk4`, `wk5`,// `wki`, `wks`, `wku`) * Lotus WordPro (`lwp`) * Macwrite (`mw`) * Microsoft// Excel (`xls`) * Microsoft PowerPoint (`ppt`) * Microsoft Word (`doc`) *// Microsoft Works (`wks`, `wps`, `wdb`) * Microsoft Write (`wri`) * Rich Text// Format (`rtf`) * Shockwave Flash (`swf`) * Text (`ans`, `txt`). Additional// filetypes may be added in the future. An up-to-date list can always be found// in Google's file type FAQ// (https://support.google.com/webmasters/answer/35287).FileTypestring `json:"fileType,omitempty"`// Filter: Activates or deactivates the automatic filtering of Google search// results. See Automatic Filtering// (https://developers.google.com/custom-search/docs/json_api_reference#automaticFiltering)// for more information about Google's search results filters. Valid values for// this parameter are: * `0`: Disabled * `1`: Enabled (default) **Note**: By// default, Google applies filtering to all search results to improve the// quality of those results.Filterstring `json:"filter,omitempty"`// Gl: Boosts search results whose country of origin matches the parameter// value. See Country Codes// (https://developers.google.com/custom-search/docs/json_api_reference#countryCodes)// for a list of valid values. Specifying a `gl` parameter value in WebSearch// requests should improve the relevance of results. This is particularly true// for international customers and, even more specifically, for customers in// English-speaking countries other than the United States.Glstring `json:"gl,omitempty"`// GoogleHost: Specifies the Google domain (for example, google.com, google.de,// or google.fr) to which the search should be limited.GoogleHoststring `json:"googleHost,omitempty"`// HighRange: Specifies the ending value for a search range. Use `cse:lowRange`// and `cse:highrange` to append an inclusive search range of// `lowRange...highRange` to the query.HighRangestring `json:"highRange,omitempty"`// Hl: Specifies the interface language (host language) of your user interface.// Explicitly setting this parameter improves the performance and the quality// of your search results. See the Interface Languages// (https://developers.google.com/custom-search/docs/json_api_reference#wsInterfaceLanguages)// section of Internationalizing Queries and Results Presentation// (https://developers.google.com/custom-search/docs/json_api_reference#wsInternationalizing)// for more information, and Supported Interface Languages// (https://developers.google.com/custom-search/docs/json_api_reference#interfaceLanguages)// for a list of supported languages.Hlstring `json:"hl,omitempty"`// Hq: Appends the specified query terms to the query, as if they were combined// with a logical `AND` operator.Hqstring `json:"hq,omitempty"`// ImgColorType: Restricts results to images of a specified color type.// Supported values are: * `mono` (black and white) * `gray` (grayscale) *// `color` (color)ImgColorTypestring `json:"imgColorType,omitempty"`// ImgDominantColor: Restricts results to images with a specific dominant// color. Supported values are: * `red` * `orange` * `yellow` * `green` *// `teal` * `blue` * `purple` * `pink` * `white` * `gray` * `black` * `brown`ImgDominantColorstring `json:"imgDominantColor,omitempty"`// ImgSize: Restricts results to images of a specified size. Supported values// are: * `icon` (small) * `small | medium | large | xlarge` (medium) *// `xxlarge` (large) * `huge` (extra-large)ImgSizestring `json:"imgSize,omitempty"`// ImgType: Restricts results to images of a specified type. Supported values// are: * `clipart` (Clip art) * `face` (Face) * `lineart` (Line drawing) *// `photo` (Photo) * `animated` (Animated) * `stock` (Stock)ImgTypestring `json:"imgType,omitempty"`// InputEncoding: The character encoding supported for search requests.InputEncodingstring `json:"inputEncoding,omitempty"`// Language: The language of the search results.Languagestring `json:"language,omitempty"`// LinkSite: Specifies that all results should contain a link to a specific// URL.LinkSitestring `json:"linkSite,omitempty"`// LowRange: Specifies the starting value for a search range. Use// `cse:lowRange` and `cse:highrange` to append an inclusive search range of// `lowRange...highRange` to the query.LowRangestring `json:"lowRange,omitempty"`// OrTerms: Provides additional search terms to check for in a document, where// each document in the search results must contain at least one of the// additional search terms. You can also use the Boolean OR// (https://developers.google.com/custom-search/docs/json_api_reference#BooleanOrSearch)// query term for this type of query.OrTermsstring `json:"orTerms,omitempty"`// OutputEncoding: The character encoding supported for search results.OutputEncodingstring `json:"outputEncoding,omitempty"`// RelatedSite: Specifies that all search results should be pages that are// related to the specified URL. The parameter value should be a URL.RelatedSitestring `json:"relatedSite,omitempty"`// Rights: Filters based on licensing. Supported values include: *// `cc_publicdomain` * `cc_attribute` * `cc_sharealike` * `cc_noncommercial` *// `cc_nonderived`Rightsstring `json:"rights,omitempty"`// Safe: Specifies the SafeSearch level// (https://developers.google.com/custom-search/docs/json_api_reference#safeSearchLevels)// used for filtering out adult results. This is a custom property not defined// in the OpenSearch spec. Valid parameter values are: * "off": Disable// SafeSearch * "active": Enable SafeSearchSafestring `json:"safe,omitempty"`// SearchTerms: The search terms entered by the user.SearchTermsstring `json:"searchTerms,omitempty"`// SearchType: Allowed values are `web` or `image`. If unspecified, results are// limited to webpages.SearchTypestring `json:"searchType,omitempty"`// SiteSearch: Restricts results to URLs from a specified site.SiteSearchstring `json:"siteSearch,omitempty"`// SiteSearchFilter: Specifies whether to include or exclude results from the// site named in the `sitesearch` parameter. Supported values are: * `i`:// include content from site * `e`: exclude content from siteSiteSearchFilterstring `json:"siteSearchFilter,omitempty"`// Sort: Specifies that results should be sorted according to the specified// expression. For example, sort by date.Sortstring `json:"sort,omitempty"`// StartIndex: The index of the current set of search results into the total// set of results, where the index of the first result is 1.StartIndexint64 `json:"startIndex,omitempty"`// StartPage: The page number of this set of results, where the page length is// set by the `count` property.StartPageint64 `json:"startPage,omitempty"`// Title: A description of the query.Titlestring `json:"title,omitempty"`// TotalResults: Estimated number of total search results. May not be accurate.TotalResultsint64 `json:"totalResults,omitempty,string"`// ForceSendFields is a list of field names (e.g. "Count") to unconditionally// include in API requests. By default, fields with empty or default values are// omitted from API requests. See//https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more// details.ForceSendFields []string `json:"-"`// NullFields is a list of field names (e.g. "Count") to include in API// requests with the JSON null value. By default, fields with empty values are// omitted from API requests. See//https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.NullFields []string `json:"-"`}

SearchQueriesNextPage: Custom search request metadata.

func (SearchQueriesNextPage)MarshalJSONadded inv0.22.0

func (sSearchQueriesNextPage) MarshalJSON() ([]byte,error)

typeSearchQueriesPreviousPageadded inv0.22.0

type SearchQueriesPreviousPage struct {// Count: Number of search results returned in this set.Countint64 `json:"count,omitempty"`// Cr: Restricts search results to documents originating in a particular// country. You may use Boolean operators// (https://developers.google.com/custom-search/docs/json_api_reference#BooleanOrSearch)// in the `cr` parameter's value. Google WebSearch determines the country of a// document by analyzing the following: * The top-level domain (TLD) of the// document's URL. * The geographic location of the web server's IP address.// See Country (cr) Parameter Values// (https://developers.google.com/custom-search/docs/json_api_reference#countryCollections)// for a list of valid values for this parameter.Crstring `json:"cr,omitempty"`// Cx: The identifier of an engine created using the Programmable Search Engine// Control Panel (https://programmablesearchengine.google.com/). This is a// custom property not defined in the OpenSearch spec. This parameter is// **required**.Cxstring `json:"cx,omitempty"`// DateRestrict: Restricts results to URLs based on date. Supported values// include: * `d[number]`: requests results from the specified number of past// days. * `w[number]`: requests results from the specified number of past// weeks. * `m[number]`: requests results from the specified number of past// months. * `y[number]`: requests results from the specified number of past// years.DateRestrictstring `json:"dateRestrict,omitempty"`// DisableCnTwTranslation: Enables or disables the Simplified and Traditional// Chinese Search// (https://developers.google.com/custom-search/docs/json_api_reference#chineseSearch)// feature. Supported values are: * `0`: enabled (default) * `1`: disabledDisableCnTwTranslationstring `json:"disableCnTwTranslation,omitempty"`// ExactTerms: Identifies a phrase that all documents in the search results// must contain.ExactTermsstring `json:"exactTerms,omitempty"`// ExcludeTerms: Identifies a word or phrase that should not appear in any// documents in the search results.ExcludeTermsstring `json:"excludeTerms,omitempty"`// FileType: Restricts results to files of a specified extension. Filetypes// supported by Google include: * Adobe Portable Document Format (`pdf`) *// Adobe PostScript (`ps`) * Lotus 1-2-3 (`wk1`, `wk2`, `wk3`, `wk4`, `wk5`,// `wki`, `wks`, `wku`) * Lotus WordPro (`lwp`) * Macwrite (`mw`) * Microsoft// Excel (`xls`) * Microsoft PowerPoint (`ppt`) * Microsoft Word (`doc`) *// Microsoft Works (`wks`, `wps`, `wdb`) * Microsoft Write (`wri`) * Rich Text// Format (`rtf`) * Shockwave Flash (`swf`) * Text (`ans`, `txt`). Additional// filetypes may be added in the future. An up-to-date list can always be found// in Google's file type FAQ// (https://support.google.com/webmasters/answer/35287).FileTypestring `json:"fileType,omitempty"`// Filter: Activates or deactivates the automatic filtering of Google search// results. See Automatic Filtering// (https://developers.google.com/custom-search/docs/json_api_reference#automaticFiltering)// for more information about Google's search results filters. Valid values for// this parameter are: * `0`: Disabled * `1`: Enabled (default) **Note**: By// default, Google applies filtering to all search results to improve the// quality of those results.Filterstring `json:"filter,omitempty"`// Gl: Boosts search results whose country of origin matches the parameter// value. See Country Codes// (https://developers.google.com/custom-search/docs/json_api_reference#countryCodes)// for a list of valid values. Specifying a `gl` parameter value in WebSearch// requests should improve the relevance of results. This is particularly true// for international customers and, even more specifically, for customers in// English-speaking countries other than the United States.Glstring `json:"gl,omitempty"`// GoogleHost: Specifies the Google domain (for example, google.com, google.de,// or google.fr) to which the search should be limited.GoogleHoststring `json:"googleHost,omitempty"`// HighRange: Specifies the ending value for a search range. Use `cse:lowRange`// and `cse:highrange` to append an inclusive search range of// `lowRange...highRange` to the query.HighRangestring `json:"highRange,omitempty"`// Hl: Specifies the interface language (host language) of your user interface.// Explicitly setting this parameter improves the performance and the quality// of your search results. See the Interface Languages// (https://developers.google.com/custom-search/docs/json_api_reference#wsInterfaceLanguages)// section of Internationalizing Queries and Results Presentation// (https://developers.google.com/custom-search/docs/json_api_reference#wsInternationalizing)// for more information, and Supported Interface Languages// (https://developers.google.com/custom-search/docs/json_api_reference#interfaceLanguages)// for a list of supported languages.Hlstring `json:"hl,omitempty"`// Hq: Appends the specified query terms to the query, as if they were combined// with a logical `AND` operator.Hqstring `json:"hq,omitempty"`// ImgColorType: Restricts results to images of a specified color type.// Supported values are: * `mono` (black and white) * `gray` (grayscale) *// `color` (color)ImgColorTypestring `json:"imgColorType,omitempty"`// ImgDominantColor: Restricts results to images with a specific dominant// color. Supported values are: * `red` * `orange` * `yellow` * `green` *// `teal` * `blue` * `purple` * `pink` * `white` * `gray` * `black` * `brown`ImgDominantColorstring `json:"imgDominantColor,omitempty"`// ImgSize: Restricts results to images of a specified size. Supported values// are: * `icon` (small) * `small | medium | large | xlarge` (medium) *// `xxlarge` (large) * `huge` (extra-large)ImgSizestring `json:"imgSize,omitempty"`// ImgType: Restricts results to images of a specified type. Supported values// are: * `clipart` (Clip art) * `face` (Face) * `lineart` (Line drawing) *// `photo` (Photo) * `animated` (Animated) * `stock` (Stock)ImgTypestring `json:"imgType,omitempty"`// InputEncoding: The character encoding supported for search requests.InputEncodingstring `json:"inputEncoding,omitempty"`// Language: The language of the search results.Languagestring `json:"language,omitempty"`// LinkSite: Specifies that all results should contain a link to a specific// URL.LinkSitestring `json:"linkSite,omitempty"`// LowRange: Specifies the starting value for a search range. Use// `cse:lowRange` and `cse:highrange` to append an inclusive search range of// `lowRange...highRange` to the query.LowRangestring `json:"lowRange,omitempty"`// OrTerms: Provides additional search terms to check for in a document, where// each document in the search results must contain at least one of the// additional search terms. You can also use the Boolean OR// (https://developers.google.com/custom-search/docs/json_api_reference#BooleanOrSearch)// query term for this type of query.OrTermsstring `json:"orTerms,omitempty"`// OutputEncoding: The character encoding supported for search results.OutputEncodingstring `json:"outputEncoding,omitempty"`// RelatedSite: Specifies that all search results should be pages that are// related to the specified URL. The parameter value should be a URL.RelatedSitestring `json:"relatedSite,omitempty"`// Rights: Filters based on licensing. Supported values include: *// `cc_publicdomain` * `cc_attribute` * `cc_sharealike` * `cc_noncommercial` *// `cc_nonderived`Rightsstring `json:"rights,omitempty"`// Safe: Specifies the SafeSearch level// (https://developers.google.com/custom-search/docs/json_api_reference#safeSearchLevels)// used for filtering out adult results. This is a custom property not defined// in the OpenSearch spec. Valid parameter values are: * "off": Disable// SafeSearch * "active": Enable SafeSearchSafestring `json:"safe,omitempty"`// SearchTerms: The search terms entered by the user.SearchTermsstring `json:"searchTerms,omitempty"`// SearchType: Allowed values are `web` or `image`. If unspecified, results are// limited to webpages.SearchTypestring `json:"searchType,omitempty"`// SiteSearch: Restricts results to URLs from a specified site.SiteSearchstring `json:"siteSearch,omitempty"`// SiteSearchFilter: Specifies whether to include or exclude results from the// site named in the `sitesearch` parameter. Supported values are: * `i`:// include content from site * `e`: exclude content from siteSiteSearchFilterstring `json:"siteSearchFilter,omitempty"`// Sort: Specifies that results should be sorted according to the specified// expression. For example, sort by date.Sortstring `json:"sort,omitempty"`// StartIndex: The index of the current set of search results into the total// set of results, where the index of the first result is 1.StartIndexint64 `json:"startIndex,omitempty"`// StartPage: The page number of this set of results, where the page length is// set by the `count` property.StartPageint64 `json:"startPage,omitempty"`// Title: A description of the query.Titlestring `json:"title,omitempty"`// TotalResults: Estimated number of total search results. May not be accurate.TotalResultsint64 `json:"totalResults,omitempty,string"`// ForceSendFields is a list of field names (e.g. "Count") to unconditionally// include in API requests. By default, fields with empty or default values are// omitted from API requests. See//https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more// details.ForceSendFields []string `json:"-"`// NullFields is a list of field names (e.g. "Count") to include in API// requests with the JSON null value. By default, fields with empty values are// omitted from API requests. See//https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.NullFields []string `json:"-"`}

SearchQueriesPreviousPage: Custom search request metadata.

func (SearchQueriesPreviousPage)MarshalJSONadded inv0.22.0

func (sSearchQueriesPreviousPage) MarshalJSON() ([]byte,error)

typeSearchQueriesRequestadded inv0.22.0

type SearchQueriesRequest struct {// Count: Number of search results returned in this set.Countint64 `json:"count,omitempty"`// Cr: Restricts search results to documents originating in a particular// country. You may use Boolean operators// (https://developers.google.com/custom-search/docs/json_api_reference#BooleanOrSearch)// in the `cr` parameter's value. Google WebSearch determines the country of a// document by analyzing the following: * The top-level domain (TLD) of the// document's URL. * The geographic location of the web server's IP address.// See Country (cr) Parameter Values// (https://developers.google.com/custom-search/docs/json_api_reference#countryCollections)// for a list of valid values for this parameter.Crstring `json:"cr,omitempty"`// Cx: The identifier of an engine created using the Programmable Search Engine// Control Panel (https://programmablesearchengine.google.com/). This is a// custom property not defined in the OpenSearch spec. This parameter is// **required**.Cxstring `json:"cx,omitempty"`// DateRestrict: Restricts results to URLs based on date. Supported values// include: * `d[number]`: requests results from the specified number of past// days. * `w[number]`: requests results from the specified number of past// weeks. * `m[number]`: requests results from the specified number of past// months. * `y[number]`: requests results from the specified number of past// years.DateRestrictstring `json:"dateRestrict,omitempty"`// DisableCnTwTranslation: Enables or disables the Simplified and Traditional// Chinese Search// (https://developers.google.com/custom-search/docs/json_api_reference#chineseSearch)// feature. Supported values are: * `0`: enabled (default) * `1`: disabledDisableCnTwTranslationstring `json:"disableCnTwTranslation,omitempty"`// ExactTerms: Identifies a phrase that all documents in the search results// must contain.ExactTermsstring `json:"exactTerms,omitempty"`// ExcludeTerms: Identifies a word or phrase that should not appear in any// documents in the search results.ExcludeTermsstring `json:"excludeTerms,omitempty"`// FileType: Restricts results to files of a specified extension. Filetypes// supported by Google include: * Adobe Portable Document Format (`pdf`) *// Adobe PostScript (`ps`) * Lotus 1-2-3 (`wk1`, `wk2`, `wk3`, `wk4`, `wk5`,// `wki`, `wks`, `wku`) * Lotus WordPro (`lwp`) * Macwrite (`mw`) * Microsoft// Excel (`xls`) * Microsoft PowerPoint (`ppt`) * Microsoft Word (`doc`) *// Microsoft Works (`wks`, `wps`, `wdb`) * Microsoft Write (`wri`) * Rich Text// Format (`rtf`) * Shockwave Flash (`swf`) * Text (`ans`, `txt`). Additional// filetypes may be added in the future. An up-to-date list can always be found// in Google's file type FAQ// (https://support.google.com/webmasters/answer/35287).FileTypestring `json:"fileType,omitempty"`// Filter: Activates or deactivates the automatic filtering of Google search// results. See Automatic Filtering// (https://developers.google.com/custom-search/docs/json_api_reference#automaticFiltering)// for more information about Google's search results filters. Valid values for// this parameter are: * `0`: Disabled * `1`: Enabled (default) **Note**: By// default, Google applies filtering to all search results to improve the// quality of those results.Filterstring `json:"filter,omitempty"`// Gl: Boosts search results whose country of origin matches the parameter// value. See Country Codes// (https://developers.google.com/custom-search/docs/json_api_reference#countryCodes)// for a list of valid values. Specifying a `gl` parameter value in WebSearch// requests should improve the relevance of results. This is particularly true// for international customers and, even more specifically, for customers in// English-speaking countries other than the United States.Glstring `json:"gl,omitempty"`// GoogleHost: Specifies the Google domain (for example, google.com, google.de,// or google.fr) to which the search should be limited.GoogleHoststring `json:"googleHost,omitempty"`// HighRange: Specifies the ending value for a search range. Use `cse:lowRange`// and `cse:highrange` to append an inclusive search range of// `lowRange...highRange` to the query.HighRangestring `json:"highRange,omitempty"`// Hl: Specifies the interface language (host language) of your user interface.// Explicitly setting this parameter improves the performance and the quality// of your search results. See the Interface Languages// (https://developers.google.com/custom-search/docs/json_api_reference#wsInterfaceLanguages)// section of Internationalizing Queries and Results Presentation// (https://developers.google.com/custom-search/docs/json_api_reference#wsInternationalizing)// for more information, and Supported Interface Languages// (https://developers.google.com/custom-search/docs/json_api_reference#interfaceLanguages)// for a list of supported languages.Hlstring `json:"hl,omitempty"`// Hq: Appends the specified query terms to the query, as if they were combined// with a logical `AND` operator.Hqstring `json:"hq,omitempty"`// ImgColorType: Restricts results to images of a specified color type.// Supported values are: * `mono` (black and white) * `gray` (grayscale) *// `color` (color)ImgColorTypestring `json:"imgColorType,omitempty"`// ImgDominantColor: Restricts results to images with a specific dominant// color. Supported values are: * `red` * `orange` * `yellow` * `green` *// `teal` * `blue` * `purple` * `pink` * `white` * `gray` * `black` * `brown`ImgDominantColorstring `json:"imgDominantColor,omitempty"`// ImgSize: Restricts results to images of a specified size. Supported values// are: * `icon` (small) * `small | medium | large | xlarge` (medium) *// `xxlarge` (large) * `huge` (extra-large)ImgSizestring `json:"imgSize,omitempty"`// ImgType: Restricts results to images of a specified type. Supported values// are: * `clipart` (Clip art) * `face` (Face) * `lineart` (Line drawing) *// `photo` (Photo) * `animated` (Animated) * `stock` (Stock)ImgTypestring `json:"imgType,omitempty"`// InputEncoding: The character encoding supported for search requests.InputEncodingstring `json:"inputEncoding,omitempty"`// Language: The language of the search results.Languagestring `json:"language,omitempty"`// LinkSite: Specifies that all results should contain a link to a specific// URL.LinkSitestring `json:"linkSite,omitempty"`// LowRange: Specifies the starting value for a search range. Use// `cse:lowRange` and `cse:highrange` to append an inclusive search range of// `lowRange...highRange` to the query.LowRangestring `json:"lowRange,omitempty"`// OrTerms: Provides additional search terms to check for in a document, where// each document in the search results must contain at least one of the// additional search terms. You can also use the Boolean OR// (https://developers.google.com/custom-search/docs/json_api_reference#BooleanOrSearch)// query term for this type of query.OrTermsstring `json:"orTerms,omitempty"`// OutputEncoding: The character encoding supported for search results.OutputEncodingstring `json:"outputEncoding,omitempty"`// RelatedSite: Specifies that all search results should be pages that are// related to the specified URL. The parameter value should be a URL.RelatedSitestring `json:"relatedSite,omitempty"`// Rights: Filters based on licensing. Supported values include: *// `cc_publicdomain` * `cc_attribute` * `cc_sharealike` * `cc_noncommercial` *// `cc_nonderived`Rightsstring `json:"rights,omitempty"`// Safe: Specifies the SafeSearch level// (https://developers.google.com/custom-search/docs/json_api_reference#safeSearchLevels)// used for filtering out adult results. This is a custom property not defined// in the OpenSearch spec. Valid parameter values are: * "off": Disable// SafeSearch * "active": Enable SafeSearchSafestring `json:"safe,omitempty"`// SearchTerms: The search terms entered by the user.SearchTermsstring `json:"searchTerms,omitempty"`// SearchType: Allowed values are `web` or `image`. If unspecified, results are// limited to webpages.SearchTypestring `json:"searchType,omitempty"`// SiteSearch: Restricts results to URLs from a specified site.SiteSearchstring `json:"siteSearch,omitempty"`// SiteSearchFilter: Specifies whether to include or exclude results from the// site named in the `sitesearch` parameter. Supported values are: * `i`:// include content from site * `e`: exclude content from siteSiteSearchFilterstring `json:"siteSearchFilter,omitempty"`// Sort: Specifies that results should be sorted according to the specified// expression. For example, sort by date.Sortstring `json:"sort,omitempty"`// StartIndex: The index of the current set of search results into the total// set of results, where the index of the first result is 1.StartIndexint64 `json:"startIndex,omitempty"`// StartPage: The page number of this set of results, where the page length is// set by the `count` property.StartPageint64 `json:"startPage,omitempty"`// Title: A description of the query.Titlestring `json:"title,omitempty"`// TotalResults: Estimated number of total search results. May not be accurate.TotalResultsint64 `json:"totalResults,omitempty,string"`// ForceSendFields is a list of field names (e.g. "Count") to unconditionally// include in API requests. By default, fields with empty or default values are// omitted from API requests. See//https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more// details.ForceSendFields []string `json:"-"`// NullFields is a list of field names (e.g. "Count") to include in API// requests with the JSON null value. By default, fields with empty values are// omitted from API requests. See//https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.NullFields []string `json:"-"`}

SearchQueriesRequest: Custom search request metadata.

func (SearchQueriesRequest)MarshalJSONadded inv0.22.0

func (sSearchQueriesRequest) MarshalJSON() ([]byte,error)

typeSearchSearchInformation

type SearchSearchInformation struct {// FormattedSearchTime: The time taken for the server to return search results,// formatted according to locale style.FormattedSearchTimestring `json:"formattedSearchTime,omitempty"`// FormattedTotalResults: The total number of search results, formatted// according to locale style.FormattedTotalResultsstring `json:"formattedTotalResults,omitempty"`// SearchTime: The time taken for the server to return search results.SearchTimefloat64 `json:"searchTime,omitempty"`// TotalResults: The total number of search results returned by the query.TotalResultsstring `json:"totalResults,omitempty"`// ForceSendFields is a list of field names (e.g. "FormattedSearchTime") to// unconditionally include in API requests. By default, fields with empty or// default values are omitted from API requests. See//https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more// details.ForceSendFields []string `json:"-"`// NullFields is a list of field names (e.g. "FormattedSearchTime") to include// in API requests with the JSON null value. By default, fields with empty// values are omitted from API requests. See//https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.NullFields []string `json:"-"`}

SearchSearchInformation: Metadata about a search operation.

func (SearchSearchInformation)MarshalJSON

func (sSearchSearchInformation) MarshalJSON() ([]byte,error)

func (*SearchSearchInformation)UnmarshalJSON

func (s *SearchSearchInformation) UnmarshalJSON(data []byte)error

typeSearchSpelling

type SearchSpelling struct {// CorrectedQuery: The corrected query.CorrectedQuerystring `json:"correctedQuery,omitempty"`// HtmlCorrectedQuery: The corrected query, formatted in HTML.HtmlCorrectedQuerystring `json:"htmlCorrectedQuery,omitempty"`// ForceSendFields is a list of field names (e.g. "CorrectedQuery") to// unconditionally include in API requests. By default, fields with empty or// default values are omitted from API requests. See//https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more// details.ForceSendFields []string `json:"-"`// NullFields is a list of field names (e.g. "CorrectedQuery") to include in// API requests with the JSON null value. By default, fields with empty values// are omitted from API requests. See//https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.NullFields []string `json:"-"`}

SearchSpelling: Spell correction information for a query.

func (SearchSpelling)MarshalJSON

func (sSearchSpelling) MarshalJSON() ([]byte,error)

typeSearchUrl

type SearchUrl struct {// Template: The actual OpenSearch template// (http://www.opensearch.org/specifications/opensearch/1.1#opensearch_url_template_syntax)// for this API.Templatestring `json:"template,omitempty"`// Type: The MIME type of the OpenSearch URL template for the Custom Search// JSON API.Typestring `json:"type,omitempty"`// ForceSendFields is a list of field names (e.g. "Template") to// unconditionally include in API requests. By default, fields with empty or// default values are omitted from API requests. See//https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more// details.ForceSendFields []string `json:"-"`// NullFields is a list of field names (e.g. "Template") to include in API// requests with the JSON null value. By default, fields with empty values are// omitted from API requests. See//https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.NullFields []string `json:"-"`}

SearchUrl: OpenSearch template and URL.

func (SearchUrl)MarshalJSON

func (sSearchUrl) MarshalJSON() ([]byte,error)

typeService

type Service struct {BasePathstring// API endpoint base URLUserAgentstring// optional additional User-Agent fragmentCse *CseService// contains filtered or unexported fields}

funcNewdeprecated

func New(client *http.Client) (*Service,error)

New creates a new Service. It uses the provided http.Client for requests.

Deprecated: please use NewService instead.To provide a custom HTTP client, use option.WithHTTPClient.If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.

funcNewServiceadded inv0.3.0

func NewService(ctxcontext.Context, opts ...option.ClientOption) (*Service,error)

NewService creates a new Service.

Source Files

View all Source files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp