1 // Copyright 2024 Google LLC. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 // Code generated file. DO NOT EDIT. 6 7 // Package customsearch provides access to the Custom Search API. 8 // 9 // For product documentation, see: https://developers.google.com/custom-search/v1/introduction 10 // 11 // # Library status 12 // 13 // These client libraries are officially supported by Google. However, this 14 // library is considered complete and is in maintenance mode. This means 15 // that we will address critical bugs and security issues but will not add 16 // any new features. 17 // 18 // When possible, we recommend using our newer 19 // [Cloud Client Libraries for Go](https://pkg.go.dev/cloud.google.com/go) 20 // that are still actively being worked and iterated on. 21 // 22 // # Creating a client 23 // 24 // Usage example: 25 // 26 // import "google.golang.org/api/customsearch/v1" 27 // ... 28 // ctx := context.Background() 29 // customsearchService, err := customsearch.NewService(ctx) 30 // 31 // In this example, Google Application Default Credentials are used for 32 // authentication. For information on how to create and obtain Application 33 // Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials. 34 // 35 // # Other authentication options 36 // 37 // To use an API key for authentication (note: some APIs do not support API 38 // keys), use [google.golang.org/api/option.WithAPIKey]: 39 // 40 // customsearchService, err := customsearch.NewService(ctx, option.WithAPIKey("AIza...")) 41 // 42 // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth 43 // flow, use [google.golang.org/api/option.WithTokenSource]: 44 // 45 // config := &oauth2.Config{...} 46 // // ... 47 // token, err := config.Exchange(ctx, ...) 48 // customsearchService, err := customsearch.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token))) 49 // 50 // See [google.golang.org/api/option.ClientOption] for details on options. 51 package customsearch // import "google.golang.org/api/customsearch/v1" 52 53 import ( 54 "bytes" 55 "context" 56 "encoding/json" 57 "errors" 58 "fmt" 59 "io" 60 "net/http" 61 "net/url" 62 "strconv" 63 "strings" 64 65 googleapi "google.golang.org/api/googleapi" 66 internal "google.golang.org/api/internal" 67 gensupport "google.golang.org/api/internal/gensupport" 68 option "google.golang.org/api/option" 69 internaloption "google.golang.org/api/option/internaloption" 70 htransport "google.golang.org/api/transport/http" 71 ) 72 73 // Always reference these packages, just in case the auto-generated code 74 // below doesn't. 75 var _ = bytes.NewBuffer 76 var _ = strconv.Itoa 77 var _ = fmt.Sprintf 78 var _ = json.NewDecoder 79 var _ = io.Copy 80 var _ = url.Parse 81 var _ = gensupport.MarshalJSON 82 var _ = googleapi.Version 83 var _ = errors.New 84 var _ = strings.Replace 85 var _ = context.Canceled 86 var _ = internaloption.WithDefaultEndpoint 87 var _ = internal.Version 88 89 const apiId = "customsearch:v1" 90 const apiName = "customsearch" 91 const apiVersion = "v1" 92 const basePath = "https://customsearch.googleapis.com/" 93 const basePathTemplate = "https://customsearch.UNIVERSE_DOMAIN/" 94 const mtlsBasePath = "https://customsearch.mtls.googleapis.com/" 95 96 // NewService creates a new Service. 97 func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) { 98 opts = append(opts, internaloption.WithDefaultEndpoint(basePath)) 99 opts = append(opts, internaloption.WithDefaultEndpointTemplate(basePathTemplate)) 100 opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath)) 101 opts = append(opts, internaloption.EnableNewAuthLibrary()) 102 client, endpoint, err := htransport.NewClient(ctx, opts...) 103 if err != nil { 104 return nil, err 105 } 106 s, err := New(client) 107 if err != nil { 108 return nil, err 109 } 110 if endpoint != "" { 111 s.BasePath = endpoint 112 } 113 return s, nil 114 } 115 116 // New creates a new Service. It uses the provided http.Client for requests. 117 // 118 // Deprecated: please use NewService instead. 119 // To provide a custom HTTP client, use option.WithHTTPClient. 120 // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead. 121 func New(client *http.Client) (*Service, error) { 122 if client == nil { 123 return nil, errors.New("client is nil") 124 } 125 s := &Service{client: client, BasePath: basePath} 126 s.Cse = NewCseService(s) 127 return s, nil 128 } 129 130 type Service struct { 131 client *http.Client 132 BasePath string // API endpoint base URL 133 UserAgent string // optional additional User-Agent fragment 134 135 Cse *CseService 136 } 137 138 func (s *Service) userAgent() string { 139 if s.UserAgent == "" { 140 return googleapi.UserAgent 141 } 142 return googleapi.UserAgent + " " + s.UserAgent 143 } 144 145 func NewCseService(s *Service) *CseService { 146 rs := &CseService{s: s} 147 rs.Siterestrict = NewCseSiterestrictService(s) 148 return rs 149 } 150 151 type CseService struct { 152 s *Service 153 154 Siterestrict *CseSiterestrictService 155 } 156 157 func NewCseSiterestrictService(s *Service) *CseSiterestrictService { 158 rs := &CseSiterestrictService{s: s} 159 return rs 160 } 161 162 type CseSiterestrictService struct { 163 s *Service 164 } 165 166 // Promotion: Promotion result. 167 type Promotion struct { 168 // BodyLines: An array of block objects for this promotion. 169 BodyLines []*PromotionBodyLines `json:"bodyLines,omitempty"` 170 // DisplayLink: An abridged version of this search's result URL, e.g. 171 // www.example.com. 172 DisplayLink string `json:"displayLink,omitempty"` 173 // HtmlTitle: The title of the promotion, in HTML. 174 HtmlTitle string `json:"htmlTitle,omitempty"` 175 // Image: Image belonging to a promotion. 176 Image *PromotionImage `json:"image,omitempty"` 177 // Link: The URL of the promotion. 178 Link string `json:"link,omitempty"` 179 // Title: The title of the promotion. 180 Title string `json:"title,omitempty"` 181 // ForceSendFields is a list of field names (e.g. "BodyLines") to 182 // unconditionally include in API requests. By default, fields with empty or 183 // default values are omitted from API requests. See 184 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 185 // details. 186 ForceSendFields []string `json:"-"` 187 // NullFields is a list of field names (e.g. "BodyLines") to include in API 188 // requests with the JSON null value. By default, fields with empty values are 189 // omitted from API requests. See 190 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 191 NullFields []string `json:"-"` 192 } 193 194 func (s *Promotion) MarshalJSON() ([]byte, error) { 195 type NoMethod Promotion 196 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 197 } 198 199 // PromotionBodyLines: Block object belonging to a promotion. 200 type PromotionBodyLines struct { 201 // HtmlTitle: The block object's text in HTML, if it has text. 202 HtmlTitle string `json:"htmlTitle,omitempty"` 203 // Link: The anchor text of the block object's link, if it has a link. 204 Link string `json:"link,omitempty"` 205 // Title: The block object's text, if it has text. 206 Title string `json:"title,omitempty"` 207 // Url: The URL of the block object's link, if it has one. 208 Url string `json:"url,omitempty"` 209 // ForceSendFields is a list of field names (e.g. "HtmlTitle") to 210 // unconditionally include in API requests. By default, fields with empty or 211 // default values are omitted from API requests. See 212 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 213 // details. 214 ForceSendFields []string `json:"-"` 215 // NullFields is a list of field names (e.g. "HtmlTitle") to include in API 216 // requests with the JSON null value. By default, fields with empty values are 217 // omitted from API requests. See 218 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 219 NullFields []string `json:"-"` 220 } 221 222 func (s *PromotionBodyLines) MarshalJSON() ([]byte, error) { 223 type NoMethod PromotionBodyLines 224 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 225 } 226 227 // PromotionImage: Image belonging to a promotion. 228 type PromotionImage struct { 229 // Height: Image height in pixels. 230 Height int64 `json:"height,omitempty"` 231 // Source: URL of the image for this promotion link. 232 Source string `json:"source,omitempty"` 233 // Width: Image width in pixels. 234 Width int64 `json:"width,omitempty"` 235 // ForceSendFields is a list of field names (e.g. "Height") to unconditionally 236 // include in API requests. By default, fields with empty or default values are 237 // omitted from API requests. See 238 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 239 // details. 240 ForceSendFields []string `json:"-"` 241 // NullFields is a list of field names (e.g. "Height") to include in API 242 // requests with the JSON null value. By default, fields with empty values are 243 // omitted from API requests. See 244 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 245 NullFields []string `json:"-"` 246 } 247 248 func (s *PromotionImage) MarshalJSON() ([]byte, error) { 249 type NoMethod PromotionImage 250 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 251 } 252 253 // Result: A custom search result. 254 type Result struct { 255 // CacheId: Indicates the ID of Google's cached version of the search result. 256 CacheId string `json:"cacheId,omitempty"` 257 // DisplayLink: An abridged version of this search result’s URL, e.g. 258 // www.example.com. 259 DisplayLink string `json:"displayLink,omitempty"` 260 // FileFormat: The file format of the search result. 261 FileFormat string `json:"fileFormat,omitempty"` 262 // FormattedUrl: The URL displayed after the snippet for each search result. 263 FormattedUrl string `json:"formattedUrl,omitempty"` 264 // HtmlFormattedUrl: The HTML-formatted URL displayed after the snippet for 265 // each search result. 266 HtmlFormattedUrl string `json:"htmlFormattedUrl,omitempty"` 267 // HtmlSnippet: The snippet of the search result, in HTML. 268 HtmlSnippet string `json:"htmlSnippet,omitempty"` 269 // HtmlTitle: The title of the search result, in HTML. 270 HtmlTitle string `json:"htmlTitle,omitempty"` 271 // Image: Image belonging to a custom search result. 272 Image *ResultImage `json:"image,omitempty"` 273 // Kind: A unique identifier for the type of current object. For this API, it 274 // is `customsearch#result.` 275 Kind string `json:"kind,omitempty"` 276 // Labels: Encapsulates all information about refinement labels. 277 Labels []*ResultLabels `json:"labels,omitempty"` 278 // Link: The full URL to which the search result is pointing, e.g. 279 // http://www.example.com/foo/bar. 280 Link string `json:"link,omitempty"` 281 // Mime: The MIME type of the search result. 282 Mime string `json:"mime,omitempty"` 283 // Pagemap: Contains PageMap 284 // (https://developers.google.com/custom-search/docs/structured_data#pagemaps) 285 // information for this search result. 286 Pagemap googleapi.RawMessage `json:"pagemap,omitempty"` 287 // Snippet: The snippet of the search result, in plain text. 288 Snippet string `json:"snippet,omitempty"` 289 // Title: The title of the search result, in plain text. 290 Title string `json:"title,omitempty"` 291 // ForceSendFields is a list of field names (e.g. "CacheId") to unconditionally 292 // include in API requests. By default, fields with empty or default values are 293 // omitted from API requests. See 294 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 295 // details. 296 ForceSendFields []string `json:"-"` 297 // NullFields is a list of field names (e.g. "CacheId") to include in API 298 // requests with the JSON null value. By default, fields with empty values are 299 // omitted from API requests. See 300 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 301 NullFields []string `json:"-"` 302 } 303 304 func (s *Result) MarshalJSON() ([]byte, error) { 305 type NoMethod Result 306 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 307 } 308 309 // ResultImage: Image belonging to a custom search result. 310 type ResultImage struct { 311 // ByteSize: The size of the image, in bytes. 312 ByteSize int64 `json:"byteSize,omitempty"` 313 // ContextLink: A URL pointing to the webpage hosting the image. 314 ContextLink string `json:"contextLink,omitempty"` 315 // Height: The height of the image, in pixels. 316 Height int64 `json:"height,omitempty"` 317 // ThumbnailHeight: The height of the thumbnail image, in pixels. 318 ThumbnailHeight int64 `json:"thumbnailHeight,omitempty"` 319 // ThumbnailLink: A URL to the thumbnail image. 320 ThumbnailLink string `json:"thumbnailLink,omitempty"` 321 // ThumbnailWidth: The width of the thumbnail image, in pixels. 322 ThumbnailWidth int64 `json:"thumbnailWidth,omitempty"` 323 // Width: The width of the image, in pixels. 324 Width int64 `json:"width,omitempty"` 325 // ForceSendFields is a list of field names (e.g. "ByteSize") to 326 // unconditionally include in API requests. By default, fields with empty or 327 // default values are omitted from API requests. See 328 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 329 // details. 330 ForceSendFields []string `json:"-"` 331 // NullFields is a list of field names (e.g. "ByteSize") to include in API 332 // requests with the JSON null value. By default, fields with empty values are 333 // omitted from API requests. See 334 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 335 NullFields []string `json:"-"` 336 } 337 338 func (s *ResultImage) MarshalJSON() ([]byte, error) { 339 type NoMethod ResultImage 340 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 341 } 342 343 // ResultLabels: Refinement label associated with a custom search result. 344 type ResultLabels struct { 345 // DisplayName: The display name of a refinement label. This is the name you 346 // should display in your user interface. 347 DisplayName string `json:"displayName,omitempty"` 348 // LabelWithOp: Refinement label and the associated refinement operation. 349 LabelWithOp string `json:"label_with_op,omitempty"` 350 // Name: The name of a refinement label, which you can use to refine searches. 351 // Don't display this in your user interface; instead, use displayName. 352 Name string `json:"name,omitempty"` 353 // ForceSendFields is a list of field names (e.g. "DisplayName") to 354 // unconditionally include in API requests. By default, fields with empty or 355 // default values are omitted from API requests. See 356 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 357 // details. 358 ForceSendFields []string `json:"-"` 359 // NullFields is a list of field names (e.g. "DisplayName") to include in API 360 // requests with the JSON null value. By default, fields with empty values are 361 // omitted from API requests. See 362 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 363 NullFields []string `json:"-"` 364 } 365 366 func (s *ResultLabels) MarshalJSON() ([]byte, error) { 367 type NoMethod ResultLabels 368 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 369 } 370 371 // Search: Response to a custom search request. 372 type Search struct { 373 // Context: Metadata and refinements associated with the given search engine, 374 // including: * The name of the search engine that was used for the query. * A 375 // set of facet objects 376 // (https://developers.google.com/custom-search/docs/refinements#create) 377 // (refinements) you can use for refining a search. 378 Context googleapi.RawMessage `json:"context,omitempty"` 379 // Items: The current set of custom search results. 380 Items []*Result `json:"items,omitempty"` 381 // Kind: Unique identifier for the type of current object. For this API, it is 382 // customsearch#search. 383 Kind string `json:"kind,omitempty"` 384 // Promotions: The set of promotions 385 // (https://developers.google.com/custom-search/docs/promotions). Present only 386 // if the custom search engine's configuration files define any promotions for 387 // the given query. 388 Promotions []*Promotion `json:"promotions,omitempty"` 389 // Queries: Query metadata for the previous, current, and next pages of 390 // results. 391 Queries *SearchQueries `json:"queries,omitempty"` 392 // SearchInformation: Metadata about a search operation. 393 SearchInformation *SearchSearchInformation `json:"searchInformation,omitempty"` 394 // Spelling: Spell correction information for a query. 395 Spelling *SearchSpelling `json:"spelling,omitempty"` 396 // Url: OpenSearch template and URL. 397 Url *SearchUrl `json:"url,omitempty"` 398 399 // ServerResponse contains the HTTP response code and headers from the server. 400 googleapi.ServerResponse `json:"-"` 401 // ForceSendFields is a list of field names (e.g. "Context") to unconditionally 402 // include in API requests. By default, fields with empty or default values are 403 // omitted from API requests. See 404 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 405 // details. 406 ForceSendFields []string `json:"-"` 407 // NullFields is a list of field names (e.g. "Context") to include in API 408 // requests with the JSON null value. By default, fields with empty values are 409 // omitted from API requests. See 410 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 411 NullFields []string `json:"-"` 412 } 413 414 func (s *Search) MarshalJSON() ([]byte, error) { 415 type NoMethod Search 416 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 417 } 418 419 // SearchQueries: Query metadata for the previous, current, and next pages of 420 // results. 421 type SearchQueries struct { 422 // NextPage: Metadata representing the next page of results, if applicable. 423 NextPage []*SearchQueriesNextPage `json:"nextPage,omitempty"` 424 // PreviousPage: Metadata representing the previous page of results, if 425 // applicable. 426 PreviousPage []*SearchQueriesPreviousPage `json:"previousPage,omitempty"` 427 // Request: Metadata representing the current request. 428 Request []*SearchQueriesRequest `json:"request,omitempty"` 429 // ForceSendFields is a list of field names (e.g. "NextPage") to 430 // unconditionally include in API requests. By default, fields with empty or 431 // default values are omitted from API requests. See 432 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 433 // details. 434 ForceSendFields []string `json:"-"` 435 // NullFields is a list of field names (e.g. "NextPage") to include in API 436 // requests with the JSON null value. By default, fields with empty values are 437 // omitted from API requests. See 438 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 439 NullFields []string `json:"-"` 440 } 441 442 func (s *SearchQueries) MarshalJSON() ([]byte, error) { 443 type NoMethod SearchQueries 444 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 445 } 446 447 // SearchQueriesNextPage: Custom search request metadata. 448 type SearchQueriesNextPage struct { 449 // Count: Number of search results returned in this set. 450 Count int64 `json:"count,omitempty"` 451 // Cr: Restricts search results to documents originating in a particular 452 // country. You may use Boolean operators 453 // (https://developers.google.com/custom-search/docs/json_api_reference#BooleanOrSearch) 454 // in the `cr` parameter's value. Google WebSearch determines the country of a 455 // document by analyzing the following: * The top-level domain (TLD) of the 456 // document's URL. * The geographic location of the web server's IP address. 457 // See Country (cr) Parameter Values 458 // (https://developers.google.com/custom-search/docs/json_api_reference#countryCollections) 459 // for a list of valid values for this parameter. 460 Cr string `json:"cr,omitempty"` 461 // Cx: The identifier of an engine created using the Programmable Search Engine 462 // Control Panel (https://programmablesearchengine.google.com/). This is a 463 // custom property not defined in the OpenSearch spec. This parameter is 464 // **required**. 465 Cx string `json:"cx,omitempty"` 466 // DateRestrict: Restricts results to URLs based on date. Supported values 467 // include: * `d[number]`: requests results from the specified number of past 468 // days. * `w[number]`: requests results from the specified number of past 469 // weeks. * `m[number]`: requests results from the specified number of past 470 // months. * `y[number]`: requests results from the specified number of past 471 // years. 472 DateRestrict string `json:"dateRestrict,omitempty"` 473 // DisableCnTwTranslation: Enables or disables the Simplified and Traditional 474 // Chinese Search 475 // (https://developers.google.com/custom-search/docs/json_api_reference#chineseSearch) 476 // feature. Supported values are: * `0`: enabled (default) * `1`: disabled 477 DisableCnTwTranslation string `json:"disableCnTwTranslation,omitempty"` 478 // ExactTerms: Identifies a phrase that all documents in the search results 479 // must contain. 480 ExactTerms string `json:"exactTerms,omitempty"` 481 // ExcludeTerms: Identifies a word or phrase that should not appear in any 482 // documents in the search results. 483 ExcludeTerms string `json:"excludeTerms,omitempty"` 484 // FileType: Restricts results to files of a specified extension. Filetypes 485 // supported by Google include: * Adobe Portable Document Format (`pdf`) * 486 // Adobe PostScript (`ps`) * Lotus 1-2-3 (`wk1`, `wk2`, `wk3`, `wk4`, `wk5`, 487 // `wki`, `wks`, `wku`) * Lotus WordPro (`lwp`) * Macwrite (`mw`) * Microsoft 488 // Excel (`xls`) * Microsoft PowerPoint (`ppt`) * Microsoft Word (`doc`) * 489 // Microsoft Works (`wks`, `wps`, `wdb`) * Microsoft Write (`wri`) * Rich Text 490 // Format (`rtf`) * Shockwave Flash (`swf`) * Text (`ans`, `txt`). Additional 491 // filetypes may be added in the future. An up-to-date list can always be found 492 // in Google's file type FAQ 493 // (https://support.google.com/webmasters/answer/35287). 494 FileType string `json:"fileType,omitempty"` 495 // Filter: Activates or deactivates the automatic filtering of Google search 496 // results. See Automatic Filtering 497 // (https://developers.google.com/custom-search/docs/json_api_reference#automaticFiltering) 498 // for more information about Google's search results filters. Valid values for 499 // this parameter are: * `0`: Disabled * `1`: Enabled (default) **Note**: By 500 // default, Google applies filtering to all search results to improve the 501 // quality of those results. 502 Filter string `json:"filter,omitempty"` 503 // Gl: Boosts search results whose country of origin matches the parameter 504 // value. See Country Codes 505 // (https://developers.google.com/custom-search/docs/json_api_reference#countryCodes) 506 // for a list of valid values. Specifying a `gl` parameter value in WebSearch 507 // requests should improve the relevance of results. This is particularly true 508 // for international customers and, even more specifically, for customers in 509 // English-speaking countries other than the United States. 510 Gl string `json:"gl,omitempty"` 511 // GoogleHost: Specifies the Google domain (for example, google.com, google.de, 512 // or google.fr) to which the search should be limited. 513 GoogleHost string `json:"googleHost,omitempty"` 514 // HighRange: Specifies the ending value for a search range. Use `cse:lowRange` 515 // and `cse:highrange` to append an inclusive search range of 516 // `lowRange...highRange` to the query. 517 HighRange string `json:"highRange,omitempty"` 518 // Hl: Specifies the interface language (host language) of your user interface. 519 // Explicitly setting this parameter improves the performance and the quality 520 // of your search results. See the Interface Languages 521 // (https://developers.google.com/custom-search/docs/json_api_reference#wsInterfaceLanguages) 522 // section of Internationalizing Queries and Results Presentation 523 // (https://developers.google.com/custom-search/docs/json_api_reference#wsInternationalizing) 524 // for more information, and Supported Interface Languages 525 // (https://developers.google.com/custom-search/docs/json_api_reference#interfaceLanguages) 526 // for a list of supported languages. 527 Hl string `json:"hl,omitempty"` 528 // Hq: Appends the specified query terms to the query, as if they were combined 529 // with a logical `AND` operator. 530 Hq string `json:"hq,omitempty"` 531 // ImgColorType: Restricts results to images of a specified color type. 532 // Supported values are: * `mono` (black and white) * `gray` (grayscale) * 533 // `color` (color) 534 ImgColorType string `json:"imgColorType,omitempty"` 535 // ImgDominantColor: Restricts results to images with a specific dominant 536 // color. Supported values are: * `red` * `orange` * `yellow` * `green` * 537 // `teal` * `blue` * `purple` * `pink` * `white` * `gray` * `black` * `brown` 538 ImgDominantColor string `json:"imgDominantColor,omitempty"` 539 // ImgSize: Restricts results to images of a specified size. Supported values 540 // are: * `icon` (small) * `small | medium | large | xlarge` (medium) * 541 // `xxlarge` (large) * `huge` (extra-large) 542 ImgSize string `json:"imgSize,omitempty"` 543 // ImgType: Restricts results to images of a specified type. Supported values 544 // are: * `clipart` (Clip art) * `face` (Face) * `lineart` (Line drawing) * 545 // `photo` (Photo) * `animated` (Animated) * `stock` (Stock) 546 ImgType string `json:"imgType,omitempty"` 547 // InputEncoding: The character encoding supported for search requests. 548 InputEncoding string `json:"inputEncoding,omitempty"` 549 // Language: The language of the search results. 550 Language string `json:"language,omitempty"` 551 // LinkSite: Specifies that all results should contain a link to a specific 552 // URL. 553 LinkSite string `json:"linkSite,omitempty"` 554 // LowRange: Specifies the starting value for a search range. Use 555 // `cse:lowRange` and `cse:highrange` to append an inclusive search range of 556 // `lowRange...highRange` to the query. 557 LowRange string `json:"lowRange,omitempty"` 558 // OrTerms: Provides additional search terms to check for in a document, where 559 // each document in the search results must contain at least one of the 560 // additional search terms. You can also use the Boolean OR 561 // (https://developers.google.com/custom-search/docs/json_api_reference#BooleanOrSearch) 562 // query term for this type of query. 563 OrTerms string `json:"orTerms,omitempty"` 564 // OutputEncoding: The character encoding supported for search results. 565 OutputEncoding string `json:"outputEncoding,omitempty"` 566 // RelatedSite: Specifies that all search results should be pages that are 567 // related to the specified URL. The parameter value should be a URL. 568 RelatedSite string `json:"relatedSite,omitempty"` 569 // Rights: Filters based on licensing. Supported values include: * 570 // `cc_publicdomain` * `cc_attribute` * `cc_sharealike` * `cc_noncommercial` * 571 // `cc_nonderived` 572 Rights string `json:"rights,omitempty"` 573 // Safe: Specifies the SafeSearch level 574 // (https://developers.google.com/custom-search/docs/json_api_reference#safeSearchLevels) 575 // used for filtering out adult results. This is a custom property not defined 576 // in the OpenSearch spec. Valid parameter values are: * "off": Disable 577 // SafeSearch * "active": Enable SafeSearch 578 Safe string `json:"safe,omitempty"` 579 // SearchTerms: The search terms entered by the user. 580 SearchTerms string `json:"searchTerms,omitempty"` 581 // SearchType: Allowed values are `web` or `image`. If unspecified, results are 582 // limited to webpages. 583 SearchType string `json:"searchType,omitempty"` 584 // SiteSearch: Restricts results to URLs from a specified site. 585 SiteSearch string `json:"siteSearch,omitempty"` 586 // SiteSearchFilter: Specifies whether to include or exclude results from the 587 // site named in the `sitesearch` parameter. Supported values are: * `i`: 588 // include content from site * `e`: exclude content from site 589 SiteSearchFilter string `json:"siteSearchFilter,omitempty"` 590 // Sort: Specifies that results should be sorted according to the specified 591 // expression. For example, sort by date. 592 Sort string `json:"sort,omitempty"` 593 // StartIndex: The index of the current set of search results into the total 594 // set of results, where the index of the first result is 1. 595 StartIndex int64 `json:"startIndex,omitempty"` 596 // StartPage: The page number of this set of results, where the page length is 597 // set by the `count` property. 598 StartPage int64 `json:"startPage,omitempty"` 599 // Title: A description of the query. 600 Title string `json:"title,omitempty"` 601 // TotalResults: Estimated number of total search results. May not be accurate. 602 TotalResults int64 `json:"totalResults,omitempty,string"` 603 // ForceSendFields is a list of field names (e.g. "Count") to unconditionally 604 // include in API requests. By default, fields with empty or default values are 605 // omitted from API requests. See 606 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 607 // details. 608 ForceSendFields []string `json:"-"` 609 // NullFields is a list of field names (e.g. "Count") to include in API 610 // requests with the JSON null value. By default, fields with empty values are 611 // omitted from API requests. See 612 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 613 NullFields []string `json:"-"` 614 } 615 616 func (s *SearchQueriesNextPage) MarshalJSON() ([]byte, error) { 617 type NoMethod SearchQueriesNextPage 618 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 619 } 620 621 // SearchQueriesPreviousPage: Custom search request metadata. 622 type SearchQueriesPreviousPage struct { 623 // Count: Number of search results returned in this set. 624 Count int64 `json:"count,omitempty"` 625 // Cr: Restricts search results to documents originating in a particular 626 // country. You may use Boolean operators 627 // (https://developers.google.com/custom-search/docs/json_api_reference#BooleanOrSearch) 628 // in the `cr` parameter's value. Google WebSearch determines the country of a 629 // document by analyzing the following: * The top-level domain (TLD) of the 630 // document's URL. * The geographic location of the web server's IP address. 631 // See Country (cr) Parameter Values 632 // (https://developers.google.com/custom-search/docs/json_api_reference#countryCollections) 633 // for a list of valid values for this parameter. 634 Cr string `json:"cr,omitempty"` 635 // Cx: The identifier of an engine created using the Programmable Search Engine 636 // Control Panel (https://programmablesearchengine.google.com/). This is a 637 // custom property not defined in the OpenSearch spec. This parameter is 638 // **required**. 639 Cx string `json:"cx,omitempty"` 640 // DateRestrict: Restricts results to URLs based on date. Supported values 641 // include: * `d[number]`: requests results from the specified number of past 642 // days. * `w[number]`: requests results from the specified number of past 643 // weeks. * `m[number]`: requests results from the specified number of past 644 // months. * `y[number]`: requests results from the specified number of past 645 // years. 646 DateRestrict string `json:"dateRestrict,omitempty"` 647 // DisableCnTwTranslation: Enables or disables the Simplified and Traditional 648 // Chinese Search 649 // (https://developers.google.com/custom-search/docs/json_api_reference#chineseSearch) 650 // feature. Supported values are: * `0`: enabled (default) * `1`: disabled 651 DisableCnTwTranslation string `json:"disableCnTwTranslation,omitempty"` 652 // ExactTerms: Identifies a phrase that all documents in the search results 653 // must contain. 654 ExactTerms string `json:"exactTerms,omitempty"` 655 // ExcludeTerms: Identifies a word or phrase that should not appear in any 656 // documents in the search results. 657 ExcludeTerms string `json:"excludeTerms,omitempty"` 658 // FileType: Restricts results to files of a specified extension. Filetypes 659 // supported by Google include: * Adobe Portable Document Format (`pdf`) * 660 // Adobe PostScript (`ps`) * Lotus 1-2-3 (`wk1`, `wk2`, `wk3`, `wk4`, `wk5`, 661 // `wki`, `wks`, `wku`) * Lotus WordPro (`lwp`) * Macwrite (`mw`) * Microsoft 662 // Excel (`xls`) * Microsoft PowerPoint (`ppt`) * Microsoft Word (`doc`) * 663 // Microsoft Works (`wks`, `wps`, `wdb`) * Microsoft Write (`wri`) * Rich Text 664 // Format (`rtf`) * Shockwave Flash (`swf`) * Text (`ans`, `txt`). Additional 665 // filetypes may be added in the future. An up-to-date list can always be found 666 // in Google's file type FAQ 667 // (https://support.google.com/webmasters/answer/35287). 668 FileType string `json:"fileType,omitempty"` 669 // Filter: Activates or deactivates the automatic filtering of Google search 670 // results. See Automatic Filtering 671 // (https://developers.google.com/custom-search/docs/json_api_reference#automaticFiltering) 672 // for more information about Google's search results filters. Valid values for 673 // this parameter are: * `0`: Disabled * `1`: Enabled (default) **Note**: By 674 // default, Google applies filtering to all search results to improve the 675 // quality of those results. 676 Filter string `json:"filter,omitempty"` 677 // Gl: Boosts search results whose country of origin matches the parameter 678 // value. See Country Codes 679 // (https://developers.google.com/custom-search/docs/json_api_reference#countryCodes) 680 // for a list of valid values. Specifying a `gl` parameter value in WebSearch 681 // requests should improve the relevance of results. This is particularly true 682 // for international customers and, even more specifically, for customers in 683 // English-speaking countries other than the United States. 684 Gl string `json:"gl,omitempty"` 685 // GoogleHost: Specifies the Google domain (for example, google.com, google.de, 686 // or google.fr) to which the search should be limited. 687 GoogleHost string `json:"googleHost,omitempty"` 688 // HighRange: Specifies the ending value for a search range. Use `cse:lowRange` 689 // and `cse:highrange` to append an inclusive search range of 690 // `lowRange...highRange` to the query. 691 HighRange string `json:"highRange,omitempty"` 692 // Hl: Specifies the interface language (host language) of your user interface. 693 // Explicitly setting this parameter improves the performance and the quality 694 // of your search results. See the Interface Languages 695 // (https://developers.google.com/custom-search/docs/json_api_reference#wsInterfaceLanguages) 696 // section of Internationalizing Queries and Results Presentation 697 // (https://developers.google.com/custom-search/docs/json_api_reference#wsInternationalizing) 698 // for more information, and Supported Interface Languages 699 // (https://developers.google.com/custom-search/docs/json_api_reference#interfaceLanguages) 700 // for a list of supported languages. 701 Hl string `json:"hl,omitempty"` 702 // Hq: Appends the specified query terms to the query, as if they were combined 703 // with a logical `AND` operator. 704 Hq string `json:"hq,omitempty"` 705 // ImgColorType: Restricts results to images of a specified color type. 706 // Supported values are: * `mono` (black and white) * `gray` (grayscale) * 707 // `color` (color) 708 ImgColorType string `json:"imgColorType,omitempty"` 709 // ImgDominantColor: Restricts results to images with a specific dominant 710 // color. Supported values are: * `red` * `orange` * `yellow` * `green` * 711 // `teal` * `blue` * `purple` * `pink` * `white` * `gray` * `black` * `brown` 712 ImgDominantColor string `json:"imgDominantColor,omitempty"` 713 // ImgSize: Restricts results to images of a specified size. Supported values 714 // are: * `icon` (small) * `small | medium | large | xlarge` (medium) * 715 // `xxlarge` (large) * `huge` (extra-large) 716 ImgSize string `json:"imgSize,omitempty"` 717 // ImgType: Restricts results to images of a specified type. Supported values 718 // are: * `clipart` (Clip art) * `face` (Face) * `lineart` (Line drawing) * 719 // `photo` (Photo) * `animated` (Animated) * `stock` (Stock) 720 ImgType string `json:"imgType,omitempty"` 721 // InputEncoding: The character encoding supported for search requests. 722 InputEncoding string `json:"inputEncoding,omitempty"` 723 // Language: The language of the search results. 724 Language string `json:"language,omitempty"` 725 // LinkSite: Specifies that all results should contain a link to a specific 726 // URL. 727 LinkSite string `json:"linkSite,omitempty"` 728 // LowRange: Specifies the starting value for a search range. Use 729 // `cse:lowRange` and `cse:highrange` to append an inclusive search range of 730 // `lowRange...highRange` to the query. 731 LowRange string `json:"lowRange,omitempty"` 732 // OrTerms: Provides additional search terms to check for in a document, where 733 // each document in the search results must contain at least one of the 734 // additional search terms. You can also use the Boolean OR 735 // (https://developers.google.com/custom-search/docs/json_api_reference#BooleanOrSearch) 736 // query term for this type of query. 737 OrTerms string `json:"orTerms,omitempty"` 738 // OutputEncoding: The character encoding supported for search results. 739 OutputEncoding string `json:"outputEncoding,omitempty"` 740 // RelatedSite: Specifies that all search results should be pages that are 741 // related to the specified URL. The parameter value should be a URL. 742 RelatedSite string `json:"relatedSite,omitempty"` 743 // Rights: Filters based on licensing. Supported values include: * 744 // `cc_publicdomain` * `cc_attribute` * `cc_sharealike` * `cc_noncommercial` * 745 // `cc_nonderived` 746 Rights string `json:"rights,omitempty"` 747 // Safe: Specifies the SafeSearch level 748 // (https://developers.google.com/custom-search/docs/json_api_reference#safeSearchLevels) 749 // used for filtering out adult results. This is a custom property not defined 750 // in the OpenSearch spec. Valid parameter values are: * "off": Disable 751 // SafeSearch * "active": Enable SafeSearch 752 Safe string `json:"safe,omitempty"` 753 // SearchTerms: The search terms entered by the user. 754 SearchTerms string `json:"searchTerms,omitempty"` 755 // SearchType: Allowed values are `web` or `image`. If unspecified, results are 756 // limited to webpages. 757 SearchType string `json:"searchType,omitempty"` 758 // SiteSearch: Restricts results to URLs from a specified site. 759 SiteSearch string `json:"siteSearch,omitempty"` 760 // SiteSearchFilter: Specifies whether to include or exclude results from the 761 // site named in the `sitesearch` parameter. Supported values are: * `i`: 762 // include content from site * `e`: exclude content from site 763 SiteSearchFilter string `json:"siteSearchFilter,omitempty"` 764 // Sort: Specifies that results should be sorted according to the specified 765 // expression. For example, sort by date. 766 Sort string `json:"sort,omitempty"` 767 // StartIndex: The index of the current set of search results into the total 768 // set of results, where the index of the first result is 1. 769 StartIndex int64 `json:"startIndex,omitempty"` 770 // StartPage: The page number of this set of results, where the page length is 771 // set by the `count` property. 772 StartPage int64 `json:"startPage,omitempty"` 773 // Title: A description of the query. 774 Title string `json:"title,omitempty"` 775 // TotalResults: Estimated number of total search results. May not be accurate. 776 TotalResults int64 `json:"totalResults,omitempty,string"` 777 // ForceSendFields is a list of field names (e.g. "Count") to unconditionally 778 // include in API requests. By default, fields with empty or default values are 779 // omitted from API requests. See 780 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 781 // details. 782 ForceSendFields []string `json:"-"` 783 // NullFields is a list of field names (e.g. "Count") to include in API 784 // requests with the JSON null value. By default, fields with empty values are 785 // omitted from API requests. See 786 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 787 NullFields []string `json:"-"` 788 } 789 790 func (s *SearchQueriesPreviousPage) MarshalJSON() ([]byte, error) { 791 type NoMethod SearchQueriesPreviousPage 792 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 793 } 794 795 // SearchQueriesRequest: Custom search request metadata. 796 type SearchQueriesRequest struct { 797 // Count: Number of search results returned in this set. 798 Count int64 `json:"count,omitempty"` 799 // Cr: Restricts search results to documents originating in a particular 800 // country. You may use Boolean operators 801 // (https://developers.google.com/custom-search/docs/json_api_reference#BooleanOrSearch) 802 // in the `cr` parameter's value. Google WebSearch determines the country of a 803 // document by analyzing the following: * The top-level domain (TLD) of the 804 // document's URL. * The geographic location of the web server's IP address. 805 // See Country (cr) Parameter Values 806 // (https://developers.google.com/custom-search/docs/json_api_reference#countryCollections) 807 // for a list of valid values for this parameter. 808 Cr string `json:"cr,omitempty"` 809 // Cx: The identifier of an engine created using the Programmable Search Engine 810 // Control Panel (https://programmablesearchengine.google.com/). This is a 811 // custom property not defined in the OpenSearch spec. This parameter is 812 // **required**. 813 Cx string `json:"cx,omitempty"` 814 // DateRestrict: Restricts results to URLs based on date. Supported values 815 // include: * `d[number]`: requests results from the specified number of past 816 // days. * `w[number]`: requests results from the specified number of past 817 // weeks. * `m[number]`: requests results from the specified number of past 818 // months. * `y[number]`: requests results from the specified number of past 819 // years. 820 DateRestrict string `json:"dateRestrict,omitempty"` 821 // DisableCnTwTranslation: Enables or disables the Simplified and Traditional 822 // Chinese Search 823 // (https://developers.google.com/custom-search/docs/json_api_reference#chineseSearch) 824 // feature. Supported values are: * `0`: enabled (default) * `1`: disabled 825 DisableCnTwTranslation string `json:"disableCnTwTranslation,omitempty"` 826 // ExactTerms: Identifies a phrase that all documents in the search results 827 // must contain. 828 ExactTerms string `json:"exactTerms,omitempty"` 829 // ExcludeTerms: Identifies a word or phrase that should not appear in any 830 // documents in the search results. 831 ExcludeTerms string `json:"excludeTerms,omitempty"` 832 // FileType: Restricts results to files of a specified extension. Filetypes 833 // supported by Google include: * Adobe Portable Document Format (`pdf`) * 834 // Adobe PostScript (`ps`) * Lotus 1-2-3 (`wk1`, `wk2`, `wk3`, `wk4`, `wk5`, 835 // `wki`, `wks`, `wku`) * Lotus WordPro (`lwp`) * Macwrite (`mw`) * Microsoft 836 // Excel (`xls`) * Microsoft PowerPoint (`ppt`) * Microsoft Word (`doc`) * 837 // Microsoft Works (`wks`, `wps`, `wdb`) * Microsoft Write (`wri`) * Rich Text 838 // Format (`rtf`) * Shockwave Flash (`swf`) * Text (`ans`, `txt`). Additional 839 // filetypes may be added in the future. An up-to-date list can always be found 840 // in Google's file type FAQ 841 // (https://support.google.com/webmasters/answer/35287). 842 FileType string `json:"fileType,omitempty"` 843 // Filter: Activates or deactivates the automatic filtering of Google search 844 // results. See Automatic Filtering 845 // (https://developers.google.com/custom-search/docs/json_api_reference#automaticFiltering) 846 // for more information about Google's search results filters. Valid values for 847 // this parameter are: * `0`: Disabled * `1`: Enabled (default) **Note**: By 848 // default, Google applies filtering to all search results to improve the 849 // quality of those results. 850 Filter string `json:"filter,omitempty"` 851 // Gl: Boosts search results whose country of origin matches the parameter 852 // value. See Country Codes 853 // (https://developers.google.com/custom-search/docs/json_api_reference#countryCodes) 854 // for a list of valid values. Specifying a `gl` parameter value in WebSearch 855 // requests should improve the relevance of results. This is particularly true 856 // for international customers and, even more specifically, for customers in 857 // English-speaking countries other than the United States. 858 Gl string `json:"gl,omitempty"` 859 // GoogleHost: Specifies the Google domain (for example, google.com, google.de, 860 // or google.fr) to which the search should be limited. 861 GoogleHost string `json:"googleHost,omitempty"` 862 // HighRange: Specifies the ending value for a search range. Use `cse:lowRange` 863 // and `cse:highrange` to append an inclusive search range of 864 // `lowRange...highRange` to the query. 865 HighRange string `json:"highRange,omitempty"` 866 // Hl: Specifies the interface language (host language) of your user interface. 867 // Explicitly setting this parameter improves the performance and the quality 868 // of your search results. See the Interface Languages 869 // (https://developers.google.com/custom-search/docs/json_api_reference#wsInterfaceLanguages) 870 // section of Internationalizing Queries and Results Presentation 871 // (https://developers.google.com/custom-search/docs/json_api_reference#wsInternationalizing) 872 // for more information, and Supported Interface Languages 873 // (https://developers.google.com/custom-search/docs/json_api_reference#interfaceLanguages) 874 // for a list of supported languages. 875 Hl string `json:"hl,omitempty"` 876 // Hq: Appends the specified query terms to the query, as if they were combined 877 // with a logical `AND` operator. 878 Hq string `json:"hq,omitempty"` 879 // ImgColorType: Restricts results to images of a specified color type. 880 // Supported values are: * `mono` (black and white) * `gray` (grayscale) * 881 // `color` (color) 882 ImgColorType string `json:"imgColorType,omitempty"` 883 // ImgDominantColor: Restricts results to images with a specific dominant 884 // color. Supported values are: * `red` * `orange` * `yellow` * `green` * 885 // `teal` * `blue` * `purple` * `pink` * `white` * `gray` * `black` * `brown` 886 ImgDominantColor string `json:"imgDominantColor,omitempty"` 887 // ImgSize: Restricts results to images of a specified size. Supported values 888 // are: * `icon` (small) * `small | medium | large | xlarge` (medium) * 889 // `xxlarge` (large) * `huge` (extra-large) 890 ImgSize string `json:"imgSize,omitempty"` 891 // ImgType: Restricts results to images of a specified type. Supported values 892 // are: * `clipart` (Clip art) * `face` (Face) * `lineart` (Line drawing) * 893 // `photo` (Photo) * `animated` (Animated) * `stock` (Stock) 894 ImgType string `json:"imgType,omitempty"` 895 // InputEncoding: The character encoding supported for search requests. 896 InputEncoding string `json:"inputEncoding,omitempty"` 897 // Language: The language of the search results. 898 Language string `json:"language,omitempty"` 899 // LinkSite: Specifies that all results should contain a link to a specific 900 // URL. 901 LinkSite string `json:"linkSite,omitempty"` 902 // LowRange: Specifies the starting value for a search range. Use 903 // `cse:lowRange` and `cse:highrange` to append an inclusive search range of 904 // `lowRange...highRange` to the query. 905 LowRange string `json:"lowRange,omitempty"` 906 // OrTerms: Provides additional search terms to check for in a document, where 907 // each document in the search results must contain at least one of the 908 // additional search terms. You can also use the Boolean OR 909 // (https://developers.google.com/custom-search/docs/json_api_reference#BooleanOrSearch) 910 // query term for this type of query. 911 OrTerms string `json:"orTerms,omitempty"` 912 // OutputEncoding: The character encoding supported for search results. 913 OutputEncoding string `json:"outputEncoding,omitempty"` 914 // RelatedSite: Specifies that all search results should be pages that are 915 // related to the specified URL. The parameter value should be a URL. 916 RelatedSite string `json:"relatedSite,omitempty"` 917 // Rights: Filters based on licensing. Supported values include: * 918 // `cc_publicdomain` * `cc_attribute` * `cc_sharealike` * `cc_noncommercial` * 919 // `cc_nonderived` 920 Rights string `json:"rights,omitempty"` 921 // Safe: Specifies the SafeSearch level 922 // (https://developers.google.com/custom-search/docs/json_api_reference#safeSearchLevels) 923 // used for filtering out adult results. This is a custom property not defined 924 // in the OpenSearch spec. Valid parameter values are: * "off": Disable 925 // SafeSearch * "active": Enable SafeSearch 926 Safe string `json:"safe,omitempty"` 927 // SearchTerms: The search terms entered by the user. 928 SearchTerms string `json:"searchTerms,omitempty"` 929 // SearchType: Allowed values are `web` or `image`. If unspecified, results are 930 // limited to webpages. 931 SearchType string `json:"searchType,omitempty"` 932 // SiteSearch: Restricts results to URLs from a specified site. 933 SiteSearch string `json:"siteSearch,omitempty"` 934 // SiteSearchFilter: Specifies whether to include or exclude results from the 935 // site named in the `sitesearch` parameter. Supported values are: * `i`: 936 // include content from site * `e`: exclude content from site 937 SiteSearchFilter string `json:"siteSearchFilter,omitempty"` 938 // Sort: Specifies that results should be sorted according to the specified 939 // expression. For example, sort by date. 940 Sort string `json:"sort,omitempty"` 941 // StartIndex: The index of the current set of search results into the total 942 // set of results, where the index of the first result is 1. 943 StartIndex int64 `json:"startIndex,omitempty"` 944 // StartPage: The page number of this set of results, where the page length is 945 // set by the `count` property. 946 StartPage int64 `json:"startPage,omitempty"` 947 // Title: A description of the query. 948 Title string `json:"title,omitempty"` 949 // TotalResults: Estimated number of total search results. May not be accurate. 950 TotalResults int64 `json:"totalResults,omitempty,string"` 951 // ForceSendFields is a list of field names (e.g. "Count") to unconditionally 952 // include in API requests. By default, fields with empty or default values are 953 // omitted from API requests. See 954 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 955 // details. 956 ForceSendFields []string `json:"-"` 957 // NullFields is a list of field names (e.g. "Count") to include in API 958 // requests with the JSON null value. By default, fields with empty values are 959 // omitted from API requests. See 960 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 961 NullFields []string `json:"-"` 962 } 963 964 func (s *SearchQueriesRequest) MarshalJSON() ([]byte, error) { 965 type NoMethod SearchQueriesRequest 966 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 967 } 968 969 // SearchSearchInformation: Metadata about a search operation. 970 type SearchSearchInformation struct { 971 // FormattedSearchTime: The time taken for the server to return search results, 972 // formatted according to locale style. 973 FormattedSearchTime string `json:"formattedSearchTime,omitempty"` 974 // FormattedTotalResults: The total number of search results, formatted 975 // according to locale style. 976 FormattedTotalResults string `json:"formattedTotalResults,omitempty"` 977 // SearchTime: The time taken for the server to return search results. 978 SearchTime float64 `json:"searchTime,omitempty"` 979 // TotalResults: The total number of search results returned by the query. 980 TotalResults string `json:"totalResults,omitempty"` 981 // ForceSendFields is a list of field names (e.g. "FormattedSearchTime") to 982 // unconditionally include in API requests. By default, fields with empty or 983 // default values are omitted from API requests. See 984 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 985 // details. 986 ForceSendFields []string `json:"-"` 987 // NullFields is a list of field names (e.g. "FormattedSearchTime") to include 988 // in API requests with the JSON null value. By default, fields with empty 989 // values are omitted from API requests. See 990 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 991 NullFields []string `json:"-"` 992 } 993 994 func (s *SearchSearchInformation) MarshalJSON() ([]byte, error) { 995 type NoMethod SearchSearchInformation 996 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 997 } 998 999 func (s *SearchSearchInformation) UnmarshalJSON(data []byte) error { 1000 type NoMethod SearchSearchInformation 1001 var s1 struct { 1002 SearchTime gensupport.JSONFloat64 `json:"searchTime"` 1003 *NoMethod 1004 } 1005 s1.NoMethod = (*NoMethod)(s) 1006 if err := json.Unmarshal(data, &s1); err != nil { 1007 return err 1008 } 1009 s.SearchTime = float64(s1.SearchTime) 1010 return nil 1011 } 1012 1013 // SearchSpelling: Spell correction information for a query. 1014 type SearchSpelling struct { 1015 // CorrectedQuery: The corrected query. 1016 CorrectedQuery string `json:"correctedQuery,omitempty"` 1017 // HtmlCorrectedQuery: The corrected query, formatted in HTML. 1018 HtmlCorrectedQuery string `json:"htmlCorrectedQuery,omitempty"` 1019 // ForceSendFields is a list of field names (e.g. "CorrectedQuery") to 1020 // unconditionally include in API requests. By default, fields with empty or 1021 // default values are omitted from API requests. See 1022 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 1023 // details. 1024 ForceSendFields []string `json:"-"` 1025 // NullFields is a list of field names (e.g. "CorrectedQuery") to include in 1026 // API requests with the JSON null value. By default, fields with empty values 1027 // are omitted from API requests. See 1028 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 1029 NullFields []string `json:"-"` 1030 } 1031 1032 func (s *SearchSpelling) MarshalJSON() ([]byte, error) { 1033 type NoMethod SearchSpelling 1034 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 1035 } 1036 1037 // SearchUrl: OpenSearch template and URL. 1038 type SearchUrl struct { 1039 // Template: The actual OpenSearch template 1040 // (http://www.opensearch.org/specifications/opensearch/1.1#opensearch_url_template_syntax) 1041 // for this API. 1042 Template string `json:"template,omitempty"` 1043 // Type: The MIME type of the OpenSearch URL template for the Custom Search 1044 // JSON API. 1045 Type string `json:"type,omitempty"` 1046 // ForceSendFields is a list of field names (e.g. "Template") to 1047 // unconditionally include in API requests. By default, fields with empty or 1048 // default values are omitted from API requests. See 1049 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 1050 // details. 1051 ForceSendFields []string `json:"-"` 1052 // NullFields is a list of field names (e.g. "Template") to include in API 1053 // requests with the JSON null value. By default, fields with empty values are 1054 // omitted from API requests. See 1055 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 1056 NullFields []string `json:"-"` 1057 } 1058 1059 func (s *SearchUrl) MarshalJSON() ([]byte, error) { 1060 type NoMethod SearchUrl 1061 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 1062 } 1063 1064 type CseListCall struct { 1065 s *Service 1066 urlParams_ gensupport.URLParams 1067 ifNoneMatch_ string 1068 ctx_ context.Context 1069 header_ http.Header 1070 } 1071 1072 // List: Returns metadata about the search performed, metadata about the engine 1073 // used for the search, and the search results. 1074 func (r *CseService) List() *CseListCall { 1075 c := &CseListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1076 return c 1077 } 1078 1079 // C2coff sets the optional parameter "c2coff": Enables or disables Simplified 1080 // and Traditional Chinese Search 1081 // (https://developers.google.com/custom-search/docs/json_api_reference#chineseSearch). 1082 // The default value for this parameter is 0 (zero), meaning that the feature 1083 // is enabled. Supported values are: * `1`: Disabled * `0`: Enabled (default) 1084 func (c *CseListCall) C2coff(c2coff string) *CseListCall { 1085 c.urlParams_.Set("c2coff", c2coff) 1086 return c 1087 } 1088 1089 // Cr sets the optional parameter "cr": Restricts search results to documents 1090 // originating in a particular country. You may use Boolean operators 1091 // (https://developers.google.com/custom-search/docs/json_api_reference#booleanOperators) 1092 // in the cr parameter's value. Google Search determines the country of a 1093 // document by analyzing: * the top-level domain (TLD) of the document's URL * 1094 // the geographic location of the Web server's IP address See the Country 1095 // Parameter Values 1096 // (https://developers.google.com/custom-search/docs/json_api_reference#countryCollections) 1097 // page for a list of valid values for this parameter. 1098 func (c *CseListCall) Cr(cr string) *CseListCall { 1099 c.urlParams_.Set("cr", cr) 1100 return c 1101 } 1102 1103 // Cx sets the optional parameter "cx": The Programmable Search Engine ID to 1104 // use for this request. 1105 func (c *CseListCall) Cx(cx string) *CseListCall { 1106 c.urlParams_.Set("cx", cx) 1107 return c 1108 } 1109 1110 // DateRestrict sets the optional parameter "dateRestrict": Restricts results 1111 // to URLs based on date. Supported values include: * `d[number]`: requests 1112 // results from the specified number of past days. * `w[number]`: requests 1113 // results from the specified number of past weeks. * `m[number]`: requests 1114 // results from the specified number of past months. * `y[number]`: requests 1115 // results from the specified number of past years. 1116 func (c *CseListCall) DateRestrict(dateRestrict string) *CseListCall { 1117 c.urlParams_.Set("dateRestrict", dateRestrict) 1118 return c 1119 } 1120 1121 // ExactTerms sets the optional parameter "exactTerms": Identifies a phrase 1122 // that all documents in the search results must contain. 1123 func (c *CseListCall) ExactTerms(exactTerms string) *CseListCall { 1124 c.urlParams_.Set("exactTerms", exactTerms) 1125 return c 1126 } 1127 1128 // ExcludeTerms sets the optional parameter "excludeTerms": Identifies a word 1129 // or phrase that should not appear in any documents in the search results. 1130 func (c *CseListCall) ExcludeTerms(excludeTerms string) *CseListCall { 1131 c.urlParams_.Set("excludeTerms", excludeTerms) 1132 return c 1133 } 1134 1135 // FileType sets the optional parameter "fileType": Restricts results to files 1136 // of a specified extension. A list of file types indexable by Google can be 1137 // found in Search Console Help Center 1138 // (https://support.google.com/webmasters/answer/35287). 1139 func (c *CseListCall) FileType(fileType string) *CseListCall { 1140 c.urlParams_.Set("fileType", fileType) 1141 return c 1142 } 1143 1144 // Filter sets the optional parameter "filter": Controls turning on or off the 1145 // duplicate content filter. * See Automatic Filtering 1146 // (https://developers.google.com/custom-search/docs/json_api_reference#automaticFiltering) 1147 // for more information about Google's search results filters. Note that host 1148 // crowding filtering applies only to multi-site searches. * By default, Google 1149 // applies filtering to all search results to improve the quality of those 1150 // results. Acceptable values are: * `0`: Turns off duplicate content filter. * 1151 // `1`: Turns on duplicate content filter. 1152 func (c *CseListCall) Filter(filter string) *CseListCall { 1153 c.urlParams_.Set("filter", filter) 1154 return c 1155 } 1156 1157 // Gl sets the optional parameter "gl": Geolocation of end user. * The `gl` 1158 // parameter value is a two-letter country code. The `gl` parameter boosts 1159 // search results whose country of origin matches the parameter value. See the 1160 // Country Codes 1161 // (https://developers.google.com/custom-search/docs/json_api_reference#countryCodes) 1162 // page for a list of valid values. * Specifying a `gl` parameter value should 1163 // lead to more relevant results. This is particularly true for international 1164 // customers and, even more specifically, for customers in English- speaking 1165 // countries other than the United States. 1166 func (c *CseListCall) Gl(gl string) *CseListCall { 1167 c.urlParams_.Set("gl", gl) 1168 return c 1169 } 1170 1171 // Googlehost sets the optional parameter "googlehost": **Deprecated**. Use the 1172 // `gl` parameter for a similar effect. The local Google domain (for example, 1173 // google.com, google.de, or google.fr) to use to perform the search. 1174 func (c *CseListCall) Googlehost(googlehost string) *CseListCall { 1175 c.urlParams_.Set("googlehost", googlehost) 1176 return c 1177 } 1178 1179 // HighRange sets the optional parameter "highRange": Specifies the ending 1180 // value for a search range. * Use `lowRange` and `highRange` to append an 1181 // inclusive search range of `lowRange...highRange` to the query. 1182 func (c *CseListCall) HighRange(highRange string) *CseListCall { 1183 c.urlParams_.Set("highRange", highRange) 1184 return c 1185 } 1186 1187 // Hl sets the optional parameter "hl": Sets the user interface language. * 1188 // Explicitly setting this parameter improves the performance and the quality 1189 // of your search results. * See the Interface Languages 1190 // (https://developers.google.com/custom-search/docs/json_api_reference#wsInterfaceLanguages) 1191 // section of Internationalizing Queries and Results Presentation 1192 // (https://developers.google.com/custom-search/docs/json_api_reference#wsInternationalizing) 1193 // for more information, and Supported Interface Languages 1194 // (https://developers.google.com/custom-search/docs/json_api_reference#interfaceLanguages) 1195 // for a list of supported languages. 1196 func (c *CseListCall) Hl(hl string) *CseListCall { 1197 c.urlParams_.Set("hl", hl) 1198 return c 1199 } 1200 1201 // Hq sets the optional parameter "hq": Appends the specified query terms to 1202 // the query, as if they were combined with a logical AND operator. 1203 func (c *CseListCall) Hq(hq string) *CseListCall { 1204 c.urlParams_.Set("hq", hq) 1205 return c 1206 } 1207 1208 // ImgColorType sets the optional parameter "imgColorType": Returns black and 1209 // white, grayscale, transparent, or color images. Acceptable values are: * 1210 // "color" * "gray" * "mono": black and white * "trans": transparent 1211 // background 1212 // 1213 // Possible values: 1214 // 1215 // "imgColorTypeUndefined" - No image color type specified. 1216 // "mono" - Black and white images only. 1217 // "gray" - Grayscale images only. 1218 // "color" - Color images only. 1219 // "trans" - Images with transparent background 1220 func (c *CseListCall) ImgColorType(imgColorType string) *CseListCall { 1221 c.urlParams_.Set("imgColorType", imgColorType) 1222 return c 1223 } 1224 1225 // ImgDominantColor sets the optional parameter "imgDominantColor": Returns 1226 // images of a specific dominant color. Acceptable values are: * "black" * 1227 // "blue" * "brown" * "gray" * "green" * "orange" * "pink" * 1228 // "purple" * "red" * "teal" * "white" * "yellow" 1229 // 1230 // Possible values: 1231 // 1232 // "imgDominantColorUndefined" - No dominant color specified. 1233 // "black" - Predominantly black images only. 1234 // "blue" - Predominantly blue images only. 1235 // "brown" - Predominantly brown images only. 1236 // "gray" - Predominantly gray images only. 1237 // "green" - Predominantly green images only. 1238 // "orange" - Predominantly orange images only. 1239 // "pink" - Predominantly pink images only. 1240 // "purple" - Predominantly purple images only. 1241 // "red" - Predominantly red images only. 1242 // "teal" - Predominantly teal images only. 1243 // "white" - Predominantly white images only. 1244 // "yellow" - Predominantly yellow images only. 1245 func (c *CseListCall) ImgDominantColor(imgDominantColor string) *CseListCall { 1246 c.urlParams_.Set("imgDominantColor", imgDominantColor) 1247 return c 1248 } 1249 1250 // ImgSize sets the optional parameter "imgSize": Returns images of a specified 1251 // size. Acceptable values are: * "huge" * "icon" * "large" * "medium" 1252 // * "small" * "xlarge" * "xxlarge" 1253 // 1254 // Possible values: 1255 // 1256 // "imgSizeUndefined" - No image size specified. 1257 // "HUGE" - Only the largest possible images. 1258 // "ICON" - Only very small icon-sized images. 1259 // "LARGE" - Only large images. 1260 // "MEDIUM" - Only medium images. 1261 // "SMALL" - Only small images. 1262 // "XLARGE" - Only very large images. 1263 // "XXLARGE" - Only extremely large images. 1264 func (c *CseListCall) ImgSize(imgSize string) *CseListCall { 1265 c.urlParams_.Set("imgSize", imgSize) 1266 return c 1267 } 1268 1269 // ImgType sets the optional parameter "imgType": Returns images of a type. 1270 // Acceptable values are: * "clipart" * "face" * "lineart" * "stock" * 1271 // "photo" * "animated" 1272 // 1273 // Possible values: 1274 // 1275 // "imgTypeUndefined" - No image type specified. 1276 // "clipart" - Clipart-style images only. 1277 // "face" - Images of faces only. 1278 // "lineart" - Line art images only. 1279 // "stock" - Stock images only. 1280 // "photo" - Photo images only. 1281 // "animated" - Animated images only. 1282 func (c *CseListCall) ImgType(imgType string) *CseListCall { 1283 c.urlParams_.Set("imgType", imgType) 1284 return c 1285 } 1286 1287 // LinkSite sets the optional parameter "linkSite": Specifies that all search 1288 // results should contain a link to a particular URL. 1289 func (c *CseListCall) LinkSite(linkSite string) *CseListCall { 1290 c.urlParams_.Set("linkSite", linkSite) 1291 return c 1292 } 1293 1294 // LowRange sets the optional parameter "lowRange": Specifies the starting 1295 // value for a search range. Use `lowRange` and `highRange` to append an 1296 // inclusive search range of `lowRange...highRange` to the query. 1297 func (c *CseListCall) LowRange(lowRange string) *CseListCall { 1298 c.urlParams_.Set("lowRange", lowRange) 1299 return c 1300 } 1301 1302 // Lr sets the optional parameter "lr": Restricts the search to documents 1303 // written in a particular language (e.g., `lr=lang_ja`). Acceptable values 1304 // are: * "lang_ar": Arabic * "lang_bg": Bulgarian * "lang_ca": Catalan * 1305 // "lang_cs": Czech * "lang_da": Danish * "lang_de": German * 1306 // "lang_el": Greek * "lang_en": English * "lang_es": Spanish * 1307 // "lang_et": Estonian * "lang_fi": Finnish * "lang_fr": French * 1308 // "lang_hr": Croatian * "lang_hu": Hungarian * "lang_id": Indonesian * 1309 // "lang_is": Icelandic * "lang_it": Italian * "lang_iw": Hebrew * 1310 // "lang_ja": Japanese * "lang_ko": Korean * "lang_lt": Lithuanian * 1311 // "lang_lv": Latvian * "lang_nl": Dutch * "lang_no": Norwegian * 1312 // "lang_pl": Polish * "lang_pt": Portuguese * "lang_ro": Romanian * 1313 // "lang_ru": Russian * "lang_sk": Slovak * "lang_sl": Slovenian * 1314 // "lang_sr": Serbian * "lang_sv": Swedish * "lang_tr": Turkish * 1315 // "lang_zh-CN": Chinese (Simplified) * "lang_zh-TW": Chinese (Traditional) 1316 func (c *CseListCall) Lr(lr string) *CseListCall { 1317 c.urlParams_.Set("lr", lr) 1318 return c 1319 } 1320 1321 // Num sets the optional parameter "num": Number of search results to return. * 1322 // Valid values are integers between 1 and 10, inclusive. 1323 func (c *CseListCall) Num(num int64) *CseListCall { 1324 c.urlParams_.Set("num", fmt.Sprint(num)) 1325 return c 1326 } 1327 1328 // OrTerms sets the optional parameter "orTerms": Provides additional search 1329 // terms to check for in a document, where each document in the search results 1330 // must contain at least one of the additional search terms. 1331 func (c *CseListCall) OrTerms(orTerms string) *CseListCall { 1332 c.urlParams_.Set("orTerms", orTerms) 1333 return c 1334 } 1335 1336 // Q sets the optional parameter "q": Query 1337 func (c *CseListCall) Q(q string) *CseListCall { 1338 c.urlParams_.Set("q", q) 1339 return c 1340 } 1341 1342 // RelatedSite sets the optional parameter "relatedSite": Deprecated. 1343 func (c *CseListCall) RelatedSite(relatedSite string) *CseListCall { 1344 c.urlParams_.Set("relatedSite", relatedSite) 1345 return c 1346 } 1347 1348 // Rights sets the optional parameter "rights": Filters based on licensing. 1349 // Supported values include: `cc_publicdomain`, `cc_attribute`, 1350 // `cc_sharealike`, `cc_noncommercial`, `cc_nonderived` and combinations of 1351 // these. See typical combinations 1352 // (https://wiki.creativecommons.org/wiki/CC_Search_integration). 1353 func (c *CseListCall) Rights(rights string) *CseListCall { 1354 c.urlParams_.Set("rights", rights) 1355 return c 1356 } 1357 1358 // Safe sets the optional parameter "safe": Search safety level. Acceptable 1359 // values are: * "active": Enables SafeSearch filtering. * "off": Disables 1360 // SafeSearch filtering. (default) 1361 // 1362 // Possible values: 1363 // 1364 // "safeUndefined" - SafeSearch mode unspecified. (Falls back to engine's 1365 // 1366 // configuration.) 1367 // 1368 // "active" - Turn SafeSearch on. 1369 // "high" - Deprecated, equivalent to "active". 1370 // "medium" - Deprecated, equivalent to "active". 1371 // "off" - Turn SafeSearch off. 1372 func (c *CseListCall) Safe(safe string) *CseListCall { 1373 c.urlParams_.Set("safe", safe) 1374 return c 1375 } 1376 1377 // SearchType sets the optional parameter "searchType": Specifies the search 1378 // type: `image`. If unspecified, results are limited to webpages. Acceptable 1379 // values are: * "image": custom image search. 1380 // 1381 // Possible values: 1382 // 1383 // "searchTypeUndefined" - Search type unspecified (defaults to web search). 1384 // "image" - Image search. 1385 func (c *CseListCall) SearchType(searchType string) *CseListCall { 1386 c.urlParams_.Set("searchType", searchType) 1387 return c 1388 } 1389 1390 // SiteSearch sets the optional parameter "siteSearch": Specifies a given site 1391 // which should always be included or excluded from results (see 1392 // `siteSearchFilter` parameter, below). 1393 func (c *CseListCall) SiteSearch(siteSearch string) *CseListCall { 1394 c.urlParams_.Set("siteSearch", siteSearch) 1395 return c 1396 } 1397 1398 // SiteSearchFilter sets the optional parameter "siteSearchFilter": Controls 1399 // whether to include or exclude results from the site named in the 1400 // `siteSearch` parameter. Acceptable values are: * "e": exclude * "i": 1401 // include 1402 // 1403 // Possible values: 1404 // 1405 // "siteSearchFilterUndefined" - Filter mode unspecified. 1406 // "e" - Exclude results from the listed sites. 1407 // "i" - Include only results from the listed sites. 1408 func (c *CseListCall) SiteSearchFilter(siteSearchFilter string) *CseListCall { 1409 c.urlParams_.Set("siteSearchFilter", siteSearchFilter) 1410 return c 1411 } 1412 1413 // SnippetLength sets the optional parameter "snippetLength": Maximum length of 1414 // snippet text, in characters, to be returned with results. Note: this feature 1415 // is limited to specific engines. * Valid values are integers between 161 and 1416 // 1000, inclusive. 1417 func (c *CseListCall) SnippetLength(snippetLength int64) *CseListCall { 1418 c.urlParams_.Set("snippetLength", fmt.Sprint(snippetLength)) 1419 return c 1420 } 1421 1422 // Sort sets the optional parameter "sort": The sort expression to apply to the 1423 // results. The sort parameter specifies that the results be sorted according 1424 // to the specified expression i.e. sort by date. Example: sort=date 1425 // (https://developers.google.com/custom-search/docs/structured_search#sort-by-attribute). 1426 func (c *CseListCall) Sort(sort string) *CseListCall { 1427 c.urlParams_.Set("sort", sort) 1428 return c 1429 } 1430 1431 // Start sets the optional parameter "start": The index of the first result to 1432 // return. The default number of results per page is 10, so `&start=11` would 1433 // start at the top of the second page of results. **Note**: The JSON API will 1434 // never return more than 100 results, even if more than 100 documents match 1435 // the query, so setting the sum of `start + num` to a number greater than 100 1436 // will produce an error. Also note that the maximum value for `num` is 10. 1437 func (c *CseListCall) Start(start int64) *CseListCall { 1438 c.urlParams_.Set("start", fmt.Sprint(start)) 1439 return c 1440 } 1441 1442 // Fields allows partial responses to be retrieved. See 1443 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more 1444 // details. 1445 func (c *CseListCall) Fields(s ...googleapi.Field) *CseListCall { 1446 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1447 return c 1448 } 1449 1450 // IfNoneMatch sets an optional parameter which makes the operation fail if the 1451 // object's ETag matches the given value. This is useful for getting updates 1452 // only after the object has changed since the last request. 1453 func (c *CseListCall) IfNoneMatch(entityTag string) *CseListCall { 1454 c.ifNoneMatch_ = entityTag 1455 return c 1456 } 1457 1458 // Context sets the context to be used in this call's Do method. 1459 func (c *CseListCall) Context(ctx context.Context) *CseListCall { 1460 c.ctx_ = ctx 1461 return c 1462 } 1463 1464 // Header returns a http.Header that can be modified by the caller to add 1465 // headers to the request. 1466 func (c *CseListCall) Header() http.Header { 1467 if c.header_ == nil { 1468 c.header_ = make(http.Header) 1469 } 1470 return c.header_ 1471 } 1472 1473 func (c *CseListCall) doRequest(alt string) (*http.Response, error) { 1474 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_) 1475 if c.ifNoneMatch_ != "" { 1476 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 1477 } 1478 var body io.Reader = nil 1479 c.urlParams_.Set("alt", alt) 1480 c.urlParams_.Set("prettyPrint", "false") 1481 urls := googleapi.ResolveRelative(c.s.BasePath, "customsearch/v1") 1482 urls += "?" + c.urlParams_.Encode() 1483 req, err := http.NewRequest("GET", urls, body) 1484 if err != nil { 1485 return nil, err 1486 } 1487 req.Header = reqHeaders 1488 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1489 } 1490 1491 // Do executes the "search.cse.list" call. 1492 // Any non-2xx status code is an error. Response headers are in either 1493 // *Search.ServerResponse.Header or (if a response was returned at all) in 1494 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check 1495 // whether the returned error was because http.StatusNotModified was returned. 1496 func (c *CseListCall) Do(opts ...googleapi.CallOption) (*Search, error) { 1497 gensupport.SetOptions(c.urlParams_, opts...) 1498 res, err := c.doRequest("json") 1499 if res != nil && res.StatusCode == http.StatusNotModified { 1500 if res.Body != nil { 1501 res.Body.Close() 1502 } 1503 return nil, gensupport.WrapError(&googleapi.Error{ 1504 Code: res.StatusCode, 1505 Header: res.Header, 1506 }) 1507 } 1508 if err != nil { 1509 return nil, err 1510 } 1511 defer googleapi.CloseBody(res) 1512 if err := googleapi.CheckResponse(res); err != nil { 1513 return nil, gensupport.WrapError(err) 1514 } 1515 ret := &Search{ 1516 ServerResponse: googleapi.ServerResponse{ 1517 Header: res.Header, 1518 HTTPStatusCode: res.StatusCode, 1519 }, 1520 } 1521 target := &ret 1522 if err := gensupport.DecodeResponse(target, res); err != nil { 1523 return nil, err 1524 } 1525 return ret, nil 1526 } 1527 1528 type CseSiterestrictListCall struct { 1529 s *Service 1530 urlParams_ gensupport.URLParams 1531 ifNoneMatch_ string 1532 ctx_ context.Context 1533 header_ http.Header 1534 } 1535 1536 // List: Returns metadata about the search performed, metadata about the engine 1537 // used for the search, and the search results. Uses a small set of url 1538 // patterns. 1539 func (r *CseSiterestrictService) List() *CseSiterestrictListCall { 1540 c := &CseSiterestrictListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1541 return c 1542 } 1543 1544 // C2coff sets the optional parameter "c2coff": Enables or disables Simplified 1545 // and Traditional Chinese Search 1546 // (https://developers.google.com/custom-search/docs/json_api_reference#chineseSearch). 1547 // The default value for this parameter is 0 (zero), meaning that the feature 1548 // is enabled. Supported values are: * `1`: Disabled * `0`: Enabled (default) 1549 func (c *CseSiterestrictListCall) C2coff(c2coff string) *CseSiterestrictListCall { 1550 c.urlParams_.Set("c2coff", c2coff) 1551 return c 1552 } 1553 1554 // Cr sets the optional parameter "cr": Restricts search results to documents 1555 // originating in a particular country. You may use Boolean operators 1556 // (https://developers.google.com/custom-search/docs/json_api_reference#booleanOperators) 1557 // in the cr parameter's value. Google Search determines the country of a 1558 // document by analyzing: * the top-level domain (TLD) of the document's URL * 1559 // the geographic location of the Web server's IP address See the Country 1560 // Parameter Values 1561 // (https://developers.google.com/custom-search/docs/json_api_reference#countryCollections) 1562 // page for a list of valid values for this parameter. 1563 func (c *CseSiterestrictListCall) Cr(cr string) *CseSiterestrictListCall { 1564 c.urlParams_.Set("cr", cr) 1565 return c 1566 } 1567 1568 // Cx sets the optional parameter "cx": The Programmable Search Engine ID to 1569 // use for this request. 1570 func (c *CseSiterestrictListCall) Cx(cx string) *CseSiterestrictListCall { 1571 c.urlParams_.Set("cx", cx) 1572 return c 1573 } 1574 1575 // DateRestrict sets the optional parameter "dateRestrict": Restricts results 1576 // to URLs based on date. Supported values include: * `d[number]`: requests 1577 // results from the specified number of past days. * `w[number]`: requests 1578 // results from the specified number of past weeks. * `m[number]`: requests 1579 // results from the specified number of past months. * `y[number]`: requests 1580 // results from the specified number of past years. 1581 func (c *CseSiterestrictListCall) DateRestrict(dateRestrict string) *CseSiterestrictListCall { 1582 c.urlParams_.Set("dateRestrict", dateRestrict) 1583 return c 1584 } 1585 1586 // ExactTerms sets the optional parameter "exactTerms": Identifies a phrase 1587 // that all documents in the search results must contain. 1588 func (c *CseSiterestrictListCall) ExactTerms(exactTerms string) *CseSiterestrictListCall { 1589 c.urlParams_.Set("exactTerms", exactTerms) 1590 return c 1591 } 1592 1593 // ExcludeTerms sets the optional parameter "excludeTerms": Identifies a word 1594 // or phrase that should not appear in any documents in the search results. 1595 func (c *CseSiterestrictListCall) ExcludeTerms(excludeTerms string) *CseSiterestrictListCall { 1596 c.urlParams_.Set("excludeTerms", excludeTerms) 1597 return c 1598 } 1599 1600 // FileType sets the optional parameter "fileType": Restricts results to files 1601 // of a specified extension. A list of file types indexable by Google can be 1602 // found in Search Console Help Center 1603 // (https://support.google.com/webmasters/answer/35287). 1604 func (c *CseSiterestrictListCall) FileType(fileType string) *CseSiterestrictListCall { 1605 c.urlParams_.Set("fileType", fileType) 1606 return c 1607 } 1608 1609 // Filter sets the optional parameter "filter": Controls turning on or off the 1610 // duplicate content filter. * See Automatic Filtering 1611 // (https://developers.google.com/custom-search/docs/json_api_reference#automaticFiltering) 1612 // for more information about Google's search results filters. Note that host 1613 // crowding filtering applies only to multi-site searches. * By default, Google 1614 // applies filtering to all search results to improve the quality of those 1615 // results. Acceptable values are: * `0`: Turns off duplicate content filter. * 1616 // `1`: Turns on duplicate content filter. 1617 func (c *CseSiterestrictListCall) Filter(filter string) *CseSiterestrictListCall { 1618 c.urlParams_.Set("filter", filter) 1619 return c 1620 } 1621 1622 // Gl sets the optional parameter "gl": Geolocation of end user. * The `gl` 1623 // parameter value is a two-letter country code. The `gl` parameter boosts 1624 // search results whose country of origin matches the parameter value. See the 1625 // Country Codes 1626 // (https://developers.google.com/custom-search/docs/json_api_reference#countryCodes) 1627 // page for a list of valid values. * Specifying a `gl` parameter value should 1628 // lead to more relevant results. This is particularly true for international 1629 // customers and, even more specifically, for customers in English- speaking 1630 // countries other than the United States. 1631 func (c *CseSiterestrictListCall) Gl(gl string) *CseSiterestrictListCall { 1632 c.urlParams_.Set("gl", gl) 1633 return c 1634 } 1635 1636 // Googlehost sets the optional parameter "googlehost": **Deprecated**. Use the 1637 // `gl` parameter for a similar effect. The local Google domain (for example, 1638 // google.com, google.de, or google.fr) to use to perform the search. 1639 func (c *CseSiterestrictListCall) Googlehost(googlehost string) *CseSiterestrictListCall { 1640 c.urlParams_.Set("googlehost", googlehost) 1641 return c 1642 } 1643 1644 // HighRange sets the optional parameter "highRange": Specifies the ending 1645 // value for a search range. * Use `lowRange` and `highRange` to append an 1646 // inclusive search range of `lowRange...highRange` to the query. 1647 func (c *CseSiterestrictListCall) HighRange(highRange string) *CseSiterestrictListCall { 1648 c.urlParams_.Set("highRange", highRange) 1649 return c 1650 } 1651 1652 // Hl sets the optional parameter "hl": Sets the user interface language. * 1653 // Explicitly setting this parameter improves the performance and the quality 1654 // of your search results. * See the Interface Languages 1655 // (https://developers.google.com/custom-search/docs/json_api_reference#wsInterfaceLanguages) 1656 // section of Internationalizing Queries and Results Presentation 1657 // (https://developers.google.com/custom-search/docs/json_api_reference#wsInternationalizing) 1658 // for more information, and Supported Interface Languages 1659 // (https://developers.google.com/custom-search/docs/json_api_reference#interfaceLanguages) 1660 // for a list of supported languages. 1661 func (c *CseSiterestrictListCall) Hl(hl string) *CseSiterestrictListCall { 1662 c.urlParams_.Set("hl", hl) 1663 return c 1664 } 1665 1666 // Hq sets the optional parameter "hq": Appends the specified query terms to 1667 // the query, as if they were combined with a logical AND operator. 1668 func (c *CseSiterestrictListCall) Hq(hq string) *CseSiterestrictListCall { 1669 c.urlParams_.Set("hq", hq) 1670 return c 1671 } 1672 1673 // ImgColorType sets the optional parameter "imgColorType": Returns black and 1674 // white, grayscale, transparent, or color images. Acceptable values are: * 1675 // "color" * "gray" * "mono": black and white * "trans": transparent 1676 // background 1677 // 1678 // Possible values: 1679 // 1680 // "imgColorTypeUndefined" - No image color type specified. 1681 // "mono" - Black and white images only. 1682 // "gray" - Grayscale images only. 1683 // "color" - Color images only. 1684 // "trans" - Images with transparent background 1685 func (c *CseSiterestrictListCall) ImgColorType(imgColorType string) *CseSiterestrictListCall { 1686 c.urlParams_.Set("imgColorType", imgColorType) 1687 return c 1688 } 1689 1690 // ImgDominantColor sets the optional parameter "imgDominantColor": Returns 1691 // images of a specific dominant color. Acceptable values are: * "black" * 1692 // "blue" * "brown" * "gray" * "green" * "orange" * "pink" * 1693 // "purple" * "red" * "teal" * "white" * "yellow" 1694 // 1695 // Possible values: 1696 // 1697 // "imgDominantColorUndefined" - No dominant color specified. 1698 // "black" - Predominantly black images only. 1699 // "blue" - Predominantly blue images only. 1700 // "brown" - Predominantly brown images only. 1701 // "gray" - Predominantly gray images only. 1702 // "green" - Predominantly green images only. 1703 // "orange" - Predominantly orange images only. 1704 // "pink" - Predominantly pink images only. 1705 // "purple" - Predominantly purple images only. 1706 // "red" - Predominantly red images only. 1707 // "teal" - Predominantly teal images only. 1708 // "white" - Predominantly white images only. 1709 // "yellow" - Predominantly yellow images only. 1710 func (c *CseSiterestrictListCall) ImgDominantColor(imgDominantColor string) *CseSiterestrictListCall { 1711 c.urlParams_.Set("imgDominantColor", imgDominantColor) 1712 return c 1713 } 1714 1715 // ImgSize sets the optional parameter "imgSize": Returns images of a specified 1716 // size. Acceptable values are: * "huge" * "icon" * "large" * "medium" 1717 // * "small" * "xlarge" * "xxlarge" 1718 // 1719 // Possible values: 1720 // 1721 // "imgSizeUndefined" - No image size specified. 1722 // "HUGE" - Only the largest possible images. 1723 // "ICON" - Only very small icon-sized images. 1724 // "LARGE" - Only large images. 1725 // "MEDIUM" - Only medium images. 1726 // "SMALL" - Only small images. 1727 // "XLARGE" - Only very large images. 1728 // "XXLARGE" - Only extremely large images. 1729 func (c *CseSiterestrictListCall) ImgSize(imgSize string) *CseSiterestrictListCall { 1730 c.urlParams_.Set("imgSize", imgSize) 1731 return c 1732 } 1733 1734 // ImgType sets the optional parameter "imgType": Returns images of a type. 1735 // Acceptable values are: * "clipart" * "face" * "lineart" * "stock" * 1736 // "photo" * "animated" 1737 // 1738 // Possible values: 1739 // 1740 // "imgTypeUndefined" - No image type specified. 1741 // "clipart" - Clipart-style images only. 1742 // "face" - Images of faces only. 1743 // "lineart" - Line art images only. 1744 // "stock" - Stock images only. 1745 // "photo" - Photo images only. 1746 // "animated" - Animated images only. 1747 func (c *CseSiterestrictListCall) ImgType(imgType string) *CseSiterestrictListCall { 1748 c.urlParams_.Set("imgType", imgType) 1749 return c 1750 } 1751 1752 // LinkSite sets the optional parameter "linkSite": Specifies that all search 1753 // results should contain a link to a particular URL. 1754 func (c *CseSiterestrictListCall) LinkSite(linkSite string) *CseSiterestrictListCall { 1755 c.urlParams_.Set("linkSite", linkSite) 1756 return c 1757 } 1758 1759 // LowRange sets the optional parameter "lowRange": Specifies the starting 1760 // value for a search range. Use `lowRange` and `highRange` to append an 1761 // inclusive search range of `lowRange...highRange` to the query. 1762 func (c *CseSiterestrictListCall) LowRange(lowRange string) *CseSiterestrictListCall { 1763 c.urlParams_.Set("lowRange", lowRange) 1764 return c 1765 } 1766 1767 // Lr sets the optional parameter "lr": Restricts the search to documents 1768 // written in a particular language (e.g., `lr=lang_ja`). Acceptable values 1769 // are: * "lang_ar": Arabic * "lang_bg": Bulgarian * "lang_ca": Catalan * 1770 // "lang_cs": Czech * "lang_da": Danish * "lang_de": German * 1771 // "lang_el": Greek * "lang_en": English * "lang_es": Spanish * 1772 // "lang_et": Estonian * "lang_fi": Finnish * "lang_fr": French * 1773 // "lang_hr": Croatian * "lang_hu": Hungarian * "lang_id": Indonesian * 1774 // "lang_is": Icelandic * "lang_it": Italian * "lang_iw": Hebrew * 1775 // "lang_ja": Japanese * "lang_ko": Korean * "lang_lt": Lithuanian * 1776 // "lang_lv": Latvian * "lang_nl": Dutch * "lang_no": Norwegian * 1777 // "lang_pl": Polish * "lang_pt": Portuguese * "lang_ro": Romanian * 1778 // "lang_ru": Russian * "lang_sk": Slovak * "lang_sl": Slovenian * 1779 // "lang_sr": Serbian * "lang_sv": Swedish * "lang_tr": Turkish * 1780 // "lang_zh-CN": Chinese (Simplified) * "lang_zh-TW": Chinese (Traditional) 1781 func (c *CseSiterestrictListCall) Lr(lr string) *CseSiterestrictListCall { 1782 c.urlParams_.Set("lr", lr) 1783 return c 1784 } 1785 1786 // Num sets the optional parameter "num": Number of search results to return. * 1787 // Valid values are integers between 1 and 10, inclusive. 1788 func (c *CseSiterestrictListCall) Num(num int64) *CseSiterestrictListCall { 1789 c.urlParams_.Set("num", fmt.Sprint(num)) 1790 return c 1791 } 1792 1793 // OrTerms sets the optional parameter "orTerms": Provides additional search 1794 // terms to check for in a document, where each document in the search results 1795 // must contain at least one of the additional search terms. 1796 func (c *CseSiterestrictListCall) OrTerms(orTerms string) *CseSiterestrictListCall { 1797 c.urlParams_.Set("orTerms", orTerms) 1798 return c 1799 } 1800 1801 // Q sets the optional parameter "q": Query 1802 func (c *CseSiterestrictListCall) Q(q string) *CseSiterestrictListCall { 1803 c.urlParams_.Set("q", q) 1804 return c 1805 } 1806 1807 // RelatedSite sets the optional parameter "relatedSite": Deprecated. 1808 func (c *CseSiterestrictListCall) RelatedSite(relatedSite string) *CseSiterestrictListCall { 1809 c.urlParams_.Set("relatedSite", relatedSite) 1810 return c 1811 } 1812 1813 // Rights sets the optional parameter "rights": Filters based on licensing. 1814 // Supported values include: `cc_publicdomain`, `cc_attribute`, 1815 // `cc_sharealike`, `cc_noncommercial`, `cc_nonderived` and combinations of 1816 // these. See typical combinations 1817 // (https://wiki.creativecommons.org/wiki/CC_Search_integration). 1818 func (c *CseSiterestrictListCall) Rights(rights string) *CseSiterestrictListCall { 1819 c.urlParams_.Set("rights", rights) 1820 return c 1821 } 1822 1823 // Safe sets the optional parameter "safe": Search safety level. Acceptable 1824 // values are: * "active": Enables SafeSearch filtering. * "off": Disables 1825 // SafeSearch filtering. (default) 1826 // 1827 // Possible values: 1828 // 1829 // "safeUndefined" - SafeSearch mode unspecified. (Falls back to engine's 1830 // 1831 // configuration.) 1832 // 1833 // "active" - Turn SafeSearch on. 1834 // "high" - Deprecated, equivalent to "active". 1835 // "medium" - Deprecated, equivalent to "active". 1836 // "off" - Turn SafeSearch off. 1837 func (c *CseSiterestrictListCall) Safe(safe string) *CseSiterestrictListCall { 1838 c.urlParams_.Set("safe", safe) 1839 return c 1840 } 1841 1842 // SearchType sets the optional parameter "searchType": Specifies the search 1843 // type: `image`. If unspecified, results are limited to webpages. Acceptable 1844 // values are: * "image": custom image search. 1845 // 1846 // Possible values: 1847 // 1848 // "searchTypeUndefined" - Search type unspecified (defaults to web search). 1849 // "image" - Image search. 1850 func (c *CseSiterestrictListCall) SearchType(searchType string) *CseSiterestrictListCall { 1851 c.urlParams_.Set("searchType", searchType) 1852 return c 1853 } 1854 1855 // SiteSearch sets the optional parameter "siteSearch": Specifies a given site 1856 // which should always be included or excluded from results (see 1857 // `siteSearchFilter` parameter, below). 1858 func (c *CseSiterestrictListCall) SiteSearch(siteSearch string) *CseSiterestrictListCall { 1859 c.urlParams_.Set("siteSearch", siteSearch) 1860 return c 1861 } 1862 1863 // SiteSearchFilter sets the optional parameter "siteSearchFilter": Controls 1864 // whether to include or exclude results from the site named in the 1865 // `siteSearch` parameter. Acceptable values are: * "e": exclude * "i": 1866 // include 1867 // 1868 // Possible values: 1869 // 1870 // "siteSearchFilterUndefined" - Filter mode unspecified. 1871 // "e" - Exclude results from the listed sites. 1872 // "i" - Include only results from the listed sites. 1873 func (c *CseSiterestrictListCall) SiteSearchFilter(siteSearchFilter string) *CseSiterestrictListCall { 1874 c.urlParams_.Set("siteSearchFilter", siteSearchFilter) 1875 return c 1876 } 1877 1878 // SnippetLength sets the optional parameter "snippetLength": Maximum length of 1879 // snippet text, in characters, to be returned with results. Note: this feature 1880 // is limited to specific engines. * Valid values are integers between 161 and 1881 // 1000, inclusive. 1882 func (c *CseSiterestrictListCall) SnippetLength(snippetLength int64) *CseSiterestrictListCall { 1883 c.urlParams_.Set("snippetLength", fmt.Sprint(snippetLength)) 1884 return c 1885 } 1886 1887 // Sort sets the optional parameter "sort": The sort expression to apply to the 1888 // results. The sort parameter specifies that the results be sorted according 1889 // to the specified expression i.e. sort by date. Example: sort=date 1890 // (https://developers.google.com/custom-search/docs/structured_search#sort-by-attribute). 1891 func (c *CseSiterestrictListCall) Sort(sort string) *CseSiterestrictListCall { 1892 c.urlParams_.Set("sort", sort) 1893 return c 1894 } 1895 1896 // Start sets the optional parameter "start": The index of the first result to 1897 // return. The default number of results per page is 10, so `&start=11` would 1898 // start at the top of the second page of results. **Note**: The JSON API will 1899 // never return more than 100 results, even if more than 100 documents match 1900 // the query, so setting the sum of `start + num` to a number greater than 100 1901 // will produce an error. Also note that the maximum value for `num` is 10. 1902 func (c *CseSiterestrictListCall) Start(start int64) *CseSiterestrictListCall { 1903 c.urlParams_.Set("start", fmt.Sprint(start)) 1904 return c 1905 } 1906 1907 // Fields allows partial responses to be retrieved. See 1908 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more 1909 // details. 1910 func (c *CseSiterestrictListCall) Fields(s ...googleapi.Field) *CseSiterestrictListCall { 1911 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1912 return c 1913 } 1914 1915 // IfNoneMatch sets an optional parameter which makes the operation fail if the 1916 // object's ETag matches the given value. This is useful for getting updates 1917 // only after the object has changed since the last request. 1918 func (c *CseSiterestrictListCall) IfNoneMatch(entityTag string) *CseSiterestrictListCall { 1919 c.ifNoneMatch_ = entityTag 1920 return c 1921 } 1922 1923 // Context sets the context to be used in this call's Do method. 1924 func (c *CseSiterestrictListCall) Context(ctx context.Context) *CseSiterestrictListCall { 1925 c.ctx_ = ctx 1926 return c 1927 } 1928 1929 // Header returns a http.Header that can be modified by the caller to add 1930 // headers to the request. 1931 func (c *CseSiterestrictListCall) Header() http.Header { 1932 if c.header_ == nil { 1933 c.header_ = make(http.Header) 1934 } 1935 return c.header_ 1936 } 1937 1938 func (c *CseSiterestrictListCall) doRequest(alt string) (*http.Response, error) { 1939 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_) 1940 if c.ifNoneMatch_ != "" { 1941 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 1942 } 1943 var body io.Reader = nil 1944 c.urlParams_.Set("alt", alt) 1945 c.urlParams_.Set("prettyPrint", "false") 1946 urls := googleapi.ResolveRelative(c.s.BasePath, "customsearch/v1/siterestrict") 1947 urls += "?" + c.urlParams_.Encode() 1948 req, err := http.NewRequest("GET", urls, body) 1949 if err != nil { 1950 return nil, err 1951 } 1952 req.Header = reqHeaders 1953 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1954 } 1955 1956 // Do executes the "search.cse.siterestrict.list" call. 1957 // Any non-2xx status code is an error. Response headers are in either 1958 // *Search.ServerResponse.Header or (if a response was returned at all) in 1959 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check 1960 // whether the returned error was because http.StatusNotModified was returned. 1961 func (c *CseSiterestrictListCall) Do(opts ...googleapi.CallOption) (*Search, error) { 1962 gensupport.SetOptions(c.urlParams_, opts...) 1963 res, err := c.doRequest("json") 1964 if res != nil && res.StatusCode == http.StatusNotModified { 1965 if res.Body != nil { 1966 res.Body.Close() 1967 } 1968 return nil, gensupport.WrapError(&googleapi.Error{ 1969 Code: res.StatusCode, 1970 Header: res.Header, 1971 }) 1972 } 1973 if err != nil { 1974 return nil, err 1975 } 1976 defer googleapi.CloseBody(res) 1977 if err := googleapi.CheckResponse(res); err != nil { 1978 return nil, gensupport.WrapError(err) 1979 } 1980 ret := &Search{ 1981 ServerResponse: googleapi.ServerResponse{ 1982 Header: res.Header, 1983 HTTPStatusCode: res.StatusCode, 1984 }, 1985 } 1986 target := &ret 1987 if err := gensupport.DecodeResponse(target, res); err != nil { 1988 return nil, err 1989 } 1990 return ret, nil 1991 } 1992