google_customsearch1/
api.rs

1#![allow(clippy::ptr_arg)]
2
3use std::collections::{BTreeSet, HashMap};
4
5use tokio::time::sleep;
6
7// ##############
8// UTILITIES ###
9// ############
10
11// ########
12// HUB ###
13// ######
14
15/// Central instance to access all CustomSearchAPI related resource activities
16///
17/// # Examples
18///
19/// Instantiate a new hub
20///
21/// ```test_harness,no_run
22/// extern crate hyper;
23/// extern crate hyper_rustls;
24/// extern crate google_customsearch1 as customsearch1;
25/// use customsearch1::{Result, Error};
26/// # async fn dox() {
27/// use customsearch1::{CustomSearchAPI, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
28///
29/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
30/// // `client_secret`, among other things.
31/// let secret: yup_oauth2::ApplicationSecret = Default::default();
32/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
33/// // unless you replace  `None` with the desired Flow.
34/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
35/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
36/// // retrieve them from storage.
37/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
38///     secret,
39///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
40/// ).build().await.unwrap();
41///
42/// let client = hyper_util::client::legacy::Client::builder(
43///     hyper_util::rt::TokioExecutor::new()
44/// )
45/// .build(
46///     hyper_rustls::HttpsConnectorBuilder::new()
47///         .with_native_roots()
48///         .unwrap()
49///         .https_or_http()
50///         .enable_http1()
51///         .build()
52/// );
53/// let mut hub = CustomSearchAPI::new(client, auth);
54/// // You can configure optional parameters by calling the respective setters at will, and
55/// // execute the final call using `doit()`.
56/// // Values shown here are possibly random and not representative !
57/// let result = hub.cse().siterestrict_list()
58///              .start(81)
59///              .sort("vero")
60///              .snippet_length(-76)
61///              .site_search_filter("invidunt")
62///              .site_search("Stet")
63///              .search_type("vero")
64///              .safe("elitr")
65///              .rights("Lorem")
66///              .related_site("diam")
67///              .q("no")
68///              .or_terms("ipsum")
69///              .num(-23)
70///              .lr("takimata")
71///              .low_range("consetetur")
72///              .link_site("voluptua.")
73///              .img_type("et")
74///              .img_size("erat")
75///              .img_dominant_color("consetetur")
76///              .img_color_type("amet.")
77///              .hq("sed")
78///              .hl("takimata")
79///              .high_range("dolores")
80///              .googlehost("gubergren")
81///              .gl("et")
82///              .filter("accusam")
83///              .file_type("voluptua.")
84///              .exclude_terms("dolore")
85///              .exact_terms("dolore")
86///              .date_restrict("dolore")
87///              .cx("voluptua.")
88///              .cr("amet.")
89///              .c2coff("ea")
90///              .doit().await;
91///
92/// match result {
93///     Err(e) => match e {
94///         // The Error enum provides details about what exactly happened.
95///         // You can also just use its `Debug`, `Display` or `Error` traits
96///          Error::HttpError(_)
97///         |Error::Io(_)
98///         |Error::MissingAPIKey
99///         |Error::MissingToken(_)
100///         |Error::Cancelled
101///         |Error::UploadSizeLimitExceeded(_, _)
102///         |Error::Failure(_)
103///         |Error::BadRequest(_)
104///         |Error::FieldClash(_)
105///         |Error::JsonDecodeError(_, _) => println!("{}", e),
106///     },
107///     Ok(res) => println!("Success: {:?}", res),
108/// }
109/// # }
110/// ```
111#[derive(Clone)]
112pub struct CustomSearchAPI<C> {
113    pub client: common::Client<C>,
114    pub auth: Box<dyn common::GetToken>,
115    _user_agent: String,
116    _base_url: String,
117    _root_url: String,
118}
119
120impl<C> common::Hub for CustomSearchAPI<C> {}
121
122impl<'a, C> CustomSearchAPI<C> {
123    pub fn new<A: 'static + common::GetToken>(
124        client: common::Client<C>,
125        auth: A,
126    ) -> CustomSearchAPI<C> {
127        CustomSearchAPI {
128            client,
129            auth: Box::new(auth),
130            _user_agent: "google-api-rust-client/6.0.0".to_string(),
131            _base_url: "https://customsearch.googleapis.com/".to_string(),
132            _root_url: "https://customsearch.googleapis.com/".to_string(),
133        }
134    }
135
136    pub fn cse(&'a self) -> CseMethods<'a, C> {
137        CseMethods { hub: self }
138    }
139
140    /// Set the user-agent header field to use in all requests to the server.
141    /// It defaults to `google-api-rust-client/6.0.0`.
142    ///
143    /// Returns the previously set user-agent.
144    pub fn user_agent(&mut self, agent_name: String) -> String {
145        std::mem::replace(&mut self._user_agent, agent_name)
146    }
147
148    /// Set the base url to use in all requests to the server.
149    /// It defaults to `https://customsearch.googleapis.com/`.
150    ///
151    /// Returns the previously set base url.
152    pub fn base_url(&mut self, new_base_url: String) -> String {
153        std::mem::replace(&mut self._base_url, new_base_url)
154    }
155
156    /// Set the root url to use in all requests to the server.
157    /// It defaults to `https://customsearch.googleapis.com/`.
158    ///
159    /// Returns the previously set root url.
160    pub fn root_url(&mut self, new_root_url: String) -> String {
161        std::mem::replace(&mut self._root_url, new_root_url)
162    }
163}
164
165// ############
166// SCHEMAS ###
167// ##########
168/// Promotion result.
169///
170/// This type is not used in any activity, and only used as *part* of another schema.
171///
172#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
173#[serde_with::serde_as]
174#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
175pub struct Promotion {
176    /// An array of block objects for this promotion.
177    #[serde(rename = "bodyLines")]
178    pub body_lines: Option<Vec<PromotionBodyLines>>,
179    /// An abridged version of this search's result URL, e.g. www.example.com.
180    #[serde(rename = "displayLink")]
181    pub display_link: Option<String>,
182    /// The title of the promotion, in HTML.
183    #[serde(rename = "htmlTitle")]
184    pub html_title: Option<String>,
185    /// Image belonging to a promotion.
186    pub image: Option<PromotionImage>,
187    /// The URL of the promotion.
188    pub link: Option<String>,
189    /// The title of the promotion.
190    pub title: Option<String>,
191}
192
193impl common::Part for Promotion {}
194
195/// A custom search result.
196///
197/// This type is not used in any activity, and only used as *part* of another schema.
198///
199#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
200#[serde_with::serde_as]
201#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
202pub struct Result {
203    /// Indicates the ID of Google's cached version of the search result.
204    #[serde(rename = "cacheId")]
205    pub cache_id: Option<String>,
206    /// An abridged version of this search result’s URL, e.g. www.example.com.
207    #[serde(rename = "displayLink")]
208    pub display_link: Option<String>,
209    /// The file format of the search result.
210    #[serde(rename = "fileFormat")]
211    pub file_format: Option<String>,
212    /// The URL displayed after the snippet for each search result.
213    #[serde(rename = "formattedUrl")]
214    pub formatted_url: Option<String>,
215    /// The HTML-formatted URL displayed after the snippet for each search result.
216    #[serde(rename = "htmlFormattedUrl")]
217    pub html_formatted_url: Option<String>,
218    /// The snippet of the search result, in HTML.
219    #[serde(rename = "htmlSnippet")]
220    pub html_snippet: Option<String>,
221    /// The title of the search result, in HTML.
222    #[serde(rename = "htmlTitle")]
223    pub html_title: Option<String>,
224    /// Image belonging to a custom search result.
225    pub image: Option<ResultImage>,
226    /// A unique identifier for the type of current object. For this API, it is `customsearch#result.`
227    pub kind: Option<String>,
228    /// Encapsulates all information about refinement labels.
229    pub labels: Option<Vec<ResultLabels>>,
230    /// The full URL to which the search result is pointing, e.g. http://www.example.com/foo/bar.
231    pub link: Option<String>,
232    /// The MIME type of the search result.
233    pub mime: Option<String>,
234    /// Contains [PageMap](https://developers.google.com/custom-search/docs/structured_data#pagemaps) information for this search result.
235    pub pagemap: Option<HashMap<String, serde_json::Value>>,
236    /// The snippet of the search result, in plain text.
237    pub snippet: Option<String>,
238    /// The title of the search result, in plain text.
239    pub title: Option<String>,
240}
241
242impl common::Part for Result {}
243
244/// Response to a custom search request.
245///
246/// # Activities
247///
248/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
249/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
250///
251/// * [siterestrict list cse](CseSiterestrictListCall) (response)
252/// * [list cse](CseListCall) (response)
253#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
254#[serde_with::serde_as]
255#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
256pub struct Search {
257    /// Metadata and refinements associated with the given search engine, including: * The name of the search engine that was used for the query. * A set of [facet objects](https://developers.google.com/custom-search/docs/refinements#create) (refinements) you can use for refining a search.
258    pub context: Option<HashMap<String, serde_json::Value>>,
259    /// The current set of custom search results.
260    pub items: Option<Vec<Result>>,
261    /// Unique identifier for the type of current object. For this API, it is customsearch#search.
262    pub kind: Option<String>,
263    /// The set of [promotions](https://developers.google.com/custom-search/docs/promotions). Present only if the custom search engine's configuration files define any promotions for the given query.
264    pub promotions: Option<Vec<Promotion>>,
265    /// Query metadata for the previous, current, and next pages of results.
266    pub queries: Option<SearchQueries>,
267    /// Metadata about a search operation.
268    #[serde(rename = "searchInformation")]
269    pub search_information: Option<SearchSearchInformation>,
270    /// Spell correction information for a query.
271    pub spelling: Option<SearchSpelling>,
272    /// OpenSearch template and URL.
273    pub url: Option<SearchUrl>,
274}
275
276impl common::ResponseResult for Search {}
277
278/// Block object belonging to a promotion.
279///
280/// This type is not used in any activity, and only used as *part* of another schema.
281///
282#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
283#[serde_with::serde_as]
284#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
285pub struct PromotionBodyLines {
286    /// The block object's text in HTML, if it has text.
287    #[serde(rename = "htmlTitle")]
288    pub html_title: Option<String>,
289    /// The anchor text of the block object's link, if it has a link.
290    pub link: Option<String>,
291    /// The block object's text, if it has text.
292    pub title: Option<String>,
293    /// The URL of the block object's link, if it has one.
294    pub url: Option<String>,
295}
296
297impl common::NestedType for PromotionBodyLines {}
298impl common::Part for PromotionBodyLines {}
299
300/// Image belonging to a promotion.
301///
302/// This type is not used in any activity, and only used as *part* of another schema.
303///
304#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
305#[serde_with::serde_as]
306#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
307pub struct PromotionImage {
308    /// Image height in pixels.
309    pub height: Option<i32>,
310    /// URL of the image for this promotion link.
311    pub source: Option<String>,
312    /// Image width in pixels.
313    pub width: Option<i32>,
314}
315
316impl common::NestedType for PromotionImage {}
317impl common::Part for PromotionImage {}
318
319/// Image belonging to a custom search result.
320///
321/// This type is not used in any activity, and only used as *part* of another schema.
322///
323#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
324#[serde_with::serde_as]
325#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
326pub struct ResultImage {
327    /// The size of the image, in bytes.
328    #[serde(rename = "byteSize")]
329    pub byte_size: Option<i32>,
330    /// A URL pointing to the webpage hosting the image.
331    #[serde(rename = "contextLink")]
332    pub context_link: Option<String>,
333    /// The height of the image, in pixels.
334    pub height: Option<i32>,
335    /// The height of the thumbnail image, in pixels.
336    #[serde(rename = "thumbnailHeight")]
337    pub thumbnail_height: Option<i32>,
338    /// A URL to the thumbnail image.
339    #[serde(rename = "thumbnailLink")]
340    pub thumbnail_link: Option<String>,
341    /// The width of the thumbnail image, in pixels.
342    #[serde(rename = "thumbnailWidth")]
343    pub thumbnail_width: Option<i32>,
344    /// The width of the image, in pixels.
345    pub width: Option<i32>,
346}
347
348impl common::NestedType for ResultImage {}
349impl common::Part for ResultImage {}
350
351/// Refinement label associated with a custom search result.
352///
353/// This type is not used in any activity, and only used as *part* of another schema.
354///
355#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
356#[serde_with::serde_as]
357#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
358pub struct ResultLabels {
359    /// The display name of a refinement label. This is the name you should display in your user interface.
360    #[serde(rename = "displayName")]
361    pub display_name: Option<String>,
362    /// Refinement label and the associated refinement operation.
363    pub label_with_op: Option<String>,
364    /// The name of a refinement label, which you can use to refine searches. Don't display this in your user interface; instead, use displayName.
365    pub name: Option<String>,
366}
367
368impl common::NestedType for ResultLabels {}
369impl common::Part for ResultLabels {}
370
371/// Query metadata for the previous, current, and next pages of results.
372///
373/// This type is not used in any activity, and only used as *part* of another schema.
374///
375#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
376#[serde_with::serde_as]
377#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
378pub struct SearchQueries {
379    /// Metadata representing the next page of results, if applicable.
380    #[serde(rename = "nextPage")]
381    pub next_page: Option<Vec<SearchQueriesNextPage>>,
382    /// Metadata representing the previous page of results, if applicable.
383    #[serde(rename = "previousPage")]
384    pub previous_page: Option<Vec<SearchQueriesPreviousPage>>,
385    /// Metadata representing the current request.
386    pub request: Option<Vec<SearchQueriesRequest>>,
387}
388
389impl common::NestedType for SearchQueries {}
390impl common::Part for SearchQueries {}
391
392/// Custom search request metadata.
393///
394/// This type is not used in any activity, and only used as *part* of another schema.
395///
396#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
397#[serde_with::serde_as]
398#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
399pub struct SearchQueriesNextPage {
400    /// Number of search results returned in this set.
401    pub count: Option<i32>,
402    /// Restricts search results to documents originating in a particular country. You may use [Boolean operators](https://developers.google.com/custom-search/docs/json_api_reference#BooleanOrSearch) in the `cr` parameter's value. Google WebSearch determines the country of a document by analyzing the following: * The top-level domain (TLD) of the document's URL. * The geographic location of the web server's IP address. See [Country (cr) Parameter Values](https://developers.google.com/custom-search/docs/json_api_reference#countryCollections) for a list of valid values for this parameter.
403    pub cr: Option<String>,
404    /// The identifier of an engine created using the Programmable Search Engine [Control Panel](https://programmablesearchengine.google.com/). This is a custom property not defined in the OpenSearch spec. This parameter is **required**.
405    pub cx: Option<String>,
406    /// Restricts results to URLs based on date. Supported values include: * `d[number]`: requests results from the specified number of past days. * `w[number]`: requests results from the specified number of past weeks. * `m[number]`: requests results from the specified number of past months. * `y[number]`: requests results from the specified number of past years.
407    #[serde(rename = "dateRestrict")]
408    pub date_restrict: Option<String>,
409    /// Enables or disables the [Simplified and Traditional Chinese Search](https://developers.google.com/custom-search/docs/json_api_reference#chineseSearch) feature. Supported values are: * `0`: enabled (default) * `1`: disabled
410    #[serde(rename = "disableCnTwTranslation")]
411    pub disable_cn_tw_translation: Option<String>,
412    /// Identifies a phrase that all documents in the search results must contain.
413    #[serde(rename = "exactTerms")]
414    pub exact_terms: Option<String>,
415    /// Identifies a word or phrase that should not appear in any documents in the search results.
416    #[serde(rename = "excludeTerms")]
417    pub exclude_terms: Option<String>,
418    /// Restricts results to files of a specified extension. Filetypes supported by Google include: * Adobe Portable Document Format (`pdf`) * Adobe PostScript (`ps`) * Lotus 1-2-3 (`wk1`, `wk2`, `wk3`, `wk4`, `wk5`, `wki`, `wks`, `wku`) * Lotus WordPro (`lwp`) * Macwrite (`mw`) * Microsoft Excel (`xls`) * Microsoft PowerPoint (`ppt`) * Microsoft Word (`doc`) * Microsoft Works (`wks`, `wps`, `wdb`) * Microsoft Write (`wri`) * Rich Text Format (`rtf`) * Shockwave Flash (`swf`) * Text (`ans`, `txt`). Additional filetypes may be added in the future. An up-to-date list can always be found in Google's [file type FAQ](https://support.google.com/webmasters/answer/35287).
419    #[serde(rename = "fileType")]
420    pub file_type: Option<String>,
421    /// Activates or deactivates the automatic filtering of Google search results. See [Automatic Filtering](https://developers.google.com/custom-search/docs/json_api_reference#automaticFiltering) for more information about Google's search results filters. Valid values for this parameter are: * `0`: Disabled * `1`: Enabled (default) **Note**: By default, Google applies filtering to all search results to improve the quality of those results.
422    pub filter: Option<String>,
423    /// Boosts search results whose country of origin matches the parameter value. See [Country Codes](https://developers.google.com/custom-search/docs/json_api_reference#countryCodes) for a list of valid values. Specifying a `gl` parameter value in WebSearch requests should improve the relevance of results. This is particularly true for international customers and, even more specifically, for customers in English-speaking countries other than the United States.
424    pub gl: Option<String>,
425    /// Specifies the Google domain (for example, google.com, google.de, or google.fr) to which the search should be limited.
426    #[serde(rename = "googleHost")]
427    pub google_host: Option<String>,
428    /// Specifies the ending value for a search range. Use `cse:lowRange` and `cse:highrange` to append an inclusive search range of `lowRange...highRange` to the query.
429    #[serde(rename = "highRange")]
430    pub high_range: Option<String>,
431    /// Specifies the interface language (host language) of your user interface. Explicitly setting this parameter improves the performance and the quality of your search results. See the [Interface Languages](https://developers.google.com/custom-search/docs/json_api_reference#wsInterfaceLanguages) section of [Internationalizing Queries and Results Presentation](https://developers.google.com/custom-search/docs/json_api_reference#wsInternationalizing) for more information, and [Supported Interface Languages](https://developers.google.com/custom-search/docs/json_api_reference#interfaceLanguages) for a list of supported languages.
432    pub hl: Option<String>,
433    /// Appends the specified query terms to the query, as if they were combined with a logical `AND` operator.
434    pub hq: Option<String>,
435    /// Restricts results to images of a specified color type. Supported values are: * `mono` (black and white) * `gray` (grayscale) * `color` (color)
436    #[serde(rename = "imgColorType")]
437    pub img_color_type: Option<String>,
438    /// Restricts results to images with a specific dominant color. Supported values are: * `red` * `orange` * `yellow` * `green` * `teal` * `blue` * `purple` * `pink` * `white` * `gray` * `black` * `brown`
439    #[serde(rename = "imgDominantColor")]
440    pub img_dominant_color: Option<String>,
441    /// Restricts results to images of a specified size. Supported values are: * `icon` (small) * `small | medium | large | xlarge` (medium) * `xxlarge` (large) * `huge` (extra-large)
442    #[serde(rename = "imgSize")]
443    pub img_size: Option<String>,
444    /// Restricts results to images of a specified type. Supported values are: * `clipart` (Clip art) * `face` (Face) * `lineart` (Line drawing) * `photo` (Photo) * `animated` (Animated) * `stock` (Stock)
445    #[serde(rename = "imgType")]
446    pub img_type: Option<String>,
447    /// The character encoding supported for search requests.
448    #[serde(rename = "inputEncoding")]
449    pub input_encoding: Option<String>,
450    /// The language of the search results.
451    pub language: Option<String>,
452    /// Specifies that all results should contain a link to a specific URL.
453    #[serde(rename = "linkSite")]
454    pub link_site: Option<String>,
455    /// Specifies the starting value for a search range. Use `cse:lowRange` and `cse:highrange` to append an inclusive search range of `lowRange...highRange` to the query.
456    #[serde(rename = "lowRange")]
457    pub low_range: Option<String>,
458    /// Provides additional search terms to check for in a document, where each document in the search results must contain at least one of the additional search terms. You can also use the [Boolean OR](https://developers.google.com/custom-search/docs/json_api_reference#BooleanOrSearch) query term for this type of query.
459    #[serde(rename = "orTerms")]
460    pub or_terms: Option<String>,
461    /// The character encoding supported for search results.
462    #[serde(rename = "outputEncoding")]
463    pub output_encoding: Option<String>,
464    /// Specifies that all search results should be pages that are related to the specified URL. The parameter value should be a URL.
465    #[serde(rename = "relatedSite")]
466    pub related_site: Option<String>,
467    /// Filters based on licensing. Supported values include: * `cc_publicdomain` * `cc_attribute` * `cc_sharealike` * `cc_noncommercial` * `cc_nonderived`
468    pub rights: Option<String>,
469    /// Specifies the [SafeSearch level](https://developers.google.com/custom-search/docs/json_api_reference#safeSearchLevels) used for filtering out adult results. This is a custom property not defined in the OpenSearch spec. Valid parameter values are: * `"off"`: Disable SafeSearch * `"active"`: Enable SafeSearch
470    pub safe: Option<String>,
471    /// The search terms entered by the user.
472    #[serde(rename = "searchTerms")]
473    pub search_terms: Option<String>,
474    /// Allowed values are `web` or `image`. If unspecified, results are limited to webpages.
475    #[serde(rename = "searchType")]
476    pub search_type: Option<String>,
477    /// Restricts results to URLs from a specified site.
478    #[serde(rename = "siteSearch")]
479    pub site_search: Option<String>,
480    /// Specifies whether to include or exclude results from the site named in the `sitesearch` parameter. Supported values are: * `i`: include content from site * `e`: exclude content from site
481    #[serde(rename = "siteSearchFilter")]
482    pub site_search_filter: Option<String>,
483    /// Specifies that results should be sorted according to the specified expression. For example, sort by date.
484    pub sort: Option<String>,
485    /// The index of the current set of search results into the total set of results, where the index of the first result is 1.
486    #[serde(rename = "startIndex")]
487    pub start_index: Option<i32>,
488    /// The page number of this set of results, where the page length is set by the `count` property.
489    #[serde(rename = "startPage")]
490    pub start_page: Option<i32>,
491    /// A description of the query.
492    pub title: Option<String>,
493    /// Estimated number of total search results. May not be accurate.
494    #[serde(rename = "totalResults")]
495    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
496    pub total_results: Option<i64>,
497}
498
499impl common::NestedType for SearchQueriesNextPage {}
500impl common::Part for SearchQueriesNextPage {}
501
502/// Custom search request metadata.
503///
504/// This type is not used in any activity, and only used as *part* of another schema.
505///
506#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
507#[serde_with::serde_as]
508#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
509pub struct SearchQueriesPreviousPage {
510    /// Number of search results returned in this set.
511    pub count: Option<i32>,
512    /// Restricts search results to documents originating in a particular country. You may use [Boolean operators](https://developers.google.com/custom-search/docs/json_api_reference#BooleanOrSearch) in the `cr` parameter's value. Google WebSearch determines the country of a document by analyzing the following: * The top-level domain (TLD) of the document's URL. * The geographic location of the web server's IP address. See [Country (cr) Parameter Values](https://developers.google.com/custom-search/docs/json_api_reference#countryCollections) for a list of valid values for this parameter.
513    pub cr: Option<String>,
514    /// The identifier of an engine created using the Programmable Search Engine [Control Panel](https://programmablesearchengine.google.com/). This is a custom property not defined in the OpenSearch spec. This parameter is **required**.
515    pub cx: Option<String>,
516    /// Restricts results to URLs based on date. Supported values include: * `d[number]`: requests results from the specified number of past days. * `w[number]`: requests results from the specified number of past weeks. * `m[number]`: requests results from the specified number of past months. * `y[number]`: requests results from the specified number of past years.
517    #[serde(rename = "dateRestrict")]
518    pub date_restrict: Option<String>,
519    /// Enables or disables the [Simplified and Traditional Chinese Search](https://developers.google.com/custom-search/docs/json_api_reference#chineseSearch) feature. Supported values are: * `0`: enabled (default) * `1`: disabled
520    #[serde(rename = "disableCnTwTranslation")]
521    pub disable_cn_tw_translation: Option<String>,
522    /// Identifies a phrase that all documents in the search results must contain.
523    #[serde(rename = "exactTerms")]
524    pub exact_terms: Option<String>,
525    /// Identifies a word or phrase that should not appear in any documents in the search results.
526    #[serde(rename = "excludeTerms")]
527    pub exclude_terms: Option<String>,
528    /// Restricts results to files of a specified extension. Filetypes supported by Google include: * Adobe Portable Document Format (`pdf`) * Adobe PostScript (`ps`) * Lotus 1-2-3 (`wk1`, `wk2`, `wk3`, `wk4`, `wk5`, `wki`, `wks`, `wku`) * Lotus WordPro (`lwp`) * Macwrite (`mw`) * Microsoft Excel (`xls`) * Microsoft PowerPoint (`ppt`) * Microsoft Word (`doc`) * Microsoft Works (`wks`, `wps`, `wdb`) * Microsoft Write (`wri`) * Rich Text Format (`rtf`) * Shockwave Flash (`swf`) * Text (`ans`, `txt`). Additional filetypes may be added in the future. An up-to-date list can always be found in Google's [file type FAQ](https://support.google.com/webmasters/answer/35287).
529    #[serde(rename = "fileType")]
530    pub file_type: Option<String>,
531    /// Activates or deactivates the automatic filtering of Google search results. See [Automatic Filtering](https://developers.google.com/custom-search/docs/json_api_reference#automaticFiltering) for more information about Google's search results filters. Valid values for this parameter are: * `0`: Disabled * `1`: Enabled (default) **Note**: By default, Google applies filtering to all search results to improve the quality of those results.
532    pub filter: Option<String>,
533    /// Boosts search results whose country of origin matches the parameter value. See [Country Codes](https://developers.google.com/custom-search/docs/json_api_reference#countryCodes) for a list of valid values. Specifying a `gl` parameter value in WebSearch requests should improve the relevance of results. This is particularly true for international customers and, even more specifically, for customers in English-speaking countries other than the United States.
534    pub gl: Option<String>,
535    /// Specifies the Google domain (for example, google.com, google.de, or google.fr) to which the search should be limited.
536    #[serde(rename = "googleHost")]
537    pub google_host: Option<String>,
538    /// Specifies the ending value for a search range. Use `cse:lowRange` and `cse:highrange` to append an inclusive search range of `lowRange...highRange` to the query.
539    #[serde(rename = "highRange")]
540    pub high_range: Option<String>,
541    /// Specifies the interface language (host language) of your user interface. Explicitly setting this parameter improves the performance and the quality of your search results. See the [Interface Languages](https://developers.google.com/custom-search/docs/json_api_reference#wsInterfaceLanguages) section of [Internationalizing Queries and Results Presentation](https://developers.google.com/custom-search/docs/json_api_reference#wsInternationalizing) for more information, and [Supported Interface Languages](https://developers.google.com/custom-search/docs/json_api_reference#interfaceLanguages) for a list of supported languages.
542    pub hl: Option<String>,
543    /// Appends the specified query terms to the query, as if they were combined with a logical `AND` operator.
544    pub hq: Option<String>,
545    /// Restricts results to images of a specified color type. Supported values are: * `mono` (black and white) * `gray` (grayscale) * `color` (color)
546    #[serde(rename = "imgColorType")]
547    pub img_color_type: Option<String>,
548    /// Restricts results to images with a specific dominant color. Supported values are: * `red` * `orange` * `yellow` * `green` * `teal` * `blue` * `purple` * `pink` * `white` * `gray` * `black` * `brown`
549    #[serde(rename = "imgDominantColor")]
550    pub img_dominant_color: Option<String>,
551    /// Restricts results to images of a specified size. Supported values are: * `icon` (small) * `small | medium | large | xlarge` (medium) * `xxlarge` (large) * `huge` (extra-large)
552    #[serde(rename = "imgSize")]
553    pub img_size: Option<String>,
554    /// Restricts results to images of a specified type. Supported values are: * `clipart` (Clip art) * `face` (Face) * `lineart` (Line drawing) * `photo` (Photo) * `animated` (Animated) * `stock` (Stock)
555    #[serde(rename = "imgType")]
556    pub img_type: Option<String>,
557    /// The character encoding supported for search requests.
558    #[serde(rename = "inputEncoding")]
559    pub input_encoding: Option<String>,
560    /// The language of the search results.
561    pub language: Option<String>,
562    /// Specifies that all results should contain a link to a specific URL.
563    #[serde(rename = "linkSite")]
564    pub link_site: Option<String>,
565    /// Specifies the starting value for a search range. Use `cse:lowRange` and `cse:highrange` to append an inclusive search range of `lowRange...highRange` to the query.
566    #[serde(rename = "lowRange")]
567    pub low_range: Option<String>,
568    /// Provides additional search terms to check for in a document, where each document in the search results must contain at least one of the additional search terms. You can also use the [Boolean OR](https://developers.google.com/custom-search/docs/json_api_reference#BooleanOrSearch) query term for this type of query.
569    #[serde(rename = "orTerms")]
570    pub or_terms: Option<String>,
571    /// The character encoding supported for search results.
572    #[serde(rename = "outputEncoding")]
573    pub output_encoding: Option<String>,
574    /// Specifies that all search results should be pages that are related to the specified URL. The parameter value should be a URL.
575    #[serde(rename = "relatedSite")]
576    pub related_site: Option<String>,
577    /// Filters based on licensing. Supported values include: * `cc_publicdomain` * `cc_attribute` * `cc_sharealike` * `cc_noncommercial` * `cc_nonderived`
578    pub rights: Option<String>,
579    /// Specifies the [SafeSearch level](https://developers.google.com/custom-search/docs/json_api_reference#safeSearchLevels) used for filtering out adult results. This is a custom property not defined in the OpenSearch spec. Valid parameter values are: * `"off"`: Disable SafeSearch * `"active"`: Enable SafeSearch
580    pub safe: Option<String>,
581    /// The search terms entered by the user.
582    #[serde(rename = "searchTerms")]
583    pub search_terms: Option<String>,
584    /// Allowed values are `web` or `image`. If unspecified, results are limited to webpages.
585    #[serde(rename = "searchType")]
586    pub search_type: Option<String>,
587    /// Restricts results to URLs from a specified site.
588    #[serde(rename = "siteSearch")]
589    pub site_search: Option<String>,
590    /// Specifies whether to include or exclude results from the site named in the `sitesearch` parameter. Supported values are: * `i`: include content from site * `e`: exclude content from site
591    #[serde(rename = "siteSearchFilter")]
592    pub site_search_filter: Option<String>,
593    /// Specifies that results should be sorted according to the specified expression. For example, sort by date.
594    pub sort: Option<String>,
595    /// The index of the current set of search results into the total set of results, where the index of the first result is 1.
596    #[serde(rename = "startIndex")]
597    pub start_index: Option<i32>,
598    /// The page number of this set of results, where the page length is set by the `count` property.
599    #[serde(rename = "startPage")]
600    pub start_page: Option<i32>,
601    /// A description of the query.
602    pub title: Option<String>,
603    /// Estimated number of total search results. May not be accurate.
604    #[serde(rename = "totalResults")]
605    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
606    pub total_results: Option<i64>,
607}
608
609impl common::NestedType for SearchQueriesPreviousPage {}
610impl common::Part for SearchQueriesPreviousPage {}
611
612/// Custom search request metadata.
613///
614/// This type is not used in any activity, and only used as *part* of another schema.
615///
616#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
617#[serde_with::serde_as]
618#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
619pub struct SearchQueriesRequest {
620    /// Number of search results returned in this set.
621    pub count: Option<i32>,
622    /// Restricts search results to documents originating in a particular country. You may use [Boolean operators](https://developers.google.com/custom-search/docs/json_api_reference#BooleanOrSearch) in the `cr` parameter's value. Google WebSearch determines the country of a document by analyzing the following: * The top-level domain (TLD) of the document's URL. * The geographic location of the web server's IP address. See [Country (cr) Parameter Values](https://developers.google.com/custom-search/docs/json_api_reference#countryCollections) for a list of valid values for this parameter.
623    pub cr: Option<String>,
624    /// The identifier of an engine created using the Programmable Search Engine [Control Panel](https://programmablesearchengine.google.com/). This is a custom property not defined in the OpenSearch spec. This parameter is **required**.
625    pub cx: Option<String>,
626    /// Restricts results to URLs based on date. Supported values include: * `d[number]`: requests results from the specified number of past days. * `w[number]`: requests results from the specified number of past weeks. * `m[number]`: requests results from the specified number of past months. * `y[number]`: requests results from the specified number of past years.
627    #[serde(rename = "dateRestrict")]
628    pub date_restrict: Option<String>,
629    /// Enables or disables the [Simplified and Traditional Chinese Search](https://developers.google.com/custom-search/docs/json_api_reference#chineseSearch) feature. Supported values are: * `0`: enabled (default) * `1`: disabled
630    #[serde(rename = "disableCnTwTranslation")]
631    pub disable_cn_tw_translation: Option<String>,
632    /// Identifies a phrase that all documents in the search results must contain.
633    #[serde(rename = "exactTerms")]
634    pub exact_terms: Option<String>,
635    /// Identifies a word or phrase that should not appear in any documents in the search results.
636    #[serde(rename = "excludeTerms")]
637    pub exclude_terms: Option<String>,
638    /// Restricts results to files of a specified extension. Filetypes supported by Google include: * Adobe Portable Document Format (`pdf`) * Adobe PostScript (`ps`) * Lotus 1-2-3 (`wk1`, `wk2`, `wk3`, `wk4`, `wk5`, `wki`, `wks`, `wku`) * Lotus WordPro (`lwp`) * Macwrite (`mw`) * Microsoft Excel (`xls`) * Microsoft PowerPoint (`ppt`) * Microsoft Word (`doc`) * Microsoft Works (`wks`, `wps`, `wdb`) * Microsoft Write (`wri`) * Rich Text Format (`rtf`) * Shockwave Flash (`swf`) * Text (`ans`, `txt`). Additional filetypes may be added in the future. An up-to-date list can always be found in Google's [file type FAQ](https://support.google.com/webmasters/answer/35287).
639    #[serde(rename = "fileType")]
640    pub file_type: Option<String>,
641    /// Activates or deactivates the automatic filtering of Google search results. See [Automatic Filtering](https://developers.google.com/custom-search/docs/json_api_reference#automaticFiltering) for more information about Google's search results filters. Valid values for this parameter are: * `0`: Disabled * `1`: Enabled (default) **Note**: By default, Google applies filtering to all search results to improve the quality of those results.
642    pub filter: Option<String>,
643    /// Boosts search results whose country of origin matches the parameter value. See [Country Codes](https://developers.google.com/custom-search/docs/json_api_reference#countryCodes) for a list of valid values. Specifying a `gl` parameter value in WebSearch requests should improve the relevance of results. This is particularly true for international customers and, even more specifically, for customers in English-speaking countries other than the United States.
644    pub gl: Option<String>,
645    /// Specifies the Google domain (for example, google.com, google.de, or google.fr) to which the search should be limited.
646    #[serde(rename = "googleHost")]
647    pub google_host: Option<String>,
648    /// Specifies the ending value for a search range. Use `cse:lowRange` and `cse:highrange` to append an inclusive search range of `lowRange...highRange` to the query.
649    #[serde(rename = "highRange")]
650    pub high_range: Option<String>,
651    /// Specifies the interface language (host language) of your user interface. Explicitly setting this parameter improves the performance and the quality of your search results. See the [Interface Languages](https://developers.google.com/custom-search/docs/json_api_reference#wsInterfaceLanguages) section of [Internationalizing Queries and Results Presentation](https://developers.google.com/custom-search/docs/json_api_reference#wsInternationalizing) for more information, and [Supported Interface Languages](https://developers.google.com/custom-search/docs/json_api_reference#interfaceLanguages) for a list of supported languages.
652    pub hl: Option<String>,
653    /// Appends the specified query terms to the query, as if they were combined with a logical `AND` operator.
654    pub hq: Option<String>,
655    /// Restricts results to images of a specified color type. Supported values are: * `mono` (black and white) * `gray` (grayscale) * `color` (color)
656    #[serde(rename = "imgColorType")]
657    pub img_color_type: Option<String>,
658    /// Restricts results to images with a specific dominant color. Supported values are: * `red` * `orange` * `yellow` * `green` * `teal` * `blue` * `purple` * `pink` * `white` * `gray` * `black` * `brown`
659    #[serde(rename = "imgDominantColor")]
660    pub img_dominant_color: Option<String>,
661    /// Restricts results to images of a specified size. Supported values are: * `icon` (small) * `small | medium | large | xlarge` (medium) * `xxlarge` (large) * `huge` (extra-large)
662    #[serde(rename = "imgSize")]
663    pub img_size: Option<String>,
664    /// Restricts results to images of a specified type. Supported values are: * `clipart` (Clip art) * `face` (Face) * `lineart` (Line drawing) * `photo` (Photo) * `animated` (Animated) * `stock` (Stock)
665    #[serde(rename = "imgType")]
666    pub img_type: Option<String>,
667    /// The character encoding supported for search requests.
668    #[serde(rename = "inputEncoding")]
669    pub input_encoding: Option<String>,
670    /// The language of the search results.
671    pub language: Option<String>,
672    /// Specifies that all results should contain a link to a specific URL.
673    #[serde(rename = "linkSite")]
674    pub link_site: Option<String>,
675    /// Specifies the starting value for a search range. Use `cse:lowRange` and `cse:highrange` to append an inclusive search range of `lowRange...highRange` to the query.
676    #[serde(rename = "lowRange")]
677    pub low_range: Option<String>,
678    /// Provides additional search terms to check for in a document, where each document in the search results must contain at least one of the additional search terms. You can also use the [Boolean OR](https://developers.google.com/custom-search/docs/json_api_reference#BooleanOrSearch) query term for this type of query.
679    #[serde(rename = "orTerms")]
680    pub or_terms: Option<String>,
681    /// The character encoding supported for search results.
682    #[serde(rename = "outputEncoding")]
683    pub output_encoding: Option<String>,
684    /// Specifies that all search results should be pages that are related to the specified URL. The parameter value should be a URL.
685    #[serde(rename = "relatedSite")]
686    pub related_site: Option<String>,
687    /// Filters based on licensing. Supported values include: * `cc_publicdomain` * `cc_attribute` * `cc_sharealike` * `cc_noncommercial` * `cc_nonderived`
688    pub rights: Option<String>,
689    /// Specifies the [SafeSearch level](https://developers.google.com/custom-search/docs/json_api_reference#safeSearchLevels) used for filtering out adult results. This is a custom property not defined in the OpenSearch spec. Valid parameter values are: * `"off"`: Disable SafeSearch * `"active"`: Enable SafeSearch
690    pub safe: Option<String>,
691    /// The search terms entered by the user.
692    #[serde(rename = "searchTerms")]
693    pub search_terms: Option<String>,
694    /// Allowed values are `web` or `image`. If unspecified, results are limited to webpages.
695    #[serde(rename = "searchType")]
696    pub search_type: Option<String>,
697    /// Restricts results to URLs from a specified site.
698    #[serde(rename = "siteSearch")]
699    pub site_search: Option<String>,
700    /// Specifies whether to include or exclude results from the site named in the `sitesearch` parameter. Supported values are: * `i`: include content from site * `e`: exclude content from site
701    #[serde(rename = "siteSearchFilter")]
702    pub site_search_filter: Option<String>,
703    /// Specifies that results should be sorted according to the specified expression. For example, sort by date.
704    pub sort: Option<String>,
705    /// The index of the current set of search results into the total set of results, where the index of the first result is 1.
706    #[serde(rename = "startIndex")]
707    pub start_index: Option<i32>,
708    /// The page number of this set of results, where the page length is set by the `count` property.
709    #[serde(rename = "startPage")]
710    pub start_page: Option<i32>,
711    /// A description of the query.
712    pub title: Option<String>,
713    /// Estimated number of total search results. May not be accurate.
714    #[serde(rename = "totalResults")]
715    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
716    pub total_results: Option<i64>,
717}
718
719impl common::NestedType for SearchQueriesRequest {}
720impl common::Part for SearchQueriesRequest {}
721
722/// Metadata about a search operation.
723///
724/// This type is not used in any activity, and only used as *part* of another schema.
725///
726#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
727#[serde_with::serde_as]
728#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
729pub struct SearchSearchInformation {
730    /// The time taken for the server to return search results, formatted according to locale style.
731    #[serde(rename = "formattedSearchTime")]
732    pub formatted_search_time: Option<String>,
733    /// The total number of search results, formatted according to locale style.
734    #[serde(rename = "formattedTotalResults")]
735    pub formatted_total_results: Option<String>,
736    /// The time taken for the server to return search results.
737    #[serde(rename = "searchTime")]
738    pub search_time: Option<f64>,
739    /// The total number of search results returned by the query.
740    #[serde(rename = "totalResults")]
741    pub total_results: Option<String>,
742}
743
744impl common::NestedType for SearchSearchInformation {}
745impl common::Part for SearchSearchInformation {}
746
747/// Spell correction information for a query.
748///
749/// This type is not used in any activity, and only used as *part* of another schema.
750///
751#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
752#[serde_with::serde_as]
753#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
754pub struct SearchSpelling {
755    /// The corrected query.
756    #[serde(rename = "correctedQuery")]
757    pub corrected_query: Option<String>,
758    /// The corrected query, formatted in HTML.
759    #[serde(rename = "htmlCorrectedQuery")]
760    pub html_corrected_query: Option<String>,
761}
762
763impl common::NestedType for SearchSpelling {}
764impl common::Part for SearchSpelling {}
765
766/// OpenSearch template and URL.
767///
768/// This type is not used in any activity, and only used as *part* of another schema.
769///
770#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
771#[serde_with::serde_as]
772#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
773pub struct SearchUrl {
774    /// The actual [OpenSearch template](http://www.opensearch.org/specifications/opensearch/1.1#opensearch_url_template_syntax) for this API.
775    pub template: Option<String>,
776    /// The MIME type of the OpenSearch URL template for the Custom Search JSON API.
777    #[serde(rename = "type")]
778    pub type_: Option<String>,
779}
780
781impl common::NestedType for SearchUrl {}
782impl common::Part for SearchUrl {}
783
784// ###################
785// MethodBuilders ###
786// #################
787
788/// A builder providing access to all methods supported on *cse* resources.
789/// It is not used directly, but through the [`CustomSearchAPI`] hub.
790///
791/// # Example
792///
793/// Instantiate a resource builder
794///
795/// ```test_harness,no_run
796/// extern crate hyper;
797/// extern crate hyper_rustls;
798/// extern crate google_customsearch1 as customsearch1;
799///
800/// # async fn dox() {
801/// use customsearch1::{CustomSearchAPI, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
802///
803/// let secret: yup_oauth2::ApplicationSecret = Default::default();
804/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
805///     secret,
806///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
807/// ).build().await.unwrap();
808///
809/// let client = hyper_util::client::legacy::Client::builder(
810///     hyper_util::rt::TokioExecutor::new()
811/// )
812/// .build(
813///     hyper_rustls::HttpsConnectorBuilder::new()
814///         .with_native_roots()
815///         .unwrap()
816///         .https_or_http()
817///         .enable_http1()
818///         .build()
819/// );
820/// let mut hub = CustomSearchAPI::new(client, auth);
821/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
822/// // like `list(...)` and `siterestrict_list(...)`
823/// // to build up your call.
824/// let rb = hub.cse();
825/// # }
826/// ```
827pub struct CseMethods<'a, C>
828where
829    C: 'a,
830{
831    hub: &'a CustomSearchAPI<C>,
832}
833
834impl<'a, C> common::MethodsBuilder for CseMethods<'a, C> {}
835
836impl<'a, C> CseMethods<'a, C> {
837    /// Create a builder to help you perform the following task:
838    ///
839    /// Returns metadata about the search performed, metadata about the engine used for the search, and the search results. Uses a small set of url patterns.
840    pub fn siterestrict_list(&self) -> CseSiterestrictListCall<'a, C> {
841        CseSiterestrictListCall {
842            hub: self.hub,
843            _start: Default::default(),
844            _sort: Default::default(),
845            _snippet_length: Default::default(),
846            _site_search_filter: Default::default(),
847            _site_search: Default::default(),
848            _search_type: Default::default(),
849            _safe: Default::default(),
850            _rights: Default::default(),
851            _related_site: Default::default(),
852            _q: Default::default(),
853            _or_terms: Default::default(),
854            _num: Default::default(),
855            _lr: Default::default(),
856            _low_range: Default::default(),
857            _link_site: Default::default(),
858            _img_type: Default::default(),
859            _img_size: Default::default(),
860            _img_dominant_color: Default::default(),
861            _img_color_type: Default::default(),
862            _hq: Default::default(),
863            _hl: Default::default(),
864            _high_range: Default::default(),
865            _googlehost: Default::default(),
866            _gl: Default::default(),
867            _filter: Default::default(),
868            _file_type: Default::default(),
869            _exclude_terms: Default::default(),
870            _exact_terms: Default::default(),
871            _date_restrict: Default::default(),
872            _cx: Default::default(),
873            _cr: Default::default(),
874            _c2coff: Default::default(),
875            _delegate: Default::default(),
876            _additional_params: Default::default(),
877        }
878    }
879
880    /// Create a builder to help you perform the following task:
881    ///
882    /// Returns metadata about the search performed, metadata about the engine used for the search, and the search results.
883    pub fn list(&self) -> CseListCall<'a, C> {
884        CseListCall {
885            hub: self.hub,
886            _start: Default::default(),
887            _sort: Default::default(),
888            _snippet_length: Default::default(),
889            _site_search_filter: Default::default(),
890            _site_search: Default::default(),
891            _search_type: Default::default(),
892            _safe: Default::default(),
893            _rights: Default::default(),
894            _related_site: Default::default(),
895            _q: Default::default(),
896            _or_terms: Default::default(),
897            _num: Default::default(),
898            _lr: Default::default(),
899            _low_range: Default::default(),
900            _link_site: Default::default(),
901            _img_type: Default::default(),
902            _img_size: Default::default(),
903            _img_dominant_color: Default::default(),
904            _img_color_type: Default::default(),
905            _hq: Default::default(),
906            _hl: Default::default(),
907            _high_range: Default::default(),
908            _googlehost: Default::default(),
909            _gl: Default::default(),
910            _filter: Default::default(),
911            _file_type: Default::default(),
912            _exclude_terms: Default::default(),
913            _exact_terms: Default::default(),
914            _date_restrict: Default::default(),
915            _cx: Default::default(),
916            _cr: Default::default(),
917            _c2coff: Default::default(),
918            _delegate: Default::default(),
919            _additional_params: Default::default(),
920        }
921    }
922}
923
924// ###################
925// CallBuilders   ###
926// #################
927
928/// Returns metadata about the search performed, metadata about the engine used for the search, and the search results. Uses a small set of url patterns.
929///
930/// A builder for the *siterestrict.list* method supported by a *cse* resource.
931/// It is not used directly, but through a [`CseMethods`] instance.
932///
933/// # Example
934///
935/// Instantiate a resource method builder
936///
937/// ```test_harness,no_run
938/// # extern crate hyper;
939/// # extern crate hyper_rustls;
940/// # extern crate google_customsearch1 as customsearch1;
941/// # async fn dox() {
942/// # use customsearch1::{CustomSearchAPI, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
943///
944/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
945/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
946/// #     secret,
947/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
948/// # ).build().await.unwrap();
949///
950/// # let client = hyper_util::client::legacy::Client::builder(
951/// #     hyper_util::rt::TokioExecutor::new()
952/// # )
953/// # .build(
954/// #     hyper_rustls::HttpsConnectorBuilder::new()
955/// #         .with_native_roots()
956/// #         .unwrap()
957/// #         .https_or_http()
958/// #         .enable_http1()
959/// #         .build()
960/// # );
961/// # let mut hub = CustomSearchAPI::new(client, auth);
962/// // You can configure optional parameters by calling the respective setters at will, and
963/// // execute the final call using `doit()`.
964/// // Values shown here are possibly random and not representative !
965/// let result = hub.cse().siterestrict_list()
966///              .start(6)
967///              .sort("Lorem")
968///              .snippet_length(-38)
969///              .site_search_filter("no")
970///              .site_search("est")
971///              .search_type("At")
972///              .safe("sed")
973///              .rights("sit")
974///              .related_site("et")
975///              .q("tempor")
976///              .or_terms("aliquyam")
977///              .num(-5)
978///              .lr("et")
979///              .low_range("sanctus")
980///              .link_site("Lorem")
981///              .img_type("est")
982///              .img_size("sed")
983///              .img_dominant_color("diam")
984///              .img_color_type("dolores")
985///              .hq("dolores")
986///              .hl("et")
987///              .high_range("sed")
988///              .googlehost("no")
989///              .gl("et")
990///              .filter("elitr")
991///              .file_type("sed")
992///              .exclude_terms("no")
993///              .exact_terms("nonumy")
994///              .date_restrict("At")
995///              .cx("sadipscing")
996///              .cr("aliquyam")
997///              .c2coff("dolores")
998///              .doit().await;
999/// # }
1000/// ```
1001pub struct CseSiterestrictListCall<'a, C>
1002where
1003    C: 'a,
1004{
1005    hub: &'a CustomSearchAPI<C>,
1006    _start: Option<u32>,
1007    _sort: Option<String>,
1008    _snippet_length: Option<i32>,
1009    _site_search_filter: Option<String>,
1010    _site_search: Option<String>,
1011    _search_type: Option<String>,
1012    _safe: Option<String>,
1013    _rights: Option<String>,
1014    _related_site: Option<String>,
1015    _q: Option<String>,
1016    _or_terms: Option<String>,
1017    _num: Option<i32>,
1018    _lr: Option<String>,
1019    _low_range: Option<String>,
1020    _link_site: Option<String>,
1021    _img_type: Option<String>,
1022    _img_size: Option<String>,
1023    _img_dominant_color: Option<String>,
1024    _img_color_type: Option<String>,
1025    _hq: Option<String>,
1026    _hl: Option<String>,
1027    _high_range: Option<String>,
1028    _googlehost: Option<String>,
1029    _gl: Option<String>,
1030    _filter: Option<String>,
1031    _file_type: Option<String>,
1032    _exclude_terms: Option<String>,
1033    _exact_terms: Option<String>,
1034    _date_restrict: Option<String>,
1035    _cx: Option<String>,
1036    _cr: Option<String>,
1037    _c2coff: Option<String>,
1038    _delegate: Option<&'a mut dyn common::Delegate>,
1039    _additional_params: HashMap<String, String>,
1040}
1041
1042impl<'a, C> common::CallBuilder for CseSiterestrictListCall<'a, C> {}
1043
1044impl<'a, C> CseSiterestrictListCall<'a, C>
1045where
1046    C: common::Connector,
1047{
1048    /// Perform the operation you have build so far.
1049    pub async fn doit(mut self) -> common::Result<(common::Response, Search)> {
1050        use std::borrow::Cow;
1051        use std::io::{Read, Seek};
1052
1053        use common::{url::Params, ToParts};
1054        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
1055
1056        let mut dd = common::DefaultDelegate;
1057        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
1058        dlg.begin(common::MethodInfo {
1059            id: "search.cse.siterestrict.list",
1060            http_method: hyper::Method::GET,
1061        });
1062
1063        for &field in [
1064            "alt",
1065            "start",
1066            "sort",
1067            "snippetLength",
1068            "siteSearchFilter",
1069            "siteSearch",
1070            "searchType",
1071            "safe",
1072            "rights",
1073            "relatedSite",
1074            "q",
1075            "orTerms",
1076            "num",
1077            "lr",
1078            "lowRange",
1079            "linkSite",
1080            "imgType",
1081            "imgSize",
1082            "imgDominantColor",
1083            "imgColorType",
1084            "hq",
1085            "hl",
1086            "highRange",
1087            "googlehost",
1088            "gl",
1089            "filter",
1090            "fileType",
1091            "excludeTerms",
1092            "exactTerms",
1093            "dateRestrict",
1094            "cx",
1095            "cr",
1096            "c2coff",
1097        ]
1098        .iter()
1099        {
1100            if self._additional_params.contains_key(field) {
1101                dlg.finished(false);
1102                return Err(common::Error::FieldClash(field));
1103            }
1104        }
1105
1106        let mut params = Params::with_capacity(34 + self._additional_params.len());
1107        if let Some(value) = self._start.as_ref() {
1108            params.push("start", value.to_string());
1109        }
1110        if let Some(value) = self._sort.as_ref() {
1111            params.push("sort", value);
1112        }
1113        if let Some(value) = self._snippet_length.as_ref() {
1114            params.push("snippetLength", value.to_string());
1115        }
1116        if let Some(value) = self._site_search_filter.as_ref() {
1117            params.push("siteSearchFilter", value);
1118        }
1119        if let Some(value) = self._site_search.as_ref() {
1120            params.push("siteSearch", value);
1121        }
1122        if let Some(value) = self._search_type.as_ref() {
1123            params.push("searchType", value);
1124        }
1125        if let Some(value) = self._safe.as_ref() {
1126            params.push("safe", value);
1127        }
1128        if let Some(value) = self._rights.as_ref() {
1129            params.push("rights", value);
1130        }
1131        if let Some(value) = self._related_site.as_ref() {
1132            params.push("relatedSite", value);
1133        }
1134        if let Some(value) = self._q.as_ref() {
1135            params.push("q", value);
1136        }
1137        if let Some(value) = self._or_terms.as_ref() {
1138            params.push("orTerms", value);
1139        }
1140        if let Some(value) = self._num.as_ref() {
1141            params.push("num", value.to_string());
1142        }
1143        if let Some(value) = self._lr.as_ref() {
1144            params.push("lr", value);
1145        }
1146        if let Some(value) = self._low_range.as_ref() {
1147            params.push("lowRange", value);
1148        }
1149        if let Some(value) = self._link_site.as_ref() {
1150            params.push("linkSite", value);
1151        }
1152        if let Some(value) = self._img_type.as_ref() {
1153            params.push("imgType", value);
1154        }
1155        if let Some(value) = self._img_size.as_ref() {
1156            params.push("imgSize", value);
1157        }
1158        if let Some(value) = self._img_dominant_color.as_ref() {
1159            params.push("imgDominantColor", value);
1160        }
1161        if let Some(value) = self._img_color_type.as_ref() {
1162            params.push("imgColorType", value);
1163        }
1164        if let Some(value) = self._hq.as_ref() {
1165            params.push("hq", value);
1166        }
1167        if let Some(value) = self._hl.as_ref() {
1168            params.push("hl", value);
1169        }
1170        if let Some(value) = self._high_range.as_ref() {
1171            params.push("highRange", value);
1172        }
1173        if let Some(value) = self._googlehost.as_ref() {
1174            params.push("googlehost", value);
1175        }
1176        if let Some(value) = self._gl.as_ref() {
1177            params.push("gl", value);
1178        }
1179        if let Some(value) = self._filter.as_ref() {
1180            params.push("filter", value);
1181        }
1182        if let Some(value) = self._file_type.as_ref() {
1183            params.push("fileType", value);
1184        }
1185        if let Some(value) = self._exclude_terms.as_ref() {
1186            params.push("excludeTerms", value);
1187        }
1188        if let Some(value) = self._exact_terms.as_ref() {
1189            params.push("exactTerms", value);
1190        }
1191        if let Some(value) = self._date_restrict.as_ref() {
1192            params.push("dateRestrict", value);
1193        }
1194        if let Some(value) = self._cx.as_ref() {
1195            params.push("cx", value);
1196        }
1197        if let Some(value) = self._cr.as_ref() {
1198            params.push("cr", value);
1199        }
1200        if let Some(value) = self._c2coff.as_ref() {
1201            params.push("c2coff", value);
1202        }
1203
1204        params.extend(self._additional_params.iter());
1205
1206        params.push("alt", "json");
1207        let mut url = self.hub._base_url.clone() + "customsearch/v1/siterestrict";
1208
1209        match dlg.api_key() {
1210            Some(value) => params.push("key", value),
1211            None => {
1212                dlg.finished(false);
1213                return Err(common::Error::MissingAPIKey);
1214            }
1215        }
1216
1217        let url = params.parse_with_url(&url);
1218
1219        loop {
1220            let mut req_result = {
1221                let client = &self.hub.client;
1222                dlg.pre_request();
1223                let mut req_builder = hyper::Request::builder()
1224                    .method(hyper::Method::GET)
1225                    .uri(url.as_str())
1226                    .header(USER_AGENT, self.hub._user_agent.clone());
1227
1228                let request = req_builder
1229                    .header(CONTENT_LENGTH, 0_u64)
1230                    .body(common::to_body::<String>(None));
1231
1232                client.request(request.unwrap()).await
1233            };
1234
1235            match req_result {
1236                Err(err) => {
1237                    if let common::Retry::After(d) = dlg.http_error(&err) {
1238                        sleep(d).await;
1239                        continue;
1240                    }
1241                    dlg.finished(false);
1242                    return Err(common::Error::HttpError(err));
1243                }
1244                Ok(res) => {
1245                    let (mut parts, body) = res.into_parts();
1246                    let mut body = common::Body::new(body);
1247                    if !parts.status.is_success() {
1248                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1249                        let error = serde_json::from_str(&common::to_string(&bytes));
1250                        let response = common::to_response(parts, bytes.into());
1251
1252                        if let common::Retry::After(d) =
1253                            dlg.http_failure(&response, error.as_ref().ok())
1254                        {
1255                            sleep(d).await;
1256                            continue;
1257                        }
1258
1259                        dlg.finished(false);
1260
1261                        return Err(match error {
1262                            Ok(value) => common::Error::BadRequest(value),
1263                            _ => common::Error::Failure(response),
1264                        });
1265                    }
1266                    let response = {
1267                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1268                        let encoded = common::to_string(&bytes);
1269                        match serde_json::from_str(&encoded) {
1270                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
1271                            Err(error) => {
1272                                dlg.response_json_decode_error(&encoded, &error);
1273                                return Err(common::Error::JsonDecodeError(
1274                                    encoded.to_string(),
1275                                    error,
1276                                ));
1277                            }
1278                        }
1279                    };
1280
1281                    dlg.finished(true);
1282                    return Ok(response);
1283                }
1284            }
1285        }
1286    }
1287
1288    /// The index of the first result to return. The default number of results per page is 10, so `&start=11` would start at the top of the second page of results. **Note**: The JSON API will never return more than 100 results, even if more than 100 documents match the query, so setting the sum of `start + num` to a number greater than 100 will produce an error. Also note that the maximum value for `num` is 10.
1289    ///
1290    /// Sets the *start* query property to the given value.
1291    pub fn start(mut self, new_value: u32) -> CseSiterestrictListCall<'a, C> {
1292        self._start = Some(new_value);
1293        self
1294    }
1295    /// The sort expression to apply to the results. The sort parameter specifies that the results be sorted according to the specified expression i.e. sort by date. [Example: sort=date](https://developers.google.com/custom-search/docs/structured_search#sort-by-attribute).
1296    ///
1297    /// Sets the *sort* query property to the given value.
1298    pub fn sort(mut self, new_value: &str) -> CseSiterestrictListCall<'a, C> {
1299        self._sort = Some(new_value.to_string());
1300        self
1301    }
1302    /// Optional. Maximum length of snippet text, in characters, to be returned with results. Note: this feature is limited to specific engines. * Valid values are integers between 161 and 1000, inclusive.
1303    ///
1304    /// Sets the *snippet length* query property to the given value.
1305    pub fn snippet_length(mut self, new_value: i32) -> CseSiterestrictListCall<'a, C> {
1306        self._snippet_length = Some(new_value);
1307        self
1308    }
1309    /// Controls whether to include or exclude results from the site named in the `siteSearch` parameter. Acceptable values are: * `"e"`: exclude * `"i"`: include
1310    ///
1311    /// Sets the *site search filter* query property to the given value.
1312    pub fn site_search_filter(mut self, new_value: &str) -> CseSiterestrictListCall<'a, C> {
1313        self._site_search_filter = Some(new_value.to_string());
1314        self
1315    }
1316    /// Specifies a given site which should always be included or excluded from results (see `siteSearchFilter` parameter, below).
1317    ///
1318    /// Sets the *site search* query property to the given value.
1319    pub fn site_search(mut self, new_value: &str) -> CseSiterestrictListCall<'a, C> {
1320        self._site_search = Some(new_value.to_string());
1321        self
1322    }
1323    /// Specifies the search type: `image`. If unspecified, results are limited to webpages. Acceptable values are: * `"image"`: custom image search.
1324    ///
1325    /// Sets the *search type* query property to the given value.
1326    pub fn search_type(mut self, new_value: &str) -> CseSiterestrictListCall<'a, C> {
1327        self._search_type = Some(new_value.to_string());
1328        self
1329    }
1330    /// Search safety level. Acceptable values are: * `"active"`: Enables SafeSearch filtering. * `"off"`: Disables SafeSearch filtering. (default)
1331    ///
1332    /// Sets the *safe* query property to the given value.
1333    pub fn safe(mut self, new_value: &str) -> CseSiterestrictListCall<'a, C> {
1334        self._safe = Some(new_value.to_string());
1335        self
1336    }
1337    /// Filters based on licensing. Supported values include: `cc_publicdomain`, `cc_attribute`, `cc_sharealike`, `cc_noncommercial`, `cc_nonderived` and combinations of these. See [typical combinations](https://wiki.creativecommons.org/wiki/CC_Search_integration).
1338    ///
1339    /// Sets the *rights* query property to the given value.
1340    pub fn rights(mut self, new_value: &str) -> CseSiterestrictListCall<'a, C> {
1341        self._rights = Some(new_value.to_string());
1342        self
1343    }
1344    /// Deprecated.
1345    ///
1346    /// Sets the *related site* query property to the given value.
1347    pub fn related_site(mut self, new_value: &str) -> CseSiterestrictListCall<'a, C> {
1348        self._related_site = Some(new_value.to_string());
1349        self
1350    }
1351    /// Query
1352    ///
1353    /// Sets the *q* query property to the given value.
1354    pub fn q(mut self, new_value: &str) -> CseSiterestrictListCall<'a, C> {
1355        self._q = Some(new_value.to_string());
1356        self
1357    }
1358    /// Provides additional search terms to check for in a document, where each document in the search results must contain at least one of the additional search terms.
1359    ///
1360    /// Sets the *or terms* query property to the given value.
1361    pub fn or_terms(mut self, new_value: &str) -> CseSiterestrictListCall<'a, C> {
1362        self._or_terms = Some(new_value.to_string());
1363        self
1364    }
1365    /// Number of search results to return. * Valid values are integers between 1 and 10, inclusive.
1366    ///
1367    /// Sets the *num* query property to the given value.
1368    pub fn num(mut self, new_value: i32) -> CseSiterestrictListCall<'a, C> {
1369        self._num = Some(new_value);
1370        self
1371    }
1372    /// Restricts the search to documents written in a particular language (e.g., `lr=lang_ja`). Acceptable values are: * `"lang_ar"`: Arabic * `"lang_bg"`: Bulgarian * `"lang_ca"`: Catalan * `"lang_cs"`: Czech * `"lang_da"`: Danish * `"lang_de"`: German * `"lang_el"`: Greek * `"lang_en"`: English * `"lang_es"`: Spanish * `"lang_et"`: Estonian * `"lang_fi"`: Finnish * `"lang_fr"`: French * `"lang_hr"`: Croatian * `"lang_hu"`: Hungarian * `"lang_id"`: Indonesian * `"lang_is"`: Icelandic * `"lang_it"`: Italian * `"lang_iw"`: Hebrew * `"lang_ja"`: Japanese * `"lang_ko"`: Korean * `"lang_lt"`: Lithuanian * `"lang_lv"`: Latvian * `"lang_nl"`: Dutch * `"lang_no"`: Norwegian * `"lang_pl"`: Polish * `"lang_pt"`: Portuguese * `"lang_ro"`: Romanian * `"lang_ru"`: Russian * `"lang_sk"`: Slovak * `"lang_sl"`: Slovenian * `"lang_sr"`: Serbian * `"lang_sv"`: Swedish * `"lang_tr"`: Turkish * `"lang_zh-CN"`: Chinese (Simplified) * `"lang_zh-TW"`: Chinese (Traditional)
1373    ///
1374    /// Sets the *lr* query property to the given value.
1375    pub fn lr(mut self, new_value: &str) -> CseSiterestrictListCall<'a, C> {
1376        self._lr = Some(new_value.to_string());
1377        self
1378    }
1379    /// Specifies the starting value for a search range. Use `lowRange` and `highRange` to append an inclusive search range of `lowRange...highRange` to the query.
1380    ///
1381    /// Sets the *low range* query property to the given value.
1382    pub fn low_range(mut self, new_value: &str) -> CseSiterestrictListCall<'a, C> {
1383        self._low_range = Some(new_value.to_string());
1384        self
1385    }
1386    /// Specifies that all search results should contain a link to a particular URL.
1387    ///
1388    /// Sets the *link site* query property to the given value.
1389    pub fn link_site(mut self, new_value: &str) -> CseSiterestrictListCall<'a, C> {
1390        self._link_site = Some(new_value.to_string());
1391        self
1392    }
1393    /// Returns images of a type. Acceptable values are: * `"clipart"` * `"face"` * `"lineart"` * `"stock"` * `"photo"` * `"animated"`
1394    ///
1395    /// Sets the *img type* query property to the given value.
1396    pub fn img_type(mut self, new_value: &str) -> CseSiterestrictListCall<'a, C> {
1397        self._img_type = Some(new_value.to_string());
1398        self
1399    }
1400    /// Returns images of a specified size. Acceptable values are: * `"huge"` * `"icon"` * `"large"` * `"medium"` * `"small"` * `"xlarge"` * `"xxlarge"`
1401    ///
1402    /// Sets the *img size* query property to the given value.
1403    pub fn img_size(mut self, new_value: &str) -> CseSiterestrictListCall<'a, C> {
1404        self._img_size = Some(new_value.to_string());
1405        self
1406    }
1407    /// Returns images of a specific dominant color. Acceptable values are: * `"black"` * `"blue"` * `"brown"` * `"gray"` * `"green"` * `"orange"` * `"pink"` * `"purple"` * `"red"` * `"teal"` * `"white"` * `"yellow"`
1408    ///
1409    /// Sets the *img dominant color* query property to the given value.
1410    pub fn img_dominant_color(mut self, new_value: &str) -> CseSiterestrictListCall<'a, C> {
1411        self._img_dominant_color = Some(new_value.to_string());
1412        self
1413    }
1414    /// Returns black and white, grayscale, transparent, or color images. Acceptable values are: * `"color"` * `"gray"` * `"mono"`: black and white * `"trans"`: transparent background
1415    ///
1416    /// Sets the *img color type* query property to the given value.
1417    pub fn img_color_type(mut self, new_value: &str) -> CseSiterestrictListCall<'a, C> {
1418        self._img_color_type = Some(new_value.to_string());
1419        self
1420    }
1421    /// Appends the specified query terms to the query, as if they were combined with a logical AND operator.
1422    ///
1423    /// Sets the *hq* query property to the given value.
1424    pub fn hq(mut self, new_value: &str) -> CseSiterestrictListCall<'a, C> {
1425        self._hq = Some(new_value.to_string());
1426        self
1427    }
1428    /// Sets the user interface language. * Explicitly setting this parameter improves the performance and the quality of your search results. * See the [Interface Languages](https://developers.google.com/custom-search/docs/json_api_reference#wsInterfaceLanguages) section of [Internationalizing Queries and Results Presentation](https://developers.google.com/custom-search/docs/json_api_reference#wsInternationalizing) for more information, and [Supported Interface Languages](https://developers.google.com/custom-search/docs/json_api_reference#interfaceLanguages) for a list of supported languages.
1429    ///
1430    /// Sets the *hl* query property to the given value.
1431    pub fn hl(mut self, new_value: &str) -> CseSiterestrictListCall<'a, C> {
1432        self._hl = Some(new_value.to_string());
1433        self
1434    }
1435    /// Specifies the ending value for a search range. * Use `lowRange` and `highRange` to append an inclusive search range of `lowRange...highRange` to the query.
1436    ///
1437    /// Sets the *high range* query property to the given value.
1438    pub fn high_range(mut self, new_value: &str) -> CseSiterestrictListCall<'a, C> {
1439        self._high_range = Some(new_value.to_string());
1440        self
1441    }
1442    /// **Deprecated**. Use the `gl` parameter for a similar effect. The local Google domain (for example, google.com, google.de, or google.fr) to use to perform the search.
1443    ///
1444    /// Sets the *googlehost* query property to the given value.
1445    pub fn googlehost(mut self, new_value: &str) -> CseSiterestrictListCall<'a, C> {
1446        self._googlehost = Some(new_value.to_string());
1447        self
1448    }
1449    /// Geolocation of end user. * The `gl` parameter value is a two-letter country code. The `gl` parameter boosts search results whose country of origin matches the parameter value. See the [Country Codes](https://developers.google.com/custom-search/docs/json_api_reference#countryCodes) page for a list of valid values. * Specifying a `gl` parameter value should lead to more relevant results. This is particularly true for international customers and, even more specifically, for customers in English- speaking countries other than the United States.
1450    ///
1451    /// Sets the *gl* query property to the given value.
1452    pub fn gl(mut self, new_value: &str) -> CseSiterestrictListCall<'a, C> {
1453        self._gl = Some(new_value.to_string());
1454        self
1455    }
1456    /// Controls turning on or off the duplicate content filter. * See [Automatic Filtering](https://developers.google.com/custom-search/docs/json_api_reference#automaticFiltering) for more information about Google's search results filters. Note that host crowding filtering applies only to multi-site searches. * By default, Google applies filtering to all search results to improve the quality of those results. Acceptable values are: * `0`: Turns off duplicate content filter. * `1`: Turns on duplicate content filter.
1457    ///
1458    /// Sets the *filter* query property to the given value.
1459    pub fn filter(mut self, new_value: &str) -> CseSiterestrictListCall<'a, C> {
1460        self._filter = Some(new_value.to_string());
1461        self
1462    }
1463    /// Restricts results to files of a specified extension. A list of file types indexable by Google can be found in Search Console [Help Center](https://support.google.com/webmasters/answer/35287).
1464    ///
1465    /// Sets the *file type* query property to the given value.
1466    pub fn file_type(mut self, new_value: &str) -> CseSiterestrictListCall<'a, C> {
1467        self._file_type = Some(new_value.to_string());
1468        self
1469    }
1470    /// Identifies a word or phrase that should not appear in any documents in the search results.
1471    ///
1472    /// Sets the *exclude terms* query property to the given value.
1473    pub fn exclude_terms(mut self, new_value: &str) -> CseSiterestrictListCall<'a, C> {
1474        self._exclude_terms = Some(new_value.to_string());
1475        self
1476    }
1477    /// Identifies a phrase that all documents in the search results must contain.
1478    ///
1479    /// Sets the *exact terms* query property to the given value.
1480    pub fn exact_terms(mut self, new_value: &str) -> CseSiterestrictListCall<'a, C> {
1481        self._exact_terms = Some(new_value.to_string());
1482        self
1483    }
1484    /// Restricts results to URLs based on date. Supported values include: * `d[number]`: requests results from the specified number of past days. * `w[number]`: requests results from the specified number of past weeks. * `m[number]`: requests results from the specified number of past months. * `y[number]`: requests results from the specified number of past years.
1485    ///
1486    /// Sets the *date restrict* query property to the given value.
1487    pub fn date_restrict(mut self, new_value: &str) -> CseSiterestrictListCall<'a, C> {
1488        self._date_restrict = Some(new_value.to_string());
1489        self
1490    }
1491    /// The Programmable Search Engine ID to use for this request.
1492    ///
1493    /// Sets the *cx* query property to the given value.
1494    pub fn cx(mut self, new_value: &str) -> CseSiterestrictListCall<'a, C> {
1495        self._cx = Some(new_value.to_string());
1496        self
1497    }
1498    /// Restricts search results to documents originating in a particular country. You may use [Boolean operators](https://developers.google.com/custom-search/docs/json_api_reference#booleanOperators) in the cr parameter's value. Google Search determines the country of a document by analyzing: * the top-level domain (TLD) of the document's URL * the geographic location of the Web server's IP address See the [Country Parameter Values](https://developers.google.com/custom-search/docs/json_api_reference#countryCollections) page for a list of valid values for this parameter.
1499    ///
1500    /// Sets the *cr* query property to the given value.
1501    pub fn cr(mut self, new_value: &str) -> CseSiterestrictListCall<'a, C> {
1502        self._cr = Some(new_value.to_string());
1503        self
1504    }
1505    /// Enables or disables [Simplified and Traditional Chinese Search](https://developers.google.com/custom-search/docs/json_api_reference#chineseSearch). The default value for this parameter is 0 (zero), meaning that the feature is enabled. Supported values are: * `1`: Disabled * `0`: Enabled (default)
1506    ///
1507    /// Sets the *c2coff* query property to the given value.
1508    pub fn c2coff(mut self, new_value: &str) -> CseSiterestrictListCall<'a, C> {
1509        self._c2coff = Some(new_value.to_string());
1510        self
1511    }
1512    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
1513    /// while executing the actual API request.
1514    ///
1515    /// ````text
1516    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
1517    /// ````
1518    ///
1519    /// Sets the *delegate* property to the given value.
1520    pub fn delegate(
1521        mut self,
1522        new_value: &'a mut dyn common::Delegate,
1523    ) -> CseSiterestrictListCall<'a, C> {
1524        self._delegate = Some(new_value);
1525        self
1526    }
1527
1528    /// Set any additional parameter of the query string used in the request.
1529    /// It should be used to set parameters which are not yet available through their own
1530    /// setters.
1531    ///
1532    /// Please note that this method must not be used to set any of the known parameters
1533    /// which have their own setter method. If done anyway, the request will fail.
1534    ///
1535    /// # Additional Parameters
1536    ///
1537    /// * *$.xgafv* (query-string) - V1 error format.
1538    /// * *access_token* (query-string) - OAuth access token.
1539    /// * *alt* (query-string) - Data format for response.
1540    /// * *callback* (query-string) - JSONP
1541    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
1542    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
1543    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
1544    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
1545    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
1546    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
1547    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
1548    pub fn param<T>(mut self, name: T, value: T) -> CseSiterestrictListCall<'a, C>
1549    where
1550        T: AsRef<str>,
1551    {
1552        self._additional_params
1553            .insert(name.as_ref().to_string(), value.as_ref().to_string());
1554        self
1555    }
1556}
1557
1558/// Returns metadata about the search performed, metadata about the engine used for the search, and the search results.
1559///
1560/// A builder for the *list* method supported by a *cse* resource.
1561/// It is not used directly, but through a [`CseMethods`] instance.
1562///
1563/// # Example
1564///
1565/// Instantiate a resource method builder
1566///
1567/// ```test_harness,no_run
1568/// # extern crate hyper;
1569/// # extern crate hyper_rustls;
1570/// # extern crate google_customsearch1 as customsearch1;
1571/// # async fn dox() {
1572/// # use customsearch1::{CustomSearchAPI, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1573///
1574/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1575/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
1576/// #     secret,
1577/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1578/// # ).build().await.unwrap();
1579///
1580/// # let client = hyper_util::client::legacy::Client::builder(
1581/// #     hyper_util::rt::TokioExecutor::new()
1582/// # )
1583/// # .build(
1584/// #     hyper_rustls::HttpsConnectorBuilder::new()
1585/// #         .with_native_roots()
1586/// #         .unwrap()
1587/// #         .https_or_http()
1588/// #         .enable_http1()
1589/// #         .build()
1590/// # );
1591/// # let mut hub = CustomSearchAPI::new(client, auth);
1592/// // You can configure optional parameters by calling the respective setters at will, and
1593/// // execute the final call using `doit()`.
1594/// // Values shown here are possibly random and not representative !
1595/// let result = hub.cse().list()
1596///              .start(6)
1597///              .sort("erat")
1598///              .snippet_length(-82)
1599///              .site_search_filter("amet")
1600///              .site_search("est")
1601///              .search_type("et")
1602///              .safe("sea")
1603///              .rights("consetetur")
1604///              .related_site("consetetur")
1605///              .q("Stet")
1606///              .or_terms("est")
1607///              .num(-82)
1608///              .lr("elitr")
1609///              .low_range("duo")
1610///              .link_site("diam")
1611///              .img_type("est")
1612///              .img_size("sit")
1613///              .img_dominant_color("sed")
1614///              .img_color_type("eos")
1615///              .hq("Lorem")
1616///              .hl("ea")
1617///              .high_range("Stet")
1618///              .googlehost("dolores")
1619///              .gl("eos")
1620///              .filter("et")
1621///              .file_type("sea")
1622///              .exclude_terms("et")
1623///              .exact_terms("At")
1624///              .date_restrict("dolore")
1625///              .cx("eirmod")
1626///              .cr("Lorem")
1627///              .c2coff("accusam")
1628///              .doit().await;
1629/// # }
1630/// ```
1631pub struct CseListCall<'a, C>
1632where
1633    C: 'a,
1634{
1635    hub: &'a CustomSearchAPI<C>,
1636    _start: Option<u32>,
1637    _sort: Option<String>,
1638    _snippet_length: Option<i32>,
1639    _site_search_filter: Option<String>,
1640    _site_search: Option<String>,
1641    _search_type: Option<String>,
1642    _safe: Option<String>,
1643    _rights: Option<String>,
1644    _related_site: Option<String>,
1645    _q: Option<String>,
1646    _or_terms: Option<String>,
1647    _num: Option<i32>,
1648    _lr: Option<String>,
1649    _low_range: Option<String>,
1650    _link_site: Option<String>,
1651    _img_type: Option<String>,
1652    _img_size: Option<String>,
1653    _img_dominant_color: Option<String>,
1654    _img_color_type: Option<String>,
1655    _hq: Option<String>,
1656    _hl: Option<String>,
1657    _high_range: Option<String>,
1658    _googlehost: Option<String>,
1659    _gl: Option<String>,
1660    _filter: Option<String>,
1661    _file_type: Option<String>,
1662    _exclude_terms: Option<String>,
1663    _exact_terms: Option<String>,
1664    _date_restrict: Option<String>,
1665    _cx: Option<String>,
1666    _cr: Option<String>,
1667    _c2coff: Option<String>,
1668    _delegate: Option<&'a mut dyn common::Delegate>,
1669    _additional_params: HashMap<String, String>,
1670}
1671
1672impl<'a, C> common::CallBuilder for CseListCall<'a, C> {}
1673
1674impl<'a, C> CseListCall<'a, C>
1675where
1676    C: common::Connector,
1677{
1678    /// Perform the operation you have build so far.
1679    pub async fn doit(mut self) -> common::Result<(common::Response, Search)> {
1680        use std::borrow::Cow;
1681        use std::io::{Read, Seek};
1682
1683        use common::{url::Params, ToParts};
1684        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
1685
1686        let mut dd = common::DefaultDelegate;
1687        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
1688        dlg.begin(common::MethodInfo {
1689            id: "search.cse.list",
1690            http_method: hyper::Method::GET,
1691        });
1692
1693        for &field in [
1694            "alt",
1695            "start",
1696            "sort",
1697            "snippetLength",
1698            "siteSearchFilter",
1699            "siteSearch",
1700            "searchType",
1701            "safe",
1702            "rights",
1703            "relatedSite",
1704            "q",
1705            "orTerms",
1706            "num",
1707            "lr",
1708            "lowRange",
1709            "linkSite",
1710            "imgType",
1711            "imgSize",
1712            "imgDominantColor",
1713            "imgColorType",
1714            "hq",
1715            "hl",
1716            "highRange",
1717            "googlehost",
1718            "gl",
1719            "filter",
1720            "fileType",
1721            "excludeTerms",
1722            "exactTerms",
1723            "dateRestrict",
1724            "cx",
1725            "cr",
1726            "c2coff",
1727        ]
1728        .iter()
1729        {
1730            if self._additional_params.contains_key(field) {
1731                dlg.finished(false);
1732                return Err(common::Error::FieldClash(field));
1733            }
1734        }
1735
1736        let mut params = Params::with_capacity(34 + self._additional_params.len());
1737        if let Some(value) = self._start.as_ref() {
1738            params.push("start", value.to_string());
1739        }
1740        if let Some(value) = self._sort.as_ref() {
1741            params.push("sort", value);
1742        }
1743        if let Some(value) = self._snippet_length.as_ref() {
1744            params.push("snippetLength", value.to_string());
1745        }
1746        if let Some(value) = self._site_search_filter.as_ref() {
1747            params.push("siteSearchFilter", value);
1748        }
1749        if let Some(value) = self._site_search.as_ref() {
1750            params.push("siteSearch", value);
1751        }
1752        if let Some(value) = self._search_type.as_ref() {
1753            params.push("searchType", value);
1754        }
1755        if let Some(value) = self._safe.as_ref() {
1756            params.push("safe", value);
1757        }
1758        if let Some(value) = self._rights.as_ref() {
1759            params.push("rights", value);
1760        }
1761        if let Some(value) = self._related_site.as_ref() {
1762            params.push("relatedSite", value);
1763        }
1764        if let Some(value) = self._q.as_ref() {
1765            params.push("q", value);
1766        }
1767        if let Some(value) = self._or_terms.as_ref() {
1768            params.push("orTerms", value);
1769        }
1770        if let Some(value) = self._num.as_ref() {
1771            params.push("num", value.to_string());
1772        }
1773        if let Some(value) = self._lr.as_ref() {
1774            params.push("lr", value);
1775        }
1776        if let Some(value) = self._low_range.as_ref() {
1777            params.push("lowRange", value);
1778        }
1779        if let Some(value) = self._link_site.as_ref() {
1780            params.push("linkSite", value);
1781        }
1782        if let Some(value) = self._img_type.as_ref() {
1783            params.push("imgType", value);
1784        }
1785        if let Some(value) = self._img_size.as_ref() {
1786            params.push("imgSize", value);
1787        }
1788        if let Some(value) = self._img_dominant_color.as_ref() {
1789            params.push("imgDominantColor", value);
1790        }
1791        if let Some(value) = self._img_color_type.as_ref() {
1792            params.push("imgColorType", value);
1793        }
1794        if let Some(value) = self._hq.as_ref() {
1795            params.push("hq", value);
1796        }
1797        if let Some(value) = self._hl.as_ref() {
1798            params.push("hl", value);
1799        }
1800        if let Some(value) = self._high_range.as_ref() {
1801            params.push("highRange", value);
1802        }
1803        if let Some(value) = self._googlehost.as_ref() {
1804            params.push("googlehost", value);
1805        }
1806        if let Some(value) = self._gl.as_ref() {
1807            params.push("gl", value);
1808        }
1809        if let Some(value) = self._filter.as_ref() {
1810            params.push("filter", value);
1811        }
1812        if let Some(value) = self._file_type.as_ref() {
1813            params.push("fileType", value);
1814        }
1815        if let Some(value) = self._exclude_terms.as_ref() {
1816            params.push("excludeTerms", value);
1817        }
1818        if let Some(value) = self._exact_terms.as_ref() {
1819            params.push("exactTerms", value);
1820        }
1821        if let Some(value) = self._date_restrict.as_ref() {
1822            params.push("dateRestrict", value);
1823        }
1824        if let Some(value) = self._cx.as_ref() {
1825            params.push("cx", value);
1826        }
1827        if let Some(value) = self._cr.as_ref() {
1828            params.push("cr", value);
1829        }
1830        if let Some(value) = self._c2coff.as_ref() {
1831            params.push("c2coff", value);
1832        }
1833
1834        params.extend(self._additional_params.iter());
1835
1836        params.push("alt", "json");
1837        let mut url = self.hub._base_url.clone() + "customsearch/v1";
1838
1839        match dlg.api_key() {
1840            Some(value) => params.push("key", value),
1841            None => {
1842                dlg.finished(false);
1843                return Err(common::Error::MissingAPIKey);
1844            }
1845        }
1846
1847        let url = params.parse_with_url(&url);
1848
1849        loop {
1850            let mut req_result = {
1851                let client = &self.hub.client;
1852                dlg.pre_request();
1853                let mut req_builder = hyper::Request::builder()
1854                    .method(hyper::Method::GET)
1855                    .uri(url.as_str())
1856                    .header(USER_AGENT, self.hub._user_agent.clone());
1857
1858                let request = req_builder
1859                    .header(CONTENT_LENGTH, 0_u64)
1860                    .body(common::to_body::<String>(None));
1861
1862                client.request(request.unwrap()).await
1863            };
1864
1865            match req_result {
1866                Err(err) => {
1867                    if let common::Retry::After(d) = dlg.http_error(&err) {
1868                        sleep(d).await;
1869                        continue;
1870                    }
1871                    dlg.finished(false);
1872                    return Err(common::Error::HttpError(err));
1873                }
1874                Ok(res) => {
1875                    let (mut parts, body) = res.into_parts();
1876                    let mut body = common::Body::new(body);
1877                    if !parts.status.is_success() {
1878                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1879                        let error = serde_json::from_str(&common::to_string(&bytes));
1880                        let response = common::to_response(parts, bytes.into());
1881
1882                        if let common::Retry::After(d) =
1883                            dlg.http_failure(&response, error.as_ref().ok())
1884                        {
1885                            sleep(d).await;
1886                            continue;
1887                        }
1888
1889                        dlg.finished(false);
1890
1891                        return Err(match error {
1892                            Ok(value) => common::Error::BadRequest(value),
1893                            _ => common::Error::Failure(response),
1894                        });
1895                    }
1896                    let response = {
1897                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1898                        let encoded = common::to_string(&bytes);
1899                        match serde_json::from_str(&encoded) {
1900                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
1901                            Err(error) => {
1902                                dlg.response_json_decode_error(&encoded, &error);
1903                                return Err(common::Error::JsonDecodeError(
1904                                    encoded.to_string(),
1905                                    error,
1906                                ));
1907                            }
1908                        }
1909                    };
1910
1911                    dlg.finished(true);
1912                    return Ok(response);
1913                }
1914            }
1915        }
1916    }
1917
1918    /// The index of the first result to return. The default number of results per page is 10, so `&start=11` would start at the top of the second page of results. **Note**: The JSON API will never return more than 100 results, even if more than 100 documents match the query, so setting the sum of `start + num` to a number greater than 100 will produce an error. Also note that the maximum value for `num` is 10.
1919    ///
1920    /// Sets the *start* query property to the given value.
1921    pub fn start(mut self, new_value: u32) -> CseListCall<'a, C> {
1922        self._start = Some(new_value);
1923        self
1924    }
1925    /// The sort expression to apply to the results. The sort parameter specifies that the results be sorted according to the specified expression i.e. sort by date. [Example: sort=date](https://developers.google.com/custom-search/docs/structured_search#sort-by-attribute).
1926    ///
1927    /// Sets the *sort* query property to the given value.
1928    pub fn sort(mut self, new_value: &str) -> CseListCall<'a, C> {
1929        self._sort = Some(new_value.to_string());
1930        self
1931    }
1932    /// Optional. Maximum length of snippet text, in characters, to be returned with results. Note: this feature is limited to specific engines. * Valid values are integers between 161 and 1000, inclusive.
1933    ///
1934    /// Sets the *snippet length* query property to the given value.
1935    pub fn snippet_length(mut self, new_value: i32) -> CseListCall<'a, C> {
1936        self._snippet_length = Some(new_value);
1937        self
1938    }
1939    /// Controls whether to include or exclude results from the site named in the `siteSearch` parameter. Acceptable values are: * `"e"`: exclude * `"i"`: include
1940    ///
1941    /// Sets the *site search filter* query property to the given value.
1942    pub fn site_search_filter(mut self, new_value: &str) -> CseListCall<'a, C> {
1943        self._site_search_filter = Some(new_value.to_string());
1944        self
1945    }
1946    /// Specifies a given site which should always be included or excluded from results (see `siteSearchFilter` parameter, below).
1947    ///
1948    /// Sets the *site search* query property to the given value.
1949    pub fn site_search(mut self, new_value: &str) -> CseListCall<'a, C> {
1950        self._site_search = Some(new_value.to_string());
1951        self
1952    }
1953    /// Specifies the search type: `image`. If unspecified, results are limited to webpages. Acceptable values are: * `"image"`: custom image search.
1954    ///
1955    /// Sets the *search type* query property to the given value.
1956    pub fn search_type(mut self, new_value: &str) -> CseListCall<'a, C> {
1957        self._search_type = Some(new_value.to_string());
1958        self
1959    }
1960    /// Search safety level. Acceptable values are: * `"active"`: Enables SafeSearch filtering. * `"off"`: Disables SafeSearch filtering. (default)
1961    ///
1962    /// Sets the *safe* query property to the given value.
1963    pub fn safe(mut self, new_value: &str) -> CseListCall<'a, C> {
1964        self._safe = Some(new_value.to_string());
1965        self
1966    }
1967    /// Filters based on licensing. Supported values include: `cc_publicdomain`, `cc_attribute`, `cc_sharealike`, `cc_noncommercial`, `cc_nonderived` and combinations of these. See [typical combinations](https://wiki.creativecommons.org/wiki/CC_Search_integration).
1968    ///
1969    /// Sets the *rights* query property to the given value.
1970    pub fn rights(mut self, new_value: &str) -> CseListCall<'a, C> {
1971        self._rights = Some(new_value.to_string());
1972        self
1973    }
1974    /// Deprecated.
1975    ///
1976    /// Sets the *related site* query property to the given value.
1977    pub fn related_site(mut self, new_value: &str) -> CseListCall<'a, C> {
1978        self._related_site = Some(new_value.to_string());
1979        self
1980    }
1981    /// Query
1982    ///
1983    /// Sets the *q* query property to the given value.
1984    pub fn q(mut self, new_value: &str) -> CseListCall<'a, C> {
1985        self._q = Some(new_value.to_string());
1986        self
1987    }
1988    /// Provides additional search terms to check for in a document, where each document in the search results must contain at least one of the additional search terms.
1989    ///
1990    /// Sets the *or terms* query property to the given value.
1991    pub fn or_terms(mut self, new_value: &str) -> CseListCall<'a, C> {
1992        self._or_terms = Some(new_value.to_string());
1993        self
1994    }
1995    /// Number of search results to return. * Valid values are integers between 1 and 10, inclusive.
1996    ///
1997    /// Sets the *num* query property to the given value.
1998    pub fn num(mut self, new_value: i32) -> CseListCall<'a, C> {
1999        self._num = Some(new_value);
2000        self
2001    }
2002    /// Restricts the search to documents written in a particular language (e.g., `lr=lang_ja`). Acceptable values are: * `"lang_ar"`: Arabic * `"lang_bg"`: Bulgarian * `"lang_ca"`: Catalan * `"lang_cs"`: Czech * `"lang_da"`: Danish * `"lang_de"`: German * `"lang_el"`: Greek * `"lang_en"`: English * `"lang_es"`: Spanish * `"lang_et"`: Estonian * `"lang_fi"`: Finnish * `"lang_fr"`: French * `"lang_hr"`: Croatian * `"lang_hu"`: Hungarian * `"lang_id"`: Indonesian * `"lang_is"`: Icelandic * `"lang_it"`: Italian * `"lang_iw"`: Hebrew * `"lang_ja"`: Japanese * `"lang_ko"`: Korean * `"lang_lt"`: Lithuanian * `"lang_lv"`: Latvian * `"lang_nl"`: Dutch * `"lang_no"`: Norwegian * `"lang_pl"`: Polish * `"lang_pt"`: Portuguese * `"lang_ro"`: Romanian * `"lang_ru"`: Russian * `"lang_sk"`: Slovak * `"lang_sl"`: Slovenian * `"lang_sr"`: Serbian * `"lang_sv"`: Swedish * `"lang_tr"`: Turkish * `"lang_zh-CN"`: Chinese (Simplified) * `"lang_zh-TW"`: Chinese (Traditional)
2003    ///
2004    /// Sets the *lr* query property to the given value.
2005    pub fn lr(mut self, new_value: &str) -> CseListCall<'a, C> {
2006        self._lr = Some(new_value.to_string());
2007        self
2008    }
2009    /// Specifies the starting value for a search range. Use `lowRange` and `highRange` to append an inclusive search range of `lowRange...highRange` to the query.
2010    ///
2011    /// Sets the *low range* query property to the given value.
2012    pub fn low_range(mut self, new_value: &str) -> CseListCall<'a, C> {
2013        self._low_range = Some(new_value.to_string());
2014        self
2015    }
2016    /// Specifies that all search results should contain a link to a particular URL.
2017    ///
2018    /// Sets the *link site* query property to the given value.
2019    pub fn link_site(mut self, new_value: &str) -> CseListCall<'a, C> {
2020        self._link_site = Some(new_value.to_string());
2021        self
2022    }
2023    /// Returns images of a type. Acceptable values are: * `"clipart"` * `"face"` * `"lineart"` * `"stock"` * `"photo"` * `"animated"`
2024    ///
2025    /// Sets the *img type* query property to the given value.
2026    pub fn img_type(mut self, new_value: &str) -> CseListCall<'a, C> {
2027        self._img_type = Some(new_value.to_string());
2028        self
2029    }
2030    /// Returns images of a specified size. Acceptable values are: * `"huge"` * `"icon"` * `"large"` * `"medium"` * `"small"` * `"xlarge"` * `"xxlarge"`
2031    ///
2032    /// Sets the *img size* query property to the given value.
2033    pub fn img_size(mut self, new_value: &str) -> CseListCall<'a, C> {
2034        self._img_size = Some(new_value.to_string());
2035        self
2036    }
2037    /// Returns images of a specific dominant color. Acceptable values are: * `"black"` * `"blue"` * `"brown"` * `"gray"` * `"green"` * `"orange"` * `"pink"` * `"purple"` * `"red"` * `"teal"` * `"white"` * `"yellow"`
2038    ///
2039    /// Sets the *img dominant color* query property to the given value.
2040    pub fn img_dominant_color(mut self, new_value: &str) -> CseListCall<'a, C> {
2041        self._img_dominant_color = Some(new_value.to_string());
2042        self
2043    }
2044    /// Returns black and white, grayscale, transparent, or color images. Acceptable values are: * `"color"` * `"gray"` * `"mono"`: black and white * `"trans"`: transparent background
2045    ///
2046    /// Sets the *img color type* query property to the given value.
2047    pub fn img_color_type(mut self, new_value: &str) -> CseListCall<'a, C> {
2048        self._img_color_type = Some(new_value.to_string());
2049        self
2050    }
2051    /// Appends the specified query terms to the query, as if they were combined with a logical AND operator.
2052    ///
2053    /// Sets the *hq* query property to the given value.
2054    pub fn hq(mut self, new_value: &str) -> CseListCall<'a, C> {
2055        self._hq = Some(new_value.to_string());
2056        self
2057    }
2058    /// Sets the user interface language. * Explicitly setting this parameter improves the performance and the quality of your search results. * See the [Interface Languages](https://developers.google.com/custom-search/docs/json_api_reference#wsInterfaceLanguages) section of [Internationalizing Queries and Results Presentation](https://developers.google.com/custom-search/docs/json_api_reference#wsInternationalizing) for more information, and [Supported Interface Languages](https://developers.google.com/custom-search/docs/json_api_reference#interfaceLanguages) for a list of supported languages.
2059    ///
2060    /// Sets the *hl* query property to the given value.
2061    pub fn hl(mut self, new_value: &str) -> CseListCall<'a, C> {
2062        self._hl = Some(new_value.to_string());
2063        self
2064    }
2065    /// Specifies the ending value for a search range. * Use `lowRange` and `highRange` to append an inclusive search range of `lowRange...highRange` to the query.
2066    ///
2067    /// Sets the *high range* query property to the given value.
2068    pub fn high_range(mut self, new_value: &str) -> CseListCall<'a, C> {
2069        self._high_range = Some(new_value.to_string());
2070        self
2071    }
2072    /// **Deprecated**. Use the `gl` parameter for a similar effect. The local Google domain (for example, google.com, google.de, or google.fr) to use to perform the search.
2073    ///
2074    /// Sets the *googlehost* query property to the given value.
2075    pub fn googlehost(mut self, new_value: &str) -> CseListCall<'a, C> {
2076        self._googlehost = Some(new_value.to_string());
2077        self
2078    }
2079    /// Geolocation of end user. * The `gl` parameter value is a two-letter country code. The `gl` parameter boosts search results whose country of origin matches the parameter value. See the [Country Codes](https://developers.google.com/custom-search/docs/json_api_reference#countryCodes) page for a list of valid values. * Specifying a `gl` parameter value should lead to more relevant results. This is particularly true for international customers and, even more specifically, for customers in English- speaking countries other than the United States.
2080    ///
2081    /// Sets the *gl* query property to the given value.
2082    pub fn gl(mut self, new_value: &str) -> CseListCall<'a, C> {
2083        self._gl = Some(new_value.to_string());
2084        self
2085    }
2086    /// Controls turning on or off the duplicate content filter. * See [Automatic Filtering](https://developers.google.com/custom-search/docs/json_api_reference#automaticFiltering) for more information about Google's search results filters. Note that host crowding filtering applies only to multi-site searches. * By default, Google applies filtering to all search results to improve the quality of those results. Acceptable values are: * `0`: Turns off duplicate content filter. * `1`: Turns on duplicate content filter.
2087    ///
2088    /// Sets the *filter* query property to the given value.
2089    pub fn filter(mut self, new_value: &str) -> CseListCall<'a, C> {
2090        self._filter = Some(new_value.to_string());
2091        self
2092    }
2093    /// Restricts results to files of a specified extension. A list of file types indexable by Google can be found in Search Console [Help Center](https://support.google.com/webmasters/answer/35287).
2094    ///
2095    /// Sets the *file type* query property to the given value.
2096    pub fn file_type(mut self, new_value: &str) -> CseListCall<'a, C> {
2097        self._file_type = Some(new_value.to_string());
2098        self
2099    }
2100    /// Identifies a word or phrase that should not appear in any documents in the search results.
2101    ///
2102    /// Sets the *exclude terms* query property to the given value.
2103    pub fn exclude_terms(mut self, new_value: &str) -> CseListCall<'a, C> {
2104        self._exclude_terms = Some(new_value.to_string());
2105        self
2106    }
2107    /// Identifies a phrase that all documents in the search results must contain.
2108    ///
2109    /// Sets the *exact terms* query property to the given value.
2110    pub fn exact_terms(mut self, new_value: &str) -> CseListCall<'a, C> {
2111        self._exact_terms = Some(new_value.to_string());
2112        self
2113    }
2114    /// Restricts results to URLs based on date. Supported values include: * `d[number]`: requests results from the specified number of past days. * `w[number]`: requests results from the specified number of past weeks. * `m[number]`: requests results from the specified number of past months. * `y[number]`: requests results from the specified number of past years.
2115    ///
2116    /// Sets the *date restrict* query property to the given value.
2117    pub fn date_restrict(mut self, new_value: &str) -> CseListCall<'a, C> {
2118        self._date_restrict = Some(new_value.to_string());
2119        self
2120    }
2121    /// The Programmable Search Engine ID to use for this request.
2122    ///
2123    /// Sets the *cx* query property to the given value.
2124    pub fn cx(mut self, new_value: &str) -> CseListCall<'a, C> {
2125        self._cx = Some(new_value.to_string());
2126        self
2127    }
2128    /// Restricts search results to documents originating in a particular country. You may use [Boolean operators](https://developers.google.com/custom-search/docs/json_api_reference#booleanOperators) in the cr parameter's value. Google Search determines the country of a document by analyzing: * the top-level domain (TLD) of the document's URL * the geographic location of the Web server's IP address See the [Country Parameter Values](https://developers.google.com/custom-search/docs/json_api_reference#countryCollections) page for a list of valid values for this parameter.
2129    ///
2130    /// Sets the *cr* query property to the given value.
2131    pub fn cr(mut self, new_value: &str) -> CseListCall<'a, C> {
2132        self._cr = Some(new_value.to_string());
2133        self
2134    }
2135    /// Enables or disables [Simplified and Traditional Chinese Search](https://developers.google.com/custom-search/docs/json_api_reference#chineseSearch). The default value for this parameter is 0 (zero), meaning that the feature is enabled. Supported values are: * `1`: Disabled * `0`: Enabled (default)
2136    ///
2137    /// Sets the *c2coff* query property to the given value.
2138    pub fn c2coff(mut self, new_value: &str) -> CseListCall<'a, C> {
2139        self._c2coff = Some(new_value.to_string());
2140        self
2141    }
2142    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2143    /// while executing the actual API request.
2144    ///
2145    /// ````text
2146    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
2147    /// ````
2148    ///
2149    /// Sets the *delegate* property to the given value.
2150    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> CseListCall<'a, C> {
2151        self._delegate = Some(new_value);
2152        self
2153    }
2154
2155    /// Set any additional parameter of the query string used in the request.
2156    /// It should be used to set parameters which are not yet available through their own
2157    /// setters.
2158    ///
2159    /// Please note that this method must not be used to set any of the known parameters
2160    /// which have their own setter method. If done anyway, the request will fail.
2161    ///
2162    /// # Additional Parameters
2163    ///
2164    /// * *$.xgafv* (query-string) - V1 error format.
2165    /// * *access_token* (query-string) - OAuth access token.
2166    /// * *alt* (query-string) - Data format for response.
2167    /// * *callback* (query-string) - JSONP
2168    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2169    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
2170    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2171    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2172    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
2173    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2174    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2175    pub fn param<T>(mut self, name: T, value: T) -> CseListCall<'a, C>
2176    where
2177        T: AsRef<str>,
2178    {
2179        self._additional_params
2180            .insert(name.as_ref().to_string(), value.as_ref().to_string());
2181        self
2182    }
2183}