list method

Future<Search> list({
  1. String? c2coff,
  2. String? cr,
  3. String? cx,
  4. String? dateRestrict,
  5. String? exactTerms,
  6. String? excludeTerms,
  7. String? fileType,
  8. String? filter,
  9. String? gl,
  10. String? googlehost,
  11. String? highRange,
  12. String? hl,
  13. String? hq,
  14. String? imgColorType,
  15. String? imgDominantColor,
  16. String? imgSize,
  17. String? imgType,
  18. String? linkSite,
  19. String? lowRange,
  20. String? lr,
  21. int? num,
  22. String? orTerms,
  23. String? q,
  24. String? relatedSite,
  25. String? rights,
  26. String? safe,
  27. String? searchType,
  28. String? siteSearch,
  29. String? siteSearchFilter,
  30. String? sort,
  31. int? start,
  32. String? $fields,
})

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.

Request parameters:

c2coff - Enables or disables Simplified and Traditional Chinese Search. The default value for this parameter is 0 (zero), meaning that the feature is enabled. Supported values are: * 1: Disabled * 0: Enabled (default)

cr - Restricts search results to documents originating in a particular country. You may use Boolean operators 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 page for a list of valid values for this parameter.

cx - The Programmable Search Engine ID to use for this request.

dateRestrict - Restricts results to URLs based on date. Supported values include: * d[number]: requests results from the specified number of past days. * w[number]: requests results from the specified number of past weeks. * m[number]: requests results from the specified number of past months. * y[number]: requests results from the specified number of past years.

exactTerms - Identifies a phrase that all documents in the search results must contain.

excludeTerms - Identifies a word or phrase that should not appear in any documents in the search results.

fileType - Restricts results to files of a specified extension. A list of file types indexable by Google can be found in Search Console Help Center.

filter - Controls turning on or off the duplicate content filter. * See Automatic Filtering 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.

gl - 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 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.

googlehost - Deprecated. Use the gl parameter for a similar effect. The local Google domain (for example, google.com, google.de, or google.fr) to use to perform the search.

highRange - Specifies the ending value for a search range. * Use lowRange and highRange to append an inclusive search range of lowRange...highRange to the query.

hl - Sets the user interface language. * Explicitly setting this parameter improves the performance and the quality of your search results.

hq - Appends the specified query terms to the query, as if they were combined with a logical AND operator.

imgColorType - Returns black and white, grayscale, transparent, or color images. Acceptable values are: * "color" * "gray" * "mono": black and white * "trans": transparent background Possible string values are:

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

imgDominantColor - Returns images of a specific dominant color. Acceptable values are: * "black" * "blue" * "brown" * "gray" * "green" * "orange" * "pink" * "purple" * "red" * "teal" * "white" * "yellow" Possible string values are:

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

imgSize - Returns images of a specified size. Acceptable values are: * "huge" * "icon" * "large" * "medium" * "small" * "xlarge" * "xxlarge" Possible string values are:

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

imgType - Returns images of a type. Acceptable values are: * "clipart"

  • "face" * "lineart" * "stock" * "photo" * "animated" Possible string values are:
  • "imgTypeUndefined" : No image type specified.
  • "clipart" : Clipart-style images only.
  • "face" : Images of faces only.
  • "lineart" : Line art images only.
  • "stock" : Stock images only.
  • "photo" : Photo images only.
  • "animated" : Animated images only.

linkSite - Specifies that all search results should contain a link to a particular URL.

lowRange - Specifies the starting value for a search range. Use lowRange and highRange to append an inclusive search range of lowRange...highRange to the query.

lr - 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)

num - Number of search results to return. * Valid values are integers between 1 and 10, inclusive.

orTerms - Provides additional search terms to check for in a document, where each document in the search results must contain at least one of the additional search terms.

q - Query

relatedSite - Deprecated.

rights - Filters based on licensing. Supported values include: cc_publicdomain, cc_attribute, cc_sharealike, cc_noncommercial, cc_nonderived and combinations of these. See typical combinations.

safe - Search safety level. Acceptable values are: * "active": Enables SafeSearch filtering. * "off": Disables SafeSearch filtering. (default) Possible string values are:

  • "safeUndefined" : SafeSearch mode unspecified. (Falls back to engine's configuration.)
  • "active" : Turn SafeSearch on.
  • "high" : Deprecated, equivalent to "active".
  • "medium" : Deprecated, equivalent to "active".
  • "off" : Turn SafeSearch off.

searchType - Specifies the search type: image. If unspecified, results are limited to webpages. Acceptable values are: * "image": custom image search. Possible string values are:

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

siteSearch - Specifies a given site which should always be included or excluded from results (see siteSearchFilter parameter, below).

siteSearchFilter - Controls whether to include or exclude results from the site named in the siteSearch parameter. Acceptable values are: * "e": exclude * "i": include Possible string values are:

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

sort - 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).

start - 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.

$fields - Selector specifying which fields to include in a partial response.

Completes with a Search.

Completes with a commons.ApiRequestError if the API endpoint returned an error.

If the used http.Client completes with an error when making a REST call, this method will complete with the same error.

Implementation

async.Future<Search> list({
  core.String? c2coff,
  core.String? cr,
  core.String? cx,
  core.String? dateRestrict,
  core.String? exactTerms,
  core.String? excludeTerms,
  core.String? fileType,
  core.String? filter,
  core.String? gl,
  core.String? googlehost,
  core.String? highRange,
  core.String? hl,
  core.String? hq,
  core.String? imgColorType,
  core.String? imgDominantColor,
  core.String? imgSize,
  core.String? imgType,
  core.String? linkSite,
  core.String? lowRange,
  core.String? lr,
  core.int? num,
  core.String? orTerms,
  core.String? q,
  core.String? relatedSite,
  core.String? rights,
  core.String? safe,
  core.String? searchType,
  core.String? siteSearch,
  core.String? siteSearchFilter,
  core.String? sort,
  core.int? start,
  core.String? $fields,
}) async {
  final queryParams_ = <core.String, core.List<core.String>>{
    if (c2coff != null) 'c2coff': [c2coff],
    if (cr != null) 'cr': [cr],
    if (cx != null) 'cx': [cx],
    if (dateRestrict != null) 'dateRestrict': [dateRestrict],
    if (exactTerms != null) 'exactTerms': [exactTerms],
    if (excludeTerms != null) 'excludeTerms': [excludeTerms],
    if (fileType != null) 'fileType': [fileType],
    if (filter != null) 'filter': [filter],
    if (gl != null) 'gl': [gl],
    if (googlehost != null) 'googlehost': [googlehost],
    if (highRange != null) 'highRange': [highRange],
    if (hl != null) 'hl': [hl],
    if (hq != null) 'hq': [hq],
    if (imgColorType != null) 'imgColorType': [imgColorType],
    if (imgDominantColor != null) 'imgDominantColor': [imgDominantColor],
    if (imgSize != null) 'imgSize': [imgSize],
    if (imgType != null) 'imgType': [imgType],
    if (linkSite != null) 'linkSite': [linkSite],
    if (lowRange != null) 'lowRange': [lowRange],
    if (lr != null) 'lr': [lr],
    if (num != null) 'num': ['${num}'],
    if (orTerms != null) 'orTerms': [orTerms],
    if (q != null) 'q': [q],
    if (relatedSite != null) 'relatedSite': [relatedSite],
    if (rights != null) 'rights': [rights],
    if (safe != null) 'safe': [safe],
    if (searchType != null) 'searchType': [searchType],
    if (siteSearch != null) 'siteSearch': [siteSearch],
    if (siteSearchFilter != null) 'siteSearchFilter': [siteSearchFilter],
    if (sort != null) 'sort': [sort],
    if (start != null) 'start': ['${start}'],
    if ($fields != null) 'fields': [$fields],
  };

  const url_ = 'customsearch/v1/siterestrict';

  final response_ = await _requester.request(
    url_,
    'GET',
    queryParams: queryParams_,
  );
  return Search.fromJson(response_ as core.Map<core.String, core.dynamic>);
}